Added Nix run target

This commit is contained in:
2025-11-28 09:10:52 +01:00
parent 90c0d3acf7
commit 5dd0cfbe6d
2 changed files with 15 additions and 5 deletions

View File

@@ -21,10 +21,10 @@ apt install csvkit jq zip # for Debian/Ubuntu/...
Just run:
```bash
nix build
nix run "git+https://git.zumepro.cz/tul/tultemplategen"
```
This will pull all the necessary dependencies, build the newest version from upstream, pack it and symlink it as `result`.
This will start a local instance of the generator on `localhost:8080`.
## Hosting the generator yourself

View File

@@ -8,9 +8,7 @@
outputs = { nixpkgs, utils, tultemplate2, ... }: (utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages.default = pkgs.stdenv.mkDerivation {
tultemplategen = pkgs.stdenv.mkDerivation {
name = "tultemplategen";
src = ./.;
packageRootDir = "tul-thesis";
@@ -29,6 +27,18 @@
cp -R src lib assets index.html template.zip $out
'';
};
server = with pkgs; (writeShellScriptBin "tultemplategen-server" ''
cd ${tultemplategen}
${python3}/bin/python -m http.server --bind localhost 8080
'');
in
{
packages.default = tultemplategen;
apps.default = {
type = "app";
program = "${server}/bin/tultemplategen-server";
meta.description = "Tultemplategen Server";
};
}
));
}