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.
This commit is contained in:
Konstantin Fickel 2026-04-02 22:55:14 +02:00 committed by kfickel
parent e242e0cc2c
commit 45f8b3503b

View file

@ -131,6 +131,48 @@
cargoArtifacts = craneLib.buildDepsOnly commonArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); 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 <<EOF
name: streamd
arch: amd64
platform: linux
version: "${version}"
maintainer: Konstantin Fickel
description: Personal knowledge management and time-tracking CLI using @Tag annotations
license: AGPL-3.0-only
homepage: https://git.konstantinfickel.de/kfickel/streamd
contents:
- src: ${streamd-musl}/bin/streamd
dst: /usr/bin/streamd
file_info:
mode: 0755
- src: completions/streamd.bash
dst: /usr/share/bash-completion/completions/streamd
- src: completions/_streamd
dst: /usr/share/zsh/vendor-completions/_streamd
- src: completions/streamd.fish
dst: /usr/share/fish/vendor_completions.d/streamd.fish
deb:
compression: gzip
EOF
nfpm package --config nfpm.yaml --packager deb --target $out
'';
in in
{ {
packages = forAllSystems ( packages = forAllSystems (