From ff536aa11974021b0091467ae7e2de6632b1955c Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 13 Jul 2022 14:18:43 +0300 Subject: [PATCH] Change the way we read values from userdata --- variables-module.nix | 4 ---- variables.nix | 56 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/variables-module.nix b/variables-module.nix index 9df33cd..0d5b056 100644 --- a/variables-module.nix +++ b/variables-module.nix @@ -11,10 +11,6 @@ let in { options.services.userdata = { - enable = mkOption { - default = true; - type = types.nullOr types.bool; - }; # General server options hostname = mkOption { description = "The hostname of the server."; diff --git a/variables.nix b/variables.nix index 79fb145..dfed086 100644 --- a/variables.nix +++ b/variables.nix @@ -1,6 +1,58 @@ { pkgs, ... }: +let + jsonData = builtins.fromJSON (builtins.readFile ./userdata/userdata.json); +in { - services = { - userdata = builtins.fromJSON (builtins.readFile ./userdata/userdata.json); + services.userdata = { + hostname = jsonData.hostname; + domain = jsonData.domain; + timezone = jsonData.timezone; + autoUpgrade = { + enable = jsonData.autoUpgrade.enable; + allowReboot = jsonData.autoUpgrade.allowReboot; + }; + username = jsonData.username; + hashedMasterPassword = jsonData.hashedMasterPassword; + sshKeys = jsonData.sshKeys; + api = { + token = jsonData.api.token; + enableSwagger = jsonData.api.enableSwagger; + skippedMigrations = jsonData.api.skippedMigrations; + }; + backblaze = { + bucket = jsonData.backblaze.bucket; + accountId = jsonData.backblaze.accountId; + accountKey = jsonData.backblaze.accountKey; + }; + cloudflare = { + apiKey = jsonData.cloudflare.apiKey; + }; + databasePassword = jsonData.databasePassword; + bitwarden = { + enable = jsonData.bitwarden.enable; + }; + gitea = { + enable = jsonData.gitea.enable; + }; + nextcloud = { + enable = jsonData.nextcloud.enable; + adminPassword = jsonData.nextcloud.adminPassword; + }; + pleroma = { + enable = jsonData.pleroma.enable; + }; + jitsi = { + enable = jsonData.jitsi.enable; + }; + ocserv = { + enable = jsonData.ocserv.enable; + }; + resticPassword = jsonData.resticPassword; + ssh = { + enable = jsonData.ssh.enable; + rootKeys = jsonData.ssh.rootKeys; + passwordAuthentication = jsonData.ssh.passwordAuthentication; + }; + users = jsonData.users; }; }