update flake.lock; refactor impermanence; other minor fixes
This commit is contained in:
Generated
+54
-54
@@ -11,11 +11,11 @@
|
|||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775232685,
|
"lastModified": 1776442854,
|
||||||
"narHash": "sha256-+kVivleQqI6HdFeVWVukEPvPec/SN74l+j/Tw9OBaSw=",
|
"narHash": "sha256-63dPlCgKEfqWmzaRnec4W2sQDtwfApPxKbpy05ChQ+U=",
|
||||||
"owner": "linyinfeng",
|
"owner": "linyinfeng",
|
||||||
"repo": "angrr",
|
"repo": "angrr",
|
||||||
"rev": "e1b066a0dbdd6ed3208dd5405e7d6cde91b7e20d",
|
"rev": "a49a74a81185fc0bfad62e98d80f05e80cd6c3e6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -130,11 +130,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775213373,
|
"lastModified": 1776420287,
|
||||||
"narHash": "sha256-wJHsijC2l/E+ovmlpPGha8pXA6RHSwHWmBV97gvkmyI=",
|
"narHash": "sha256-0P2QyDM8R1FFww//TNDLTRVnVkQxVdbEVQiVuyD1SqY=",
|
||||||
"owner": "catppuccin",
|
"owner": "catppuccin",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"rev": "ba73719e673e7c2d89ac2f8df0bc0d48983e4907",
|
"rev": "bdf0285dc7978ebd78b76054631d7ef05680895e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -193,11 +193,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775807984,
|
"lastModified": 1776413252,
|
||||||
"narHash": "sha256-Redoe3D9zGN5I9QPHWL9vfMVQBehY1fKsMiRXQ83X3w=",
|
"narHash": "sha256-ZQhyB2vnFsE1KcWJlWle1UujEDVjTJVL3oMIHUvnzuo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "fcf90c0c4d368b2ca917a7afa6d08e98a397e5fd",
|
"rev": "a318c3c6120e91375eea1d7c57a0cd101a81b14a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -542,11 +542,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775781825,
|
"lastModified": 1776454077,
|
||||||
"narHash": "sha256-L5yKTpR+alrZU2XYYvIxCeCP4LBHU5jhwSj7H1VAavg=",
|
"narHash": "sha256-7zSUFWsU0+jlD7WB3YAxQ84Z/iJurA5hKPm8EfEyGJk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "e35c39fca04fee829cecdf839a50eb9b54d8a701",
|
"rev": "565e5349208fe7d0831ef959103c9bafbeac0681",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -585,11 +585,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774991950,
|
"lastModified": 1776184304,
|
||||||
"narHash": "sha256-kScKj3qJDIWuN9/6PMmgy5esrTUkYinrO5VvILik/zw=",
|
"narHash": "sha256-No6QGBmIv5ChiwKCcbkxjdEQ/RO2ZS1gD7SFy6EZ7rc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "f2d3e04e278422c7379e067e323734f3e8c585a7",
|
"rev": "3c7524c68348ef79ce48308e0978611a050089b2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -704,11 +704,11 @@
|
|||||||
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
|
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775802594,
|
"lastModified": 1776435348,
|
||||||
"narHash": "sha256-miydzsK4cMzBXoHw+/5Am4PwB/P/ifWOlfHHqFe7FKU=",
|
"narHash": "sha256-qsZnMThxTqxCJZ7DEKu3DD3KjIPcuUBvZ0C9a2uIvaQ=",
|
||||||
"owner": "sodiboo",
|
"owner": "sodiboo",
|
||||||
"repo": "niri-flake",
|
"repo": "niri-flake",
|
||||||
"rev": "63213c63766e5bb28e0e0b078c4628b01b24c92f",
|
"rev": "55b5b1fc9481ab267603a1099e5d4b4ebc7394d7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -737,11 +737,11 @@
|
|||||||
"niri-unstable": {
|
"niri-unstable": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775561155,
|
"lastModified": 1776432730,
|
||||||
"narHash": "sha256-TK2IrqQivRcwqJa0suZMbcsN17CtA8Uu0v7CDnLATb0=",
|
"narHash": "sha256-Pq1ZVvRGq/IFiFH6vkNwMfZEpWk23NjgGdX50COdj/c=",
|
||||||
"owner": "YaLTeR",
|
"owner": "YaLTeR",
|
||||||
"repo": "niri",
|
"repo": "niri",
|
||||||
"rev": "599db847f857b8a7ff78ce02f15acab5d5d9fee1",
|
"rev": "c814c656c53ea9d69f5afb45c88f4dc4d25338cd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -838,11 +838,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774972752,
|
"lastModified": 1776255237,
|
||||||
"narHash": "sha256-DnLIpFxznohpLkIFs390uZ0gxwkVyhtknhKNu+lQJK8=",
|
"narHash": "sha256-LQjlc0VEn55WAT4BiI8sIsokb/2FNlcbBD+Xr3MTE24=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "d97e078f4788cddb8d11c3c99f72a4bb9ddec221",
|
"rev": "9a8c2a85f1ffdcecfb0f9c52c5a73c49ceb43911",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -881,11 +881,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-master": {
|
"nixpkgs-master": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775819370,
|
"lastModified": 1776485399,
|
||||||
"narHash": "sha256-BHRz22IikhXRf50kZ4N/zpVcwpF2Iu9oZszo7kjZOFw=",
|
"narHash": "sha256-4Cmxz15i5qn3HZFbyxf6hRyeb7huOJgW2+c1GCQ0J4U=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7a0597d154a4f90b29c0dcd8cb465de0986452a6",
|
"rev": "5230db4d0c546b5b7594aa978e6e8aa560351748",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -897,11 +897,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775595990,
|
"lastModified": 1776221942,
|
||||||
"narHash": "sha256-OEf7YqhF9IjJFYZJyuhAypgU+VsRB5lD4DuiMws5Ltc=",
|
"narHash": "sha256-FbQAeVNi7G4v3QCSThrSAAvzQTmrmyDLiHNPvTF2qFM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4e92bbcdb030f3b4782be4751dc08e6b6cb6ccf2",
|
"rev": "1766437c5509f444c1b15331e82b8b6a9b967000",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -913,11 +913,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable_2": {
|
"nixpkgs-stable_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775811116,
|
"lastModified": 1776481463,
|
||||||
"narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=",
|
"narHash": "sha256-WL4ugBHkmW89Hu4BfZN5ZdrgBhr/azwu4Ogx9IH9UaM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "54170c54449ea4d6725efd30d719c5e505f1c10e",
|
"rev": "63d42e035e2eddc492965a2cca2ac3f21dfcf82f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -929,11 +929,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775710090,
|
"lastModified": 1776169885,
|
||||||
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
|
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
|
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -993,11 +993,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775710090,
|
"lastModified": 1776169885,
|
||||||
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
|
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
|
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1127,11 +1127,11 @@
|
|||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775745684,
|
"lastModified": 1776343166,
|
||||||
"narHash": "sha256-8MbfLwd60FNa8dRFkjE+G3TT/x21G3Rsplm1bMBQUtU=",
|
"narHash": "sha256-ZiHQPWwuUZk44epAZRbyFz23Kd4CYaq8WlBgAmCqAzQ=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "64ddb549bc9a70d011328746fa46a8883f937b6b",
|
"rev": "b8458013c217be4fccefc4e4f194026fa04ab4ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1148,11 +1148,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775659564,
|
"lastModified": 1776230713,
|
||||||
"narHash": "sha256-WFLi+JOeit3ymB0gw+hswtVuks0+qOYhJaJR5Y3ARww=",
|
"narHash": "sha256-8Rv4J8M09NPJcq4pYfMyi0ibJJQD7/JzKjAqSp2LjZw=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "4eac297e5dfce12420988df36defc177c1fe9ff0",
|
"rev": "105ff9ba631f5e7ee75aac03df941981312d917e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1182,11 +1182,11 @@
|
|||||||
"tinted-zed": "tinted-zed"
|
"tinted-zed": "tinted-zed"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775429060,
|
"lastModified": 1776170745,
|
||||||
"narHash": "sha256-wbFF5cRxQOCzL/wHOKYm21t5AHPH2Lfp0mVPCOAvEoc=",
|
"narHash": "sha256-Tl1aZVP5EIlT+k0+iAKH018GLHJpLz3hhJ0LNQOWxCc=",
|
||||||
"owner": "danth",
|
"owner": "danth",
|
||||||
"repo": "stylix",
|
"repo": "stylix",
|
||||||
"rev": "d27951a6539951d87f75cf0a7cda8a3a24016019",
|
"rev": "e3861617645a43c9bbefde1aa6ac54dd0a44bfa9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1352,11 +1352,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775125835,
|
"lastModified": 1775636079,
|
||||||
"narHash": "sha256-2qYcPgzFhnQWchHo0SlqLHrXpux5i6ay6UHA+v2iH4U=",
|
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "75925962939880974e3ab417879daffcba36c4a3",
|
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1406,11 +1406,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775744672,
|
"lastModified": 1776483758,
|
||||||
"narHash": "sha256-Qg3Wnn3WYiiii35CE9kE+XX4ooSFzupAnGC1/NjI5C8=",
|
"narHash": "sha256-MjoG8oTm3KsPhXemYqnNjpGmE2PbmUdLFOGXRhNQ7sU=",
|
||||||
"owner": "0xc000022070",
|
"owner": "0xc000022070",
|
||||||
"repo": "zen-browser-flake",
|
"repo": "zen-browser-flake",
|
||||||
"rev": "14a238beb0621977e9bf04cba68919d5650deea9",
|
"rev": "44f9a58e8c1fa0a0887f51dd361aa86faa8f759c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -31,13 +31,12 @@ in
|
|||||||
services.btrfs.autoScrub.enable = true;
|
services.btrfs.autoScrub.enable = true;
|
||||||
networking.hostId = "10ca95b4";
|
networking.hostId = "10ca95b4";
|
||||||
|
|
||||||
fileSystems."/" = {
|
my.persist.btrfs = {
|
||||||
device = btrfs;
|
device = btrfs;
|
||||||
fsType = "btrfs";
|
mountPoint = "/nix/persist";
|
||||||
options = [
|
persistSubvol = "persist";
|
||||||
"compress=zstd"
|
rootSubvol = "root";
|
||||||
"subvol=root"
|
zstdCompress = true;
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" = {
|
||||||
@@ -49,17 +48,6 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
my.persist.location = "/nix/persist";
|
|
||||||
fileSystems."/nix/persist" = {
|
|
||||||
device = btrfs;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=persist"
|
|
||||||
];
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||||
mkdir /btrfs_tmp
|
mkdir /btrfs_tmp
|
||||||
mount ${btrfs} /btrfs_tmp
|
mount ${btrfs} /btrfs_tmp
|
||||||
|
|||||||
@@ -30,13 +30,12 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/" = {
|
my.persist.btrfs = {
|
||||||
device = btrfs;
|
device = btrfs;
|
||||||
fsType = "btrfs";
|
mountPoint = "/nix/persist";
|
||||||
options = [
|
persistSubvol = "persist";
|
||||||
"compress=zstd"
|
rootSubvol = "root";
|
||||||
"subvol=root"
|
zstdCompress = true;
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" = {
|
||||||
@@ -48,42 +47,6 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
my.persist.location = "/nix/persist";
|
|
||||||
fileSystems."/nix/persist" = {
|
|
||||||
device = btrfs;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=persist"
|
|
||||||
];
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
|
||||||
mkdir /btrfs_tmp
|
|
||||||
mount ${btrfs} /btrfs_tmp
|
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
|
||||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
|
||||||
fi
|
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
|
||||||
IFS=$'\n'
|
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
|
||||||
done
|
|
||||||
btrfs subvolume delete "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +14); do
|
|
||||||
delete_subvolume_recursively "$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/root
|
|
||||||
umount /btrfs_tmp
|
|
||||||
'';
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/boot" = {
|
||||||
device = "/dev/disk/by-uuid/96D3-93B0";
|
device = "/dev/disk/by-uuid/96D3-93B0";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
|||||||
@@ -37,13 +37,12 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/" = {
|
my.persist.btrfs = {
|
||||||
device = btrfs;
|
device = btrfs;
|
||||||
fsType = "btrfs";
|
mountPoint = "/nix/persist";
|
||||||
options = [
|
persistSubvol = "persistent";
|
||||||
"compress=zstd"
|
rootSubvol = "root";
|
||||||
"subvol=root"
|
zstdCompress = true;
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" = {
|
||||||
@@ -52,17 +51,6 @@ in
|
|||||||
options = [ "compress=zstd" ];
|
options = [ "compress=zstd" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
my.persist.location = "/nix/persist";
|
|
||||||
fileSystems."/nix/persist" = {
|
|
||||||
device = btrfs;
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"compress=zstd"
|
|
||||||
"subvol=persistent"
|
|
||||||
];
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/swap" = {
|
fileSystems."/swap" = {
|
||||||
device = btrfs;
|
device = btrfs;
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
@@ -73,31 +61,6 @@ in
|
|||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
|
||||||
mkdir /btrfs_tmp
|
|
||||||
mount ${btrfs} /btrfs_tmp
|
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
|
||||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
|
||||||
fi
|
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
|
||||||
IFS=$'\n'
|
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
|
||||||
done
|
|
||||||
btrfs subvolume delete "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +14); do
|
|
||||||
delete_subvolume_recursively "$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/root
|
|
||||||
umount /btrfs_tmp
|
|
||||||
'';
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/boot" = {
|
||||||
device = "/dev/disk/by-uuid/B7DC-E9AC";
|
device = "/dev/disk/by-uuid/B7DC-E9AC";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ in
|
|||||||
vimdiffAlias = true;
|
vimdiffAlias = true;
|
||||||
withPython3 = false;
|
withPython3 = false;
|
||||||
withRuby = false;
|
withRuby = false;
|
||||||
|
sideloadInitLua = true;
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
# treesitter
|
# treesitter
|
||||||
tree-sitter
|
tree-sitter
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ in
|
|||||||
my.hm.home.packages = with pkgs; [
|
my.hm.home.packages = with pkgs; [
|
||||||
go
|
go
|
||||||
gotools
|
gotools
|
||||||
gopls
|
(lib.hiPrio gopls)
|
||||||
];
|
];
|
||||||
my.persist.homeDirs = [
|
my.persist.homeDirs = [
|
||||||
"go"
|
"go"
|
||||||
|
|||||||
+87
-10
@@ -10,15 +10,35 @@ in
|
|||||||
{
|
{
|
||||||
options.my.persist = {
|
options.my.persist = {
|
||||||
enable = lib.mkEnableOption "persist";
|
enable = lib.mkEnableOption "persist";
|
||||||
location = lib.mkOption {
|
btrfs = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.submodule (
|
||||||
default = "/nix/persist";
|
{ ... }:
|
||||||
example = lib.literalExpression ''
|
{
|
||||||
"/persistent"
|
options = {
|
||||||
'';
|
device = lib.mkOption {
|
||||||
description = lib.mdDoc ''
|
type = lib.types.str;
|
||||||
Persistent location
|
};
|
||||||
'';
|
zstdCompress = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
persistSubvol = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
rootSubvol = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "root";
|
||||||
|
};
|
||||||
|
mountPoint = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/nix/persist";
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
"/persistent"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
homeDirs = lib.mkOption {
|
homeDirs = lib.mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
@@ -69,8 +89,65 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
fileSystems.${cfg.btrfs.mountPoint} = {
|
||||||
|
device = cfg.btrfs.device;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [
|
||||||
|
"subvol=${cfg.btrfs.persistSubvol}"
|
||||||
|
]
|
||||||
|
++ lib.optionals cfg.btrfs.zstdCompress [
|
||||||
|
"compress=zstd"
|
||||||
|
];
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = cfg.btrfs.device;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [
|
||||||
|
"subvol=${cfg.btrfs.rootSubvol}"
|
||||||
|
]
|
||||||
|
++ lib.optionals cfg.btrfs.zstdCompress [
|
||||||
|
"compress=zstd"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.systemd.services.wipe-root = {
|
||||||
|
description = "Rollback BTRFS rootfs";
|
||||||
|
wantedBy = [ "initrd.target" ];
|
||||||
|
before = [ "sysroot.mount" ];
|
||||||
|
after = [ "initrd-root-device.target" ];
|
||||||
|
unitConfig.DefaultDependencies = "no";
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
mkdir -p /btrfs_tmp
|
||||||
|
mount ${cfg.btrfs.device} /btrfs_tmp
|
||||||
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
|
|
||||||
|
if [ -e /btrfs_tmp/root ]; then
|
||||||
|
timestamp=$(date -d "@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%d_%H:%M:%S" 2>/dev/null || date "+%Y-%m-%d_%H:%M:%S")
|
||||||
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
delete_subvolume_recursively() {
|
||||||
|
IFS=$(printf '\n')
|
||||||
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||||
|
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||||
|
done
|
||||||
|
btrfs subvolume delete "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +14); do
|
||||||
|
delete_subvolume_recursively "$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
btrfs subvolume create /btrfs_tmp/${cfg.btrfs.rootSubvol}
|
||||||
|
umount /btrfs_tmp
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
programs.fuse.userAllowOther = true;
|
programs.fuse.userAllowOther = true;
|
||||||
environment.persistence.${cfg.location} = {
|
environment.persistence.${cfg.btrfs.mountPoint} = {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = cfg.nixosDirs;
|
directories = cfg.nixosDirs;
|
||||||
files = cfg.nixosFiles;
|
files = cfg.nixosFiles;
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ in
|
|||||||
sshKeyFile = lib.mkOption {
|
sshKeyFile = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "${
|
default = "${
|
||||||
if config.my.persist.enable then config.my.persist.location else ""
|
if config.my.persist.enable then config.my.persist.btrfs.mountPoint else ""
|
||||||
}/home/${username}/.ssh/id_ed25519";
|
}/home/${username}/.ssh/id_ed25519";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,5 @@
|
|||||||
# Desktop persistence
|
# Desktop persistence
|
||||||
my.persist = {
|
my.persist = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
location = lib.mkDefault "/nix/persist";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,5 @@
|
|||||||
# Server persistence
|
# Server persistence
|
||||||
my.persist = {
|
my.persist = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
location = lib.mkDefault "/nix/persist";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user