From 284681cb1c37f2770cc5f56e48e6c68489c20513 Mon Sep 17 00:00:00 2001 From: kat witch Date: Sun, 5 Sep 2021 19:14:08 +0100 Subject: [PATCH] hosts/shinmyoumaru: Changed IP --- config/hosts/shinmyoumaru/nixos.nix | 2 +- config/modules/nixos/glauth.nix | 54 ++++++++++++++--------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/config/hosts/shinmyoumaru/nixos.nix b/config/hosts/shinmyoumaru/nixos.nix index 43244241..7c11925d 100644 --- a/config/hosts/shinmyoumaru/nixos.nix +++ b/config/hosts/shinmyoumaru/nixos.nix @@ -20,7 +20,7 @@ type = "resource"; connection = { port = head config.services.openssh.ports; - host = "192.168.1.145"; #config.network.addresses.private.nixos.ipv4.address; + host = config.network.addresses.private.nixos.ipv4.address; }; }; }; diff --git a/config/modules/nixos/glauth.nix b/config/modules/nixos/glauth.nix index 6462a836..2d97c0ee 100644 --- a/config/modules/nixos/glauth.nix +++ b/config/modules/nixos/glauth.nix @@ -48,36 +48,34 @@ in default = {}; }; }; - config = - let - localCheck = dbcfg.local && dbcfg.enable && dbcfg.host == "localhost"; - postgresCheck = localCheck && dbcfg.type == "postgres"; - mysqlCheck = localCheck && dbcfg.type == "mysql"; - in - mkIf cfg.enable { - services.glauth.settings = mkIf cfg.database.enable { - backend = - let - pluginHandlers = { - "mysql" = "NewMySQLHandler"; - "postgres" = "NewPostgresHandler"; - "sqlite" = "NewSQLiteHandler"; - }; - in - { - datastore = "plugin"; - plugin = "${cfg.package}/bin/${dbcfg.type}.so"; - pluginhandler = pluginHandlers.${dbcfg.type}; - database = if (dbcfg.type != "sqlite") then (builtins.replaceStrings (singleton "\n") (singleton " ") '' - host=${dbcfg.host} - port=${toString dbcfg.port} - dbname=glauth - user=${dbcfg.username} - password=@db-password@ - sslmode=${if dbcfg.ssl then "enable" else "disable"} - '') else "database = \"gl.db\""; + config = let + localCheck = dbcfg.local && dbcfg.enable && dbcfg.host == "localhost"; + postgresCheck = localCheck && dbcfg.type == "postgres"; + mysqlCheck = localCheck && dbcfg.type == "mysql"; + in mkIf cfg.enable { + services.glauth.settings = mkIf cfg.database.enable { + backend = + let + pluginHandlers = { + "mysql" = "NewMySQLHandler"; + "postgres" = "NewPostgresHandler"; + "sqlite" = "NewSQLiteHandler"; }; + in + { + datastore = "plugin"; + plugin = "${cfg.package}/bin/${dbcfg.type}.so"; + pluginhandler = pluginHandlers.${dbcfg.type}; + database = if (dbcfg.type != "sqlite") then (builtins.replaceStrings (singleton "\n") (singleton " ") '' + host=${dbcfg.host} + port=${toString dbcfg.port} + dbname=glauth + user=${dbcfg.username} + password=@db-password@ + sslmode=${if dbcfg.ssl then "enable" else "disable"} + '') else "database = \"gl.db\""; }; + }; systemd.services.glauthPostgreSQLInit = lib.mkIf postgresCheck {