1{ stdenv, lib, fetchFromGitHub, installShellFiles }:
2
3stdenv.mkDerivation rec {
4 pname = "nb";
5 version = "7.12.1";
6
7 src = fetchFromGitHub {
8 owner = "xwmx";
9 repo = "nb";
10 rev = version;
11 sha256 = "sha256-vy2WrFh4ukc6f0YFVaHvw0k1Wm9mdhh9p2MKLc/566U=";
12 };
13
14 nativeBuildInputs = [ installShellFiles ];
15
16 dontBuild = true;
17
18 installPhase = ''
19 mkdir -p $out/bin/
20 mv nb $out/bin/
21 runHook postInstall
22 '';
23
24 postInstall = ''
25 installShellCompletion --cmd nb etc/nb-completion.{bash,zsh,fish}
26 '';
27
28 meta = with lib; {
29 description = "A command line note-taking, bookmarking, archiving, and knowledge base application";
30 longDescription = ''
31 `nb` creates notes in text-based formats like Markdown, Emacs Org mode,
32 and LaTeX, can work with files in any format, can import and export notes
33 to many document formats, and can create private, password-protected
34 encrypted notes and bookmarks. With `nb`, you can write notes using Vim,
35 Emacs, VS Code, Sublime Text, and any other text editor you like. `nb`
36 works in any standard Linux / Unix environment, including macOS and
37 Windows via WSL. Optional dependencies can be installed to enhance
38 functionality, but `nb` works great without them.
39
40 `nb` is also a powerful text-based CLI bookmarking system. Page
41 information is automatically downloaded, compiled, and saved into normal
42 Markdown documents made for humans, so bookmarks are easy to edit just
43 like any other note.
44
45 `nb` uses Git in the background to automatically record changes and sync
46 notebooks with remote repositories. `nb` can also be configured to sync
47 notebooks using a general purpose syncing utility like Dropbox so notes
48 can be edited in other apps on any device.
49
50 `nb` is designed to be portable, future-focused, and vendor independent,
51 providing a full-featured and intuitive experience within a highly
52 composable user-centric text interface. The entire program is a single
53 well-tested shell script that can be installed, copied, or curled almost
54 anywhere and just work, using progressive enhancement for various
55 experience improvements in more capable environments. `nb` works great
56 whether you have one notebook with just a few notes or dozens of
57 notebooks containing thousands of notes, bookmarks, and other items. `nb`
58 makes it easy to incorporate other tools, writing apps, and workflows.
59 `nb` can be used a little, a lot, once in a while, or for just a subset
60 of features. `nb` is flexible.
61 '';
62 homepage = "https://xwmx.github.io/nb/";
63 license = licenses.agpl3Plus;
64 maintainers = [ maintainers.toonn ];
65 platforms = platforms.all;
66 mainProgram = "nb";
67 };
68}