From 4e3f91a12283fbc56a7afaf40f80c800dd430cdd Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Mon, 18 Mar 2024 14:49:13 +0100 Subject: [PATCH] Replace the generic linux stuff with nix specific things --- nixos/hosts/shodan/auto-mount.nix | 12 ++++++------ pkgs/auto-mount/default.nix | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/nixos/hosts/shodan/auto-mount.nix b/nixos/hosts/shodan/auto-mount.nix index a52c160..f63a6c2 100644 --- a/nixos/hosts/shodan/auto-mount.nix +++ b/nixos/hosts/shodan/auto-mount.nix @@ -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; diff --git a/pkgs/auto-mount/default.nix b/pkgs/auto-mount/default.nix index 176ee24..8f1af57 100644 --- a/pkgs/auto-mount/default.nix +++ b/pkgs/auto-mount/default.nix @@ -13,8 +13,6 @@ writeShellApplication runtimeInputs = []; text = '' - #!/bin/bash - set -euo pipefail # Originally from https://serverfault.com/a/767079