Jump to content

USB storage devices: Difference between revisions

From NixOS Wiki
34j (talk | contribs)
No edit summary
34j (talk | contribs)
Add workaround for https://github.com/nix-community/home-manager/issues/632
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Auto-mounting with udisks ==
== Auto-mounting with udisks ==


[https://github.com/coldfix/udiskie/wiki/Usage udiskie], a udisks2 front-end that allows to manage removable media can be used. To enable automounting, first enable udisks2:
[https://github.com/coldfix/udiskie udiskie], a {{nixos:option|udisks2}} front-end that allows to manage removable media can be used. To enable automounting, first enable udisks2:


{{file|/etc/nixos/configuration.nix|nix|3=services.udisks2.enable = true;}}
{{file|/etc/nixos/configuration.nix|nix|3=services.udisks2.enable = true;}}
Line 8: Line 8:


{{file|~/.config/home-manager/home.nix|nix|3=
{{file|~/.config/home-manager/home.nix|nix|3=
services.udiskie.enable = true;
services.udiskie = {
# services.udiskie.automount = true; # true by default}}
    enable = true;
    settings = {
        # workaround for
        # https://github.com/nix-community/home-manager/issues/632
        program_options = {
            # replace with your favorite file manager
            file_manager = "${pkgs.nemo-with-extensions}/bin/nemo";
        };
    };
};
}}


Once the configurations are reflected, USB storage devices will be instantly recognized when inserted without any additional operations needed.
Once the configurations are reflected, USB storage devices will be instantly recognized when inserted without any additional operations needed.


For other solutions, please refer to [https://wiki.archlinux.org/title/Udisks#Mount_helpers udisks - ArchWiki] or [https://wiki.archlinux.org/title/USB_storage_devices USB storage devices - ArchWiki].
For other solutions, please refer to [https://wiki.archlinux.org/title/Udisks#Mount_helpers udisks - ArchWiki] or [https://wiki.archlinux.org/title/USB_storage_devices USB storage devices - ArchWiki].
[[Category:Hardware]]

Latest revision as of 03:37, 16 February 2025

Auto-mounting with udisks

udiskie, a udisks2 front-end that allows to manage removable media can be used. To enable automounting, first enable udisks2:

❄︎ /etc/nixos/configuration.nix
services.udisks2.enable = true;

Next enable udiskie via Home Manager:

❄︎ ~/.config/home-manager/home.nix
services.udiskie = {
    enable = true;
    settings = {
        # workaround for
        # https://github.com/nix-community/home-manager/issues/632
        program_options = {
            # replace with your favorite file manager
            file_manager = "${pkgs.nemo-with-extensions}/bin/nemo";
        };
    };
};

Once the configurations are reflected, USB storage devices will be instantly recognized when inserted without any additional operations needed.

For other solutions, please refer to udisks - ArchWiki or USB storage devices - ArchWiki.