Replace the generic linux stuff with nix specific things

This commit is contained in:
Lillian Violet 2024-03-18 14:49:13 +01:00
parent b7eb0d5179
commit 4e3f91a122
2 changed files with 6 additions and 8 deletions

View file

@ -9,12 +9,12 @@
environment.systemPackages = with pkgs; [auto-mount];
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"
KERNEL=="sd[a-z]|sd[a-z][0-9]", ACTION=="add", RUN+="/run/current-system/sw/bin/systemctl start --no-block external-drive-mount@%k.service"
KERNEL=="sd[a-z]|sd[a-z][0-9]", ACTION=="remove", RUN+="/run/current-system/sw/bin/systemctl stop --no-block external-drive-mount@%k.service"
KERNEL=="mmcblk0|mmcblk0p[0-9]", ACTION=="add", RUN+="/run/current-system/sw/bin/systemctl start --no-block external-drive-mount@%k.service"
KERNEL=="mmcblk0|mmcblk0p[0-9]", ACTION=="remove", RUN+="/run/current-system/sw/bin/systemctl stop --no-block external-drive-mount@%k.service"
KERNEL=="nvme0n1p9|nvme0n1p1[0-9]", ACTION=="add", RUN+="/run/current-system/sw/bin/systemctl start --no-block external-drive-mount@%k.service"
KERNEL=="nvme0n1p9|nvme0n1p1[0-9]", ACTION=="remove", RUN+="/run/current-system/sw/bin/systemctl stop --no-block external-drive-mount@%k.service"
'';
systemd.services.auto-mount = {
enable = true;

View file

@ -13,8 +13,6 @@ writeShellApplication
runtimeInputs = [];
text = ''
#!/bin/bash
set -euo pipefail
# Originally from https://serverfault.com/a/767079