| 12 Dec 2024 |
| ·☽•Nameless☆•777 · ± changed their profile picture. | 14:34:09 |
| carsonian joined the room. | 15:09:37 |
carsonian | Hi I am having an issue I was hoping someone could help me out with. Disko is working fine in my basic configuration.nix, but when I switch to my flake setup that my actual config is on it breaks with this strange error: | 15:11:00 |
carsonian | … while calling the 'head' builtin
at /nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/lib/attrsets.nix:967:11:
966| || pred here (elemAt values 1) (head values) then
967| head values
| ^
968| else
… while evaluating the attribute 'value'
at /nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `assertions':
… while evaluating definitions from `/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/nixos/modules/tasks/filesystems/zfs.nix':
… while evaluating the option `boot.zfs.enabled':
… while evaluating the option `boot.initrd.supportedFilesystems':
… while evaluating definitions from `/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/nixos/modules/system/boot/stage-1.nix':
… while evaluating definitions from `/nix/store/k5l01g2zwhysjyl5zjvg5zxnj0lyxpp1-source/nixos/modules/tasks/filesystems.nix':
… while evaluating the option `fileSystems."/".device':
… while evaluating definitions from `/nix/store/fp2j5w8ly5k2s5sqx8qnhvmlwqr3i21j-source/module.nix':
… while evaluating the option `disko.devices.disk.main.content.partitions.root.content.device':
… while evaluating the module argument `device' in "/nix/store/fp2j5w8ly5k2s5sqx8qnhvmlwqr3i21j-source/lib/types/btrfs.nix":
… while evaluating definitions from `/nix/store/drdviskxkwcg7q1la067n6dqzq0kfi18-source/hosts/skadi/disk-config.nix':
… while evaluating the option `disko.devices.disk.main.content.partitions.root.device':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: attribute 'match' missing
at /nix/store/fp2j5w8ly5k2s5sqx8qnhvmlwqr3i21j-source/lib/default.nix:114:16:
113| lib.stringAsChars
114| (c: if lib.match allowedChars c != null || c == "" then c else "\\x" + charToHex c);
| ^
115|
Did you mean path? | 15:11:37 |
| 13 Dec 2024 |
Sandro 🐧 | Please use triple backticks | 14:10:02 |
SigmaSquadron | ``` like this! ```
like this! | 22:49:49 |
| 14 Dec 2024 |
blimbus | I would think so too but whenever I run disko-install without disk arguments I get error: No device passed for disk 'home'. Pass `--disk home /dev/name` via commandline. If I specify home then it errors for root. This is my disko config:
{
disko.devices = {
disk.nix = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00003";
content = {
type = "gpt";
partitions = {
boot = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "luks";
name = "nixcrypt";
settings.allowDiscards = true;
passwordFile = "/tmp/root.key";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
postMountHook = ''
mkdir -p /mnt/disko-install-root/nix/persist/root && cp /tmp/home.key /mnt/disko-install-root/nix/persist/root/home.key
'';
subvolumes = {
"nix" = {
mountpoint = "/nix";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
};
"swap" = {
mountpoint = "/.swap";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
};
disk.home = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00005";
content = {
type = "luks";
name = "homecrypt";
settings.allowDiscards = true;
settings.keyFile = "/tmp/home.key";
initrdUnlock = false; # don't unlock at boot
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"home" = {
mountpoint = "/nix/persist/home";
mountOptions = [ "compress-force=zstd:1" "noatime"];
};
};
};
};
};
nodev."/" = {
fsType = "tmpfs";
mountOptions = [ "defaults" "size=3G" "mode=755" ];
};
};
}
| 23:14:08 |
blimbus | * I would think so too but whenever I run disko-install without disk arguments I get error: No device passed for disk 'home'. Pass `--disk home /dev/name` via commandline. If I specify home then it errors for disk.nix. This is my disko config:
{
disko.devices = {
disk.nix = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00003";
content = {
type = "gpt";
partitions = {
boot = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "luks";
name = "nixcrypt";
settings.allowDiscards = true;
passwordFile = "/tmp/root.key";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
postMountHook = ''
mkdir -p /mnt/disko-install-root/nix/persist/root && cp /tmp/home.key /mnt/disko-install-root/nix/persist/root/home.key
'';
subvolumes = {
"nix" = {
mountpoint = "/nix";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
};
"swap" = {
mountpoint = "/.swap";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
};
disk.home = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00005";
content = {
type = "luks";
name = "homecrypt";
settings.allowDiscards = true;
settings.keyFile = "/tmp/home.key";
initrdUnlock = false; # don't unlock at boot
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"home" = {
mountpoint = "/nix/persist/home";
mountOptions = [ "compress-force=zstd:1" "noatime"];
};
};
};
};
};
nodev."/" = {
fsType = "tmpfs";
mountOptions = [ "defaults" "size=3G" "mode=755" ];
};
};
}
| 23:18:33 |
| 18 Dec 2024 |
Anna Aurora | In reply to @beat_link:matrix.org if you must use swap, create a dedicated partition for it if you require encryption, then not having swap on the root encrypted filesystem really complicates things because with zfs and btrfs you want them to be directly on the hardware ideally but if you have swap, you need an lvm for swap and the btrfs/zfs to put the lvm into a luks.
or i guess you could you zfs' built-in encryption (not sure if btrfs has that) and create a luks partition in addition for the swap and make them both have the same password or so | 17:42:35 |
Anna Aurora | In reply to @blimbus:matrix.org
I would think so too but whenever I run disko-install without disk arguments I get error: No device passed for disk 'home'. Pass `--disk home /dev/name` via commandline. If I specify home then it errors for disk.nix. This is my disko config:
{
disko.devices = {
disk.nix = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00003";
content = {
type = "gpt";
partitions = {
boot = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "luks";
name = "nixcrypt";
settings.allowDiscards = true;
passwordFile = "/tmp/root.key";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
postMountHook = ''
mkdir -p /mnt/disko-install-root/nix/persist/root && cp /tmp/home.key /mnt/disko-install-root/nix/persist/root/home.key
'';
subvolumes = {
"nix" = {
mountpoint = "/nix";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
};
"swap" = {
mountpoint = "/.swap";
mountOptions = [ "compress-force=zstd:1" "noatime" ];
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
};
disk.home = {
type = "disk";
device = "/dev/disk/by-id/ata-QEMU_HARDDISK_QM00005";
content = {
type = "luks";
name = "homecrypt";
settings.allowDiscards = true;
settings.keyFile = "/tmp/home.key";
initrdUnlock = false; # don't unlock at boot
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"home" = {
mountpoint = "/nix/persist/home";
mountOptions = [ "compress-force=zstd:1" "noatime"];
};
};
};
};
};
nodev."/" = {
fsType = "tmpfs";
mountOptions = [ "defaults" "size=3G" "mode=755" ];
};
};
}
can you check if there is a device for home in repl? | 17:52:31 |
| 19 Dec 2024 |
| sebastian set a profile picture. | 12:31:14 |
| 21 Dec 2024 |
Raj | I'm trying to use the disko-install command to create a custom bootable USB that has an entire NixOS system (including persistent storage and access to git and neovim, plus a few other goodies).
After running sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake .#image --disk os /dev/sdc, things seem to get built/copied etc., but it finally halts with this error:
subprocess.CalledProcessError: Command '['/nix/store/rp6yhapgwv5yad023117digxawm4la1n-check-mountpoints']' returned non-zero exit status 1.
Failed to install bootloader
disko-install failed
rmdir: failed to remove '/mnt/disko-install-root': Directory not empty
I tried to delete the directory directly but it didn't work even as superuser (!?): rm: cannot remove '/mnt/disko-install-root/var/empty': Operation not permitted.
My disko (and NixOS configuration) is pretty simple and the problem occurs even with a minimal configuration (so I don't think it's the issue) but I can share it if required.
| 02:00:31 |
Mic92 | Is there something that doesn't get unmoun ted? | 09:46:18 |
Mic92 | mountpoint -q "${mountPoint}" | 09:47:17 |
Mic92 | Does your disko config not mount anything to it's mountpoint? | 09:47:37 |
Raj | I think it does. Here it is:
{
disko.devices = {
nodev."/" = {
fsType = "tmpfs";
mountOptions = [
"size=2G"
"defaults"
"mode=755"
];
};
nodev."/home/username" = {
fsType = "tmpfs";
mountOptions = [
"size=2G"
"defaults"
"mode=777"
];
};
disk = {
os = {
imageName = "nixos-usb-stick";
imageSize = "60G";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
priority = 0;
end = "1G";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["defaults" "umask=0077"];
};
};
root = {
priority = 1;
end = "-0";
content = {
type = "luks";
name = "root";
initrdUnlock = true;
extraFormatArgs = ["--pbkdf argon2id"];
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = ["compress=zstd" "noatime"];
};
"/data" = {
mountpoint = "/data";
mountOptions = ["compress=zstd" "noatime"];
};
};
};
};
};
};
};
};
};
};
}
| 20:10:08 |
Raj | This doesn't return anything :( | 20:11:27 |
Raj | Also, if you can think of an easier way to create a USB stick with (i) a bootable NixOS (for recovery purposes) and (ii) persistent storage of important files, that'd work for me too! | 20:12:39 |
Raj | * Also, if you can think of an easier way to create a USB stick with (i) a bootable custom NixOS (for recovery purposes) and (ii) persistent storage of important files, that'd work for me too! | 20:12:50 |
| ·☽•Nameless☆•777 · ± changed their profile picture. | 21:37:37 |
waltmck | hey, what is the best way to set up encrypted ZFS on root using disko? | 23:54:59 |
waltmck | Is there a way to get it to prompt me for a passphrase while I am provisioning the dataset? | 23:55:36 |
waltmck | also, what is the difference between zpool.<name>.rootFsOptions and zpool.<name>.options? | 23:58:42 |
| 22 Dec 2024 |
waltmck | and generally I want to make sure I understand how zfs property inheritance works with disko | 00:18:08 |
Enzime | In reply to @waltmck:matrix.org also, what is the difference between zpool.<name>.rootFsOptions and zpool.<name>.options? zpool options are https://openzfs.github.io/openzfs-docs/man/master/7/zpoolprops.7.html | 00:19:28 |
Enzime | whereas the rootfsoptions is https://openzfs.github.io/openzfs-docs/man/master/7/zfsprops.7.html | 00:19:46 |
Enzime | because every zpool has an implicit 'root' dataset | 00:20:05 |
Enzime | In reply to @waltmck:matrix.org Is there a way to get it to prompt me for a passphrase while I am provisioning the dataset? it should do that if you don't set passwordFile or keyFile | 00:20:27 |
Enzime | how are you using disko? | 00:20:41 |
waltmck | I'm not sure yet. I have used it with nixos-anywhere in the pass to deploy to headless servers, but it may be difficult since I am trying to set up encrypted root. I have physical access to this machine | 00:21:36 |