summaryrefslogtreecommitdiff
path: root/modules/usb/watchdog.nix
blob: 1a84034a41866ce32d466bbbaf8ed2ae36be99a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ pkgs, ... }:
{
  systemd.services.usbshare = {
    description = "USB Share Watchdog";
    wantedBy = [ "multi-user.target" ];

    serviceConfig =
      let
        usb_share_script = pkgs.fetchurl {
          url = "https://gist.githubusercontent.com/davidhoness/0f45ef6a41bac6311614f109acbf92db/raw/970badd0ae4b097e3af8d5142e65c34b21f5cfab/usb_share.py";
          sha256 = "sha256-Z8HoOmzK3UjZac6hB3297fCDrbLwiFFNwxhqzr1WMSo";
        };
      in
      {
        ExecStart = "${pkgs.python3.withPackages (ps: [ ps.watchdog ])}/bin/python3 ${usb_share_script}";
        Restart = "always";
        Type = "simple";
        Environment = "PATH=${pkgs.kmod}/bin:${pkgs.coreutils}/bin";
      };
  };
}