Make all colmena nodes also be nixosconfigurations :3

This commit is contained in:
CherryKitten 2024-03-24 19:02:31 +01:00
parent e3d2db48bb
commit 014e41d930
Signed by: sammy
GPG key ID: 98D8F75FB0658276
4 changed files with 99 additions and 11 deletions

View file

@ -1,6 +1,60 @@
{ {
"nodes": { "nodes": {
"colmena": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"stable": "stable"
},
"locked": {
"lastModified": 1706509311,
"narHash": "sha256-QQKQ6r3CID8aXn2ZXZ79ZJxdCOeVP+JTnOctDALErOw=",
"owner": "zhaofengli",
"repo": "colmena",
"rev": "c84ccd0a7a712475e861c2b111574472b1a8d0cd",
"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": { "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"
}
},
"flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
@ -71,12 +125,29 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "colmena": "colmena",
"flake-utils": "flake-utils_2",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },
"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": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -3,6 +3,9 @@
nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs.url = "nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable"; nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena";
colmena.inputs.nixpkgs.follows = "nixpkgs";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -10,7 +13,7 @@
}; };
outputs = outputs =
inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }: inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, colmena, ... }:
let let
inherit (self) outputs; inherit (self) outputs;
systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
@ -26,17 +29,17 @@
}; };
}; };
in in
{ rec {
inherit lib; inherit lib;
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
devShells = forAllSystems (system: devShells = forAllSystems (system:
let pkgs = import nixpkgs { system = system; }; in let pkgs = import nixpkgs { system = system; }; in
{ {
default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ nix colmena git pkgs.home-manager ]; }; default = pkgs.mkShell { nativeBuildInputs = [ pkgs.nix pkgs.colmena pkgs.git pkgs.home-manager ]; };
}); });
colmena = { colmenaHive = colmena.lib.makeHive {
meta = { meta = {
description = "All my NixoS machines"; description = "All my NixoS machines";
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit inputs outputs; };
@ -47,12 +50,13 @@
maine-coon = mkHost { hostname = "maine-coon"; }; maine-coon = mkHost { hostname = "maine-coon"; };
}; };
nixosConfigurations.test = nixpkgs.lib.nixosSystem { nixosConfigurations = {
system = "x86_64-linux"; test = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; }; system = "x86_64-linux";
modules = [ ./modules ./hosts/test-vm/configuration.nix (import "${home-manager}/nixos") ]; specialArgs = { inherit inputs outputs; };
}; modules = [ ./modules/nixos/common.nix ./hosts/test-vm/configuration.nix (import "${home-manager}/nixos") ];
};
} // colmenaHive.nodes;
homeConfigurations.sammy = homeConfigurations.sammy =
let let
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };

View file

@ -19,6 +19,7 @@ in
./security.nix ./security.nix
../users ../users
./yubikey.nix ./yubikey.nix
../virtualization.nix
]; ];
config = { config = {

View file

@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
{
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = 8192;
cores = 6;
graphics = true;
};
users.users.sammy.password = "test";
};
}