aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix36
1 files changed, 33 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index 729ab7e..a863509 100644
--- a/flake.nix
+++ b/flake.nix
@@ -20,11 +20,26 @@
20 "x86_64-darwin" 20 "x86_64-darwin"
21 "aarch64-darwin" 21 "aarch64-darwin"
22 ]; 22 ];
23
24 # Any directory under hosts/ other than hosts/template that contains a
25 # `system` file becomes a real nixosConfigurations.<name> output —
26 # adding a host means dropping in a directory, not editing this file.
27 # hosts/template is excluded by name so it is never built, even though
28 # it also carries a system file (kept only so it stays a complete,
29 # consistent copy-source for the bootstrap script).
30 hostNames = builtins.attrNames
31 (nixpkgs.lib.filterAttrs
32 (name: type: type == "directory" && name != "template")
33 (builtins.readDir ./hosts));
34
35 mkHostConfig = hostname:
36 lib.mkNixos {
37 inherit hostname;
38 system = builtins.readFile (./hosts + "/${hostname}/system");
39 };
23 in 40 in
24 { 41 {
25 # No real NixOS host exists yet. hosts/template/ is copy-source only and 42 nixosConfigurations = nixpkgs.lib.genAttrs hostNames mkHostConfig;
26 # is deliberately not wired in here — see hosts/template/ and README.md.
27 nixosConfigurations = { };
28 43
29 homeConfigurations = { 44 homeConfigurations = {
30 "tom@linux" = lib.mkHome { 45 "tom@linux" = lib.mkHome {
@@ -44,5 +59,20 @@
44 packages = [ pkgs.statix pkgs.deadnix pkgs.nixfmt-rfc-style ]; 59 packages = [ pkgs.statix pkgs.deadnix pkgs.nixfmt-rfc-style ];
45 }; 60 };
46 }); 61 });
62
63 apps = forAllSystems (system:
64 let
65 pkgs = nixpkgs.legacyPackages.${system};
66 in
67 {
68 bootstrap-host = {
69 type = "app";
70 program = "${pkgs.writeShellApplication {
71 name = "bootstrap-host";
72 runtimeInputs = [ pkgs.coreutils pkgs.gnused ];
73 text = builtins.readFile ./scripts/bootstrap-host.sh;
74 }}/bin/bootstrap-host";
75 };
76 });
47 }; 77 };
48} 78}