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

6
flake.lock generated
View file

@ -53,11 +53,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1675454231,
"narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=",
"lastModified": 1675545634,
"narHash": "sha256-TbQeQcM5TA/wIho6xtzG+inUfiGzUXi8ewwttiQWYJE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "06999209d7a0043d4372e38f57cffae00223d592",
"rev": "0591d6b57bfeb55dfeec99a671843337bc2c3323",
"type": "github"
},
"original": {

View file

@ -49,7 +49,7 @@
gerg-desktop = lib.nixosSystem {
inherit system pkgs;
specialArgs = {
inherit inputs;
inherit inputs self;
settings = {
username = "gerg";
version = "23.05";
@ -66,7 +66,7 @@
game-laptop = lib.nixosSystem {
inherit system pkgs;
specialArgs = {
inherit inputs;
inherit inputs self;
settings = {
username = "games";
version = "23.05";
@ -82,7 +82,7 @@
moms-laptop = lib.nixosSystem {
inherit system pkgs;
specialArgs = {
inherit inputs;
inherit inputs self;
settings = {
username = "jo";
version = "23.05";

19
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;
_: value: {
flake = value;
}
) (
lib.attrsets.filterAttrs (
_: source: (
!(lib.attrsets.hasAttrByPath ["flake"] source) || source.flake == false
_: value: (
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
)
)
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;
}