-
-
Notifications
You must be signed in to change notification settings - Fork 269
Open
Description
I've been in the process of rewriting my NixOS config with disko, and wanted to test/iterate on it using a vmWithDisko. However, my setup seems to cause problems with a VM.
- Initially, when only creating a
/homesubvolume, users were created before mounting subvolumes, resulting in a/home/bendirectory on the root subvolume, but an empty/homesubvolume mounted. As a consequence, the user now has no home directory mounted at all. - After adding the
/home/bensub-subvolume (seen below, as taken from the examples),/home/benexists but is owned by root, and the user can't write to their own homedir.
Unsure what to do, I have previously installed with disko on bare metal, where this problem doesn't exist, but vmWithDisko seems to first do a complete nixos-install, then mount subvolumes, while disko-install does it the other (and more reasonable) way around.
How can I get vmWithDisko to either
- first mount the
/homesubvolume before creating user directories, or chownthe/home/bensubvolume to my user?
Relevant disko and user config
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
# Boot partition.
boot = {
priority = 1;
type = "EF00"; # EFI system partition.
start = "1M";
end = "512M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
# Encrypted btrfs main partition.
luks = {
size = "100%";
content = {
type = "luks";
name = "crypt-main";
settings = {
allowDiscards = true; # Pass trim commands to disk.
};
# btrfs main volume.
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/rootfs" = {
mountpoint = "/";
};
"/var" = {
mountpoint = "/var";
mountOptions = [ "compress=zstd" ];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" ];
};
"/home/ben" = {};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
};
};
};
};
};
nodev = {
"/tmp" = {
fsType = "tmpfs";
mountOptions = [ "size=200M" ];
};
};
};
# - snip -
users.users.ben = {
isNormalUser = true;
description = "Ben";
shell = pkgs.zsh;
extraGroups = [
"wheel" # Allow use of sudo.
"networkmanager"
];
};
}Running the VM with
$ nix run -L .#nixosConfigurations.wunstpc.config.system.build.vmWithDisko
Metadata
Metadata
Assignees
Labels
No labels