forked from bechampion/gohip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
57 lines (53 loc) · 1.79 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [];
pkgs = import nixpkgs {
inherit system overlays;
};
gohip-vendor-hash = import ./gohip.vendor.hash.nix;
gohip-package = (pkgs.buildGoModule {
name = "gohip";
pname = "gohip";
src = ./.;
vendorHash = gohip-vendor-hash pkgs;
proxyVendor = true;
excludedPackages = ["osdata" "others" "systemd" "types"];
});
upgrade-nix-gohip-package = pkgs.writeShellScriptBin "upgrade-nix-gohip" ''
echo "UPGRADING"
echo "pkgs : pkgs.lib.fakeHash" > $WORKSPACE/gohip.vendor.hash.nix
NEW_HASH=`nix build .#default 2>&1 | grep " got: " | awk '{print $2}'`
echo "pkgs : \"$NEW_HASH\"" > $WORKSPACE/gohip.vendor.hash.nix
'';
custom-packages = {upgrade-nix-gohip = upgrade-nix-gohip-package;};
in
with pkgs;
{
devShells.default = (import ./shell.nix) pkgs custom-packages;
apps = rec {
gohip = flake-utils.lib.mkApp {
drv = pkgs.writeShellScriptBin "gohip" ''
cd `mktemp -d`
"${gohip-package}"/bin/gohip
'';
};
upgrade-nix-gohip = flake-utils.lib.mkApp {
drv = upgrade-nix-gohip-package;
};
default = gohip;
};
packages = rec {
gohip = gohip-package;
upgrade-nix-gohip = upgrade-nix-gohip-package;
default = gohip;
};
}
);
}