stitch

Note taking for messy minimalists

git clone git://mccd.space/stitch
commit 8dbf8014991bd7456dfa09b85f07c04086d70459
parent efe45feea10551feda95d647dccecd973cfe5320
Author: Marc Coquand <marc@mccd.space>
Date:   Fri, 17 May 2024 12:03:09 -0500

stuff

Diffstat:
M.gitignore | 1+
MREADME | 21++++++++++++++++++---
Mbin/dune | 16++++++++++++++++
Mdune-project | 1+
Mflake.nix | 26++++++++------------------
Mstitch.opam | 7++++---
Astitch.opam.template | 14++++++++++++++
7 files changed, 62 insertions(+), 24 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,2 +1,3 @@
 _build/*
 .direnv
+result
diff --git a/README b/README
@@ -37,17 +37,21 @@ _________________
 
   Stitch does not have any opinion about which file format you use for
   file capturing, use org, markdown, whatever you want. You can also
-  customize the grep command to speed up performance.
+  customize the grep command to speed up performance. It only requires
+  that each note is contained to one file
 
   Stitch does not come with any note capturing system built in, but
   instead makes it easy for you to set up your own system in with your
   preferred editor.  There is a basic example included in the manpages.
 
+  Stitch comes as a single static binary, but uses grep, sort, cut, find
+  to work.
+
 
 1.1 FEATURES
 ~~~~~~~~~~~~
 
-  - Single binary
+  - Single static binary (though it makes use of coreutils)
   - No need for any DB, just files
   - UNIXy & fast
   - Work with any file format, markdown, ruby markup, org etc.
@@ -91,12 +95,21 @@ _________________
 
   dune exec -- stitch --help=groff
 
+  To prepare for release, run 
+
+  dune build --profile release
+  
+  Binary will be found in ./_build/default/bin/stitch
+
 
 1.6 ROADMAP
 ~~~~~~~~~~~
 
   - Support sort
-  - Support easy tagging
+  - Support tagging commands
+  - Support command pipign and hotkeys 
+  - Line wrapping
+  - Support URL shortening.
 
 
 2 KNOWN ISSUES
@@ -111,6 +124,8 @@ _________________
     uniform file name that we can regexp (and also tweak). I am not sure
     yet what's best.
 
+  - The binary file is kinda big, 5mb. I'd love to slim it down.
+
 
 3 Author
 ========
diff --git a/bin/dune b/bin/dune
@@ -1,5 +1,7 @@
 (executable
  (public_name stitch)
+ (package stitch)
+ (flags (:standard -cclib -static -cclib -no-pie))
  (name main)
  (libraries
   stitch
@@ -10,3 +12,17 @@
   notty.unix
   shexp.process
   lambda-term))
+
+
+; Rule to generate a man page for stitch
+(rule
+  (target        stitch.1)
+  (action (with-outputs-to %{target} (run stitch --help=groff)))
+)
+
+; Install the man page
+(install
+ (section  man)
+ (files    stitch.1)
+ (package  stitch)
+)
diff --git a/dune-project b/dune-project
@@ -1,6 +1,7 @@
 (lang dune 3.11)
 
 (name stitch)
+(version efe45fe-dirty)
 
 (generate_opam_files true)
 
diff --git a/flake.nix b/flake.nix
@@ -33,9 +33,14 @@
           ${package} = prev.${package}.overrideAttrs (_: {
             # Prevent the ocaml dependencies from leaking into dependent environments
             doNixSupport = false;
-            buildInputs =
-              [ pkgs."gmp" pkgs."libev" pkgs."openssl" pkgs."libargon2" ];
-            DUNE_PROFILE = "release";
+           buildInputs = [
+              pkgs.glibc.static
+              pkgs.zlib.static
+              pkgs.binutils-unwrapped
+              pkgs.ocaml
+              pkgs.musl
+              pkgs.gcc
+            ];
           });
         };
         scope' = scope.overrideScope' overlay;
@@ -49,21 +54,6 @@
 
         packages.default = main;
 
-
-        defaultPackage = pkgs.stdenv.mkDerivation {
-          name = "stitch";
-          src = ./.;
-          buildInputs = devPackages;
-          buildPhase = ''
-            dune build --profile release
-          '';
-
-          installPhase = ''
-            echo "building to $out"
-            cp _build/install/default/bin/stitch/ $out
-          '';
-        };
-
         apps.stitch.default = {
           type = "app";
           program = "${main}/bin/stitch";
diff --git a/stitch.opam b/stitch.opam
@@ -1,5 +1,6 @@
 # This file is generated by dune, edit dune-project instead
 opam-version: "2.0"
+version: "efe45fe-dirty"
 synopsis: "A Note Composer"
 description:
   "A minimal CLI tool that allows you to compose notes together. Useful as part of a bigger system for building a PKM."
@@ -18,7 +19,7 @@ depends: [
   "odoc" {with-doc}
 ]
 build: [
-  ["dune" "subst"] {dev}
+  ["dune" "subst"] {release}
   [
     "dune"
     "build"
@@ -27,7 +28,7 @@ build: [
     "-j"
     jobs
     "@install"
-    "@runtest" {with-test}
-    "@doc" {with-doc}
+    "--profile"
+    "release"
   ]
 ]
diff --git a/stitch.opam.template b/stitch.opam.template
@@ -0,0 +1,14 @@
+build: [
+  ["dune" "subst"] {release}
+  [
+    "dune"
+    "build"
+    "-p"
+    name
+    "-j"
+    jobs
+    "@install"
+    "--profile"
+    "release"
+  ]
+]