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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1675454231, "lastModified": 1675545634,
"narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=", "narHash": "sha256-TbQeQcM5TA/wIho6xtzG+inUfiGzUXi8ewwttiQWYJE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "06999209d7a0043d4372e38f57cffae00223d592", "rev": "0591d6b57bfeb55dfeec99a671843337bc2c3323",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

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

29
nix.nix
View file

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