mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
refactor: pivot to lovesegfault's config structure
This commit is contained in:
parent
d7e6ab7071
commit
04fc94267a
29 changed files with 588 additions and 1150 deletions
35
nix/hosts.nix
Normal file
35
nix/hosts.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
let
|
||||
hosts = {
|
||||
nom = {
|
||||
type = "nixos";
|
||||
hostname = "nom";
|
||||
hostPlatform = "x86_64-linux";
|
||||
remoteBuild = true;
|
||||
};
|
||||
};
|
||||
|
||||
inherit (builtins) attrNames concatMap listToAttrs;
|
||||
|
||||
filterAttrs = pred: set:
|
||||
listToAttrs (concatMap (name: let
|
||||
value = set.${name};
|
||||
in
|
||||
if pred name value
|
||||
then [{inherit name value;}]
|
||||
else []) (attrNames set));
|
||||
|
||||
systemPred = system: (_: v: builtins.match ".*${system}.*" v.hostPlatform != null);
|
||||
|
||||
genFamily = filter: hosts: rec {
|
||||
all = filterAttrs filter hosts;
|
||||
|
||||
nixos = genFamily (_: v: v.type == "nixos") all;
|
||||
homeManager = genFamily (_: v: v.type == "home-manager") all;
|
||||
|
||||
linux = genFamily (systemPred "-linux") all;
|
||||
|
||||
aarch64-linux = genFamily (systemPred "aarch64-linux") all;
|
||||
x86_64-linux = genFamily (systemPred "x86_64-linux") all;
|
||||
};
|
||||
in
|
||||
genFamily (_: _: true) hosts
|
Loading…
Add table
Add a link
Reference in a new issue