summary refs log tree commit diff
path: root/nixos/modules/services/networking/openvpn.nix
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-02-22 23:27:13 -0800
committerRobert Schütz <github@dotlambda.de>2023-02-26 10:12:28 -0800
commit9e1d4dff3e91f5e580a8ac992c8902928a075acb (patch)
tree645a275d8aa05791a76d2bd4a27491b8dce4484e /nixos/modules/services/networking/openvpn.nix
parent2700684d64adf28c93afc1ebb60a2d3953a59f5e (diff)
downloadnixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar.gz
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar.bz2
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar.lz
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar.xz
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.tar.zst
nixpkgs-9e1d4dff3e91f5e580a8ac992c8902928a075acb.zip
nixos/openvpn: use writeShellScript
Previously the upScript would fail with

    Syntax error: "(" unexpected (expecting "done")

on line 7 if /bin/sh is not bash.
Diffstat (limited to 'nixos/modules/services/networking/openvpn.nix')
-rw-r--r--nixos/modules/services/networking/openvpn.nix6
1 files changed, 2 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix
index 78d312af978..9a5866f2afd 100644
--- a/nixos/modules/services/networking/openvpn.nix
+++ b/nixos/modules/services/networking/openvpn.nix
@@ -14,7 +14,6 @@ let
       path = makeBinPath (getAttr "openvpn-${name}" config.systemd.services).path;
 
       upScript = ''
-        #! /bin/sh
         export PATH=${path}
 
         # For convenience in client scripts, extract the remote domain
@@ -34,7 +33,6 @@ let
       '';
 
       downScript = ''
-        #! /bin/sh
         export PATH=${path}
         ${optionalString cfg.updateResolvConf
            "${pkgs.update-resolv-conf}/libexec/openvpn/update-resolv-conf"}
@@ -47,9 +45,9 @@ let
           ${optionalString (cfg.up != "" || cfg.down != "" || cfg.updateResolvConf) "script-security 2"}
           ${cfg.config}
           ${optionalString (cfg.up != "" || cfg.updateResolvConf)
-              "up ${pkgs.writeScript "openvpn-${name}-up" upScript}"}
+              "up ${pkgs.writeShellScript "openvpn-${name}-up" upScript}"}
           ${optionalString (cfg.down != "" || cfg.updateResolvConf)
-              "down ${pkgs.writeScript "openvpn-${name}-down" downScript}"}
+              "down ${pkgs.writeShellScript "openvpn-${name}-down" downScript}"}
           ${optionalString (cfg.authUserPass != null)
               "auth-user-pass ${pkgs.writeText "openvpn-credentials-${name}" ''
                 ${cfg.authUserPass.username}