Change the way we read values from userdata

pull/19/head
Inex Code 2022-07-13 14:18:43 +03:00
parent 41187bb18f
commit ff536aa119
2 changed files with 54 additions and 6 deletions

View File

@ -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.";

View File

@ -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;
};
}