mullvad: Move script into system module

It doesn’t make sense to install the configuration files system-wide but
the script only for the user.
upower
Simon Bruder 2021-06-01 10:29:58 +02:00
parent e0efa77520
commit c0efaa02ba
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
2 changed files with 21 additions and 4 deletions

View File

@ -47,9 +47,26 @@ in
};
config = lib.mkIf cfg.enable {
environment.etc = builtins.listToAttrs
(map
(name: lib.nameValuePair "wireguard/${name}" { source = "${relayConfigFiles}/${name}"; })
(lib.attrNames relayConfigs));
environment = {
etc = builtins.listToAttrs
(map
(name: lib.nameValuePair "wireguard/${name}" { source = "${relayConfigFiles}/${name}"; })
(lib.attrNames relayConfigs));
systemPackages = lib.singleton (pkgs.stdenv.mkDerivation {
name = "mullvad-on-demand";
src = ./mullvad.sh;
dontUnpack = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -D $src $out/bin/mullvad
runHook postInstall
'';
});
};
};
}