2024-05-14 19:21:19 +02:00
|
|
|
let
|
2024-03-13 11:11:16 +01:00
|
|
|
mods = import ./modules;
|
|
|
|
users = import ./users;
|
2024-06-01 00:28:17 +02:00
|
|
|
sources = import ./npins;
|
2024-11-14 15:30:17 +01:00
|
|
|
inherit (import sources.nix-patches { patchFile = ./patches; }) mkNixpkgsSrc;
|
2024-12-05 17:03:42 +01:00
|
|
|
|
|
|
|
unstable = {
|
2024-12-14 14:48:58 +01:00
|
|
|
nixpkgs = mkNixpkgsSrc {
|
2024-12-05 17:03:42 +01:00
|
|
|
src = sources.nixpkgs-unstable;
|
2024-10-27 10:47:35 +01:00
|
|
|
version = "unstable";
|
2024-12-14 14:48:58 +01:00
|
|
|
};
|
2024-12-05 17:03:42 +01:00
|
|
|
home-manager = "${sources.home-manager-unstable}/nixos";
|
|
|
|
nixvim = import sources.nixvim-unstable;
|
|
|
|
};
|
|
|
|
stable = {
|
2024-12-14 14:48:58 +01:00
|
|
|
nixpkgs = mkNixpkgsSrc {
|
2024-12-05 17:03:42 +01:00
|
|
|
src = sources.nixpkgs-stable;
|
|
|
|
version = "stable";
|
2024-12-14 14:48:58 +01:00
|
|
|
};
|
2024-12-05 17:03:42 +01:00
|
|
|
home-manager = "${sources.home-manager-stable}/nixos";
|
|
|
|
nixvim = import sources.nixvim-stable;
|
|
|
|
};
|
2024-12-14 14:48:58 +01:00
|
|
|
inherit (import unstable.nixpkgs { }) lib;
|
2024-12-05 17:03:42 +01:00
|
|
|
|
|
|
|
nodes = lib.mapAttrs' (name: _: {
|
|
|
|
name = lib.removeSuffix ".nix" name;
|
|
|
|
value = import ./machines/${name};
|
|
|
|
}) (builtins.readDir ./machines);
|
|
|
|
|
|
|
|
nodes-meta = lib.mapAttrs (_: n: n.meta) nodes;
|
2024-05-14 19:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2024-12-05 17:03:42 +01:00
|
|
|
meta = rec {
|
|
|
|
inherit (unstable) nixpkgs;
|
2024-07-26 21:22:44 +02:00
|
|
|
specialArgs = {
|
|
|
|
inherit mods users sources;
|
2024-12-05 17:03:42 +01:00
|
|
|
meta = nodes-meta;
|
|
|
|
versions = {
|
|
|
|
inherit unstable stable;
|
|
|
|
};
|
2024-07-26 21:22:44 +02:00
|
|
|
};
|
2024-12-05 17:03:42 +01:00
|
|
|
nodeNixpkgs = lib.mapAttrs (
|
|
|
|
_: node:
|
|
|
|
lib.foldl (
|
|
|
|
pkgs: patch:
|
2024-12-14 14:48:58 +01:00
|
|
|
mkNixpkgsSrc {
|
2024-12-05 17:03:42 +01:00
|
|
|
src = pkgs;
|
|
|
|
version = patch;
|
2024-12-14 14:48:58 +01:00
|
|
|
}
|
|
|
|
) (if node.unstable then unstable else stable).nixpkgs (node.nixPatches or [ ])
|
2024-12-05 17:03:42 +01:00
|
|
|
) nodes-meta;
|
|
|
|
nodeSpecialArgs = lib.mapAttrs (name: node: {
|
|
|
|
inherit (node) unstable;
|
|
|
|
self-version = (if node.unstable then unstable else stable) // {
|
2024-12-14 14:48:58 +01:00
|
|
|
nixpkgs = nodeNixpkgs.${name};
|
2024-12-05 17:03:42 +01:00
|
|
|
};
|
|
|
|
}) nodes-meta;
|
2024-03-13 11:11:16 +01:00
|
|
|
};
|
2024-05-14 19:21:19 +02:00
|
|
|
defaults =
|
2024-06-01 16:26:08 +02:00
|
|
|
{
|
|
|
|
name,
|
|
|
|
...
|
|
|
|
}:
|
2024-05-14 19:21:19 +02:00
|
|
|
{
|
2024-10-27 10:47:35 +01:00
|
|
|
imports = [ ./kat ];
|
2024-09-26 11:51:04 +02:00
|
|
|
networking.hostName = name;
|
2024-05-14 19:21:19 +02:00
|
|
|
};
|
2024-03-12 17:26:16 +01:00
|
|
|
}
|
2024-12-05 17:03:42 +01:00
|
|
|
// lib.mapAttrs (_: n: n.config) nodes
|