-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
86 lines (73 loc) · 2.23 KB
/
flake.nix
File metadata and controls
86 lines (73 loc) · 2.23 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
78
79
80
81
82
83
84
85
86
{
description = "Zig utilities including nix-zsh-env";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = {
gitclone = pkgs.stdenv.mkDerivation {
pname = "gitclone";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.zig ];
buildPhase = ''
export HOME=$TMPDIR
zig build -Doptimize=ReleaseSafe
'';
installPhase = ''
mkdir -p $out/bin
cp zig-out/bin/gitclone $out/bin/
'';
meta = {
description = "Clone git repositories";
license = pkgs.lib.licenses.mit;
platforms = pkgs.lib.platforms.all;
};
};
nix-zsh-env = pkgs.stdenv.mkDerivation {
pname = "nix-zsh-env";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.zig ];
buildPhase = ''
export HOME=$TMPDIR
zig build -Doptimize=ReleaseSafe
'';
installPhase = ''
mkdir -p $out/bin
cp zig-out/bin/nix-zsh-env $out/bin/
'';
meta = {
description = "Display nix-shell packages for zsh prompt";
license = pkgs.lib.licenses.mit;
platforms = pkgs.lib.platforms.all;
};
};
default = pkgs.symlinkJoin {
name = "zigutils";
paths = [
self.packages.${system}.gitclone
self.packages.${system}.nix-zsh-env
];
};
};
apps = {
gitclone = {
type = "app";
program = "${self.packages.${system}.gitclone}/bin/gitclone";
};
nix-zsh-env = {
type = "app";
program = "${self.packages.${system}.nix-zsh-env}/bin/nix-zsh-env";
};
default = self.apps.${system}.gitclone;
};
}
);
}