[Nix-dev] How to incorporate my Bash script in configuration.nix

Profpatsch mail at profpatsch.de
Fri May 12 17:51:26 CEST 2017


On 17-05-12 05:02pm, Profpatsch wrote:
> systemd.service.myUsbService = 
>   let startupScript = ''
>     #!${pkgs.bash}
>     echo "0b05 17e8" | tee /sys/bus/usb/drivers/rt2800usb/new_id
>   '';
>   in { 
>     description = "get my US WiFi to work";
>     wantedBy = [ "default.target" ];
>     serviceConfig = {
>       ExecStart = startupScript;
>     };
>   };

aszlig just told me that this can be done shorter:

systemd.service.myUsbService = {
  description = "get my US WiFi to work";
  bindsTo = [ "sys-subsystem-net-devices-XXX.device" ];
  script = "echo 0b05 17e8 | tee /sys/bus/usb/drivers/rt2800usb/new_id";
}

see `man systemd.device`.

-- 
Proudly written in Mutt with Vim on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
May take up to five days to read your message. If it’s urgent, call me.


More information about the nix-dev mailing list