paretosecurity: 0.1.3 -> 0.1.9 (#397890)

Changed files
+63 -63
nixos
modules
services
tests
pkgs
by-name
pa
paretosecurity
+16 -15
nixos/modules/services/security/paretosecurity.nix
···
pkgs,
...
}:
+
let
+
cfg = config.services.paretosecurity;
+
in
{
options.services.paretosecurity = {
···
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.
···
];
# 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" ];
+
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"
+
];
+
};
};
-
services.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" ];
};
};
}
+25 -34
nixos/tests/paretosecurity.nix
···
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;
+
+
# 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"'
+
'';
+
});
};
-
-
networking.firewall.enable = true;
};
-
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 ];
···
environment.systemPackages = [ pkgs.xdotool ];
environment.variables.XAUTHORITY = "/home/alice/.Xauthority";
-
};
enableOCR = true;
+22 -14
pkgs/by-name/pa/paretosecurity/package.nix
···
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;
···
maintainers = with lib.maintainers; [ zupo ];
mainProgram = "paretosecurity";
};
-
}
+
})