Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
77 lines (66 loc) · 2.17 KB
/
Copy pathflake.nix
File metadata and controls
77 lines (66 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
description = "daya - Rapid text-based graphing tool";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:mitchellh/zig-overlay";
zig.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, zig }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
zigPkgs = zig.packages.${system};
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "daya";
version = "0.1.0";
src = self;
nativeBuildInputs = with pkgs; [
zigPkgs.master
makeWrapper
];
buildInputs = with pkgs; [
graphviz
];
buildPhase = ''
cd compiler
export HOME=$TMPDIR
${zigPkgs.master}/bin/zig build -Doptimize=ReleaseSafe
'';
installPhase = ''
mkdir -p $out/bin
cp zig-out/bin/daya $out/bin/daya-unwrapped
# Wrap daya to include graphviz in PATH
makeWrapper $out/bin/daya-unwrapped $out/bin/daya \
--prefix PATH : ${pkgs.graphviz}/bin
'';
meta = with pkgs.lib; {
description = "Rapid text-based graphing tool using GraphViz";
homepage = "https://github.com/michaelo/daya";
license = licenses.mit;
maintainers = [];
platforms = platforms.all;
};
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/daya";
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Zig 0.17.x compiler (using master from zig-overlay)
# Latest stable available in overlay is 0.16.0, master tracks development
zigPkgs.master
# GraphViz for dot command used in daya
graphviz
];
shellHook = ''
echo "daya development environment loaded"
echo "Zig version: $(zig version)"
'';
};
}
);
}