From 41ca1fce03f10625feffec2798f97cbe98798236 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Thu, 2 Apr 2026 22:54:11 +0200 Subject: [PATCH 1/6] refactor(flake): read version from Cargo.toml Extract version from Cargo.toml using builtins.fromTOML as single source of truth instead of hardcoding "0.1.0" in derivations. --- flake.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d0c3479..430150f 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,9 @@ inherit (nixpkgs) lib; forAllSystems = lib.genAttrs lib.systems.flakeExposed; + # Read version from Cargo.toml as single source of truth + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; + mkPkgs = system: import nixpkgs { @@ -58,7 +61,7 @@ commonArgs = { src = craneLib.path ./.; pname = "streamd"; - version = "0.1.0"; + inherit version; strictDeps = true; }; -- 2.53.0 From 73ecd4e89ec9e0a8d259616aed604f279669f6fc Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Thu, 2 Apr 2026 22:54:42 +0200 Subject: [PATCH 2/6] feat(flake): add musl static build for streamd Add mkMuslCraneLib and mkStreamdMusl functions to create a statically-linked binary using the x86_64-unknown-linux-musl target. This enables portable binaries that don't depend on system glibc. --- flake.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/flake.nix b/flake.nix index 430150f..9f0f395 100644 --- a/flake.nix +++ b/flake.nix @@ -105,6 +105,32 @@ commitizen.enable = true; }; }; + + mkMuslCraneLib = + system: + let + pkgs = mkPkgs system; + toolchain = pkgs.rust-bin.stable.latest.default.override { + targets = [ "x86_64-unknown-linux-musl" ]; + }; + in + (crane.mkLib pkgs).overrideToolchain toolchain; + + mkStreamdMusl = + system: + let + craneLib = mkMuslCraneLib system; + commonArgs = { + src = craneLib.path ./.; + pname = "streamd"; + inherit version; + strictDeps = true; + CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl"; + CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; + }; + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + in + craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); in { packages = forAllSystems ( -- 2.53.0 From 8b210a3b41aa2dcab0715b2083900decc7adf251 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Thu, 2 Apr 2026 22:55:14 +0200 Subject: [PATCH 3/6] feat(flake): add .deb packaging with shell completions Add mkStreamdDeb function that uses nfpm to create a .deb package containing the statically-linked binary and shell completions for bash, zsh, and fish. --- flake.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/flake.nix b/flake.nix index 9f0f395..e1783e8 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,48 @@ cargoArtifacts = craneLib.buildDepsOnly commonArgs; in craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); + + mkStreamdDeb = + system: + let + pkgs = mkPkgs system; + streamd-musl = mkStreamdMusl system; + in + pkgs.runCommand "streamd_${version}_amd64.deb" { + nativeBuildInputs = [ pkgs.nfpm ]; + } '' + # Generate shell completions + mkdir -p completions + ${streamd-musl}/bin/streamd completions bash > completions/streamd.bash + ${streamd-musl}/bin/streamd completions zsh > completions/_streamd + ${streamd-musl}/bin/streamd completions fish > completions/streamd.fish + + cat > nfpm.yaml < Date: Thu, 2 Apr 2026 22:55:44 +0200 Subject: [PATCH 4/6] feat(flake): expose streamd-musl and streamd-deb packages Update packages output to include streamd-musl (static binary) and streamd-deb (.deb package) alongside the default streamd package. --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index e1783e8..38723ae 100644 --- a/flake.nix +++ b/flake.nix @@ -179,9 +179,11 @@ system: let streamd = mkStreamd system; + streamd-musl = mkStreamdMusl system; + streamd-deb = mkStreamdDeb system; in { - inherit streamd; + inherit streamd streamd-musl streamd-deb; default = streamd; } ); -- 2.53.0 From dfd359802ff80636ce2446b3e238684643838f02 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Thu, 2 Apr 2026 22:56:11 +0200 Subject: [PATCH 5/6] feat(ci): add release workflow for .deb and static binary Add Forgejo Actions workflow that builds and publishes releases: - Triggers on tag push (v*) or manual workflow dispatch - Builds static binary using musl target - Creates .deb package with shell completions - Uploads artifacts to Forgejo Releases Requires RELEASE_TOKEN secret to be configured in repository settings. --- .forgejo/workflows/release.yml | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..8daf837 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,82 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + release: + name: Build and Release + runs-on: nix + + steps: + - name: Check out Repository + uses: https://git.konstantinfickel.de/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 0 + + - name: Extract version and handle tagging + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + # Manual trigger: read version from Cargo.toml + VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') + TAG="v${VERSION}" + + # Check if tag already exists + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "::error::Version ${VERSION} is already released" + exit 1 + fi + + # Create and push the tag + git tag "$TAG" + git push origin "$TAG" + + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo "TAG=${TAG}" >> $GITHUB_OUTPUT + else + # Tag push trigger: extract version from tag + VERSION="${GITHUB_REF_NAME#v}" + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT + fi + + - name: Build .deb package + run: nix build .#streamd-deb -o result-deb + + - name: Build static binary + run: nix build .#streamd-musl -o result-musl + + - name: Prepare release artifacts + run: | + mkdir -p release + cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb + cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64 + + - name: Create release + uses: https://code.forgejo.org/actions/forgejo-release@v2 + with: + direction: upload + url: https://git.konstantinfickel.de + repo: kfickel/streamd + token: ${{ secrets.RELEASE_TOKEN }} + tag: ${{ steps.version.outputs.TAG }} + release-dir: release + release-notes: | + ## streamd ${{ steps.version.outputs.VERSION }} + + ### Debian/Ubuntu + ```bash + wget /streamd_${{ steps.version.outputs.VERSION }}_amd64.deb + sudo dpkg -i streamd_${{ steps.version.outputs.VERSION }}_amd64.deb + ``` + + ### Static binary + ```bash + wget /streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64 + chmod +x streamd-*-linux-x86_64 + sudo mv streamd-*-linux-x86_64 /usr/local/bin/streamd + ``` -- 2.53.0 From ae539f01c95c9a8e17987f6706ad0288e1aadba0 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Thu, 2 Apr 2026 22:56:40 +0200 Subject: [PATCH 6/6] docs: add installation instructions for .deb, binary, and Nix Document the three installation methods: - Debian/Ubuntu .deb package with shell completions - Statically-linked binary for any Linux system - Nix flake and Home Manager module --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 1ee95a9..a738339 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,39 @@ Strea.md is a personal knowledge management and time-tracking CLI tool. It organizes time-ordered markdown files using `@tag` annotations, letting you manage tasks, track time, and query your notes from the terminal. +## Installation + +### Debian/Ubuntu (.deb package) + +Download and install the latest release: + +```bash +wget https://git.konstantinfickel.de/kfickel/streamd/releases/download/vX.Y.Z/streamd_X.Y.Z_amd64.deb +sudo dpkg -i streamd_X.Y.Z_amd64.deb +``` + +This includes shell completions for bash, zsh, and fish. + +### Static Binary + +Download the statically-linked binary: + +```bash +wget https://git.konstantinfickel.de/kfickel/streamd/releases/download/vX.Y.Z/streamd-X.Y.Z-linux-x86_64 +chmod +x streamd-X.Y.Z-linux-x86_64 +sudo mv streamd-X.Y.Z-linux-x86_64 /usr/local/bin/streamd +``` + +### Nix + +Using the flake directly: + +```bash +nix run git+https://git.konstantinfickel.de/kfickel/streamd +``` + +Or add to your NixOS/Home Manager configuration using the provided `homeManagerModules.default`. + ## Core Concepts - **Shards** — Sections of markdown files, organized hierarchically by headings. Each shard can contain markers, tags, and nested child shards. -- 2.53.0