added backup of current config to /etc/booted-system and nix.registry

This commit is contained in:
ISnortPennies 2023-02-06 21:04:26 -05:00
parent 4a10671be7
commit ec27847966
3 changed files with 23 additions and 18 deletions

29
nix.nix
View file

@ -2,25 +2,29 @@
inputs,
lib,
config,
self,
...
}: {
nix = {
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
#automatically get registry from input flakes
registry =
lib.attrsets.mapAttrs (
_: source: {
flake = source;
}
) (
lib.attrsets.filterAttrs (
_: source: (
!(lib.attrsets.hasAttrByPath ["flake"] source) || source.flake == false
(
lib.attrsets.mapAttrs (
_: value: {
flake = value;
}
) (
lib.attrsets.filterAttrs (
_: value: (
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
)
)
inputs
)
inputs
);
)
// {system = {flake = self;};};
#automatically add registry entries to nixPath
nixPath = (lib.mapAttrsToList (name: value: name + "=" + value) inputs) ++ [("system=" + ./.)];
settings = {
experimental-features = ["nix-command" "flakes" "repl-flake"];
auto-optimise-store = true;
@ -31,4 +35,5 @@
keep-derivations = false
'';
};
environment.etc."booted-system".source = self;
}