diff --git a/README.md b/README.md index 35cb589..81bbe1f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The canonical location for this repository is https://git.qenya.tel/qenya/nixfil ### Building -To build locally, run `nixos-rebuild switch --flake .#[hostname]` as root. +To build locally, run `colmena apply-local` as root. To build the remote machines, run `colmena apply`. See the [colmena documentation](https://colmena.cli.rs/) for command-line options. Notable options include: * `--on [hostname]`: build a specific machine only diff --git a/common/default.nix b/common/default.nix index a1f43a4..fd0791c 100644 --- a/common/default.nix +++ b/common/default.nix @@ -6,7 +6,6 @@ ./environment.nix ./home-manager.nix ./nginx.nix - ./nix.nix ./openssh.nix ./security.nix ./steam.nix diff --git a/common/nix.nix b/common/nix.nix deleted file mode 100644 index 9361188..0000000 --- a/common/nix.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - nix.settings.experimental-features = "nix-command flakes"; - nix.nixPath = [ "nixpkgs=flake:nixpkgs" ]; - nixpkgs.config.allowUnfree = true; -} diff --git a/common/users/qenya.nix b/common/users/qenya.nix index 6e96e58..e9d11ad 100644 --- a/common/users/qenya.nix +++ b/common/users/qenya.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, ... }: let keys = import ../../keys.nix; in { @@ -11,6 +11,4 @@ in { }; programs.zsh.enable = true; - - home-manager.users."qenya" = inputs.self.homeManagerModules."qenya"; } diff --git a/flake.lock b/flake.lock index c0faff0..3ecf0fb 100644 --- a/flake.lock +++ b/flake.lock @@ -39,60 +39,6 @@ "url": "https://git.qenya.tel/qenya/birdsong" } }, - "colmena": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ], - "stable": "stable" - }, - "locked": { - "lastModified": 1711386353, - "narHash": "sha256-gWEpb8Hybnoqb4O4tmpohGZk6+aerAbJpywKcFIiMlg=", - "owner": "zhaofengli", - "repo": "colmena", - "rev": "cd65ef7a25cdc75052fbd04b120aeb066c3881db", - "type": "github" - }, - "original": { - "owner": "zhaofengli", - "repo": "colmena", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -121,11 +67,11 @@ ] }, "locked": { - "lastModified": 1726592409, - "narHash": "sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U=", + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "type": "github" }, "original": { @@ -137,11 +83,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1725001927, + "narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "6e99f2a27d600612004fbd2c3282d614bfee6421", "type": "github" }, "original": { @@ -151,29 +97,13 @@ "type": "github" } }, - "nixpkgsSmall": { - "locked": { - "lastModified": 1726611721, - "narHash": "sha256-oSDOQ5c7CTVzkaG5A19UW3Yxsv9TLNFNcrvQT9F4Pz0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a51a2cef87fc37c7e31d3a5345bc493e5f7a5f6e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "locked": { - "lastModified": 1726681508, - "narHash": "sha256-xz858EXcKZjWR6TPyU84BTeMHIPewGW68DutnxghaR4=", + "lastModified": 1725486293, + "narHash": "sha256-XRWbx8JcTCVoGxr3P2YL/tK4s4HzZBhUqlxr91zLOZs=", "owner": "nix-community", "repo": "NUR", - "rev": "59c5c2575c0cae6bc98b9de8161731cfb8cdc1f0", + "rev": "444e1f3fdf23aa476489b0038e0738c6f4d9df85", "type": "github" }, "original": { @@ -192,11 +122,11 @@ ] }, "locked": { - "lastModified": 1726509788, - "narHash": "sha256-PmCmO8NDKzwHrTp9Ox/rcLiCYivqIpZlnLk8wZRjv2I=", + "lastModified": 1725914634, + "narHash": "sha256-U74hu15xSb6JNySMOwyJrsh4uk1DVa182bdHLeHdYMc=", "owner": "nix-community", "repo": "plasma-manager", - "rev": "5a0c70a007837e2db01e0bb68971792e8653d32c", + "rev": "60becd0e994e25b372c8d0500fc944396f6c1085", "type": "github" }, "original": { @@ -209,30 +139,12 @@ "inputs": { "agenix": "agenix", "birdsong": "birdsong", - "colmena": "colmena", "home-manager": "home-manager_2", "nixpkgs": "nixpkgs", - "nixpkgsSmall": "nixpkgsSmall", "nur": "nur", "plasma-manager": "plasma-manager" } }, - "stable": { - "locked": { - "lastModified": 1696039360, - "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 50a5c8a..71aa94d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; - nixpkgsSmall.url = "github:NixOS/nixpkgs/nixos-24.05-small"; - home-manager = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; @@ -25,16 +23,39 @@ }; }; - colmena = { - url = "github:zhaofengli/colmena"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - birdsong.url = "git+https://git.qenya.tel/qenya/birdsong?ref=main"; }; - outputs = inputs@{ self, nixpkgs, nixpkgsSmall, home-manager, plasma-manager, nur, agenix, colmena, birdsong, ... }: { - nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes; + outputs = inputs@{ self, nixpkgs, home-manager, plasma-manager, nur, agenix, birdsong, ... }: { + nixosModules.default = { + nix.settings.experimental-features = "nix-command flakes"; + nix.nixPath = [ "nixpkgs=flake:nixpkgs" ]; + nixpkgs.config.allowUnfree = true; + + nixpkgs.overlays = [ nur.overlay ]; + + # TODO: make this or something like it work without infinite recursion + # home-manager.users."qenya" = lib.mkIf (config.users.users ? "qenya") self.homeManagerModules."qenya"; + home-manager.users."qenya" = self.homeManagerModules."qenya"; + + imports = [ + home-manager.nixosModules.home-manager + nur.nixosModules.nur + agenix.nixosModules.default + birdsong.nixosModules.default + ./common + ./services + ]; + }; + + # TODO: simplify + nixosConfigurations = { + "kilgharrah" = nixpkgs.lib.nixosSystem { modules = [ ./hosts/kilgharrah self.nixosModules.default ]; }; + "tohru" = nixpkgs.lib.nixosSystem { modules = [ ./hosts/tohru self.nixosModules.default ]; }; + "yevaud" = nixpkgs.lib.nixosSystem { modules = [ ./hosts/yevaud self.nixosModules.default ]; }; + "orm" = nixpkgs.lib.nixosSystem { modules = [ ./hosts/orm self.nixosModules.default ]; }; + "kalessin" = nixpkgs.lib.nixosSystem { modules = [ ./hosts/kalessin self.nixosModules.default ]; }; + }; # The name of this output type is not standardised. I have picked # "homeManagerModules" as the discussion here suggests it's the most common: @@ -54,26 +75,11 @@ colmena = { meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; - nodeNixpkgs = { - kilgharrah = import nixpkgs { system = "x86_64-linux"; }; - tohru = import nixpkgs { system = "x86_64-linux"; }; - yevaud = import nixpkgsSmall { system = "x86_64-linux"; }; - orm = import nixpkgsSmall { system = "x86_64-linux"; }; - kalessin = import nixpkgsSmall { system = "aarch64-linux"; }; - }; - specialArgs = { inherit inputs; }; + nodeNixpkgs = builtins.mapAttrs (name: value: value.pkgs) self.nixosConfigurations; }; - defaults.imports = [ - home-manager.nixosModules.home-manager - nur.nixosModules.nur - { nixpkgs.overlays = [ nur.overlay ]; } - agenix.nixosModules.default - birdsong.nixosModules.default - ./common - ./services - ]; - + # TODO: eliminate duplication with nixosConfigurations + defaults.imports = [ self.nixosModules.default ]; kilgharrah.imports = [ ./hosts/kilgharrah ]; tohru.imports = [ ./hosts/tohru ]; yevaud.imports = [ ./hosts/yevaud ]; diff --git a/home/qenya/vscode.nix b/home/qenya/vscode.nix index 5a4c9bd..f9d8c6e 100644 --- a/home/qenya/vscode.nix +++ b/home/qenya/vscode.nix @@ -38,7 +38,10 @@ in "nix.serverSettings".nil = { diagnostics.ignored = [ "unused_binding" "unused_with" ]; formatting.command = [ "nixpkgs-fmt" ]; - nix.flake.autoArchive = true; + nix.flake = { + autoArchive = true; + autoEvalInputs = true; + }; }; "terminal.integrated.allowChords" = false; "terminal.integrated.defaultProfile.linux" = "zsh";