nixpkgs-fmt

This commit is contained in:
fleaz 2022-02-07 00:01:27 +01:00
parent 6a9a43478c
commit 04091588ee
10 changed files with 185 additions and 169 deletions

View file

@ -2,7 +2,8 @@
let let
home-manager = (import ../nix/sources.nix).home-manager; home-manager = (import ../nix/sources.nix).home-manager;
in { in
{
imports = [ imports = [
"${home-manager}/nixos" "${home-manager}/nixos"
]; ];
@ -194,8 +195,10 @@ in {
bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
keybindings = let mod = "Mod4"; keybindings =
in { let mod = "Mod4";
in
{
"${mod}+Return" = "exec foot"; "${mod}+Return" = "exec foot";
"${mod}+p" = "exec ${pkgs.wofi}/bin/wofi --show drun"; "${mod}+p" = "exec ${pkgs.wofi}/bin/wofi --show drun";

View file

@ -3,8 +3,9 @@
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ sources ? import ../../nix { sources ? import ../../nix
, pkgs ? sources.pkgs {} , pkgs ? sources.pkgs { }
, ... } : , ...
}:
{ {
imports = [ imports = [

View file

@ -25,11 +25,13 @@
fileSystems."/mnt/pool" = { fileSystems."/mnt/pool" = {
device = "//BART/Pool/"; device = "//BART/Pool/";
fsType = "cifs"; fsType = "cifs";
options = let options =
let
# this line prevents hanging on network split # this line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=/etc/nixos/smb-secrets"]; in
[ "${automount_opts},credentials=/etc/nixos/smb-secrets" ];
}; };
swapDevices = swapDevices =

View file

@ -7,7 +7,8 @@
let let
home-manager = (import ./nix/sources.nix).home-manager; home-manager = (import ./nix/sources.nix).home-manager;
secretsFile = "/root.key"; secretsFile = "/root.key";
in { in
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -61,7 +62,7 @@ in {
enable = true; enable = true;
ipv4 = true; ipv4 = true;
ipv6 = true; ipv6 = true;
}; };
hardware.opengl = { hardware.opengl = {
enable = true; enable = true;
@ -98,8 +99,11 @@ in {
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim wget curl git vim
]; wget
curl
git
];
services.openssh.enable = true; services.openssh.enable = true;
programs.ssh.startAgent = true; programs.ssh.startAgent = true;

View file

@ -5,7 +5,8 @@
{ {
imports = imports =
[ (modulesPath + "/installer/scan/not-detected.nix") [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
@ -14,14 +15,16 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/b9edb32f-fb40-4d59-8abe-b187c88667d6"; {
device = "/dev/disk/by-uuid/b9edb32f-fb40-4d59-8abe-b187c88667d6";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/e2d53876-3fdc-486a-a354-ec834b256e43"; boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/e2d53876-3fdc-486a-a354-ec834b256e43";
fileSystems."/boot/efi" = fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/502E-A0DC"; {
device = "/dev/disk/by-uuid/502E-A0DC";
fsType = "vfat"; fsType = "vfat";
}; };

View file

@ -1,4 +1,4 @@
{ ... }:{ { ... }: {
services.openssh.enable = true; services.openssh.enable = true;
programs.ssh.startAgent = true; programs.ssh.startAgent = true;
} }

View file

@ -69,7 +69,7 @@ let
if builtins.hasAttr "nixpkgs" sources if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {} import <nixpkgs> { }
else else
abort abort
'' ''
@ -112,7 +112,7 @@ let
); );
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -123,7 +123,7 @@ let
concatStrings = builtins.concatStringsSep ""; concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {}; optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix # fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs: builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
@ -147,19 +147,22 @@ let
# Create the final "sources" from the config # Create the final "sources" from the config
mkSources = config: mkSources = config:
mapAttrs ( mapAttrs
(
name: spec: name: spec:
if builtins.hasAttr "outPath" spec if builtins.hasAttr "outPath" spec
then abort then
abort
"The values in sources.json should not have an 'outPath' attribute" "The values in sources.json should not have an 'outPath' attribute"
else else
spec // { outPath = replace name (fetch config.pkgs name spec); } spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources; )
config.sources;
# The "config" used by the fetchers # The "config" used by the fetchers
mkConfig = mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) , sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem , system ? builtins.currentSystem
, pkgs ? mkPkgs sources system , pkgs ? mkPkgs sources system
}: rec { }: rec {
@ -171,4 +174,4 @@ let
}; };
in in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View file

@ -9,5 +9,5 @@
../modules/ssh.nix ../modules/ssh.nix
../users/fleaz.nix ../users/fleaz.nix
]; ];
} }