paretosecurity: 0.1.3 -> 0.1.9 (#397890)

This commit is contained in:
Domen Kožar
2025-04-21 18:28:16 +01:00
committed by GitHub
3 changed files with 63 additions and 63 deletions
@@ -4,6 +4,9 @@
pkgs,
...
}:
let
cfg = config.services.paretosecurity;
in
{
options.services.paretosecurity = {
@@ -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.
@@ -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 = {
wantedBy = [ "graphical-session.target" ];
serviceConfig.Environment = [
"PATH=${config.system.path}/bin:${config.system.path}/sbin"
];
};
timers.paretosecurity-user = {
wantedBy = [ "timers.target" ];
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" ];
};
};
}
+25 -34
View File
@@ -4,53 +4,45 @@
meta.maintainers = [ lib.maintainers.zupo ];
nodes.terminal =
{
config,
pkgs,
lib,
...
}:
let
# Create a patched version of the package that points to the local dashboard
# for easier testing
patchedPareto = pkgs.paretosecurity.overrideAttrs (oldAttrs: {
postPatch = ''
substituteInPlace team/report.go \
--replace-warn 'const reportURL = "https://dash.paretosecurity.com"' \
'const reportURL = "http://dashboard"'
'';
});
in
{ pkgs, ... }:
{
imports = [ ./common/user-account.nix ];
networking.firewall.enable = true;
services.paretosecurity = {
enable = true;
package = patchedPareto;
};
networking.firewall.enable = true;
# Create a patched version of the package that points to the local dashboard
# for easier testing
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"'
'';
});
};
};
nodes.dashboard =
{ config, pkgs, ... }:
{
networking.firewall.allowedTCPPorts = [ 80 ];
nodes.dashboard = {
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = {
enable = true;
virtualHosts."dashboard" = {
locations."/api/v1/team/".extraConfig = ''
add_header Content-Type application/json;
return 200 '{"message": "Linked device."}';
'';
};
services.nginx = {
enable = true;
virtualHosts."dashboard" = {
locations."/api/v1/team/".extraConfig = ''
add_header Content-Type application/json;
return 200 '{"message": "Linked device."}';
'';
};
};
};
nodes.xfce =
{ config, pkgs, ... }:
{ pkgs, ... }:
{
imports = [ ./common/user-account.nix ];
@@ -76,7 +68,6 @@
environment.systemPackages = [ pkgs.xdotool ];
environment.variables.XAUTHORITY = "/home/alice/.Xauthority";
};
enableOCR = true;
+22 -14
View File
@@ -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;
@@ -80,4 +88,4 @@ buildGoModule rec {
maintainers = with lib.maintainers; [ zupo ];
mainProgram = "paretosecurity";
};
}
})