Re: [Nix-dev] How to incorporate my Bash script in configuration.nix
Thank you for reply, but this is a duplicate of "[NixOS] How to incorporate my Bash script in configuration.nix?" atd it is already solved. My bad On Fri, May 12, 2017 at 3:51 PM, Profpatschwrote: > 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. > -- Strahinja Popovic ___ nix-dev mailing list nix-dev@lists.science.uu.nl https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] How to incorporate my Bash script in configuration.nix
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. ___ nix-dev mailing list nix-dev@lists.science.uu.nl https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] How to incorporate my Bash script in configuration.nix
On 17-05-08 02:28pm, Strahinja Popovic wrote: > Hi everyone, > > I have made my USB WiFi to work, > but I have to call this script whenever I restart the computer. > > #!/usr/bin/env bash > echo "0b05 17e8"|sudo tee /sys/bus/usb/drivers/rt2800usb/new_id > > What is correct way to make this part of configuration.nix? probably by adding service file to bootup, like: 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; }; }; Maybe you’ll have to play with the units it needs to run before. I point you to `man configuration.nix` and `man systemd.unit`. -- 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. ___ nix-dev mailing list nix-dev@lists.science.uu.nl https://mailman.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] How to incorporate my Bash script in configuration.nix
Hi everyone, I have made my USB WiFi to work, but I have to call this script whenever I restart the computer. #!/usr/bin/env bash echo "0b05 17e8"|sudo tee /sys/bus/usb/drivers/rt2800usb/new_id What is correct way to make this part of configuration.nix? Cheers, -- Strahinja Popovic ___ nix-dev mailing list nix-dev@lists.science.uu.nl https://mailman.science.uu.nl/mailman/listinfo/nix-dev