Skip to content

Commit

Permalink
Setup colmena
Browse files Browse the repository at this point in the history
  • Loading branch information
peterablehmann committed Mar 15, 2024
1 parent 305b464 commit bf0e38f
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 9 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.direnv
124 changes: 115 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,57 @@

# SOPS Nix
sops-nix.url = "github:Mic92/sops-nix";

# Flake-Utils
flake-utils.url = "github:numtide/flake-utils";

# Colmena
colmena.url = "github:zhaofengli/colmena/main";
colmena.inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
{ self
, nixpkgs
, disko
, sops-nix
, flake-utils
, colmena
, ...
} @ inputs:
let
inherit (self) outputs;
conf = self.nixosConfigurations;
in
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# pkgs is needed here because colmena would otherwise be in the scope two times
pkgs.colmena
sops
jq
];
};
})) //
{
colmena = {
# see for details:
# https://github.com/zhaofengli/colmena/issues/60#issuecomment-1510496861
meta = {
nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
nodeSpecialArgs = builtins.mapAttrs (name: value: value._module.specialArgs) conf;
};
} // builtins.mapAttrs (name: value: { imports = value._module.args.modules; }) conf;

nixosConfigurations = {
mns = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
system = "x86_64-linux";
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
modules = [
./nodes/mns
self.nixosModules.common
Expand All @@ -35,6 +70,7 @@
monitoring = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
system = "x86_64-linux";
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
modules = [
./nodes/monitoring
self.nixosModules.common
Expand All @@ -43,6 +79,7 @@
sync = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
system = "x86_64-linux";
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
modules = [
./nodes/sync
self.nixosModules.common
Expand Down

0 comments on commit bf0e38f

Please sign in to comment.