diff --git a/flake.lock b/flake.lock index 4538d94..33e348b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,28 +1,31 @@ { "nodes": { - "deploy-rs": { + "colmena": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs", - "utils": "utils" + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "stable": "stable" }, "locked": { - "lastModified": 1718194053, - "narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=", - "owner": "serokell", - "repo": "deploy-rs", - "rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a", + "lastModified": 1711386353, + "narHash": "sha256-gWEpb8Hybnoqb4O4tmpohGZk6+aerAbJpywKcFIiMlg=", + "owner": "zhaofengli", + "repo": "colmena", + "rev": "cd65ef7a25cdc75052fbd04b120aeb066c3881db", "type": "github" }, "original": { - "owner": "serokell", - "repo": "deploy-rs", + "owner": "zhaofengli", + "repo": "colmena", "type": "github" } }, "fizz-strat": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "naersk": "naersk", "nixpkgs": [ "nixpkgs" @@ -46,11 +49,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { @@ -75,15 +78,12 @@ } }, "flake-utils": { - "inputs": { - "systems": "systems_2" - }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -92,9 +92,9 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_10": { "inputs": { - "systems": "systems_3" + "systems": "systems_10" }, "locked": { "lastModified": 1681202837, @@ -110,16 +110,34 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flake-utils_3": { "inputs": { - "systems": "systems_4" + "systems": "systems_2" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -130,7 +148,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_5" + "systems": "systems_3" }, "locked": { "lastModified": 1710146030, @@ -148,7 +166,7 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_6" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -166,14 +184,14 @@ }, "flake-utils_6": { "inputs": { - "systems": "systems_7" + "systems": "systems_5" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -184,14 +202,14 @@ }, "flake-utils_7": { "inputs": { - "systems": "systems_8" + "systems": "systems_6" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -202,14 +220,14 @@ }, "flake-utils_8": { "inputs": { - "systems": "systems_10" + "systems": "systems_7" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -220,14 +238,14 @@ }, "flake-utils_9": { "inputs": { - "systems": "systems_11" + "systems": "systems_9" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -312,7 +330,7 @@ }, "lix-module": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "flakey-profile": "flakey-profile", "lix": [ "lix" @@ -337,7 +355,7 @@ }, "mpdiscord": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_6", "naersk": "naersk_2", "nixpkgs": [ "nixpkgs" @@ -486,16 +504,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1702272962, - "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", + "lastModified": 1719848872, + "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", + "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -516,22 +534,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1719848872, - "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "locked": { "lastModified": 1719963896, @@ -549,12 +551,12 @@ }, "poetry2nix-src": { "inputs": { - "flake-utils": "flake-utils_7", + "flake-utils": "flake-utils_8", "nix-github-actions": "nix-github-actions", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_9", + "systems": "systems_8", "treefmt-nix": "treefmt-nix" }, "locked": { @@ -573,9 +575,9 @@ }, "root": { "inputs": { - "deploy-rs": "deploy-rs", + "colmena": "colmena", "fizz-strat": "fizz-strat", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "home-manager": "home-manager", "hydra": "hydra", "lix": "lix", @@ -583,7 +585,7 @@ "mpdiscord": "mpdiscord", "naersk": "naersk_3", "nixos-apple-silicon": "nixos-apple-silicon", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "nixpkgs-mozilla": "nixpkgs-mozilla", "nur": "nur", "poetry2nix-src": "poetry2nix-src", @@ -592,7 +594,7 @@ }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "fizz-strat", "nixpkgs" @@ -614,7 +616,7 @@ }, "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_6", + "flake-utils": "flake-utils_7", "nixpkgs": [ "mpdiscord", "nixpkgs" @@ -652,7 +654,7 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_9", + "flake-utils": "flake-utils_10", "nixpkgs": [ "upd8r", "nixpkgs" @@ -672,22 +674,23 @@ "type": "github" } }, - "systems": { + "stable": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1696039360, + "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", "type": "github" } }, - "systems_10": { + "systems": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -702,7 +705,7 @@ "type": "github" } }, - "systems_11": { + "systems_10": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -817,9 +820,8 @@ "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "id": "systems", + "type": "indirect" } }, "systems_9": { @@ -832,8 +834,9 @@ "type": "github" }, "original": { - "id": "systems", - "type": "indirect" + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "treefmt-nix": { @@ -859,7 +862,7 @@ }, "upd8r": { "inputs": { - "flake-utils": "flake-utils_8", + "flake-utils": "flake-utils_9", "naersk": "naersk_4", "nixpkgs": [ "nixpkgs" @@ -879,24 +882,6 @@ "repo": "upd8r", "type": "github" } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index bec2494..9475e32 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,6 @@ url = github:leo60228/mpdiscord; inputs.nixpkgs.follows = "nixpkgs"; }; - inputs.deploy-rs.url = "github:serokell/deploy-rs"; inputs.fizz-strat = { url = "github:BlaseballCrabs/fizz-strat"; inputs.nixpkgs.follows = "nixpkgs"; @@ -49,32 +48,46 @@ inputs.lix.follows = "lix"; inputs.nixpkgs.follows = "nixpkgs"; }; + inputs.colmena = { + url = "github:zhaofengli/colmena"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, colmena, flake-utils, ... } @ flakes: ({ + colmena = + let + dotfiles = import ./. null; + inherit (dotfiles) systems; + meta = { + nixpkgs = nixpkgs.legacyPackages.x86_64-linux; + + nodeNixpkgs = nixpkgs.lib.mapAttrs (n: x: + let + hardware = import (./hardware + "/${n}.nix"); + inherit (hardware) system; + in + nixpkgs.legacyPackages.${system}) systems; + + specialArgs.flakes = flakes; + + allowApplyAll = false; + }; + in + systems // { inherit meta; }; - outputs = { self, nixpkgs, flake-utils, deploy-rs, ... } @ flakes: (rec { nixosConfigurations = nixpkgs.lib.mapAttrs (n: x: nixpkgs.lib.nixosSystem { - system = (import (./hardware + "/${n}.nix")).system; - modules = [ x ]; - specialArgs = { - inherit flakes; - }; - }) (import ./. null).systems; + system = self.outputs.colmena.meta.nodeNixpkgs.${n}.system; + modules = [ x colmena.nixosModules.deploymentOptions ]; + inherit (self.outputs.colmena.meta) specialArgs; + }) (builtins.removeAttrs self.outputs.colmena ["meta" "defaults"]); + hydraJobs = let jobs = nixpkgs.lib.mapAttrs (n: x: { - ${x.config.nixpkgs.system} = if builtins.hasAttr n deploy.nodes then deploy.nodes.${n}.profiles.system.path else x.config.system.build.toplevel; - }) nixosConfigurations; + ${x.config.nixpkgs.system} = x.config.system.build.toplevel; + }) self.outputs.nixosConfigurations; in jobs; - deploy.nodes = nixpkgs.lib.mapAttrs (x: y: { - hostname = x; - - fastConnection = y; - - profiles.system = { - user = "root"; - path = deploy-rs.lib.${nixosConfigurations.${x}.config.nixpkgs.system}.activate.nixos nixosConfigurations.${x}; - }; - }) { leoservices = false; digitaleo = false; nucserv = false; crabstodon = false; leoserv = true; }; } // (flake-utils.lib.eachDefaultSystem (system: rec { packages = rec { nixos-rebuild = flakes.nixpkgs.legacyPackages.${system}.nixos-rebuild; diff --git a/hardware/crabstodon.nix b/hardware/crabstodon.nix index a24bc12..eee3d2f 100644 --- a/hardware/crabstodon.nix +++ b/hardware/crabstodon.nix @@ -22,6 +22,8 @@ device = "/var/swapfile"; size = 4096; } ]; + + deployment.tags = [ "servers" ]; }; nixops = { diff --git a/hardware/desktop.nix b/hardware/desktop.nix index 5480d2f..e7cb4bf 100644 --- a/hardware/desktop.nix +++ b/hardware/desktop.nix @@ -182,6 +182,9 @@ boot.loader.systemd-boot.memtest86.enable = true; virtualisation.docker.enableNvidia = true; + + deployment.tags = [ "workstation" ]; + deployment.allowLocalDeployment = true; }; nixops = { diff --git a/hardware/digitaleo.nix b/hardware/digitaleo.nix index 2ed7dd1..81a45a6 100644 --- a/hardware/digitaleo.nix +++ b/hardware/digitaleo.nix @@ -43,6 +43,8 @@ device = "/var/swapfile"; size = 4096; } ]; + + deployment.tags = [ "servers" ]; }; nixops = { diff --git a/hardware/leoasahi.nix b/hardware/leoasahi.nix index 692742e..ceed22c 100644 --- a/hardware/leoasahi.nix +++ b/hardware/leoasahi.nix @@ -36,6 +36,8 @@ hardware.asahi.extractPeripheralFirmware = false; hardware.asahi.withRust = true; + + deployment.tags = [ "servers" ]; }; nixops = { diff --git a/hardware/leoserv.nix b/hardware/leoserv.nix index 63674a9..dedcddd 100644 --- a/hardware/leoserv.nix +++ b/hardware/leoserv.nix @@ -24,6 +24,8 @@ nix.settings.max-jobs = lib.mkDefault 12; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + + deployment.tags = [ "servers" ]; }; nixops = {}; diff --git a/hardware/leoservices.nix b/hardware/leoservices.nix index f058787..e5caefc 100644 --- a/hardware/leoservices.nix +++ b/hardware/leoservices.nix @@ -18,6 +18,8 @@ } ]; boot.loader.grub.device = lib.mkForce "/dev/nvme0n1"; + + deployment.tags = [ "servers" ]; }; nixops = { diff --git a/hardware/nucserv.nix b/hardware/nucserv.nix index 9dc1983..a14d9c8 100644 --- a/hardware/nucserv.nix +++ b/hardware/nucserv.nix @@ -34,6 +34,8 @@ libvdpau-va-gl ]; }; + + deployment.tags = [ "servers" ]; }; system = "x86_64-linux"; diff --git a/hardware/zephyrus.nix b/hardware/zephyrus.nix index 133ab29..6402627 100644 --- a/hardware/zephyrus.nix +++ b/hardware/zephyrus.nix @@ -38,6 +38,9 @@ nvidiaBusId = "PCI:1:0:0"; }; boot.kernelParams = [ "nvidia.NVreg_EnableS0ixPowerManagement=1" ]; + + deployment.tags = [ "workstation" ]; + deployment.allowLocalDeployment = true; }; nixops = { diff --git a/home.nix b/home.nix index 8ba6380..7aacd8c 100644 --- a/home.nix +++ b/home.nix @@ -29,6 +29,7 @@ (hiPrio gcc) leoPkgs.bin ] else [ + colmena fusee-nano obs-studio thunderbird