nixos/spec/channel.nix
2025-01-13 11:52:09 +08:00

23 lines
494 B
Nix

{ 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}");
}