Commit 6e5f30e
Changed files (6)
lib/colmenaSystem.nix
@@ -0,0 +1,40 @@
+# colmena - Remote Deployment via SSH
+{
+ lib,
+ inputs,
+ nixos-modules,
+ home-modules ? [],
+ myvars,
+ system,
+ tags,
+ ssh-user,
+ genSpecialArgs,
+ specialArgs ? (genSpecialArgs system),
+ ...
+}: let
+ inherit (inputs) home-manager;
+in
+ {name, ...}: {
+ deployment = {
+ inherit tags;
+ targetUser = ssh-user;
+ targetHost = name; # hostName or IP address
+ };
+
+ imports =
+ nixos-modules
+ ++ (
+ lib.optionals ((lib.lists.length home-modules) > 0)
+ [
+ home-manager.nixosModules.home-manager
+ {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.backupFileExtension = "home-manager.backup";
+
+ home-manager.extraSpecialArgs = specialArgs;
+ home-manager.users."${myvars.username}".imports = home-modules;
+ }
+ ]
+ );
+ }
lib/default.nix
@@ -1,4 +1,5 @@
{lib, ...}: {
+ colmenaSystem = import ./colmenaSystem.nix;
nixosSystem = import ./nixosSystem.nix;
attrs = import ./attrs.nix {inherit lib;};
outputs/x86_64-linux/default.nix
@@ -17,6 +17,13 @@
outputs = {
nixosConfigurations = lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) dataWithoutPaths);
packages = lib.attrsets.mergeAttrsList (map (it: it.packages or {}) dataWithoutPaths);
+
+ colmenaMeta = {
+ nodeNixpkgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeNixpkgs or {}) dataWithoutPaths);
+ nodeSpecialArgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeSpecialArgs or {}) dataWithoutPaths);
+ };
+
+ colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) dataWithoutPaths);
};
in
outputs
outputs/default.nix
@@ -1,5 +1,6 @@
{
self,
+ colmena,
nixpkgs,
...
} @ inputs: let
@@ -65,6 +66,28 @@ in {
map (it: it.nixosConfigurations or {}) nixosSystemValues
);
+ # Colmena - remote deployment via SSH
+ colmenaHive = colmena.lib.makeHive self.outputs.colmena;
+ colmena =
+ {
+ meta =
+ (
+ let
+ system = "x86_64-linux";
+ in {
+ # colmena's default nixpkgs & specialArgs
+ nixpkgs = import nixpkgs {inherit system;};
+ specialArgs = genSpecialArgs system;
+ }
+ )
+ // {
+ # per-node nixpkgs & specialArgs
+ nodeNixpkgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeNixpkgs or {}) nixosSystemValues);
+ nodeSpecialArgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeSpecialArgs or {}) nixosSystemValues);
+ };
+ }
+ // lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) nixosSystemValues);
+
# macOS Hosts
darwinConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.darwinConfigurations or {}) darwinSystemValues
flake.lock
@@ -18,6 +18,46 @@
"type": "github"
}
},
+ "colmena": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
+ "nix-github-actions": "nix-github-actions",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "stable": "stable"
+ },
+ "locked": {
+ "lastModified": 1752287590,
+ "narHash": "sha256-U1IqFnxlgCRrPaeT5IGCdH0j9CNLPFcI/fRAidi0aDQ=",
+ "owner": "zhaofengli",
+ "repo": "colmena",
+ "rev": "d2beb694d54db653399b8597c0f6e15e20b26405",
+ "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-parts": {
"inputs": {
"nixpkgs-lib": [
@@ -39,6 +79,21 @@
"type": "github"
}
},
+ "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"
+ }
+ },
"haumea": {
"inputs": {
"nixpkgs": [
@@ -81,6 +136,27 @@
"type": "github"
}
},
+ "nix-github-actions": {
+ "inputs": {
+ "nixpkgs": [
+ "colmena",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1729742964,
+ "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=",
+ "owner": "nix-community",
+ "repo": "nix-github-actions",
+ "rev": "e04df33f62cdcf93d73e9a04142464753a16db67",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nix-github-actions",
+ "type": "github"
+ }
+ },
"nixos-hardware": {
"locked": {
"lastModified": 1751432711,
@@ -260,6 +336,7 @@
"root": {
"inputs": {
"catppuccin": "catppuccin",
+ "colmena": "colmena",
"haumea": "haumea",
"home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
@@ -295,6 +372,22 @@
"type": "github"
}
},
+ "stable": {
+ "locked": {
+ "lastModified": 1750133334,
+ "narHash": "sha256-urV51uWH7fVnhIvsZIELIYalMYsyr2FCalvlRTzqWRw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "36ab78dab7da2e4e27911007033713bab534187b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-25.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"wallpapers": {
"flake": false,
"locked": {
flake.nix
@@ -38,6 +38,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
+ colmena = {
+ url = "github:zhaofengli/colmena";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
nu-scripts = {
url = "github:nushell/nu_scripts";
flake = false;