nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

mount-drives.nix (606B)


      1 { lib, ... }:
      2 
      3 let
      4   nixbootExists = builtins.pathExists "/dev/disk/by-label/NIXBOOT";
      5   tankExists = builtins.pathExists "/dev/disk/by-label/TANK";
      6 in
      7 {
      8   fileSystems = lib.mkMerge [
      9 
     10     {
     11       "/" = {
     12         device = "/dev/disk/by-label/NIXROOT";
     13         fsType = "ext4";
     14       };
     15     }
     16 
     17     # Conditionally include filesystems
     18     (lib.mkIf nixbootExists {
     19       "/boot" = {
     20         device = "/dev/disk/by-label/NIXBOOT";
     21         fsType = "vfat";
     22       };
     23     })
     24     (lib.mkIf tankExists {
     25       "/tank" = {
     26         device = "/dev/disk/by-label/TANK";
     27         fsType = "ext4";
     28       };
     29     })
     30   ];
     31 }