about summary refs log tree commit diff stats
path: root/pkgs/by-name/ne/neorg/package.nix
blob: 3d26d1fb87591f9431d0fef646b5b79703dfb054 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
  lib,
  sysLib,
  # dependencies
  cocogitto,
  rofi,
  libnotify,
  taskwarrior,
  gawk,
  findutils,
  # config
  defaultNeorgProjectDir ? "/no-default-dir", # homeConfig.programs.nixvim.plugins.neorg.settings.load."core.dirman".config.workspaces.projects
  allProjectsNewline ? "", # homeConfig.soispha.taskwarrior.projects.projects_newline
  allProjectsComma ? "", # homeConfig.soispha.taskwarrior.projects.projects_comma
  allProjectsPipe ? "", # homeConfig.soispha.taskwarrior.projects.projects_pipe
  allWorkspaces ? {}, # homeConfig.programs.nixvim.plugins.neorg.settings.load."core.dirman".config.workspaces
  xdgConfigHome ? builtins.getEnv "XDG_CONFIG_HOME",
  xdgDataHome ? builtins.getEnv "XDG_DATA_HOME",
}:
sysLib.writeShellScriptMultiPart {
  name = "neorg";
  src = ./.;
  generateCompletions = true;
  keepPath = true;

  baseName = "main.sh";
  cmdPrefix = "functions";
  cmdNames = [
    "add.sh"
    "context.sh"
    "dmenu.sh"
    "f_start.sh"
    "f_stop.sh"
    "inputs.sh"
    "list.sh"
    "project.sh"
    "review.sh"
    "utils.sh"
    "workspace.sh"
  ];

  dependencies = [
    cocogitto
    rofi
    libnotify
  ];
  replacementStrings = {
    DEFAULT_NEORG_PROJECT_DIR = defaultNeorgProjectDir;
    HOME_TASKRC = "${xdgConfigHome}/task/home-manager-taskrc";
    NEORG_REVIEW_PATH = "${xdgDataHome}/neorg/review";

    NEORG_INPUTS_STORAGE_FILE = "${xdgDataHome}/neorg/inputs/url_list.txt";

    ALL_PROJECTS_NEWLINE = allProjectsNewline;
    ALL_PROJECTS_COMMA = allProjectsComma;
    ALL_PROJECTS_PIPE = allProjectsPipe;
    ALL_WORKSPACES = "${lib.strings.concatStringsSep "|" (builtins.attrNames allWorkspaces)}";

    ID_GENERATION_FUNCTION = "${sysLib.writeShellScript {
      name = "neorg_id_function";
      src = ./neorg_id_function.sh;
      dependencies = [
        taskwarrior
        gawk
        findutils # source of xargs
      ];
    }}/bin/neorg_id_function";

    # TODO: Replace the hard-coded path here with some reference <2023-10-20>
    TASK_PROJECT_FILE = "/home/soispha/repos/nix/nixos-config/hm/soispha/conf/taskwarrior/projects/default.nix";
  };
}