!JQvnJacrwKgtkGHYHO:matrix.org

NixOS + Framework

225 Members
Discussing NixOS in the context of the Framework laptop50 Servers

Load older messages


SenderMessageTime
10 May 2026
@albertlarsan68:albertlarsan.frAlbert LarsanBtrfs subvolumes are, in some way, directories. They have some properties, like being snapshottable and mount those directories from the base hierarchy without having to resort to bind mounts. It would still be a swap file in a folder, with the hassle of finding the offset (although FWIH it seems easier on btrfs new)18:23:31
@rajil:rajils.comtrumee Ah ok, then I should use lvm to create a partition 18:27:06
@sudoforge:matrix.orgsudoforgeyeah, that'll be simpler and avoid the pitfalls of using a swap file18:30:59
@sudoforge:matrix.orgsudoforge

so you'll have (assuming you're adjusting to using a single luks container as discussed earlier):

/dev/nvme0n1p1 -> a fat32 partition for your esp
/dev/nvme0n1p2 -> a luks container
  lvm
    swap
    zfs for /
18:34:06
@rajil:rajils.comtrumee

sudoforge: i wiped out my laptop and trying to create btrfs system. Why does nix detect my home subvolume?,

[nix-shell:~]# btrfs subvolume list /mnt
ID 257 gen 24 top level 5 path root
ID 258 gen 10 top level 5 path home
ID 259 gen 10 top level 5 path nix

[nix-shell:~]# nixos-generate-config --show-hardware-config
# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usbhid" "uas" "sd_mod" ];
  boot.initrd.kernelModules = [ "dm-snapshot" ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/mapper/cryptroot";
      fsType = "ext4";
    };

  boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/ca6a879a-b6a8-402d-a73a-8bf47982f3d6";

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/AF16-5E1D";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  fileSystems."/mnt" =
    { device = "/dev/mapper/pool-root";
      fsType = "btrfs";
      options = [ "subvol=root" ];
    };

  fileSystems."/mnt/boot" =
    { device = "/dev/disk/by-uuid/534B-D397";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  swapDevices =
    [ { device = "/dev/mapper/pool-swap"; }
    ];

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

20:29:29
@rajil:rajils.comtrumee *

sudoforge: i wiped out my laptop and trying to create btrfs system. Why does nix detect my home subvolume?,

[nix-shell:~]# btrfs subvolume list /mnt
ID 257 gen 25 top level 5 path root
ID 258 gen 10 top level 5 path home
ID 259 gen 10 top level 5 path nix

[nix-shell:~]# nixos-generate-config --root /mnt --show-hardware-config
# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usbhid" "uas" "sd_mod" ];
  boot.initrd.kernelModules = [ "dm-snapshot" ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/mapper/pool-root";
      fsType = "btrfs";
      options = [ "subvol=root" ];
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/534B-D397";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  swapDevices =
    [ { device = "/dev/mapper/pool-swap"; }
    ];

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

20:31:48
@albertlarsan68:albertlarsan.frAlbert LarsanIs the home subvolume actually mounted at /mnt/home?20:33:58
@rajil:rajils.comtrumee

This is my setup,

[nix-shell:~]# lsblk /dev/nvme1n1
NAME            MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
nvme1n1         259:1    0  1.8T  0 disk  
├─nvme1n1p1     259:2    0    2G  0 part  /mnt/boot
└─nvme1n1p2     259:3    0  1.8T  0 part  
  └─cryptdisk   254:3    0  1.8T  0 crypt 
    ├─pool-swap 254:4    0   98G  0 lvm   [SWAP]
    └─pool-root 254:5    0  1.7T  0 lvm   /mnt
20:33:58
@rajil:rajils.comtrumeelooks like i am missing a crucial step.20:34:46
@albertlarsan68:albertlarsan.frAlbert LarsanIf the subvolume isn’t mounted, then nix can’t infer that you want the home submodule at /home and the nix submodule at /nix20:35:01
@rajil:rajils.comtrumeehow do i mount the subvolume?20:35:15
@albertlarsan68:albertlarsan.frAlbert Larsan sudo mount -m -o subvol=home,noatime /dev/mapper/pool-root /mnt/home
sudo mount -m -o subvol=nix,noatime /dev/mapper/pool-root /mnt/nix
20:36:53
@sudoforge:matrix.orgsudoforgeah, albert got it out as i was responding :)20:37:31
@sudoforge:matrix.orgsudoforgealso, i'd strongly encourage you to use disko20:37:36
@albertlarsan68:albertlarsan.frAlbert LarsanDon’t forget to add noatime to the options in the generated nixos-hardware config, otherwise the SSD will get hammered by writes every time you read something20:37:59
@sudoforge:matrix.orgsudoforgethe config i shared earlier doesn't include LVM under the luks container but can be a great starting point20:38:06
@sudoforge:matrix.orgsudoforge
mount -t btrfs -o defaults,ssd,noatime,compress=zstd:3,subvol=/home /dev/mapper/pool-root /mnt/home

is what i would do

20:38:33
@albertlarsan68:albertlarsan.frAlbert Larsanhttps://git.sr.ht/~albertlarsan68/dotfiles/tree/flake-parts/item/disko-configurations/ginkgo-grid.nix is what I use, just remove disk2 and adapt the swap size20:39:23
@sudoforge:matrix.orgsudoforgeah you're not setting up encryption with disko? tsk tsk20:41:05
@albertlarsan68:albertlarsan.frAlbert Larsan I have VPSes that only have 15G of disk space. On them I run compress-force=zstd:15. Absolutely atrocious write performance, but really small disk usage (2 gigs for a full server) 20:41:24
@albertlarsan68:albertlarsan.frAlbert LarsanHey, it is not my fault that the disko documentation is inexistant! Also, I really like systemd-cryptsetup. This is a server, it has a few steps before I can enroll the TPM (namely re-activating Secure Boot, once Lanzaboote is working, etc.) So yes, I setup encryption well after disko has done its job.20:43:21
@albertlarsan68:albertlarsan.frAlbert LarsanAt least lvm has a passphrase20:43:33
@albertlarsan68:albertlarsan.frAlbert LarsanFrom the start20:43:38
@sudoforge:matrix.orgsudoforge disko just hands off to systemd-cryptsetup 20:43:53
@albertlarsan68:albertlarsan.frAlbert LarsanI can’t provision the TPM from the install media AFAIK20:44:40
@albertlarsan68:albertlarsan.frAlbert LarsanMy original setup came from someone else, and there were even more manual steps (see https://web.archive.org/web/20250919060007/https://github.com/kjhoerr/dotfiles/wiki/NixOS:-Instructions-for-adding-a-new-system)20:48:02
@albertlarsan68:albertlarsan.frAlbert LarsanApparently the repo I took from disappeared20:48:41
@sudoforge:matrix.orgsudoforgeah, that's right, you can't use the TPM device from the installation media20:49:12
@sudoforge:matrix.orgsudoforgehmm20:49:40
@sudoforge:matrix.orgsudoforgewell, you could disko to set up the initial encryption for it (passphrase or key file or security key), i guess20:50:03

Show newer messages


Back to Room ListRoom Version: 10