about summary refs log tree commit diff stats
path: root/common/default.nix
blob: 41705a823a20ba36cfe554495f0e17784883e477 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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")
  // (mkProgramming "docs/%INIT_APPLICATION_NAME.1.md")