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.
This commit is contained in:
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 { config = lib.mkIf cfg.enable {
environment.etc = builtins.listToAttrs environment = {
etc = builtins.listToAttrs
(map (map
(name: lib.nameValuePair "wireguard/${name}" { source = "${relayConfigFiles}/${name}"; }) (name: lib.nameValuePair "wireguard/${name}" { source = "${relayConfigFiles}/${name}"; })
(lib.attrNames relayConfigs)); (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
'';
});
};
}; };
} }