From d0210b2e7912fbda93f0046fd96491edef2f9e2e Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 13 Jun 2026 12:26:53 +0800 Subject: [PATCH] feat(nixos): enable USB automounting --- nix/modules/usb-automount.nix | 30 ++++++++++++++++++++++++++++++ nix/profiles/graphical.nix | 1 + 2 files changed, 31 insertions(+) create mode 100644 nix/modules/usb-automount.nix diff --git a/nix/modules/usb-automount.nix b/nix/modules/usb-automount.nix new file mode 100644 index 00000000..71ffb174 --- /dev/null +++ b/nix/modules/usb-automount.nix @@ -0,0 +1,30 @@ +{ + config.flake.modules.nixos."usb-automount" = + { pkgs, ... }: + { + # udisks2 provides the DBus service and udisksctl CLI used by tools such as + # zmk-nix's UF2 flasher. udiskie is the per-user automounter that mounts + # removable drives under /run/media/$USER when they appear. + services = { + udisks2.enable = true; + gvfs.enable = true; + }; + + environment.systemPackages = with pkgs; [ + udisks2 + udiskie + usbutils + ]; + + home-manager.sharedModules = [ + { + services.udiskie = { + enable = true; + automount = true; + notify = true; + tray = "never"; + }; + } + ]; + }; +} diff --git a/nix/profiles/graphical.nix b/nix/profiles/graphical.nix index d5e56811..443a834a 100644 --- a/nix/profiles/graphical.nix +++ b/nix/profiles/graphical.nix @@ -51,6 +51,7 @@ in firefox hyprland audio-config + usb-automount ]; time.timeZone = "Asia/Singapore"; security.polkit.enable = true;