Created new derivation based on this: https://github.com/scawp/Steam-Deck.Mount-External-Drive/
This commit is contained in:
parent
6f65c57314
commit
fc3384472d
4 changed files with 272 additions and 8 deletions
30
nixos/hosts/shodan/auto-mount.nix
Normal file
30
nixos/hosts/shodan/auto-mount.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="sd[a-z]|sd[a-z][0-9]", ACTION=="add", RUN+="/bin/systemctl start --no-block external-drive-mount@%k.service"
|
||||
KERNEL=="sd[a-z]|sd[a-z][0-9]", ACTION=="remove", RUN+="/bin/systemctl stop --no-block external-drive-mount@%k.service"
|
||||
KERNEL=="mmcblk0|mmcblk0p[0-9]", ACTION=="add", RUN+="/bin/systemctl start --no-block external-drive-mount@%k.service"
|
||||
KERNEL=="mmcblk0|mmcblk0p[0-9]", ACTION=="remove", RUN+="/bin/systemctl stop --no-block external-drive-mount@%k.service"
|
||||
KERNEL=="nvme0n1p9|nvme0n1p1[0-9]", ACTION=="add", RUN+="/bin/systemctl start --no-block external-drive-mount@%k.service"
|
||||
KERNEL=="nvme0n1p9|nvme0n1p1[0-9]", ACTION=="remove", RUN+="/bin/systemctl stop --no-block external-drive-mount@%k.service"
|
||||
'';
|
||||
systemd.services.auto-mount = {
|
||||
enable = true;
|
||||
description = "Mount External Drive on %i";
|
||||
unitConfig = {
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "/run/current-system/sw/bin/automount add %i";
|
||||
ExecStop = "/run/current-system/sw/bin/automount remove %i";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue