-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
64 lines (54 loc) · 1.72 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
{
description = "Git with less typing";
inputs = {
nixpkgs.url = "nixpkgs";
gg-git.url = "github:gg-scm/gg-git";
flake-utils.url = "flake-utils";
};
outputs = { self, nixpkgs, gg-git, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
gitPackages = (pkgs.lib.attrsets.filterAttrs
(k: _: pkgs.lib.strings.hasPrefix "git_" k)
gg-git.packages.${system});
inherit (pkgs.lib.attrsets) mapAttrs' nameValuePair optionalAttrs;
mkCheck = git: (self.packages.${system}.default.override {
inherit git;
doCheck = true;
}).overrideAttrs {
name = "gg-check-${git.name}";
postInstall = ''
rm -rf "$out"
touch "$out"
'';
};
gitChecks = mapAttrs' (name: git: nameValuePair ("with_" + name) (mkCheck git)) gitPackages;
in
{
packages = gitPackages // {
default = pkgs.callPackage ./. {
buildGoModule = pkgs.buildGo121Module;
commit = self.sourceInfo.rev or null;
};
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/gg";
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = [
pkgs.git
pkgs.go-tools # static check
pkgs.gotools # stringer, etc.
pkgs.python3
];
hardeningDisable = [ "fortify" ];
};
checks = {
default = mkCheck pkgs.git;
} // optionalAttrs pkgs.hostPlatform.isLinux gitChecks;
}
);
}