From 9d841295f3da4e02d7b7e87fac86b25cd1081f36 Mon Sep 17 00:00:00 2001 From: Bob van der Linden Date: Mon, 2 Oct 2017 21:04:32 +0200 Subject: [PATCH] gogs: avoid creating symlinks each run --- nixos/modules/services/misc/gogs.nix | 10 ++++++++++ pkgs/applications/version-management/gogs/default.nix | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/gogs.nix b/nixos/modules/services/misc/gogs.nix index cf1fbc7bcfa9..f6d326e43d94 100644 --- a/nixos/modules/services/misc/gogs.nix +++ b/nixos/modules/services/misc/gogs.nix @@ -25,6 +25,7 @@ let HTTP_ADDR = ${cfg.httpAddress} HTTP_PORT = ${toString cfg.httpPort} ROOT_URL = ${cfg.rootUrl} + STATIC_ROOT_PATH = ${cfg.staticRootPath} [session] COOKIE_NAME = session @@ -175,6 +176,13 @@ in ''; }; + staticRootPath = mkOption { + type = types.str; + default = "${pkgs.gogs.data}"; + example = "/var/lib/gogs/data"; + description = "Upper level of template and static files path."; + }; + extraConfig = mkOption { type = types.str; default = ""; @@ -195,6 +203,8 @@ in runConfig = "${cfg.stateDir}/custom/conf/app.ini"; secretKey = "${cfg.stateDir}/custom/conf/secret_key"; in '' + mkdir -p ${cfg.stateDir} + # copy custom configuration and generate a random secret key if needed ${optionalString (cfg.useWizard == false) '' mkdir -p ${cfg.stateDir}/custom/conf diff --git a/pkgs/applications/version-management/gogs/default.nix b/pkgs/applications/version-management/gogs/default.nix index d37057583072..5553a759894a 100644 --- a/pkgs/applications/version-management/gogs/default.nix +++ b/pkgs/applications/version-management/gogs/default.nix @@ -33,10 +33,7 @@ buildGoPackage rec { cp -R $src/{public,templates} $data wrapProgram $bin/bin/gogs \ - --prefix PATH : ${makeBinPath [ bash git gzip openssh ]} \ - --run 'export GOGS_WORK_DIR=''${GOGS_WORK_DIR:-$PWD}' \ - --run 'mkdir -p "$GOGS_WORK_DIR" && cd "$GOGS_WORK_DIR"' \ - --run "ln -fs $data/{public,templates} ." + --prefix PATH : ${makeBinPath [ bash git gzip openssh ]} ''; goPackagePath = "github.com/gogits/gogs";