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

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1749285348,
"narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3e3afe5174c561dee0df6f2c2b2236990146329f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -8,16 +8,18 @@
outputs = { outputs = {
self, self,
nixpkgs, 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; packages.x86_64-linux.sTodo = with nixpkgs.legacyPackages.x86_64-linux;
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "sTodo"; pname = "sTodo";
version = "1.0.0"; 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]; buildInputs = [zlib gmp libffi openssl];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
@ -44,19 +46,6 @@
default = "http://localhost:6901"; default = "http://localhost:6901";
description = "Link used to access the webapp"; 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 { clientSessionKey = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/etc/sTodo/client_session_key.aes"; default = "/etc/sTodo/client_session_key.aes";
@ -72,6 +61,10 @@
# Systemd Service # Systemd Service
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.etc = {
source = "$src/static";
target = "sTodo/static";
};
systemd.services.sTodo = { systemd.services.sTodo = {
description = "Launch a sTodo app to have a online todolist"; description = "Launch a sTodo app to have a online todolist";
after = ["network.target"]; after = ["network.target"];
@ -83,9 +76,9 @@
environment = { environment = {
YESOD_PORT = "${toString cfg.port}"; YESOD_PORT = "${toString cfg.port}";
YESOD_APPROOT = "${cfg.appRoot}"; YESOD_APPROOT = "${cfg.appRoot}";
YESOD_SQLITE_DATABASE = "${cfg.databaseFolder}"; YESOD_SQLITE_DATABASE = "/etc/sTodo/sTodo.sqlite3";
YESOD_STATIC_DIR = "${cfg.staticRoot}"; YESOD_STATIC_DIR = "/etc/sTodo/static";
YESOD_SESSION_KEY = "${cfg.clientSessionKey}"; YESOD_SESSION_KEY = "/etc/sTodo/client_session_key.aes";
}; };
}; };
}; };