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.
This commit is contained in:
1 parent
b9d1f96563
commit
de1576af0a
2 files changed
+75
No files matched your search
Generated
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1793865203,
|
||||||
|
"narHash": "sha256-/cpdPHaySDIyCgZI6EWngiM6jK3YLUNzv1b7lTzy6Bk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c56a87d8e41ce69bd2af57eb35dcc117a9dfca33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-26.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user