Montages autres disques

Bonjour à tous,
Dans ma config.nix je suis arrivé au montage de mes disques supplémentaires :
Music >> /dev/sdb2
Stocks >> /dev/sdb1
Series >> /dev/sdc1
Series de Films >> /dev/sda1
configuration.nix

services.fstrim.enable = true;
  fileSystems."/home/gg/Videos/Series de Films" =
  { device = "/dev/disk/by-uuid/567D-5703";
  fsType = "exfat";
  };
  fileSystems."/home/gg/Music" =
  { device = "/dev/disk/by-uuid/76BF-63AA";
    fsType = "exfat";
  };
  fileSystems."/home/gg/Stocks" =
  { device ="/dev/disk/by-uuid/FEAA-FD15";
    fsType = "exfat";
  };
  fileSystems."/home/gg/Videos/Series" =
  { device = "/dev/disk/by-uuid/58CD-8A03";
    fsType = "exfat";
  };

hardware-configuration.nix

# 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" "ahci" "nvme" "usbhid" "usb_storage" "uas" "sd_mod" ];
  boot.initrd.kernelModules = [ "dm-snapshot" ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/c7f75fec-17c7-4916-b88c-2a2aa28b66d3";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/D5B5-1F66";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  fileSystems."/home" =
    { device = "/dev/disk/by-uuid/c051616d-5d2d-456e-acd8-d0e9da463984";
      fsType = "ext4";
    };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;

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

Series : je suis bien le proprio mais il se monte en double dans mon gestionnaire de fichiers.
Stocks : proprio root
Music : proprio root
Series de Films : proprio root

Mes disques ne se monte pas au démarrage mais quand je rebuild.

J’utilise Archlinux en dual avec NixOS et dans Arch je mets ces options :
user,nosuid,nodev,nofail,x-gvfs-show,uid=user,gid=user,fmask=0113,dmask=0002
aux 4 partitions pour être tranquille.
Un peu d’aide serait la bien venue.

Salut,

Tu peux utiliser les mêmes options que tu utilises sur Archlinux via fileSystems.<name>.options.

Donc en gros:

  fileSystems."/home/gg/Videos/Series" =
  { device = "/dev/disk/by-uuid/58CD-8A03";
    fsType = "exfat";
    options = ["user" "nosuid" "nodev" "nofail" "x-gvfs-show" "uid-user" "gid=user" "fmask=0113" "dmask=0002" ];
  };
(...) etc. etc.

D’une manière plus générale, quand tu cherches le nom d’une option de ce genre, tu peux regarder man configuration.nix, puis rechercher les options liées aux filesystems en faisant un /fileSystems dans le pager.

1 Like

Salut,

  fileSystems."/home/gg/Music" =
  { device = "/dev/disk/by-uuid/76BF-63AA";
    fsType = "exfat";
    options = ["user" "nosuid" "nodev" "nofail" "x-gvfs-show" "uid=gg" "gid=gg" "fmask=0113" "dmask=0002"];
  };
× home-gg-Music.mount - /home/gg/Music
     Loaded: loaded (/etc/fstab; generated)
     Active: failed (Result: exit-code) since Tue 2024-08-06 00:27:16 CEST; 1s ago
      Where: /home/gg/Music
       What: /dev/disk/by-uuid/76BF-63AA
       Docs: man:fstab(5)
             man:systemd-fstab-generator(8)
         IP: 0B in, 0B out
        CPU: 2ms

Aug 06 00:27:16 nixos systemd[1]: Mounting /home/gg/Music...
Aug 06 00:27:16 nixos mount[4693]: mount: /home/gg/Music: failed to parse mount options 'rw,user,noexec,nosuid,nodev,x-gvfs-show,uid=1000,gid=gg,fmak=0113,dmask=0002': Invalid argument.
Aug 06 00:27:16 nixos systemd[1]: home-gg-Music.mount: Mount process exited, code=exited, status=1/FAILURE
Aug 06 00:27:16 nixos systemd[1]: home-gg-Music.mount: Failed with result 'exit-code'.
Aug 06 00:27:16 nixos systemd[1]: Failed to mount /home/gg/Music.
warning: error(s) occurred while switching to the new configuration


Avec ça :

  fileSystems."/home/gg/Music" =
  { device = "/dev/disk/by-uuid/76BF-63AA";
    fsType = "exfat";
    options = ["users" "nofail" "x-gvfs-show" "uid=gg" "gid=users"];
  };

ça fonctionne mais je ne suis tjs pas le proprio.
Et mes disques ne se monte tjs pas au démarrage.

Essaie de mettre les numéros pour le gid et le gid. IE. config.users.users.gg.uid

La solution.
Car mes disques sont des HDDs

  # Hard drive storage mounting
  fileSystems."/home/gg/Videos/Series de Films" =
  { device = "/dev/disk/by-uuid/567D-5703";
    fsType = "exfat";
    options = ["users" "nofail" "uid=gg" "gid=users"];
  };
  fileSystems."/home/gg/Music" =
  { device = "/dev/disk/by-uuid/76BF-63AA";
    fsType = "exfat";
    options = ["users" "nofail" "uid=gg" "gid=users"];
  };
  fileSystems."/home/gg/Stocks" =
  { device ="/dev/disk/by-uuid/FEAA-FD15";
    fsType = "exfat";
    options = ["users" "nofail" "uid=gg" "gid=users"];
  };
  fileSystems."/home/gg/Videos/Series" =
  { device = "/dev/disk/by-uuid/58CD-8A03";
    fsType = "exfat";
    options = ["users" "nofail" "uid=gg" "gid=users"];
  };

Merci à toi @picnoir

1 Like