diff options
author | EuAndreh <eu@euandre.org> | 2020-08-23 07:41:32 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-08-23 07:41:32 -0300 |
commit | 1d933403056ba8a3ae074b01af4844e59804c41c (patch) | |
tree | 086147c8e3b90edecf9f8d64fdc8ec15924eda3c | |
parent | Add favicon to conversejs page (diff) | |
download | toph-1d933403056ba8a3ae074b01af4844e59804c41c.tar.gz toph-1d933403056ba8a3ae074b01af4844e59804c41c.tar.xz |
Use fold to mkdir and chmod all data folders
-rw-r--r-- | secrets/secret-envrc.sh | bin | 4308 -> 4353 bytes | |||
-rw-r--r-- | vps-configuration.env.nix | 22 |
2 files changed, 8 insertions, 14 deletions
diff --git a/secrets/secret-envrc.sh b/secrets/secret-envrc.sh Binary files differindex b14f20a..3039b8c 100644 --- a/secrets/secret-envrc.sh +++ b/secrets/secret-envrc.sh diff --git a/vps-configuration.env.nix b/vps-configuration.env.nix index 8fca172..5434f5f 100644 --- a/vps-configuration.env.nix +++ b/vps-configuration.env.nix @@ -13,8 +13,9 @@ let authorizedKey = "$AUTHORIZED_KEY"; userPassword = "$USER_PASSWORD"; userName = "$USER_NAME"; - staticRoot = "$STATIC_ROOT"; dataRoot = "$DATA_ROOT"; + staticRoot = "$STATIC_ROOT"; + faviconsRoot = "$FAVICONS_ROOT"; nextcloudDatabaseUser = "$NEXTCLOUD_DATABASE_USER"; nextcloudDatabasePassword = "$NEXTCLOUD_DATABASE_PASSWORD"; nextcloudAdminUser = "$NEXTCLOUD_ADMIN_USER"; @@ -251,6 +252,7 @@ in { source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py about-filter=${pkgs.cgit}/lib/cgit/filters/about-formatting.sh scan-path=${envsubstConfiguration.gitRoot} + readme=:README.md ''; }; }; @@ -265,19 +267,11 @@ in { enable = true; description = "Setup data folders and permissions"; wantedBy = [ "multi-user.target" ]; - script = '' - mkdir -p ${envsubstConfiguration.dataRoot} - chown -R ${envsubstConfiguration.userName}:users ${envsubstConfiguration.dataRoot} - chmod -R 755 ${envsubstConfiguration.dataRoot} - - mkdir -p ${envsubstConfiguration.staticRoot} - chown -R ${envsubstConfiguration.userName}:users ${envsubstConfiguration.staticRoot} - chmod -R 755 ${envsubstConfiguration.staticRoot} - - mkdir -p ${envsubstConfiguration.gitRoot} - chown -R ${envsubstConfiguration.userName}:users ${envsubstConfiguration.gitRoot} - chmod -R 755 ${envsubstConfiguration.gitRoot} - ''; + script = pkgs.lib.fold (p: acc: acc + '' + mkdir -p ${DOLLAR}{p} + chown -R andreh:users ${DOLLAR}{p} + chmod -R 755 ${DOLLAR}{p} + '') "" (with envsubstConfiguration; [staticRoot gitRoot faviconsRoot dataRoot]); serviceConfig = { Type = "oneshot"; }; }; }; |