Skip to content

Commit 47cc372

Browse files
committed
delft: allow deployment through colemena
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.
1 parent 04cb600 commit 47cc372

File tree

2 files changed

+94
-3
lines changed

2 files changed

+94
-3
lines changed

delft/flake.lock

+73-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

delft/flake.nix

+21-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
inputs.agenix.url = "github:ryantm/agenix";
55
inputs.agenix.inputs.nixpkgs.follows = "nixpkgs";
66

7+
inputs.colmena.url = "github:zhaofengli/colmena";
8+
inputs.colmena.inputs.nixpkgs.follows = "nixpkgs";
9+
710
inputs.disko.url = "github:nix-community/disko";
811
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
912

@@ -20,7 +23,7 @@
2023
inputs.rfc39.url = "github:NixOS/rfc39";
2124
inputs.rfc39.inputs.nixpkgs.follows = "nixpkgs";
2225

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 }:
2427
let
2528
inherit (nixpkgs) lib;
2629

@@ -67,12 +70,29 @@
6770
];
6871
};
6972

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+
7089
# TODO: flake-utils.lib.eachDefaultSystem
7190
devShell.x86_64-linux = let
7291
pkgs = import nixpkgs { system = "x86_64-linux"; };
7392
in pkgs.mkShell {
7493
buildInputs = with pkgs; [
7594
agenix.packages.x86_64-linux.agenix
95+
colmena.packages.x86_64-linux.colmena
7696
];
7797
};
7898
};

0 commit comments

Comments
 (0)