add enable persistance option

This commit is contained in:
mrsu 2024-06-28 16:05:12 +01:00
parent 89dceb1827
commit 906d11b3b0
5 changed files with 29 additions and 22 deletions

View File

@ -142,11 +142,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718879355, "lastModified": 1719259945,
"narHash": "sha256-RTyqP4fBX2MdhNuMP+fnR3lIwbdtXhyj7w7fwtvgspc=", "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -278,11 +278,11 @@
"nix-secrets": { "nix-secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1719345965, "lastModified": 1719585068,
"narHash": "sha256-ZxnKEatJu/wVxLy0M7UnCVvemU3P5vVvVoueAR289fk=", "narHash": "sha256-SXos1BQQBWvuY55/N9C0MNQNp3vrokYFReFBJVssOsI=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "24db3bffa6b914d0389ff801c054dd48535872a4", "rev": "cbe3ecf4789c1dfcbfb531e50843941207653086",
"revCount": 121, "revCount": 123,
"type": "git", "type": "git",
"url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git"
}, },
@ -293,11 +293,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1719145550, "lastModified": 1719426051,
"narHash": "sha256-K0i/coxxTEl30tgt4oALaylQfxqbotTSNb1/+g+mKMQ=", "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e4509b3a560c87a8d4cb6f9992b8915abf9e36d8", "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -368,11 +368,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1719340721, "lastModified": 1719469291,
"narHash": "sha256-SfjI1Ir3Zs7w5lXXsmJ/MhB3V1Z1gHl9K2dFaEiy/GM=", "narHash": "sha256-Efir01r7ThPabDBFOygX1UDyerJFHelbRGdMo/VNw14=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "1fdbf40c177fc2edfcd3c63fadf4a6f596edc6af", "rev": "8f52e4d1e34039937efb0ee05825b9963ef29739",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -384,11 +384,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1719344711, "lastModified": 1719584730,
"narHash": "sha256-k389PPp1HG9xk3yXn4Q/eAY/K+qm/+kbHLq9hfo+m14=", "narHash": "sha256-O24Ms0iM0JE+duoXGlouxbzfaHRSXWUu0NKFKdveQ4c=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "85596df878b1b71a54e1de3835ac6135c1bb8744", "rev": "d06168ffaa627c12e0d0ea2f993387b715934e1a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -455,11 +455,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1718522839, "lastModified": 1719243788,
"narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", "narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", "rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,6 +1,8 @@
{enable}:
{ {
fileSystems."/persist".neededForBoot = true; fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist" = { environment.persistence."/persist" = {
inherit enable;
hideMounts = true; hideMounts = true;
directories = [ directories = [
"/etc/nixos" "/etc/nixos"

View File

@ -6,6 +6,7 @@ let
encrypted = false; # currrently only applies to btrfs encrypted = false; # currrently only applies to btrfs
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
user = "admin"; user = "admin";
enablePersistance = false;
in in
{ {
imports = imports =
@ -23,6 +24,8 @@ in
# Import optional options # Import optional options
../common/optional/openssh.nix ../common/optional/openssh.nix
(import ../common/optional/persistence.nix {enable = enablePersistance;})
]; ];
@ -37,7 +40,7 @@ in
boot.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ];
boot.zfs.forceImportRoot = false; boot.zfs.forceImportRoot = false;
networking.hostId = "18aec5d7" networking.hostId = "18aec5d7";
services.libinput.enable = true; services.libinput.enable = true;
} }

View File

@ -6,6 +6,7 @@ let
encrypted = true; # currrently only applies to btrfs encrypted = true; # currrently only applies to btrfs
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
user = "sam"; user = "sam";
enablePersistance = true;
in in
{ {
imports = imports =
@ -26,7 +27,7 @@ in
../common/core ../common/core
# Import optional options # Import optional options
../common/optional/persistence.nix (import ../common/optional/persistence.nix {enable = enablePersistance;})
../common/optional/pipewire.nix ../common/optional/pipewire.nix
../common/optional/openssh.nix ../common/optional/openssh.nix
../common/optional/dwm.nix ../common/optional/dwm.nix

View File

@ -5,6 +5,7 @@ let
dev = "/dev/sda"; # depends on target hardware dev = "/dev/sda"; # depends on target hardware
encrypted = false; # currrently only applies to btrfs encrypted = false; # currrently only applies to btrfs
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root"; btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
enablePersistance = true;
in in
{ {
imports = imports =
@ -26,7 +27,7 @@ in
# Import optional options # Import optional options
../common/optional/openssh.nix ../common/optional/openssh.nix
../common/optional/persistence.nix (import ../common/optional/persistence.nix {enable = enablePersistance;})
../common/optional/gaming.nix ../common/optional/gaming.nix
]; ];