Skip to content

Commit

Permalink
flake2channel: filter self also from registry
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Apr 28, 2024
1 parent 884c576 commit 58fb09d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions modules/flake2channel.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{ inputs, config, lib, ... }: {
{ inputs, config, lib, ... }: let
filterSelf = inp: lib.filterAttrs # this prevents including the customer's ansible repo, which may contain bare secrets
(name: _: name != "self")
inp;
in {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) (filterSelf inputs));

# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
Expand All @@ -11,8 +15,5 @@
(name: value: {
name = "nix/path/${name}";
value.source = value.flake;
}) (lib.filterAttrs # this prevents including the customer's ansible repo, which may contain bare secrets
(name: _: name != "self")
config.nix.registry
);
}) (filterSelf config.nix.registry);
}

0 comments on commit 58fb09d

Please sign in to comment.