opensnitch: add `package` option (#416289)

authored by Jonas Heinrich and committed by GitHub 38e5187a 0205b99b

+5 -5
+5 -5
nixos/modules/services/security/opensnitch.nix
··· 13 file = pkgs.writeText "rule" (builtins.toJSON cfg); 14 } 15 ); 16 - 17 in 18 { 19 options = { 20 services.opensnitch = { 21 enable = lib.mkEnableOption "Opensnitch application firewall"; 22 23 rules = lib.mkOption { 24 default = { }; ··· 192 services.opensnitch.settings = lib.mapAttrs (_: v: lib.mkDefault v) ( 193 builtins.fromJSON ( 194 builtins.unsafeDiscardStringContext ( 195 - builtins.readFile "${pkgs.opensnitch}/etc/opensnitchd/default-config.json" 196 ) 197 ) 198 ); 199 200 systemd = { 201 - packages = [ pkgs.opensnitch ]; 202 services.opensnitchd = { 203 wantedBy = [ "multi-user.target" ]; 204 serviceConfig = { ··· 210 in 211 [ 212 "" 213 - "${pkgs.opensnitch}/bin/opensnitchd --config-file ${format.generate "default-config.json" preparedSettings}" 214 ]; 215 }; 216 preStart = lib.mkIf (cfg.rules != { }) ( ··· 245 }; 246 tmpfiles.rules = [ 247 "d ${cfg.settings.Rules.Path} 0750 root root - -" 248 - "L+ /etc/opensnitchd/system-fw.json - - - - ${pkgs.opensnitch}/etc/opensnitchd/system-fw.json" 249 ]; 250 }; 251
··· 13 file = pkgs.writeText "rule" (builtins.toJSON cfg); 14 } 15 ); 16 in 17 { 18 options = { 19 services.opensnitch = { 20 enable = lib.mkEnableOption "Opensnitch application firewall"; 21 + package = lib.mkPackageOption pkgs "opensnitch" { }; 22 23 rules = lib.mkOption { 24 default = { }; ··· 192 services.opensnitch.settings = lib.mapAttrs (_: v: lib.mkDefault v) ( 193 builtins.fromJSON ( 194 builtins.unsafeDiscardStringContext ( 195 + builtins.readFile "${cfg.package}/etc/opensnitchd/default-config.json" 196 ) 197 ) 198 ); 199 200 systemd = { 201 + packages = [ cfg.package ]; 202 services.opensnitchd = { 203 wantedBy = [ "multi-user.target" ]; 204 serviceConfig = { ··· 210 in 211 [ 212 "" 213 + "${cfg.package}/bin/opensnitchd --config-file ${format.generate "default-config.json" preparedSettings}" 214 ]; 215 }; 216 preStart = lib.mkIf (cfg.rules != { }) ( ··· 245 }; 246 tmpfiles.rules = [ 247 "d ${cfg.settings.Rules.Path} 0750 root root - -" 248 + "L+ /etc/opensnitchd/system-fw.json - - - - ${cfg.package}/etc/opensnitchd/system-fw.json" 249 ]; 250 }; 251