-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
84 lines (65 loc) · 2.34 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "CrocUtils";
inputs.nixpkgs.url = github:NixOS/nixpkgs;
outputs = { self, nixpkgs }: let
version = if (self ? shortRev) then
"1.4.1-${toString self.revCount}-g${self.shortRev}"
else
"0.0.0-${self.lastModifiedDate}";
commitHash = if (self ? rev) then self.rev else "unknown";
mkShells = packages: builtins.mapAttrs (k: v: v.overrideAttrs(old: {
hardeningDisable = [ "all" ];
})) packages;
in {
packages.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in rec {
crocutils = pkgs.callPackage ./default.nix {
inherit version commitHash;
};
default = crocutils;
crocutils-musl64 = pkgs.pkgsCross.musl64.pkgsStatic.callPackage ./default.nix {
inherit version commitHash;
};
crocutils-win64 = pkgs.pkgsCross.mingwW64.callPackage ./default.nix {
inherit version commitHash;
};
ci = pkgs.stdenvNoCC.mkDerivation {
inherit version commitHash;
pname = "crocutils-ci";
dontUnpack = true;
installPhase = ''
mkdir -p $out
cp "${crocutils-musl64}/bin/croctool" \
"$out/croctool-${version}-${crocutils-musl64.stdenv.hostPlatform.system}"
chmod 0755 "$out/croctool-${version}-${crocutils-musl64.stdenv.hostPlatform.system}"
cp "${crocutils-win64}/bin/croctool.exe" \
"$out/croctool-${version}-${crocutils-win64.stdenv.hostPlatform.system}.exe"
chmod 0755 "$out/croctool-${version}-${crocutils-win64.stdenv.hostPlatform.system}.exe"
cd "$out" && for i in *; do
sha256sum -b "$i" > "$i.sha256"
done
'';
};
};
packages.x86_64-darwin = let
pkgs = nixpkgs.legacyPackages.x86_64-darwin;
in rec {
crocutils = pkgs.callPackage ./default.nix {
inherit version commitHash;
};
default = crocutils;
};
packages.aarch64-darwin = let
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
in rec {
crocutils = pkgs.callPackage ./default.nix {
inherit version commitHash;
};
default = crocutils;
};
devShells.x86_64-linux = mkShells self.packages.x86_64-linux;
devShells.x86_64-darwin = mkShells self.packages.x86_64-darwin;
devShells.aarch64-darwin = mkShells self.packages.x86_64-darwin;
};
}