-
Notifications
You must be signed in to change notification settings - Fork 149
/
flake.nix
68 lines (62 loc) · 2.17 KB
/
flake.nix
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [
(self: super: {
xdg-ninja = super.xdg-ninja.overrideAttrs (old: {
version = "git";
src = ./.;
});
})
];
pkgs = import nixpkgs { inherit system overlays; };
in rec {
packages = flake-utils.lib.flattenTree rec {
default = xdg-ninja;
# The shell script and configurations, uses derivation from official nixpkgs
xdg-ninja = pkgs.stdenvNoCC.mkDerivation {
pname = "xdg-ninja";
version = "0.1.0";
src = ./.;
nativeBuildInputs = with pkgs; [ makeWrapper ];
installPhase = ''
runHook preInstall
DESTDIR="$out" PREFIX= make install
wrapProgram "$out/bin/xdg-ninja" \
--prefix PATH : "${pkgs.lib.makeBinPath (with pkgs; [ glow jq findutils ])}"
runHook postInstall
'';
};
# Pre-built binary of xdgnj tool downloaded from github
xdgnj-bin = pkgs.stdenvNoCC.mkDerivation {
name = "xdgnj-bin";
version = "0.2.0.1-alpha";
src = pkgs.fetchurl {
url = "https://github.com/b3nj5m1n/xdg-ninja/releases/download/v0.2.0.1/xdgnj";
sha256 = "y1BSqKQWbhCyg2sRgMsv8ivmylSUJj6XZ8o+/2oT5ns=";
};
dontUnpack = true;
installPhase = ''
mkdir -p "$out/bin"
install -Dm755 $src "$out/bin/xdgnj"
'';
meta.description = "Pre-built binary of the xdgnj tool for creating and editing configuration files for xdg-ninja.";
};
};
apps = rec {
default = xdg-ninja;
xdg-ninja = flake-utils.lib.mkApp { drv = packages.xdg-ninja; exePath = "/bin/xdg-ninja"; };
xdgnj-bin = flake-utils.lib.mkApp { drv = packages.xdgnj-bin; exePath = "/bin/xdgnj"; };
};
}
);
}