diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-02 13:44:56 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-02 13:44:56 +0200 |
commit | 10948ed35a04d6cbe05819acf9903e5e7395375b (patch) | |
tree | e5b57b6ef3aec62686d087969d9ed441209f7751 /templates | |
parent | fix(templates.nix): Adjust to the new `init` script (diff) | |
download | flake-templates-10948ed35a04d6cbe05819acf9903e5e7395375b.tar.gz flake-templates-10948ed35a04d6cbe05819acf9903e5e7395375b.zip |
feat(treewide): Also remove hard-coded values in the `templates/` dir
Diffstat (limited to '')
-rw-r--r-- | templates/awk/flake.nix | 9 | ||||
-rw-r--r-- | templates/c/flake.nix | 6 | ||||
-rw-r--r-- | templates/c/makefile | 5 | ||||
-rw-r--r-- | templates/latex/flake.nix | 6 | ||||
-rw-r--r-- | templates/latex/main.tex | 8 | ||||
-rw-r--r-- | templates/rust/Cargo.toml | 2 | ||||
-rw-r--r-- | templates/shell/flake.nix | 4 | ||||
-rwxr-xr-x | templates/shell/src/main.sh | 4 |
8 files changed, 23 insertions, 21 deletions
diff --git a/templates/awk/flake.nix b/templates/awk/flake.nix index 8dc59bf..4f61840 100644 --- a/templates/awk/flake.nix +++ b/templates/awk/flake.nix @@ -49,10 +49,9 @@ treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; # This version is set automatically on `cog bump --auto`; - version = "v1.0.0"; # GUIDING VERSION STRING + version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING - man_number = "1"; # TODO change if necessary - pname = "TODO"; + pname = "%INIT_APPLICATION_NAME"; build = pkgs.stdenv.mkDerivation { inherit version pname; @@ -64,11 +63,11 @@ buildPhase = '' mkdir --parents $out/docs; - pandoc ./docs/${pname}.${man_number}.md -s -t man > $out/docs/${pname}.${man_number} + pandoc ./docs/${pname}.1.md -s -t man > $out/docs/${pname}.1 ''; installPhase = '' - install -D $out/docs/${pname}.${man_number} $out/share/man/man${man_number}/${pname}; + install -D $out/docs/${pname}.1 $out/share/man/man1/${pname}; install -D ./src/${pname}.awk $out/bin/${pname}.awk; diff --git a/templates/c/flake.nix b/templates/c/flake.nix index a211b56..fea015c 100644 --- a/templates/c/flake.nix +++ b/templates/c/flake.nix @@ -51,14 +51,14 @@ treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; # This version is set automatically on `cog bump --auto`; - version = "v0.1.0"; # GUIDING VERSION STRING - pname = "TODO"; + version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING + pname = "%INIT_APPLICATION_NAME"; build = pkgs.stdenv.mkDerivation { inherit pname version; src = ./.; - makeFlags = ["PREFIX=${placeholder "out"}"]; + makeFlags = ["PREFIX=${placeholder "out"}" "BIN_VERSION=${version}"]; inherit nativeBuildInputs; }; in { diff --git a/templates/c/makefile b/templates/c/makefile index e5577c4..63ca24c 100644 --- a/templates/c/makefile +++ b/templates/c/makefile @@ -2,7 +2,10 @@ PREFIX := /usr/local BINPREFIX := $(DESTDIR)$(PREFIX)/bin MANPREFIX := $(DESTDIR)$(PREFIX)/share/man/man1 -BIN_NAME := TODO +BIN_NAME := %INIT_APPLICATION_NAME +# This version is set automatically on `cog bump --auto`; +BIN_VERSION := "v%INIT_APPLICATION_VERSION" # GUIDING VERSION STRING + # The trailing slash is important BUILD_DIR := ./target/ BIN_PATH := $(BUILD_DIR)$(BIN_NAME) diff --git a/templates/latex/flake.nix b/templates/latex/flake.nix index 0247cce..a87c795 100644 --- a/templates/latex/flake.nix +++ b/templates/latex/flake.nix @@ -72,7 +72,7 @@ pkgs = nixpkgs.legacyPackages.${system}; # This version is set automatically on `cog bump --auto`; - version = "v1.0.0"; # GUIDING VERSION STRING + version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING # TODO reduce to the needed ones texlive = pkgs.texlive.combined.scheme-full; @@ -80,7 +80,7 @@ treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; build = pkgs.stdenv.mkDerivation { - pname = "TODO"; + pname = "%INIT_APPLICATION_NAME"; inherit version; src = ./.; @@ -98,7 +98,7 @@ ''; installPhase = '' - install -D ./build/main.pdf $out/TODO; + install -D ./build/main.pdf "$out/%INIT_APPLICATION_NAME"; ''; }; in { diff --git a/templates/latex/main.tex b/templates/latex/main.tex index 591e600..a458b07 100644 --- a/templates/latex/main.tex +++ b/templates/latex/main.tex @@ -7,14 +7,14 @@ \input{headers/preamble_local.tex} \title{\textbf{TODO}} -\author{Benedikt Peetz \\ -\href{mailto:benedikt.peetz@b-peetz.de}{benedikt.peetz@b-peetz.de}\\[1cm] +\author{%INIT_AUTHOR_NAME \\ +\href{mailto:%INIT_AUTHOR_EMAIL}{%INIT_AUTHOR_EMAIL}\\[1cm] {\small Supervisor: TODO}} \date{\DTMToday} % For the copyright section -\years{2024} -\authors{Benedikt Peetz} +\years{%INIT_YEAR} +\authors{%INIT_AUTHOR_NAME} \makeatletter \hypersetup{ diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml index 86c4efa..487c507 100644 --- a/templates/rust/Cargo.toml +++ b/templates/rust/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "%INIT_APPLICATION_NAME" description = "%INIT_DESCRIPTION" -version = "0.1.0" +version = "%INIT_APPLICATION_VERSION" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/templates/shell/flake.nix b/templates/shell/flake.nix index 7f3cfd2..56aa9d1 100644 --- a/templates/shell/flake.nix +++ b/templates/shell/flake.nix @@ -60,8 +60,8 @@ treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; # This version is set automatically on `cog bump --auto`; - version = "v0.1.0"; # GUIDING VERSION STRING - pname = "TODO"; + version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING + pname = "%INIT_APPLICATION_NAME"; build = shell_library.lib.${system}.writeShellScript { inherit version; diff --git a/templates/shell/src/main.sh b/templates/shell/src/main.sh index 4c4c836..cf4e438 100755 --- a/templates/shell/src/main.sh +++ b/templates/shell/src/main.sh @@ -5,9 +5,9 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH # Both are used in `version` # shellcheck disable=2034 -AUTHORS="Benedikt Peetz" +AUTHORS="%INIT_AUTHOR_NAME" # shellcheck disable=2034 -YEARS="2024" +YEARS="%INIT_YEAR" printf "Hello World!\n\n" |