···
package = mkPackageOptionMD pkgs "dae" { };
type = with types;(listOf path);
default = with pkgs; [ v2ray-geoip v2ray-domain-list-community ];
···
74
-
default = "/etc/dae/config.dae";
74
+
type = with types; (nullOr path);
example = "/path/to/your/config.dae";
The path of dae config file, end with `.dae`.
···
83
+
type = with types; (nullOr str);
86
+
WARNING: This option will expose store your config unencrypted world-readable in the nix store.
See <https://github.com/daeuniverse/dae/blob/main/example.dae>.
···
environment.systemPackages = [ cfg.package ];
systemd.packages = [ cfg.package ];
106
-
environment.etc."dae/config.dae" = {
108
-
source = pkgs.writeText "config.dae" cfg.config;
networking = lib.mkIf cfg.openFirewall.enable {
let portToOpen = cfg.openFirewall.port;
···
daeBin = lib.getExe cfg.package;
124
-
TxChecksumIpGenericWorkaround = with lib;(getExe pkgs.writeShellApplication {
125
-
name = "disable-tx-checksum-ip-generic";
126
-
text = with pkgs; ''
127
-
iface=$(${iproute2}/bin/ip route | ${lib.getExe gawk} '/default/ {print $5}')
128
-
${lib.getExe ethtool} -K "$iface" tx-checksum-ip-generic off
120
+
if cfg.configFile != null
121
+
then cfg.configFile else pkgs.writeText "config.dae" cfg.config;
123
+
TxChecksumIpGenericWorkaround = with lib;
124
+
(getExe pkgs.writeShellApplication {
125
+
name = "disable-tx-checksum-ip-generic";
126
+
text = with pkgs; ''
127
+
iface=$(${iproute2}/bin/ip route | ${lib.getExe gawk} '/default/ {print $5}')
128
+
${lib.getExe ethtool} -K "$iface" tx-checksum-ip-generic off
wantedBy = [ "multi-user.target" ];
135
-
ExecStartPre = [ "" "${daeBin} validate -c ${cfg.configFile}" ]
135
+
LoadCredential = [ "config.dae:${configPath}" ];
136
+
ExecStartPre = [ "" "${daeBin} validate -c \${CREDENTIALS_DIRECTORY}/config.dae" ]
++ (with lib; optional cfg.disableTxChecksumIpGeneric TxChecksumIpGenericWorkaround);
137
-
ExecStart = [ "" "${daeBin} run --disable-timestamp -c ${cfg.configFile}" ];
138
+
ExecStart = [ "" "${daeBin} run --disable-timestamp -c \${CREDENTIALS_DIRECTORY}/config.dae" ];
Environment = "DAE_LOCATION_ASSET=${cfg.assetsPath}";
···
152
-
assertion = !((config.services.dae.config != "global{}\nrouting{}\n")
153
-
&& (config.services.dae.configFile != "/etc/dae/config.dae"));
153
+
assertion = !((config.services.dae.config != null)
154
+
&& (config.services.dae.configFile != null));
Option `config` and `configFile` could not be set
162
+
assertion = !((config.services.dae.config == null)
163
+
&& (config.services.dae.configFile == null));
165
+
Either `config` or `configFile` should be set.