about summary refs log tree commit diff stats
path: root/common
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-02 13:15:35 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-04-02 13:24:34 +0200
commit7a366a44cf7f0aa2cb3471b9b03a83acba157707 (patch)
tree459d6fb8d965111414fb187415aad0d16dc64792 /common
parentchore(version): v0.5.0 (diff)
downloadflake-templates-7a366a44cf7f0aa2cb3471b9b03a83acba157707.tar.gz
flake-templates-7a366a44cf7f0aa2cb3471b9b03a83acba157707.zip
build(update_common_files): Allow to specify which file to move where
Diffstat (limited to '')
-rw-r--r--common/default.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/common/default.nix b/common/default.nix
new file mode 100644
index 0000000..473d4f8
--- /dev/null
+++ b/common/default.nix
@@ -0,0 +1,39 @@
+# This file specifies which files in the `./common` directory should be copied to which
+# template in `./templates`
+let
+  programmingLanguages = [
+    "awk"
+    "c"
+    "rust"
+    "shell"
+  ];
+  allLanguages =
+    programmingLanguages
+    ++ [
+      "latex"
+    ];
+  mkName = name: "./${name}";
+
+  mkBase = name: langs: {
+    "${mkName name}" = langs;
+  };
+
+  mkLang = name: lang: let
+    realLang =
+      if builtins.elem lang allLanguages
+      then lang
+      else builtins.throw "${lang} is not a recognized language!";
+  in
+    mkBase name [realLang];
+  mkProgramming = name:
+    mkBase name programmingLanguages;
+  mkAll = name:
+    mkBase name allLanguages;
+
+in
+  {}
+  // (mkAll ".licensure.yml")
+  // (mkAll "init")
+  // (mkAll "scripts/renew_copyright_header.sh")
+  // (mkAll "shell_line_editor.sh")
+  // (mkAll "treefmt.nix")