From 906d11b3b088a92dfbd2720db8c207f8326c79ea Mon Sep 17 00:00:00 2001 From: mrsu Date: Fri, 28 Jun 2024 16:05:12 +0100 Subject: [PATCH] add enable persistance option --- flake.lock | 38 +++++++++++++-------------- hosts/common/optional/persistence.nix | 2 ++ hosts/nebula/default.nix | 5 +++- hosts/semita/default.nix | 3 ++- hosts/sparky/default.nix | 3 ++- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/flake.lock b/flake.lock index 3038f93..b2d7ed6 100644 --- a/flake.lock +++ b/flake.lock @@ -142,11 +142,11 @@ ] }, "locked": { - "lastModified": 1718879355, - "narHash": "sha256-RTyqP4fBX2MdhNuMP+fnR3lIwbdtXhyj7w7fwtvgspc=", + "lastModified": 1719259945, + "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", + "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", "type": "github" }, "original": { @@ -278,11 +278,11 @@ "nix-secrets": { "flake": false, "locked": { - "lastModified": 1719345965, - "narHash": "sha256-ZxnKEatJu/wVxLy0M7UnCVvemU3P5vVvVoueAR289fk=", + "lastModified": 1719585068, + "narHash": "sha256-SXos1BQQBWvuY55/N9C0MNQNp3vrokYFReFBJVssOsI=", "ref": "refs/heads/master", - "rev": "24db3bffa6b914d0389ff801c054dd48535872a4", - "revCount": 121, + "rev": "cbe3ecf4789c1dfcbfb531e50843941207653086", + "revCount": 123, "type": "git", "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" }, @@ -293,11 +293,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719145550, - "narHash": "sha256-K0i/coxxTEl30tgt4oALaylQfxqbotTSNb1/+g+mKMQ=", + "lastModified": 1719426051, + "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e4509b3a560c87a8d4cb6f9992b8915abf9e36d8", + "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd", "type": "github" }, "original": { @@ -368,11 +368,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1719340721, - "narHash": "sha256-SfjI1Ir3Zs7w5lXXsmJ/MhB3V1Z1gHl9K2dFaEiy/GM=", + "lastModified": 1719469291, + "narHash": "sha256-Efir01r7ThPabDBFOygX1UDyerJFHelbRGdMo/VNw14=", "owner": "nix-community", "repo": "nixvim", - "rev": "1fdbf40c177fc2edfcd3c63fadf4a6f596edc6af", + "rev": "8f52e4d1e34039937efb0ee05825b9963ef29739", "type": "github" }, "original": { @@ -384,11 +384,11 @@ }, "nur": { "locked": { - "lastModified": 1719344711, - "narHash": "sha256-k389PPp1HG9xk3yXn4Q/eAY/K+qm/+kbHLq9hfo+m14=", + "lastModified": 1719584730, + "narHash": "sha256-O24Ms0iM0JE+duoXGlouxbzfaHRSXWUu0NKFKdveQ4c=", "owner": "nix-community", "repo": "NUR", - "rev": "85596df878b1b71a54e1de3835ac6135c1bb8744", + "rev": "d06168ffaa627c12e0d0ea2f993387b715934e1a", "type": "github" }, "original": { @@ -455,11 +455,11 @@ ] }, "locked": { - "lastModified": 1718522839, - "narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", + "lastModified": 1719243788, + "narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", + "rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf", "type": "github" }, "original": { diff --git a/hosts/common/optional/persistence.nix b/hosts/common/optional/persistence.nix index 1678ad6..d8dfd17 100644 --- a/hosts/common/optional/persistence.nix +++ b/hosts/common/optional/persistence.nix @@ -1,6 +1,8 @@ +{enable}: { fileSystems."/persist".neededForBoot = true; environment.persistence."/persist" = { + inherit enable; hideMounts = true; directories = [ "/etc/nixos" diff --git a/hosts/nebula/default.nix b/hosts/nebula/default.nix index 8c559aa..5f277a1 100644 --- a/hosts/nebula/default.nix +++ b/hosts/nebula/default.nix @@ -6,6 +6,7 @@ let encrypted = false; # currrently only applies to btrfs btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; user = "admin"; + enablePersistance = false; in { imports = @@ -23,6 +24,8 @@ in # Import optional options ../common/optional/openssh.nix + (import ../common/optional/persistence.nix {enable = enablePersistance;}) + ]; @@ -37,7 +40,7 @@ in boot.supportedFilesystems = [ "zfs" ]; boot.zfs.forceImportRoot = false; - networking.hostId = "18aec5d7" + networking.hostId = "18aec5d7"; services.libinput.enable = true; } diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index 95759b4..59185b8 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -6,6 +6,7 @@ let encrypted = true; # currrently only applies to btrfs btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; user = "sam"; + enablePersistance = true; in { imports = @@ -26,7 +27,7 @@ in ../common/core # Import optional options - ../common/optional/persistence.nix + (import ../common/optional/persistence.nix {enable = enablePersistance;}) ../common/optional/pipewire.nix ../common/optional/openssh.nix ../common/optional/dwm.nix diff --git a/hosts/sparky/default.nix b/hosts/sparky/default.nix index a9b17ab..566d8e7 100644 --- a/hosts/sparky/default.nix +++ b/hosts/sparky/default.nix @@ -5,6 +5,7 @@ let dev = "/dev/sda"; # depends on target hardware encrypted = false; # currrently only applies to btrfs btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; + enablePersistance = true; in { imports = @@ -26,7 +27,7 @@ in # Import optional options ../common/optional/openssh.nix - ../common/optional/persistence.nix + (import ../common/optional/persistence.nix {enable = enablePersistance;}) ../common/optional/gaming.nix ];