Discussion:
[Nix-dev] Automount for usb thumb drives / other external drives
Paul Koerbitz
2015-07-15 21:22:12 UTC
Permalink
Dear list,

I would like to automatically mount usb sticks that I plug into my
laptop. I haven't been able to figure out how to do this in NixOS,
what's the easiest option?

thank you
Paul
Eelco Dolstra
2015-07-16 11:58:29 UTC
Permalink
Hi,
Post by Paul Koerbitz
I would like to automatically mount usb sticks that I plug into my
laptop. I haven't been able to figure out how to do this in NixOS,
what's the easiest option?
The standard mechanism used for dealing with removable media is udisks, used by
desktop environments like KDE and Xfce to allow non-root users to mount disks.
It can also be used from the command-line, e.g.

$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /run/media/eelco/USBSTICK.

Udisks doesn't mount disks automatically on insertion, but this could be done by
having a script that listens for the D-Bus messages sent by udisks and then asks
udisks to do the mount. In fact, there already is a package that does this:

https://github.com/fernandotcl/udisks-glue

but it's not in Nixpkgs yet.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
Guillaume Maudoux (Layus)
2015-07-16 13:04:26 UTC
Permalink
Hi,
Post by Eelco Dolstra
Hi,
Post by Paul Koerbitz
I would like to automatically mount usb sticks that I plug into my
laptop. I haven't been able to figure out how to do this in NixOS,
what's the easiest option?
The standard mechanism used for dealing with removable media is udisks, used by
desktop environments like KDE and Xfce to allow non-root users to mount disks.
It can also be used from the command-line, e.g.
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /run/media/eelco/USBSTICK.
Udisks doesn't mount disks automatically on insertion, but this could be done by
having a script that listens for the D-Bus messages sent by udisks and then asks
https://github.com/fernandotcl/udisks-glue
but it's not in Nixpkgs yet.
There is also the excellent udevil[1] tool that comes with devmon,
a monitoring and automonting daemon.
But udevil is not yet in nixpkgs either.

[1] http://ignorantguru.github.io/udevil/
Benno Fünfstück
2015-07-16 14:27:34 UTC
Permalink
There is an udisk auto mounter in nixpkgs though: udiskie
Post by Eelco Dolstra
Hi,
Post by Eelco Dolstra
Hi,
Post by Paul Koerbitz
I would like to automatically mount usb sticks that I plug into my
laptop. I haven't been able to figure out how to do this in NixOS,
what's the easiest option?
The standard mechanism used for dealing with removable media is udisks,
used by
Post by Eelco Dolstra
desktop environments like KDE and Xfce to allow non-root users to mount
disks.
Post by Eelco Dolstra
It can also be used from the command-line, e.g.
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /run/media/eelco/USBSTICK.
Udisks doesn't mount disks automatically on insertion, but this could be
done by
Post by Eelco Dolstra
having a script that listens for the D-Bus messages sent by udisks and
then asks
Post by Eelco Dolstra
udisks to do the mount. In fact, there already is a package that does
https://github.com/fernandotcl/udisks-glue
but it's not in Nixpkgs yet.
There is also the excellent udevil[1] tool that comes with devmon,
a monitoring and automonting daemon.
But udevil is not yet in nixpkgs either.
[1] http://ignorantguru.github.io/udevil/
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
Daniel Hlynskyi
2015-07-19 05:31:25 UTC
Permalink
What is the nixos way to add udiskie as user daemon? Currently I run in
~/.bashrc and xmonad.hs

ps aux | grep -q '[u]diskie' || udiskie &
disown %1
Post by Benno Fünfstück
There is an udisk auto mounter in nixpkgs though: udiskie
Post by Eelco Dolstra
Hi,
Post by Eelco Dolstra
Hi,
Post by Paul Koerbitz
I would like to automatically mount usb sticks that I plug into my
laptop. I haven't been able to figure out how to do this in NixOS,
what's the easiest option?
The standard mechanism used for dealing with removable media is udisks,
used by
Post by Eelco Dolstra
desktop environments like KDE and Xfce to allow non-root users to mount
disks.
Post by Eelco Dolstra
It can also be used from the command-line, e.g.
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /run/media/eelco/USBSTICK.
Udisks doesn't mount disks automatically on insertion, but this could
be done by
Post by Eelco Dolstra
having a script that listens for the D-Bus messages sent by udisks and
then asks
Post by Eelco Dolstra
udisks to do the mount. In fact, there already is a package that does
https://github.com/fernandotcl/udisks-glue
but it's not in Nixpkgs yet.
There is also the excellent udevil[1] tool that comes with devmon,
a monitoring and automonting daemon.
But udevil is not yet in nixpkgs either.
[1] http://ignorantguru.github.io/udevil/
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
Oliver Charles
2015-07-19 12:52:47 UTC
Permalink
I've packaged udevil and devmon now. When it reaches the channels, you
should be able to just add `services.devmon.enable = true;`, though I
haven't been able to test it as my system config doesn't build against HEAD
as bumblebee-project.org is down...

I can confirm that udevil and devmon at least build though, and can be ran
from the command line.

- ocharles
Kosyrev Serge
2015-07-19 13:08:13 UTC
Permalink
I've packaged udevil and devmon now. When it reaches the channels, you should be
able to just add `services.devmon.enable = true;`, though I haven't been able to
test it as my system config doesn't build against HEAD as bumblebee-project.org is
down...
Ah, the joy of the upstream being down!

We do have tarball caching, but not for master, and that's why it
failed in your case, right?

If so, that's often my experience as well, since I insist on building my
own binaries, and depend on the source availability.

..and so it begets the Question -- how irrational would it be to enable
the tarball cache for master as well?

..and maybe you've been fetching from git, and so the Question is
unrelated to your case, but I think the Question still stands..
--
respectfully,
Косырев Серёга
--
“And those who were seen dancing were thought to be insane
by those who could not hear the music.”
– Friedrich Wilhelm Nietzsche
Loading...