added etc

This commit is contained in:
stuce-bot 2025-06-10 08:44:51 +02:00
parent cb9ae44ec4
commit 57d862183d
2 changed files with 41 additions and 21 deletions

View file

@ -8,16 +8,18 @@
outputs = {
self,
nixpkgs,
}: {
}: let
src = fetchTarball {
url = "https://git.stuce.ch/stuce/sTodo/releases/download/Release1/release1.tar.gz";
sha256 = "10jyldwmcs5zyz1k8lp3jscn7nhlvn56g0709l5jp91qimw7xiqz";
};
in
{
packages.x86_64-linux.sTodo = with nixpkgs.legacyPackages.x86_64-linux;
stdenv.mkDerivation {
pname = "sTodo";
version = "1.0.0";
src = fetchTarball {
url = "https://git.stuce.ch/stuce/sTodo/releases/download/Release1/release1.tar.gz";
sha256 = "10jyldwmcs5zyz1k8lp3jscn7nhlvn56g0709l5jp91qimw7xiqz";
};
buildInputs = [zlib gmp libffi openssl];
installPhase = ''
mkdir -p $out/bin
@ -44,19 +46,6 @@
default = "http://localhost:6901";
description = "Link used to access the webapp";
};
staticRoot = lib.mkOption {
type = lib.types.str;
default = "/etc/sTodo/static";
description = "Location of the static folder";
};
databaseFolder = lib.mkOption {
type = lib.types.str;
default = "/etc/sTodo/sTodo.sqlite3";
description = "Location of the database folder";
};
clientSessionKey = lib.mkOption {
type = lib.types.str;
default = "/etc/sTodo/client_session_key.aes";
@ -72,6 +61,10 @@
# Systemd Service
config = lib.mkIf cfg.enable {
environment.etc = {
source = "$src/static";
target = "sTodo/static";
};
systemd.services.sTodo = {
description = "Launch a sTodo app to have a online todolist";
after = ["network.target"];
@ -83,9 +76,9 @@
environment = {
YESOD_PORT = "${toString cfg.port}";
YESOD_APPROOT = "${cfg.appRoot}";
YESOD_SQLITE_DATABASE = "${cfg.databaseFolder}";
YESOD_STATIC_DIR = "${cfg.staticRoot}";
YESOD_SESSION_KEY = "${cfg.clientSessionKey}";
YESOD_SQLITE_DATABASE = "/etc/sTodo/sTodo.sqlite3";
YESOD_STATIC_DIR = "/etc/sTodo/static";
YESOD_SESSION_KEY = "/etc/sTodo/client_session_key.aes";
};
};
};