Loading nixos/modules/services/security/paretosecurity.nix +16 −15 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ pkgs, ... }: let cfg = config.services.paretosecurity; in { options.services.paretosecurity = { Loading @@ -12,9 +15,9 @@ trayIcon = lib.mkEnableOption "tray icon for ParetoSecurity"; }; config = lib.mkIf config.services.paretosecurity.enable { environment.systemPackages = [ config.services.paretosecurity.package ]; systemd.packages = [ config.services.paretosecurity.package ]; config = lib.mkIf cfg.enable { environment.systemPackages = [ cfg.package ]; systemd.packages = [ cfg.package ]; # In traditional Linux distributions, systemd would read the [Install] section from # unit files and automatically create the appropriate symlinks to enable services. Loading @@ -36,19 +39,17 @@ ]; # Enable the tray icon and timer services if the trayIcon option is enabled systemd.user = lib.mkIf config.services.paretosecurity.trayIcon { services.paretosecurity-trayicon = { wantedBy = [ "graphical-session.target" ]; }; services.paretosecurity-user = { systemd.user = lib.mkIf cfg.trayIcon { services = { paretosecurity-trayicon.wantedBy = [ "graphical-session.target" ]; paretosecurity-user = { wantedBy = [ "graphical-session.target" ]; serviceConfig.Environment = [ "PATH=${config.system.path}/bin:${config.system.path}/sbin" ]; }; timers.paretosecurity-user = { wantedBy = [ "timers.target" ]; }; timers.paretosecurity-user.wantedBy = [ "timers.target" ]; }; }; } nixos/tests/paretosecurity.nix +25 −34 Original line number Diff line number Diff line Loading @@ -4,38 +4,30 @@ meta.maintainers = [ lib.maintainers.zupo ]; nodes.terminal = { pkgs, ... }: { config, pkgs, lib, ... }: let imports = [ ./common/user-account.nix ]; networking.firewall.enable = true; services.paretosecurity = { enable = true; # Create a patched version of the package that points to the local dashboard # for easier testing patchedPareto = pkgs.paretosecurity.overrideAttrs (oldAttrs: { postPatch = '' package = pkgs.paretosecurity.overrideAttrs (oldAttrs: { postPatch = oldAttrs.postPatch or "" + '' substituteInPlace team/report.go \ --replace-warn 'const reportURL = "https://dash.paretosecurity.com"' \ 'const reportURL = "http://dashboard"' ''; }); in { imports = [ ./common/user-account.nix ]; services.paretosecurity = { enable = true; package = patchedPareto; }; networking.firewall.enable = true; }; nodes.dashboard = { config, pkgs, ... }: { nodes.dashboard = { networking.firewall.allowedTCPPorts = [ 80 ]; services.nginx = { Loading @@ -50,7 +42,7 @@ }; nodes.xfce = { config, pkgs, ... }: { pkgs, ... }: { imports = [ ./common/user-account.nix ]; Loading @@ -76,7 +68,6 @@ environment.systemPackages = [ pkgs.xdotool ]; environment.variables.XAUTHORITY = "/home/alice/.Xauthority"; }; enableOCR = true; Loading pkgs/by-name/pa/paretosecurity/package.nix +22 −14 Original line number Diff line number Diff line Loading @@ -5,49 +5,57 @@ testers, paretosecurity, nixosTests, pkg-config, gtk3, webkitgtk_4_1, }: buildGoModule rec { buildGoModule (finalAttrs: { nativeBuildInputs = [ pkg-config ]; buildInputs = [ gtk3 webkitgtk_4_1 ]; pname = "paretosecurity"; version = "0.1.3"; version = "0.1.9"; src = fetchFromGitHub { owner = "ParetoSecurity"; repo = "agent"; rev = version; hash = "sha256-ovyfHqLCf5U3UR1HfoA+UQhqLZ6IaILcpqptPRQsb60="; rev = finalAttrs.version; hash = "sha256-KJs4xC3EtGG4116UE+oIEwAMcuDWIm9gqgZY+Bv14ac="; }; vendorHash = "sha256-7mKAFkKGpBOjXc3J/sfF3k3pJF53tFybXZgbfJInuSY="; vendorHash = "sha256-3plpvwLe32AsGuVzdM2fSmTPkKwRFmhi651NEIRdOxw="; proxyVendor = true; ldflags = [ "-s" "-X=github.com/ParetoSecurity/agent/shared.Version=${version}" "-X=github.com/ParetoSecurity/agent/shared.Commit=${src.rev}" "-X=github.com/ParetoSecurity/agent/shared.Version=${finalAttrs.version}" "-X=github.com/ParetoSecurity/agent/shared.Commit=${finalAttrs.src.rev}" "-X=github.com/ParetoSecurity/agent/shared.Date=1970-01-01T00:00:00Z" ]; postInstall = '' # Install global systemd files install -Dm400 ${src}/apt/paretosecurity.socket $out/lib/systemd/system/paretosecurity.socket install -Dm400 ${src}/apt/paretosecurity.service $out/lib/systemd/system/paretosecurity.service install -Dm400 ${finalAttrs.src}/apt/paretosecurity.socket $out/lib/systemd/system/paretosecurity.socket install -Dm400 ${finalAttrs.src}/apt/paretosecurity.service $out/lib/systemd/system/paretosecurity.service substituteInPlace $out/lib/systemd/system/paretosecurity.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" # Install user systemd files install -Dm444 ${src}/apt/paretosecurity-user.timer $out/lib/systemd/user/paretosecurity-user.timer install -Dm444 ${src}/apt/paretosecurity-user.service $out/lib/systemd/user/paretosecurity-user.service install -Dm444 ${finalAttrs.src}/apt/paretosecurity-user.timer $out/lib/systemd/user/paretosecurity-user.timer install -Dm444 ${finalAttrs.src}/apt/paretosecurity-user.service $out/lib/systemd/user/paretosecurity-user.service substituteInPlace $out/lib/systemd/user/paretosecurity-user.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" install -Dm444 ${src}/apt/paretosecurity-trayicon.service $out/lib/systemd/user/paretosecurity-trayicon.service install -Dm444 ${finalAttrs.src}/apt/paretosecurity-trayicon.service $out/lib/systemd/user/paretosecurity-trayicon.service substituteInPlace $out/lib/systemd/user/paretosecurity-trayicon.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" ''; passthru.tests = { version = testers.testVersion { version = "${version}"; inherit (finalAttrs) version; package = paretosecurity; }; integration_test = nixosTests.paretosecurity; Loading Loading @@ -80,4 +88,4 @@ buildGoModule rec { maintainers = with lib.maintainers; [ zupo ]; mainProgram = "paretosecurity"; }; } }) Loading
nixos/modules/services/security/paretosecurity.nix +16 −15 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ pkgs, ... }: let cfg = config.services.paretosecurity; in { options.services.paretosecurity = { Loading @@ -12,9 +15,9 @@ trayIcon = lib.mkEnableOption "tray icon for ParetoSecurity"; }; config = lib.mkIf config.services.paretosecurity.enable { environment.systemPackages = [ config.services.paretosecurity.package ]; systemd.packages = [ config.services.paretosecurity.package ]; config = lib.mkIf cfg.enable { environment.systemPackages = [ cfg.package ]; systemd.packages = [ cfg.package ]; # In traditional Linux distributions, systemd would read the [Install] section from # unit files and automatically create the appropriate symlinks to enable services. Loading @@ -36,19 +39,17 @@ ]; # Enable the tray icon and timer services if the trayIcon option is enabled systemd.user = lib.mkIf config.services.paretosecurity.trayIcon { services.paretosecurity-trayicon = { wantedBy = [ "graphical-session.target" ]; }; services.paretosecurity-user = { systemd.user = lib.mkIf cfg.trayIcon { services = { paretosecurity-trayicon.wantedBy = [ "graphical-session.target" ]; paretosecurity-user = { wantedBy = [ "graphical-session.target" ]; serviceConfig.Environment = [ "PATH=${config.system.path}/bin:${config.system.path}/sbin" ]; }; timers.paretosecurity-user = { wantedBy = [ "timers.target" ]; }; timers.paretosecurity-user.wantedBy = [ "timers.target" ]; }; }; }
nixos/tests/paretosecurity.nix +25 −34 Original line number Diff line number Diff line Loading @@ -4,38 +4,30 @@ meta.maintainers = [ lib.maintainers.zupo ]; nodes.terminal = { pkgs, ... }: { config, pkgs, lib, ... }: let imports = [ ./common/user-account.nix ]; networking.firewall.enable = true; services.paretosecurity = { enable = true; # Create a patched version of the package that points to the local dashboard # for easier testing patchedPareto = pkgs.paretosecurity.overrideAttrs (oldAttrs: { postPatch = '' package = pkgs.paretosecurity.overrideAttrs (oldAttrs: { postPatch = oldAttrs.postPatch or "" + '' substituteInPlace team/report.go \ --replace-warn 'const reportURL = "https://dash.paretosecurity.com"' \ 'const reportURL = "http://dashboard"' ''; }); in { imports = [ ./common/user-account.nix ]; services.paretosecurity = { enable = true; package = patchedPareto; }; networking.firewall.enable = true; }; nodes.dashboard = { config, pkgs, ... }: { nodes.dashboard = { networking.firewall.allowedTCPPorts = [ 80 ]; services.nginx = { Loading @@ -50,7 +42,7 @@ }; nodes.xfce = { config, pkgs, ... }: { pkgs, ... }: { imports = [ ./common/user-account.nix ]; Loading @@ -76,7 +68,6 @@ environment.systemPackages = [ pkgs.xdotool ]; environment.variables.XAUTHORITY = "/home/alice/.Xauthority"; }; enableOCR = true; Loading
pkgs/by-name/pa/paretosecurity/package.nix +22 −14 Original line number Diff line number Diff line Loading @@ -5,49 +5,57 @@ testers, paretosecurity, nixosTests, pkg-config, gtk3, webkitgtk_4_1, }: buildGoModule rec { buildGoModule (finalAttrs: { nativeBuildInputs = [ pkg-config ]; buildInputs = [ gtk3 webkitgtk_4_1 ]; pname = "paretosecurity"; version = "0.1.3"; version = "0.1.9"; src = fetchFromGitHub { owner = "ParetoSecurity"; repo = "agent"; rev = version; hash = "sha256-ovyfHqLCf5U3UR1HfoA+UQhqLZ6IaILcpqptPRQsb60="; rev = finalAttrs.version; hash = "sha256-KJs4xC3EtGG4116UE+oIEwAMcuDWIm9gqgZY+Bv14ac="; }; vendorHash = "sha256-7mKAFkKGpBOjXc3J/sfF3k3pJF53tFybXZgbfJInuSY="; vendorHash = "sha256-3plpvwLe32AsGuVzdM2fSmTPkKwRFmhi651NEIRdOxw="; proxyVendor = true; ldflags = [ "-s" "-X=github.com/ParetoSecurity/agent/shared.Version=${version}" "-X=github.com/ParetoSecurity/agent/shared.Commit=${src.rev}" "-X=github.com/ParetoSecurity/agent/shared.Version=${finalAttrs.version}" "-X=github.com/ParetoSecurity/agent/shared.Commit=${finalAttrs.src.rev}" "-X=github.com/ParetoSecurity/agent/shared.Date=1970-01-01T00:00:00Z" ]; postInstall = '' # Install global systemd files install -Dm400 ${src}/apt/paretosecurity.socket $out/lib/systemd/system/paretosecurity.socket install -Dm400 ${src}/apt/paretosecurity.service $out/lib/systemd/system/paretosecurity.service install -Dm400 ${finalAttrs.src}/apt/paretosecurity.socket $out/lib/systemd/system/paretosecurity.socket install -Dm400 ${finalAttrs.src}/apt/paretosecurity.service $out/lib/systemd/system/paretosecurity.service substituteInPlace $out/lib/systemd/system/paretosecurity.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" # Install user systemd files install -Dm444 ${src}/apt/paretosecurity-user.timer $out/lib/systemd/user/paretosecurity-user.timer install -Dm444 ${src}/apt/paretosecurity-user.service $out/lib/systemd/user/paretosecurity-user.service install -Dm444 ${finalAttrs.src}/apt/paretosecurity-user.timer $out/lib/systemd/user/paretosecurity-user.timer install -Dm444 ${finalAttrs.src}/apt/paretosecurity-user.service $out/lib/systemd/user/paretosecurity-user.service substituteInPlace $out/lib/systemd/user/paretosecurity-user.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" install -Dm444 ${src}/apt/paretosecurity-trayicon.service $out/lib/systemd/user/paretosecurity-trayicon.service install -Dm444 ${finalAttrs.src}/apt/paretosecurity-trayicon.service $out/lib/systemd/user/paretosecurity-trayicon.service substituteInPlace $out/lib/systemd/user/paretosecurity-trayicon.service \ --replace-fail "/usr/bin/paretosecurity" "$out/bin/paretosecurity" ''; passthru.tests = { version = testers.testVersion { version = "${version}"; inherit (finalAttrs) version; package = paretosecurity; }; integration_test = nixosTests.paretosecurity; Loading Loading @@ -80,4 +88,4 @@ buildGoModule rec { maintainers = with lib.maintainers; [ zupo ]; mainProgram = "paretosecurity"; }; } })