-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
62 lines (58 loc) · 2.57 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
{
description = "static-binaries";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
outputs = { self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
defaultPackage = forAllSystems (system: (with import nixpkgs
{
inherit system;
config.packageOverrides = (pkgs: {
# remove when https://github.com/NixOS/nixpkgs/pull/187914 is merged
nnn = pkgs.nnn.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.musl-fts ];
NIX_CFLAGS_COMPILE = "-I${pkgs.musl-fts}/include";
NIX_LDFLAGS = "-lfts";
});
});
};
let
releaseNotes = writeText "release.txt" ''
- binutils v${binutils.version}
- curl v${curl.version}
- nmap v${nmap.version}
- nnn v${nnn.version}
- python2 v${python2.version}
- socat v${socat.version}
- tcpdump v${tcpdump.version}
'';
in
runCommand "static-binaries" { } ''
mkdir -p $out/bin
cp ${pkgsCross.musl32.pkgsStatic.binutils}/bin/objdump $out/bin/objdump-x86
cp ${pkgsCross.musl32.pkgsStatic.binutils}/bin/strings $out/bin/string-x86
cp ${pkgsCross.musl32.pkgsStatic.curl}/bin/curl $out/bin/curl-x86
cp ${pkgsCross.musl32.pkgsStatic.nmap}/bin/nmap $out/bin/nmap-x86
cp ${pkgsCross.musl32.pkgsStatic.nnn}/bin/.nnn-wrapped $out/bin/nnn-x86
cp ${pkgsCross.musl32.pkgsStatic.python2}/bin/python2.7 $out/bin/python2.7-x86
cp ${pkgsCross.musl32.pkgsStatic.socat}/bin/socat $out/bin/socat-x86
cp ${pkgsCross.musl32.pkgsStatic.tcpdump}/bin/tcpdump $out/bin/tcpdump-x86
cp ${pkgsCross.musl64.pkgsStatic.binutils}/bin/objdump $out/bin/objdump-x64
cp ${pkgsCross.musl64.pkgsStatic.binutils}/bin/strings $out/bin/string-x64
cp ${pkgsCross.musl64.pkgsStatic.curl}/bin/curl $out/bin/curl-x64
cp ${pkgsCross.musl64.pkgsStatic.nmap}/bin/nmap $out/bin/nmap-x64
cp ${pkgsCross.musl64.pkgsStatic.nnn}/bin/.nnn-wrapped $out/bin/nnn-x64
cp ${pkgsCross.musl64.pkgsStatic.python2}/bin/python2.7 $out/bin/python2.7-x64
cp ${pkgsCross.musl64.pkgsStatic.socat}/bin/socat $out/bin/socat-x64
cp ${pkgsCross.musl64.pkgsStatic.tcpdump}/bin/tcpdump $out/bin/tcpdump-x64
cp ${releaseNotes} $out/release.txt
''
));
};
}