summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 71c63017f011ac0971edd2db1edf3bd924f662b5 (plain)
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
{
  description = "journal";

  outputs = { self, nixpkgs }:
    let
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      f = "%Y/%m";
    in
    {

      packages.x86_64-linux.default =
        # starts nvim with 2 months of journal entries ahead and behing
        # nvim --cmd 'source .nvimrc' -O 2023/10 2023/11 2023/12 2024/01
        pkgs.writeScriptBin "journal" ''
          nvim --cmd 'source .nvimrc' -O $(
            ${pkgs.dateutils}/bin/dateseq \
                "$(date --date "2 months ago" +${f})" \
                "$(date --date "2 months" +${f})" \
                -i ${f} \
                -f ${f}
          )
        '';

      devShell.x86_64-linux =
        pkgs.mkShell
          {
            nativeBuildInputs = [
              self.packages.x86_64-linux.default
            ];
          };

    };
}