Compare commits
2 commits
ad67e6a215
...
1c38b53ae2
Author | SHA1 | Date | |
---|---|---|---|
|
1c38b53ae2 | ||
|
cd19bd75b3 |
25
flake.lock
Normal file
25
flake.lock
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731890469,
|
||||||
|
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "5083ec887760adfe12af64830a66807423a859a7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
19
flake.nix
Normal file
19
flake.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
description = "Website";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
in {
|
||||||
|
devShell.x86_64-linux = with pkgs;
|
||||||
|
mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
imagemagick
|
||||||
|
just
|
||||||
|
libavif
|
||||||
|
libjxl
|
||||||
|
pandoc
|
||||||
|
tup
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
2
variant_path/.gitignore
vendored
Normal file
2
variant_path/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/build-default
|
||||||
|
!/build-default/tup.config
|
0
variant_path/Tupfile.ini
Normal file
0
variant_path/Tupfile.ini
Normal file
9
variant_path/Tuprules.tup
Normal file
9
variant_path/Tuprules.tup
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
&templates_dir = ./templates
|
||||||
|
|
||||||
|
# This doesn't work, cannot find the generated header.txt
|
||||||
|
# I want to access the variant path for templates/ but $(TUP_VARIANTDIR) will
|
||||||
|
# follow the current Tupfile and there is no variant "anchor" like &-variables.
|
||||||
|
!add_header = | &(templates_dir)/<header_group> |> cat &(templates_dir)/header.txt %f &(templates_dir)/footer.txt > %o |> %B.gen.txt
|
||||||
|
|
||||||
|
# This works
|
||||||
|
#!add_header = | &(templates_dir)/<header_group> |> cat %f &(templates_dir)/footer.txt > %o |> %B.gen.txt
|
3
variant_path/nested/a/Tupfile
Normal file
3
variant_path/nested/a/Tupfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
include_rules
|
||||||
|
|
||||||
|
: a.txt |> !add_header |>
|
1
variant_path/nested/a/a.txt
Normal file
1
variant_path/nested/a/a.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
letter a
|
3
variant_path/nested/a/b/Tupfile
Normal file
3
variant_path/nested/a/b/Tupfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
include_rules
|
||||||
|
|
||||||
|
: b.txt |> !add_header |>
|
1
variant_path/nested/a/b/b.txt
Normal file
1
variant_path/nested/a/b/b.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
letter b
|
3
variant_path/nested/a/b/c/Tupfile
Normal file
3
variant_path/nested/a/b/c/Tupfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
include_rules
|
||||||
|
|
||||||
|
: c.txt |> !add_header |>
|
1
variant_path/nested/a/b/c/c.txt
Normal file
1
variant_path/nested/a/b/c/c.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
letter c
|
1
variant_path/templates/Tupfile
Normal file
1
variant_path/templates/Tupfile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
: |> ./generate_header.sh > %o |> header.txt ./<header_group>
|
2
variant_path/templates/footer.txt
Normal file
2
variant_path/templates/footer.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
--
|
||||||
|
the end
|
8
variant_path/templates/generate_header.sh
Executable file
8
variant_path/templates/generate_header.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
YEAR $(date +%Y)
|
||||||
|
====
|
||||||
|
EOF
|
Loading…
Reference in a new issue