Files
diwan/flake.nix
T
marc de1576af0a add flake.nix: package diwan as a proper nix derivation
Bundles PROTOCOL.md/TICK.md/DO.md alongside the diwan script under
share/diwan/, wraps python3 with DIWAN_DIR set explicitly to that
directory and git on PATH. Verified live: built with 'nix build', ran
'result/bin/diwan tick' against diwan-dev-notes, dispatched a real pi
tick agent successfully end to end.
2026-11-09 11:12:32 +01:00

49 lines
1.5 KiB
Nix

{
description = "diwan — an AI layer over a plain org-mode second brain";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.${system}.default = pkgs.stdenvNoCC.mkDerivation {
pname = "diwan";
version = "0.1.0";
src = self;
nativeBuildInputs = [ pkgs.makeWrapper ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm755 diwan $out/share/diwan/diwan
install -Dm444 -t $out/share/diwan PROTOCOL.md TICK.md DO.md
# DIWAN_DIR tells diwan where its own install lives, independent of
# whatever notes repo it's invoked against (DIWAN_NOTES_DIR) — see
# PROTOCOL.md/DESIGN.md. Setting it explicitly here, rather than
# relying on the script's own Path(__file__)-based guess, makes
# this robust to however the Nix store happens to lay things out.
makeWrapper ${pkgs.python3}/bin/python3 $out/bin/diwan \
--add-flags "$out/share/diwan/diwan" \
--set DIWAN_DIR "$out/share/diwan" \
--prefix PATH : ${pkgs.git}/bin
runHook postInstall
'';
meta = {
description = "An AI layer over a plain org-mode second brain";
mainProgram = "diwan";
};
};
};
}