summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock71
-rw-r--r--flake.nix21
-rw-r--r--installer.nix1
3 files changed, 89 insertions, 4 deletions
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..2a0a02da
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,71 @@
1{
2 "nodes": {
3 "home-manager": {
4 "inputs": {
5 "nixpkgs": [
6 "nixpkgs"
7 ]
8 },
9 "locked": {
10 "lastModified": 1618469593,
11 "narHash": "sha256-fNdt+Q3irnT3pId7PKSSVeR8/9inBrAEg4gpItoRowU=",
12 "owner": "nix-community",
13 "repo": "home-manager",
14 "rev": "ebbbd4f2b50703409543941e7445138dc1e7392e",
15 "type": "github"
16 },
17 "original": {
18 "owner": "nix-community",
19 "ref": "master",
20 "repo": "home-manager",
21 "type": "github"
22 }
23 },
24 "nixpkgs": {
25 "locked": {
26 "lastModified": 1618681372,
27 "narHash": "sha256-fjiabnBl20D/jc3bU3K16jP21bf5l2fG1rHij0LoHVk=",
28 "owner": "NixOS",
29 "repo": "nixpkgs",
30 "rev": "c27aea5e879748c79acf3b6681194fcf184e3eba",
31 "type": "github"
32 },
33 "original": {
34 "owner": "NixOS",
35 "ref": "master",
36 "repo": "nixpkgs",
37 "type": "github"
38 }
39 },
40 "root": {
41 "inputs": {
42 "home-manager": "home-manager",
43 "nixpkgs": "nixpkgs",
44 "sops-nix": "sops-nix"
45 }
46 },
47 "sops-nix": {
48 "inputs": {
49 "nixpkgs": [
50 "nixpkgs"
51 ]
52 },
53 "locked": {
54 "lastModified": 1618226608,
55 "narHash": "sha256-Hq/lcu48RhE3U6gYYkuT7v6hLHeu1PrasiaBiGkCX+w=",
56 "owner": "Mic92",
57 "repo": "sops-nix",
58 "rev": "ade2f5c17184df9d4c42d36da18a6ed903b4c02d",
59 "type": "github"
60 },
61 "original": {
62 "owner": "Mic92",
63 "ref": "master",
64 "repo": "sops-nix",
65 "type": "github"
66 }
67 }
68 },
69 "root": "root",
70 "version": 7
71}
diff --git a/flake.nix b/flake.nix
index 3c1507dd..e2567e84 100644
--- a/flake.nix
+++ b/flake.nix
@@ -41,7 +41,7 @@
41 accountName' = splitString "@" accountName; 41 accountName' = splitString "@" accountName;
42 in elemAt accountName' 1; 42 in elemAt accountName' 1;
43 43
44 mkNixosConfiguration = dir: path: hostName: nixosSystem rec { 44 mkNixosConfiguration = addProfiles: dir: path: hostName: nixosSystem rec {
45 specialArgs = { 45 specialArgs = {
46 flake = self; 46 flake = self;
47 flakeInputs = inputs; 47 flakeInputs = inputs;
@@ -60,7 +60,7 @@
60 }; 60 };
61 accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts); 61 accountModules = attrValues (filterAttrs accountMatchesHost self.nixosModules.accounts);
62 accountMatchesHost = n: _v: accountHostName n == hostName; 62 accountMatchesHost = n: _v: accountHostName n == hostName;
63 in attrValues (filterAttrs (n: _v: !(elem n ["systemProfiles" "users" "userProfiles" "accounts"])) self.nixosModules) ++ [ argsModule ] ++ defaultProfiles ++ [ local ] ++ accountModules; 63 in attrValues (filterAttrs (n: _v: !(elem n ["systemProfiles" "users" "userProfiles" "accounts"])) self.nixosModules) ++ [ argsModule ] ++ defaultProfiles ++ addProfiles ++ [ local ] ++ accountModules;
64 }; 64 };
65 65
66 mkSystemProfile = dir: path: profileName: { 66 mkSystemProfile = dir: path: profileName: {
@@ -110,6 +110,19 @@
110 activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations); 110 activateNixosConfigurations = forAllSystems (system: _pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; }) self.nixosConfigurations);
111 111
112 overlayPaths = recImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); } // { pkgs = ./pkgs; }; 112 overlayPaths = recImport rec { dir = ./overlays; _import = (path: _name: dir + "/${path}"); } // { pkgs = ./pkgs; };
113
114 installerProfiles = system:
115 let nixpkgs-path = nixpkgs.legacyPackages.${system}.path;
116 in mapAttrs (name: {path, output}: { profile = mkSystemProfile nixpkgs-path path "installer-${name}"; inherit output; })
117 { cd-dvd = { path = "nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; output = out: out.config.system.build.isoImage; };
118 netboot = { path = "nixos/modules/installer/netboot/netboot-minimal.nix"; output = out: (self.legacyPackages.${system}.symlinkJoin { name = "netboot"; paths = with out.config.system.build; [ netbootRamdisk kernel netbootIpxeScript ]; preferLocalBuild = true; }); };
119 };
120
121 installers =
122 let mkInstallers = system: mapAttrs (mkInstaller system) (installerProfiles system);
123 mkInstaller = system: name: {profile, output}: output (mkNixosConfiguration [profile { config = { nixpkgs.system = system; }; }] ./. installerConfig "installer");
124 installerConfig = if builtins.pathExists ./installer.nix then "installer.nix" else (if builtins.pathExists ./installer then "installer" else null);
125 in if !(builtins.isNull installerConfig) then { installers = forAllSystems (system: _systemPkgs: mkInstallers system); } else {};
113 in 126 in
114 { 127 {
115 nixosModules = 128 nixosModules =
@@ -120,7 +133,7 @@
120 accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; }); 133 accounts = recursiveUpdate rootAccounts (recImport rec { dir = ./accounts; _import = mkAccountModule dir; });
121 rootAccounts = mapAttrs' (hostName: _value: nameValuePair "root@${hostName}" ({...}: { imports = [ self.nixosModules.users.root or ({...}: { imports = defaultUserProfiles "root"; }) ]; })) self.nixosConfigurations; 134 rootAccounts = mapAttrs' (hostName: _value: nameValuePair "root@${hostName}" ({...}: { imports = [ self.nixosModules.users.root or ({...}: { imports = defaultUserProfiles "root"; }) ]; })) self.nixosConfigurations;
122 in modulesAttrs // { inherit systemProfiles users userProfiles accounts; }; 135 in modulesAttrs // { inherit systemProfiles users userProfiles accounts; };
123 nixosConfigurations = recImport rec { dir = ./hosts; _import = mkNixosConfiguration dir; }; 136 nixosConfigurations = recImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; };
124 137
125 homeManagerModules = recImport rec { dir = ./home-modules; }; 138 homeManagerModules = recImport rec { dir = ./home-modules; };
126 139
@@ -142,5 +155,5 @@
142 path = ./.; 155 path = ./.;
143 description = "GKleen's flakey nixos configuration"; 156 description = "GKleen's flakey nixos configuration";
144 }; 157 };
145 }; 158 } // installers;
146} 159}
diff --git a/installer.nix b/installer.nix
new file mode 100644
index 00000000..64629674
--- /dev/null
+++ b/installer.nix
@@ -0,0 +1 @@
{...}: {}