chore: nf-fmt-nix

This commit is contained in:
arcnmx 2024-05-26 14:05:14 -07:00
parent 0947ca0532
commit fef4f25ca4
8 changed files with 123 additions and 104 deletions

View file

@ -306,7 +306,8 @@ in {
(map ({platform, ...}: platform) cfg.config.tts or []) (map ({platform, ...}: platform) cfg.config.tts or [])
]; ];
customComponents = [ customComponents = [
(mkIf (cfg.reverseProxy.enable && cfg.reverseProxy.auth.enable) (
mkIf (cfg.reverseProxy.enable && cfg.reverseProxy.auth.enable)
pkgs.home-assistant-custom-components.auth-header pkgs.home-assistant-custom-components.auth-header
) )
]; ];

View file

@ -60,7 +60,11 @@ in {
}; };
}; };
# TODO: restrict to "/auth/authorize" and "/auth/login_flow" only..? # TODO: restrict to "/auth/authorize" and "/auth/login_flow" only..?
"/auth/" = { virtualHost, config, ... }: { "/auth/" = {
virtualHost,
config,
...
}: {
proxy = { proxy = {
inherit headers; inherit headers;
enable = true; enable = true;

View file

@ -65,14 +65,17 @@ in {
address4 address4
#address6 #address6
]; ];
guest = logistics ++ [ guest =
logistics
++ [
# bedroom tv # bedroom tv
"10.1.1.67" "10.1.1.67"
]; ];
kat = koishi; kat = koishi;
arc = shanghai ++ nue; arc = shanghai ++ nue;
enableTrustedAuth = false; enableTrustedAuth = false;
in mkIf enableTrustedAuth [ in
mkIf enableTrustedAuth [
{ {
type = "trusted_networks"; type = "trusted_networks";
#allow_bypass_login = true; #allow_bypass_login = true;

View file

@ -13,10 +13,12 @@ in {
services.vouch-proxy = { services.vouch-proxy = {
enable = mkDefault true; enable = mkDefault true;
package = mkIf hassVouch (pkgs.vouch-proxy.overrideAttrs (old: { package = mkIf hassVouch (pkgs.vouch-proxy.overrideAttrs (old: {
postPatch = '' postPatch =
''
sed -i handlers/login.go \ sed -i handlers/login.go \
-e 's/badStrings *=.*$/badStrings = []string{}/' -e 's/badStrings *=.*$/badStrings = []string{}/'
'' + old.postPatch or ""; ''
+ old.postPatch or "";
doCheck = false; doCheck = false;
})); }));
domain = mkDefault "login.${config.networking.domain}"; domain = mkDefault "login.${config.networking.domain}";

View file

@ -1,24 +1,26 @@
{ lib {
, buildPythonPackage lib,
, fetchFromGitHub buildPythonPackage,
, backports-zoneinfo fetchFromGitHub,
, deprecation backports-zoneinfo,
, pydantic deprecation,
, requests pydantic,
, responses requests,
, pre-commit responses,
, isort pre-commit,
, vcrpy isort,
, pytest vcrpy,
, pytest-recording pytest,
, pytest-mock pytest-recording,
, pythonOlder pytest-mock,
pythonOlder,
# requires an instance of grocy api running... # requires an instance of grocy api running...
, doCheckGrocy ? false doCheckGrocy ? false,
}: let }: let
inherit (lib.lists) optional optionals; inherit (lib.lists) optional optionals;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
in buildPythonPackage rec { in
buildPythonPackage rec {
pname = "pygrocy"; pname = "pygrocy";
version = "2.1.0"; version = "2.1.0";
format = "setuptools"; format = "setuptools";
@ -34,21 +36,25 @@ in buildPythonPackage rec {
rm test/test_grocy.py rm test/test_grocy.py
''; '';
propagatedBuildInputs = [ propagatedBuildInputs =
[
requests requests
deprecation deprecation
pydantic pydantic
] ++ optional (pythonOlder "3.9") backports-zoneinfo; ]
++ optional (pythonOlder "3.9") backports-zoneinfo;
pythonImportsCheck = [ pythonImportsCheck = [
"pygrocy" "pygrocy"
]; ];
checkInputs = [ checkInputs =
[
pytest pytest
pytest-recording pytest-recording
pytest-mock pytest-mock
] ++ optionals doCheckGrocy [ ]
++ optionals doCheckGrocy [
responses responses
pre-commit pre-commit
isort isort

View file

@ -19,7 +19,8 @@ in {
(nginx.virtualHosts.zigbee2mqtt.proxied.cloudflared.getIngress {}) (nginx.virtualHosts.zigbee2mqtt.proxied.cloudflared.getIngress {})
(nginx.virtualHosts.grocy.proxied.cloudflared.getIngress {}) (nginx.virtualHosts.grocy.proxied.cloudflared.getIngress {})
(nginx.virtualHosts.barcodebuddy.proxied.cloudflared.getIngress {}) (nginx.virtualHosts.barcodebuddy.proxied.cloudflared.getIngress {})
(if home-assistant.reverseProxy.auth.enable (
if home-assistant.reverseProxy.auth.enable
then (nginx.virtualHosts.home-assistant.proxied.cloudflared.getIngress {}) then (nginx.virtualHosts.home-assistant.proxied.cloudflared.getIngress {})
else { else {
${home-assistant.domain} = assert home-assistant.enable && home-assistant.reverseProxy.enable; { ${home-assistant.domain} = assert home-assistant.enable && home-assistant.reverseProxy.enable; {

View file

@ -11,7 +11,8 @@
in { in {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in
[
nixos.reisen-ct nixos.reisen-ct
nixos.sops nixos.sops
nixos.tailscale nixos.tailscale
@ -27,7 +28,8 @@ in {
nixos.grocy nixos.grocy
nixos.barcodebuddy nixos.barcodebuddy
./cloudflared.nix ./cloudflared.nix
] ++ optional hassVouchAuth nixos.access.home-assistant; ]
++ optional hassVouchAuth nixos.access.home-assistant;
services.nginx = { services.nginx = {
proxied.enable = true; proxied.enable = true;