1 Commits

Author SHA1 Message Date
github-actions[bot]
f6d2ff23ea automated: Update flake.lock
All checks were successful
Check flake.lock / Check health of `flake.lock` (pull_request) Successful in 6s
Check Nix flake / Perform Nix flake checks (pull_request) Successful in 2m18s
Auto-generated by [update.yml][1] with the help of
[create-pull-request][2].

[1]: https://nayeonie.com/ahuston-0/nix-dotfiles/src/branch/main/.github/workflows/flake-update.yml
[2]: https://forgejo.stefka.eu/jiriks74/create-pull-request
2026-04-15 12:13:08 +00:00
3 changed files with 80 additions and 117 deletions

30
flake.lock generated
View File

@@ -76,11 +76,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1776398575, "lastModified": 1776225785,
"narHash": "sha256-WArU6WOdWxzbzGqYk4w1Mucg+bw/SCl6MoSp+/cZMio=", "narHash": "sha256-yrRZkEEtTwJcIXzxL/nCFpyGsz7VmkOJSoyx/AX6Ri8=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "05815686caf4e3678f5aeb5fd36e567886ab0d30", "rev": "c09a1a34c147aefac0ff10017644ca17a3230e8c",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@@ -240,11 +240,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1776454077, "lastModified": 1776184304,
"narHash": "sha256-7zSUFWsU0+jlD7WB3YAxQ84Z/iJurA5hKPm8EfEyGJk=", "narHash": "sha256-No6QGBmIv5ChiwKCcbkxjdEQ/RO2ZS1gD7SFy6EZ7rc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "565e5349208fe7d0831ef959103c9bafbeac0681", "rev": "3c7524c68348ef79ce48308e0978611a050089b2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -281,11 +281,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1776426061, "lastModified": 1774778246,
"narHash": "sha256-3rROoGl8xBsIOM+5m+qZS4GJnsdQPAH3NJJe1OUfJ5o=", "narHash": "sha256-OX9Oba3/cHq1jMS1/ItCdxNuRBH3291Lg727nHOzYnc=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "contrib", "repo": "contrib",
"rev": "1f71628d86a7701fd5ba0f8aeabe15376f4c6afc", "rev": "ca3c381df6018e6c400ceac994066427c98fe323",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -500,11 +500,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1776169885, "lastModified": 1775710090,
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", "narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", "rev": "4c1018dae018162ec878d42fec712642d214fdfa",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -594,11 +594,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1776395632, "lastModified": 1776222810,
"narHash": "sha256-Mi1uF5f2FsdBIvy+v7MtsqxD3Xjhd0ARJdwoqqqPtJo=", "narHash": "sha256-5TD8MYqLMcJi9yV/9jq2dVUPtnu/lKZPD61esQCgvqs=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "8087ff1f47fff983a1fba70fa88b759f2fd8ae97", "rev": "4d6fee71fea68418a48992409b47f1183d0dd111",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -13,7 +13,6 @@
enable = lib.mkDefault true; enable = lib.mkDefault true;
flags = [ "--accept-flake-config" ]; flags = [ "--accept-flake-config" ];
randomizedDelaySec = "1h"; randomizedDelaySec = "1h";
runGarbageCollection = true;
persistent = true; persistent = true;
flake = "git+ssh://nayeonie.com/ahuston-0/nix-dotfiles.git"; flake = "git+ssh://nayeonie.com/ahuston-0/nix-dotfiles.git";
}; };

View File

@@ -12,107 +12,6 @@
options zfs zfs_arc_min=82463372083 options zfs zfs_arc_min=82463372083
options zfs zfs_arc_max=192414534860 options zfs zfs_arc_max=192414534860
''; '';
initrd.systemd.services = {
zfs-import-zfs-primary = {
description = "Import ZFS-primary pool in initrd";
wantedBy = [ "initrd-root-fs.target" ];
wants = [ "systemd-udev-settle.service" ];
after = [ "systemd-udev-settle.service" ];
before = [
"sysroot.mount"
"initrd-root-fs.target"
];
unitConfig.DefaultDependencies = "no";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = with pkgs; [
coreutils
gawk
zfs
];
script = ''
ZFS_FORCE="-f"
msg=""
for o in $(cat /proc/cmdline); do
case "$o" in
zfs_force|zfs_force=1|zfs_force=y)
ZFS_FORCE="-f"
;;
esac
done
pool_ready() {
pool="$1"
state="$(zpool import -d /dev/disk/by-id/ 2>/dev/null | awk '/pool: '"$pool"'/ { found = 1 }; /state:/ { if (found == 1) { print $2; exit } }; END { if (found == 0) { print "MISSING" } }')"
if [ "$state" = "ONLINE" ]; then
return 0
fi
echo "Pool $pool in state $state, waiting"
return 1
}
pool_imported() {
pool="$1"
zpool list "$pool" >/dev/null 2>/dev/null
}
pool_import() {
pool="$1"
zpool import -d /dev/disk/by-id/ -N $ZFS_FORCE "$pool"
}
echo -n 'importing root ZFS pool "ZFS-primary"...'
# Loop until import succeeds, because by-id devices may not be discovered yet.
if ! pool_imported "ZFS-primary"; then
trial=1
while [ "$trial" -le 60 ]; do
if pool_ready "ZFS-primary" >/dev/null && msg="$(pool_import "ZFS-primary" 2>&1)"; then
break
fi
sleep 1
echo -n .
trial=$((trial + 1))
done
echo
if [ -n "$msg" ]; then
echo "$msg"
fi
pool_imported "ZFS-primary" || pool_import "ZFS-primary" # Try one last time, e.g. to import a degraded pool.
fi
'';
};
zfs-load-nix-key = {
description = "Load ZFS key for ZFS-primary/nix in initrd";
wantedBy = [ "initrd-fs.target" ];
requires = [
"sysroot.mount"
"zfs-import-zfs-primary.service"
];
after = [
"sysroot.mount"
"zfs-import-zfs-primary.service"
];
before = [
"initrd-fs.target"
"sysroot-nix.mount"
];
unitConfig.DefaultDependencies = "no";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = with pkgs; [ zfs ];
script = ''
key_file="/sysroot/crypto/keys/zfs-nix-store-key"
zfs load-key -L "file://$key_file" "ZFS-primary/nix"
'';
};
};
}; };
services = { services = {
@@ -182,4 +81,69 @@
}; };
}; };
# hack to make sure pool is imported before keys are loaded,
# and also keys are imported before things get mounted
# note to self: move zfs encryption over to luks lol
boot.initrd.postResumeCommands = ''
ZFS_FORCE="-f"
for o in $(cat /proc/cmdline); do
case $o in
zfs_force|zfs_force=1|zfs_force=y)
ZFS_FORCE="-f"
;;
esac
done
poolReady() {
pool="$1"
state="$("zpool" import -d "/dev/disk/by-id/" 2>/dev/null | "awk" "/pool: $pool/ { found = 1 }; /state:/ { if (found == 1) { print \$2; exit } }; END { if (found == 0) { print \"MISSING\" } }")"
if [[ "$state" = "ONLINE" ]]; then
return 0
else
echo "Pool $pool in state $state, waiting"
return 1
fi
}
poolImported() {
pool="$1"
"zpool" list "$pool" >/dev/null 2>/dev/null
}
poolImport() {
pool="$1"
"zpool" import -d "/dev/disk/by-id/" -N $ZFS_FORCE "$pool"
}
echo -n "importing root ZFS pool \"ZFS-primary\"..."
# Loop across the import until it succeeds, because the devices needed may not be discovered yet.
if ! poolImported "ZFS-primary"; then
for trial in `seq 1 60`; do
poolReady "ZFS-primary" > /dev/null && msg="$(poolImport "ZFS-primary" 2>&1)" && break
sleep 1
echo -n .
done
echo
if [[ -n "$msg" ]]; then
echo "$msg";
fi
poolImported "ZFS-primary" || poolImport "ZFS-primary" # Try one last time, e.g. to import a degraded pool.
fi
# let root mount and everything, then manually unlock stuff
load_zfs_nix() {
local device="/dev/disk/by-uuid/8bfaa32b-09dd-45c8-831e-05e80be82f9e"
local mountPoint="/"
local options="x-initrd.mount,noatime,nodiratime"
local fsType="ext4"
echo "manually mounting key location, then unmounting"
udevadm settle
mountFS "$device" "$(escapeFstab "$mountPoint")" "$(escapeFstab "$options")" "$fsType"
zfs load-key -L "file://$targetRoot/crypto/keys/zfs-nix-store-key" "ZFS-primary/nix"
umount "$targetRoot/"
}
load_zfs_nix
'';
} }