diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a67fb22 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix index 273b351..1f8f546 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; }; }; };