@cryptotaxi247 / infra / commits / b24c882a

delft: allow deployment through colemena (#400)

Provide an output that translates nixosConfigurations to a colmena- compatible output. Colmena provides a convenient wrapper around building and deploying machines, than the bare nixos-rebuild we had been using up until now.

Martin Weinelt committed Mar 11, 2024 at 09:32 UTC b24c882a70b163a7f2feefd875bd21473072c66e
2 files changed +94 -3
delft/flake.lock
+73 -2
@@ -23,6 +23,29 @@
23 "type": "github"
24 }
25 },
26 + "colmena": {
27 + "inputs": {
28 + "flake-compat": "flake-compat",
29 + "flake-utils": "flake-utils",
30 + "nixpkgs": [
31 + "nixpkgs"
32 + ],
33 + "stable": "stable"
34 + },
35 + "locked": {
36 + "lastModified": 1706509311,
37 + "narHash": "sha256-QQKQ6r3CID8aXn2ZXZ79ZJxdCOeVP+JTnOctDALErOw=",
38 + "owner": "zhaofengli",
39 + "repo": "colmena",
40 + "rev": "c84ccd0a7a712475e861c2b111574472b1a8d0cd",
41 + "type": "github"
42 + },
43 + "original": {
44 + "owner": "zhaofengli",
45 + "repo": "colmena",
46 + "type": "github"
47 + }
48 + },
49 "cpiotools": {
50 "inputs": {
51 "nixpkgs": "nixpkgs_3"
@@ -84,6 +107,22 @@
107 }
108 },
109 "flake-compat": {
110 + "flake": false,
111 + "locked": {
112 + "lastModified": 1650374568,
113 + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
114 + "owner": "edolstra",
115 + "repo": "flake-compat",
116 + "rev": "b4a34015c698c7793d592d66adbab377907a2be8",
117 + "type": "github"
118 + },
119 + "original": {
120 + "owner": "edolstra",
121 + "repo": "flake-compat",
122 + "type": "github"
123 + }
124 + },
125 + "flake-compat_2": {
126 "flake": false,
127 "locked": {
128 "lastModified": 1673956053,
@@ -100,6 +139,21 @@
139 }
140 },
141 "flake-utils": {
142 + "locked": {
143 + "lastModified": 1659877975,
144 + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
145 + "owner": "numtide",
146 + "repo": "flake-utils",
147 + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
148 + "type": "github"
149 + },
150 + "original": {
151 + "owner": "numtide",
152 + "repo": "flake-utils",
153 + "type": "github"
154 + }
155 + },
156 + "flake-utils_2": {
157 "inputs": {
158 "systems": "systems_2"
159 },
@@ -195,7 +249,7 @@
249 },
250 "nix": {
251 "inputs": {
198 - "flake-compat": "flake-compat",
252 + "flake-compat": "flake-compat_2",
253 "lowdown-src": "lowdown-src",
254 "nixpkgs": [
255 "hydra",
@@ -371,7 +425,7 @@
425 },
426 "rfc39": {
427 "inputs": {
374 - "flake-utils": "flake-utils",
428 + "flake-utils": "flake-utils_2",
429 "nixpkgs": [
430 "nixpkgs"
431 ]
@@ -393,6 +447,7 @@
447 "root": {
448 "inputs": {
449 "agenix": "agenix",
450 + "colmena": "colmena",
451 "disko": "disko",
452 "hydra": "hydra",
453 "hydra-scale-equinix-metal": "hydra-scale-equinix-metal",
@@ -406,6 +461,22 @@
461 "rfc39": "rfc39"
462 }
463 },
464 + "stable": {
465 + "locked": {
466 + "lastModified": 1696039360,
467 + "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=",
468 + "owner": "NixOS",
469 + "repo": "nixpkgs",
470 + "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc",
471 + "type": "github"
472 + },
473 + "original": {
474 + "owner": "NixOS",
475 + "ref": "nixos-23.05",
476 + "repo": "nixpkgs",
477 + "type": "github"
478 + }
479 + },
480 "systems": {
481 "locked": {
482 "lastModified": 1681028828,
delft/flake.nix
+21 -1
@@ -4,6 +4,9 @@
4 inputs.agenix.url = "github:ryantm/agenix";
5 inputs.agenix.inputs.nixpkgs.follows = "nixpkgs";
6
7 + inputs.colmena.url = "github:zhaofengli/colmena";
8 + inputs.colmena.inputs.nixpkgs.follows = "nixpkgs";
9 +
10 inputs.disko.url = "github:nix-community/disko";
11 inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
12
@@ -20,7 +23,7 @@
23 inputs.rfc39.url = "github:NixOS/rfc39";
24 inputs.rfc39.inputs.nixpkgs.follows = "nixpkgs";
25
23 - outputs = flakes @ { self, agenix, disko, hydra, hydra-scale-equinix-metal, nix, nixpkgs, nixos-channel-scripts, nix-netboot-serve, rfc39 }:
26 + outputs = flakes @ { self, agenix, colmena, disko, hydra, hydra-scale-equinix-metal, nix, nixpkgs, nixos-channel-scripts, nix-netboot-serve, rfc39 }:
27 let
28 inherit (nixpkgs) lib;
29
@@ -67,12 +70,29 @@
70 ];
71 };
72
73 + colmena = {
74 + meta = {
75 + description = "NixOS.org infrastructure";
76 + nixpkgs = import nixpkgs {
77 + system = "x86_64-linux";
78 + };
79 + };
80 + } // builtins.mapAttrs
81 + (name: value: {
82 + nixpkgs.system = value.config.nixpkgs.system;
83 + imports = value._module.args.modules;
84 + deployment = {
85 + targetHost = "${name}.nixos.org";
86 + };
87 + }) (self.nixosConfigurations);
88 +
89 # TODO: flake-utils.lib.eachDefaultSystem
90 devShell.x86_64-linux = let
91 pkgs = import nixpkgs { system = "x86_64-linux"; };
92 in pkgs.mkShell {
93 buildInputs = with pkgs; [
94 agenix.packages.x86_64-linux.agenix
95 + colmena.packages.x86_64-linux.colmena
96 ];
97 };
98 };