diff --git a/boxes/netbox/agenix.nix b/boxes/netbox/agenix.nix index 40f5d0f..40502b5 100644 --- a/boxes/netbox/agenix.nix +++ b/boxes/netbox/agenix.nix @@ -27,5 +27,11 @@ owner = "nextcloud"; group = "nextcloud"; }; + + pcomon-secrets-file = { + file = ../../secrets/pcomon-secrets-file.age; + owner = "pcomon"; + group = "pcomon"; + }; }; } diff --git a/boxes/netbox/default.nix b/boxes/netbox/default.nix index e2ea028..817d4ad 100644 --- a/boxes/netbox/default.nix +++ b/boxes/netbox/default.nix @@ -10,6 +10,7 @@ ./mail.nix ./nextcloud.nix ./nginx.nix + ./pcomon.nix ./radicale.nix ./ssh.nix ./sslh.nix diff --git a/boxes/netbox/pcomon.nix b/boxes/netbox/pcomon.nix new file mode 100644 index 0000000..4b45917 --- /dev/null +++ b/boxes/netbox/pcomon.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +let + pcomon = (pkgs.callPackage ../../builds/pcomon.nix {}); +in { + users.users.pcomon = { + isSystemUser = true; + group = "pcomon"; + }; + + users.groups.pcomon = {}; + + systemd.services.pcomon = { + serviceConfig.type = "oneshot"; + script = '' + ${pkgs.coreutils}/bin/mkdir -p /run/pcomon + ${pkgs.coreutils}/bin/chown -R pcomon:pcomon /run/pcomon + ${pcomon}/bin/pcomon ${config.age.secrets.pcomon-secrets-file.path} + ''; + }; + + systemd.timers.pcomon = { + wantedBy = [ "timers.target" ]; + partOf = [ "pcomon.service" ]; + timerConfig.OnCalendar = "*:*:0/30"; + }; +} diff --git a/builds/pcomon.nix b/builds/pcomon.nix new file mode 100644 index 0000000..eca83cb --- /dev/null +++ b/builds/pcomon.nix @@ -0,0 +1,13 @@ +{ python3Packages, system-sendmail, fetchgit }: +with python3Packages; +buildPythonApplication { + pname = "pcomon"; + version = "1.0.0"; + + propagatedBuildInputs = [ requests system-sendmail ]; + + src = fetchgit { + url = "https://git.beepboop.systems/stupidcomputer/pcomon"; + hash = "sha256-XxPb1WWq5YQz+UZ7P5dgInPweSD+52R2XVmoVrV0GMQ="; + }; +} diff --git a/secrets/pcomon-secrets-file.age b/secrets/pcomon-secrets-file.age new file mode 100644 index 0000000..be86e1a --- /dev/null +++ b/secrets/pcomon-secrets-file.age @@ -0,0 +1,10 @@ +age-encryption.org/v1 +-> ssh-ed25519 NIIFZw 5sSS8lntUmJQBcYLay7PNt3Lw6kjFhgXQM7CcHthV1w +J73XMhzBrPWKiVEhDWO2mU04d37QUhd93W/yyY8f8ug +-> ssh-ed25519 E0Y+lw 2GZvJm18ZCkFoTq7d9f88IvE9vxc/RN2nRj6XOYamEc +UcPfmSRIMLfRtrRADcneNYKRstLLMuHIZ/zCSwK+4ko +-> ssh-ed25519 q1rODg C/xVY60gXFGe7R38udjfGxDuhNwAHj3w1YG+SzxHUUg +XylNlkJFYxSEAa5k6DbN0uJc+lSR3+9tPZI6Y3vETBA +--- Hxku4chQxW+uldmCokmMJ/zflXG6nC2GMqu4vOB0ahU + %qOȗ׸ Ҫ[~΀ +ǦσZh6(p6&ew|ﰒ!Ǘm|jeh7 QS]:% w!/𩙛 0 己2 JygfC%ҟVvp /I`geWC͐@G@r.`2U[;3wݱFG`BENwZ݁|hf \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 675fdac..1b452c5 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -22,4 +22,7 @@ in { # networkmanager "nm-home-net-config.age".publicKeys = with machines; [ copernicus.pubkey aristotle.pubkey ]; + + # pcomon + "pcomon-secrets-file.age".publicKeys = [ machines.copernicus.pubkey machines.aristotle.pubkey server-netbox ]; }