config-perso/hive.nix

70 lines
1.7 KiB
Nix
Raw Normal View History

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;
unstable = {
2024-12-14 14:48:58 +01:00
nixpkgs = mkNixpkgsSrc {
src = sources.nixpkgs-unstable;
version = "unstable";
2024-12-14 14:48:58 +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 {
src = sources.nixpkgs-stable;
version = "stable";
2024-12-14 14:48:58 +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;
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
{
meta = rec {
inherit (unstable) nixpkgs;
specialArgs = {
inherit mods users sources;
meta = nodes-meta;
versions = {
inherit unstable stable;
};
};
nodeNixpkgs = lib.mapAttrs (
_: node:
lib.foldl (
pkgs: patch:
2024-12-14 14:48:58 +01:00
mkNixpkgsSrc {
src = pkgs;
version = patch;
2024-12-14 14:48:58 +01:00
}
) (if node.unstable then unstable else stable).nixpkgs (node.nixPatches or [ ])
) 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};
};
}) 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
{
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
}
// lib.mapAttrs (_: n: n.config) nodes