nix: add modular nixos and home-manager configuration loading

This commit is contained in:
514fpv 2024-01-02 14:42:27 +08:00
parent 062900f878
commit 7af5b0d467
Signed by: koishi
SSH key fingerprint: SHA256:VkIdW3jUIiqecV2WNAje2fGU5lEhN0XZ58DN0NS4pv0
6 changed files with 213 additions and 0 deletions

15
spec/channel.nix Normal file
View file

@ -0,0 +1,15 @@
{ inputs, ... }: with inputs; with nixpkgs.lib; let
mapInputs = fn: map fn (lists.remove "self" (attrNames inputs));
channelPath = "/etc/nix/channels";
in {
nix = {
nixPath = mapInputs (i: "${i}=${channelPath}/${i}");
registry = listToAttrs
(mapInputs (name: {
inherit name;
value = {flake = inputs.${name};};
}));
};
systemd.tmpfiles.rules = mapInputs (i: "L+ ${channelPath}/${i} - - - - ${inputs.${i}.outPath}");
}