diff --git a/configuration/default.nix b/configuration/default.nix index d202fe5..b4601b1 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -15,6 +15,7 @@ (import ../modules) ./services/backups.nix + ./services/battery-manager.nix ./services/conduit.nix ./services/fail2ban.nix ./services/foundryvtt.nix diff --git a/configuration/services/battery-manager.nix b/configuration/services/battery-manager.nix new file mode 100644 index 0000000..7f27931 --- /dev/null +++ b/configuration/services/battery-manager.nix @@ -0,0 +1,17 @@ +{ + config, + flake-inputs, + ... +}: { + imports = [ + flake-inputs.sonnenshift.nixosModules.default + ]; + + services.batteryManager = { + enable = true; + battery = "3ca39300-c523-4315-b9a3-d030f85a9373"; + + emailFile = "${config.sops.secrets."battery-manager/email".path}"; + passwordFile = "${config.sops.secrets."battery-manager/password".path}"; + }; +} diff --git a/configuration/sops.nix b/configuration/sops.nix index dc9fcb5..53044fc 100644 --- a/configuration/sops.nix +++ b/configuration/sops.nix @@ -3,6 +3,16 @@ defaultSopsFile = ../keys/production.yaml; secrets = { + "battery-manager/email" = { + owner = "battery-manager"; + group = "battery-manager"; + }; + + "battery-manager/password" = { + owner = "battery-manager"; + group = "battery-manager"; + }; + # Gitea "forgejo/metrics-token" = { owner = "forgejo"; diff --git a/flake.lock b/flake.lock index f3cd588..ea6e19f 100644 --- a/flake.lock +++ b/flake.lock @@ -132,6 +132,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "foundryvtt": { "inputs": { "nixpkgs": [ @@ -152,6 +170,28 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "sonnenshift", + "poetry2nixi", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1702272962, @@ -254,6 +294,31 @@ "type": "github" } }, + "poetry2nixi": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "sonnenshift", + "nixpkgs" + ], + "systems": "systems_4", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1708589824, + "narHash": "sha256-2GOiFTkvs5MtVF65sC78KNVxQSmsxtk0WmV1wJ9V2ck=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "3c92540611f42d3fb2d0d084a6c694cd6544b609", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "purescript-overlay": { "inputs": { "nixpkgs": [ @@ -302,6 +367,7 @@ "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "nvfetcher": "nvfetcher", + "sonnenshift": "sonnenshift", "sops-nix": "sops-nix", "tlaternet-webserver": "tlaternet-webserver" } @@ -346,6 +412,28 @@ "type": "github" } }, + "sonnenshift": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "poetry2nixi": "poetry2nixi" + }, + "locked": { + "lastModified": 1712437610, + "narHash": "sha256-U0xIqSupo6yBVWQcHIcLPDKg5ShQIkV/0Ay+Xg3GIlk=", + "ref": "tlater/implement-nix-module", + "rev": "43c4f591328f194ca989b86cea49773104f75549", + "revCount": 7, + "type": "git", + "url": "ssh://git@github.com/sonnenshift/battery-manager" + }, + "original": { + "ref": "tlater/implement-nix-module", + "type": "git", + "url": "ssh://git@github.com/sonnenshift/battery-manager" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ @@ -397,6 +485,35 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, "tlaternet-webserver": { "inputs": { "dream2nix": "dream2nix", @@ -419,6 +536,28 @@ "url": "https://gitea.tlater.net/tlaternet/tlaternet.git" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "sonnenshift", + "poetry2nixi", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708335038, + "narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems" diff --git a/flake.nix b/flake.nix index 6f6b386..f9941ba 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,11 @@ url = "github:reckenrode/nix-foundryvtt"; inputs.nixpkgs.follows = "nixpkgs"; }; + + sonnenshift = { + url = "git+ssh://git@github.com/sonnenshift/battery-manager?ref=tlater/implement-nix-module"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { diff --git a/keys/production.yaml b/keys/production.yaml index aa25072..7ed57b3 100644 --- a/keys/production.yaml +++ b/keys/production.yaml @@ -1,3 +1,6 @@ +battery-manager: + email: ENC[AES256_GCM,data:rYLUACXR/n+bLBmZ,iv:sUBEkh2+7qGjHZ5R23e/hoCiyTA7GTL4bJvXmxjZ5Sw=,tag:fdPMllaQQfRgX0WZKIre4g==,type:str] + password: ENC[AES256_GCM,data:7cokZa6Q6ahSeiFPz+cV,iv:vz405P0IcG9FsAQXlY7mi78GuushQUKJm2irG6buGzc=,tag:JLHG2jTkJDGbinAq9dXRsQ==,type:str] forgejo: metrics-token: ENC[AES256_GCM,data:WVbD5JloJlHNjeEwe1uEd4Haj6L3ilj1Pnux6yrelUQP18ZPAh90aDO1OIZHaPJR7tTeyATr8BIzZL1zkNhCuA==,iv:eTYXN3hymIN3bTX1YxNGkAYE0KVDbdz2ds8UQAHlALE=,tag:A61loGdu0pfsiez96u2Qsg==,type:str] grafana: @@ -28,8 +31,8 @@ sops: azure_kv: [] hc_vault: [] age: [] - lastmodified: "2024-03-18T04:05:08Z" - mac: ENC[AES256_GCM,data:/v/XRBizRUn8UR1HOIaKrY11/5I8RmsctmxXg0wcCXO983YgcGYTEqfXOSRJzkh/MOjB0c8jpdfE7tyqYgB2iYjm+HmRFVsGNB484e+3ukAMsxz4CTz26RWC/LEemQeBOa5RB3rrPXXo1LrJCBN9Y+T/PVgO2xshUSxyhRFQmMA=,iv:km1m8k/vrCVT8ugvqAZNORLu0NSW66B58btH5k4e//Y=,tag:RZXviobM03IQXN1FwDUlVA==,type:str] + lastmodified: "2024-04-06T15:32:49Z" + mac: ENC[AES256_GCM,data:ShqLJf9b20LdmjK6MMPtI3KicE+fPc0ejzVGEIdgbNs7ueDwdt7jqgpDrpiyf+vW86tr3I1E1VTlh127XlSH/RZDRRHehpX0tnBiF0zMscmt1vdinY4cPhTwhLJ1fdpVpY8ihdOqv0UFyC39HP78aWESX5S/dJZQ6vS7K5VGKTY=,iv:TYE9f9iyrUQxmMeKXApEYsSPcMWK8vndyBm7HtJyJPo=,tag:vSlobwA1R0Go7BYgNVpMkw==,type:str] pgp: - created_at: "2024-03-18T04:02:00Z" enc: |- diff --git a/keys/staging.yaml b/keys/staging.yaml index 9e495ba..029e6ac 100644 --- a/keys/staging.yaml +++ b/keys/staging.yaml @@ -1,3 +1,6 @@ +battery-manager: + email: ENC[AES256_GCM,data:LM/EGzWHfVQ=,iv:jFaoUQuUfuGoOyj/GFpdI8TerH/c8D9fjvio+IEt2Tc=,tag:IWLiN011JEnHRLIXWQgfmA==,type:str] + password: ENC[AES256_GCM,data:SUxjqS7SJHM=,iv:LvdKk88S+nSImh6/ZezbFGLCUBu1Lpdu+neF2xyHdBg=,tag:rcMyZuW4FVNbcbz00wQKBg==,type:str] forgejo: metrics-token: ENC[AES256_GCM,data:HEDV/GK/WtI=,iv:ihPEusEGVUNZjjjxz2ys6Nfag/og4n7Cqmd4rroT6Ww=,tag:Brcv7XW6HfzzgF3emtuT2A==,type:str] grafana: @@ -28,8 +31,8 @@ sops: azure_kv: [] hc_vault: [] age: [] - lastmodified: "2024-03-18T23:13:42Z" - mac: ENC[AES256_GCM,data:/6GnUxOkftB07feEwQbeXoueLQUkRXL4pee973bAYbjse8gbmU3IvI8CVoj1PuY5JeC7pOFCMjZAxqbMh90oUbVSHssVDLIuL4/ZhxF3on+sKmC5wa/M8lU+Ld2upL+//bz2p4EsDKy1Fedwm22b3mOkjSAUcKp+uh8ORrRmWZ0=,iv:waVUyPo1VPfTldzbs0DH3mGukAWvy2Ut9w5bw7/bdFA=,tag:Wm4KUZwKI4VylJ1i2QoptA==,type:str] + lastmodified: "2024-04-06T15:33:40Z" + mac: ENC[AES256_GCM,data:qB9uDDM5K6+BmeAKyTJ0Sel6Um0Fc9IhdV3wAn13WxpwDtxmMsdqnwaewI/KepsRG3k76x9vkYL+oKkUysqq1r1FkocUDg4DnKnf1KtKo2Zm9MPcVRG833m6oDoTeGnmgrAMTDKy1tUdGkXW40IfbMakbSjSIfLbrymtoHeVbaE=,iv:8P8M4Ueo3Idlgo+Yqj6JUtFfWX949fz6HfRHEOy1/Vg=,tag:ou+IGZSQSfX6gNoxbpAipg==,type:str] pgp: - created_at: "2023-12-29T15:25:27Z" enc: |