Skip to content

Commit aadd7d2

Browse files
committed
opensnitch: add package option
1 parent 6ebd5c0 commit aadd7d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nixos/modules/services/security/opensnitch.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ let
1313
file = pkgs.writeText "rule" (builtins.toJSON cfg);
1414
}
1515
);
16-
1716
in
1817
{
1918
options = {
2019
services.opensnitch = {
2120
enable = lib.mkEnableOption "Opensnitch application firewall";
21+
package = lib.mkPackageOption pkgs "opensnitch" { };
2222

2323
rules = lib.mkOption {
2424
default = { };
@@ -192,13 +192,13 @@ in
192192
services.opensnitch.settings = lib.mapAttrs (_: v: lib.mkDefault v) (
193193
builtins.fromJSON (
194194
builtins.unsafeDiscardStringContext (
195-
builtins.readFile "${pkgs.opensnitch}/etc/opensnitchd/default-config.json"
195+
builtins.readFile "${cfg.package}/etc/opensnitchd/default-config.json"
196196
)
197197
)
198198
);
199199

200200
systemd = {
201-
packages = [ pkgs.opensnitch ];
201+
packages = [ cfg.package ];
202202
services.opensnitchd = {
203203
wantedBy = [ "multi-user.target" ];
204204
serviceConfig = {
@@ -210,7 +210,7 @@ in
210210
in
211211
[
212212
""
213-
"${pkgs.opensnitch}/bin/opensnitchd --config-file ${format.generate "default-config.json" preparedSettings}"
213+
"${cfg.package}/bin/opensnitchd --config-file ${format.generate "default-config.json" preparedSettings}"
214214
];
215215
};
216216
preStart = lib.mkIf (cfg.rules != { }) (
@@ -245,7 +245,7 @@ in
245245
};
246246
tmpfiles.rules = [
247247
"d ${cfg.settings.Rules.Path} 0750 root root - -"
248-
"L+ /etc/opensnitchd/system-fw.json - - - - ${pkgs.opensnitch}/etc/opensnitchd/system-fw.json"
248+
"L+ /etc/opensnitchd/system-fw.json - - - - ${cfg.package}/etc/opensnitchd/system-fw.json"
249249
];
250250
};
251251

0 commit comments

Comments
 (0)