65 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  config,
 | 
						|
  lib,
 | 
						|
  pkgs,
 | 
						|
  ...
 | 
						|
}:
 | 
						|
let
 | 
						|
  fsOptions = [
 | 
						|
    "noatime"
 | 
						|
    "ssd"
 | 
						|
    "compress=zstd"
 | 
						|
  ];
 | 
						|
in
 | 
						|
{
 | 
						|
  boot.initrd.luks = {
 | 
						|
    devices =
 | 
						|
      # allow discards on all devices
 | 
						|
      builtins.mapAttrs (name: val: val // { allowDiscards = true; }) {
 | 
						|
        "system".device = "/dev/disk/by-uuid/1838cdc5-9b0b-4c46-9f23-9465549eeb92";
 | 
						|
        "cryptswap".device = "/dev/disk/by-uuid/ded7d649-ab3a-42ee-ae4a-f8c4ba029e9c";
 | 
						|
      };
 | 
						|
  };
 | 
						|
 | 
						|
  fileSystems = {
 | 
						|
    "/" = {
 | 
						|
      device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172";
 | 
						|
      fsType = "btrfs";
 | 
						|
      options = fsOptions ++ [ "subvol=nixos_root" ];
 | 
						|
    };
 | 
						|
 | 
						|
    "/home" = {
 | 
						|
      device = "/dev/disk/by-uuid/22388786-4285-403b-9994-e9aae1f11172";
 | 
						|
      fsType = "btrfs";
 | 
						|
      options = fsOptions ++ [ "subvol=home" ];
 | 
						|
    };
 | 
						|
 | 
						|
    "/boot" = {
 | 
						|
      device = "/dev/disk/by-uuid/AF8E-E9E6";
 | 
						|
      fsType = "vfat";
 | 
						|
      options = [ "discard" ];
 | 
						|
    };
 | 
						|
    # nix/ lix build directory
 | 
						|
    # lix:
 | 
						|
    # > If you plan to use a tmpfs, we **strongly recommend** to set `mode=0755` as a mount option for that `tmpfs`, otherwise you are effectively reverting this mitigation.
 | 
						|
    "/nix/var/nix/builds" = {
 | 
						|
      device = "tmpfs";
 | 
						|
      fsType = "tmpfs";
 | 
						|
      options = [
 | 
						|
        "mode=0755"
 | 
						|
        "size=75%"
 | 
						|
      ];
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
  services.fstrim.enable = true;
 | 
						|
  services.btrfs.autoScrub = {
 | 
						|
    enable = true;
 | 
						|
    fileSystems = [
 | 
						|
      "/"
 | 
						|
      "/home"
 | 
						|
    ];
 | 
						|
  };
 | 
						|
 | 
						|
  boot.tmp.useTmpfs = true;
 | 
						|
}
 |