mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
reworked nixpath/registry
This commit is contained in:
parent
9ebe553ce1
commit
b6a705b16c
1 changed files with 27 additions and 24 deletions
|
|
@ -4,16 +4,10 @@ inputs: {
|
||||||
self,
|
self,
|
||||||
settings,
|
settings,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
nix = {
|
combined_flakes =
|
||||||
package = pkgs.nixVersions.unstable;
|
(
|
||||||
#automatically get registry from input flakes
|
#filter non-flakes from inputs
|
||||||
registry = (
|
|
||||||
lib.attrsets.mapAttrs (
|
|
||||||
_: value: {
|
|
||||||
flake = value;
|
|
||||||
}
|
|
||||||
) (
|
|
||||||
lib.attrsets.filterAttrs (
|
lib.attrsets.filterAttrs (
|
||||||
_: value: (
|
_: value: (
|
||||||
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
|
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
|
||||||
|
|
@ -22,16 +16,27 @@ inputs: {
|
||||||
inputs
|
inputs
|
||||||
)
|
)
|
||||||
// {
|
// {
|
||||||
nixpkgs.flake = inputs.unstable;
|
#alias unstable
|
||||||
system.flake = self;
|
nixpkgs = inputs.unstable;
|
||||||
}
|
#add system flake
|
||||||
);
|
system = self;
|
||||||
#automatically add registry entries to nixPath
|
};
|
||||||
nixPath = (lib.mapAttrsToList (name: value: name + "=" + value) inputs) ++ ["system=${self}" "nixpkgs=${inputs.unstable}"];
|
in {
|
||||||
|
#create registry from input flakes
|
||||||
|
nix.registry = lib.attrsets.mapAttrs (_: value: {flake = value;}) combined_flakes;
|
||||||
|
#add all inputs to etc
|
||||||
|
environment.etc = lib.mapAttrs' (name: value: lib.attrsets.nameValuePair "/nixpath/${name}" {source = value;}) combined_flakes;
|
||||||
|
#source the etc paths to nixPath
|
||||||
|
nix.nixPath = lib.mapAttrsToList (name: _: name + "=" + "/etc/nixpath/${name}") combined_flakes;
|
||||||
|
|
||||||
|
#other nix settings
|
||||||
|
nix = {
|
||||||
|
package = pkgs.nixVersions.unstable;
|
||||||
settings = {
|
settings = {
|
||||||
experimental-features = ["nix-command" "flakes" "repl-flake"];
|
experimental-features = ["nix-command" "flakes" "repl-flake"];
|
||||||
auto-optimise-store = true;
|
auto-optimise-store = true;
|
||||||
warn-dirty = false;
|
warn-dirty = false;
|
||||||
|
#ignore global registry
|
||||||
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}'';
|
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}'';
|
||||||
keep-outputs = true;
|
keep-outputs = true;
|
||||||
keep-derivations = true;
|
keep-derivations = true;
|
||||||
|
|
@ -43,6 +48,4 @@ inputs: {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
#make gcroots for each flake input
|
|
||||||
systemd.tmpfiles.rules = lib.attrsets.mapAttrsToList (name: value: "L+ /nix/var/nix/gcroots/${name} - - - - ${value}") inputs;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue