Bootstrap busybox from binaries
This commit is contained in:
commit
e2d6b08c5a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
result
|
29
busybox.nix
Normal file
29
busybox.nix
Normal file
@ -0,0 +1,29 @@
|
||||
let
|
||||
busybox = import ./fetchurl.nix {
|
||||
url = "https://www.busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox";
|
||||
outputHash = "sha256-mVOoYPn3r9NYiZjQf5AF2p7hXy1Q4kN5RSscc/PGpiY=";
|
||||
executable = true;
|
||||
};
|
||||
busybox_ash = import ./fetchurl.nix {
|
||||
url = "https://www.busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox_ASH";
|
||||
outputHash = "sha256-cgXsXhZxOE62NM2uYD4tkw4IA6vsiwolJjhw7zTyiIQ=";
|
||||
executable = true;
|
||||
};
|
||||
busybox_cp = import ./fetchurl.nix {
|
||||
url = "https://www.busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox_CP";
|
||||
outputHash = "sha256-SohMSgXijkdN8Y7LE522obQ0QUAs8xBEQl+p0w8iAVc=";
|
||||
executable = true;
|
||||
};
|
||||
busybox_mkdir = import ./fetchurl.nix {
|
||||
url = "https://www.busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox_MKDIR";
|
||||
outputHash = "sha256-knwWrnrCqxv52cM78VW/00Zqju6YI0+kXo/ZPLzJb18=";
|
||||
executable = true;
|
||||
};
|
||||
in {
|
||||
busybox = builtins.derivation {
|
||||
system = "x86_64-linux";
|
||||
name = "busybox";
|
||||
builder = busybox_ash;
|
||||
args = [ "-c" "${busybox_mkdir} $out; ${busybox_cp} ${busybox} $out/busybox" ];
|
||||
};
|
||||
}
|
21
fetchurl.nix
Normal file
21
fetchurl.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ url
|
||||
, outputHash
|
||||
, executable ? false
|
||||
, unpack ? false
|
||||
, name ? baseNameOf (toString url)
|
||||
}:
|
||||
|
||||
derivation ({
|
||||
builder = "builtin:fetchurl";
|
||||
outputHashMode = "recursive";
|
||||
|
||||
inherit name url executable unpack outputHash;
|
||||
|
||||
outputHashAlgo = if outputHash == "" then "sha256" else "";
|
||||
|
||||
system = "builtin";
|
||||
|
||||
# No need to double the amount of network traffic
|
||||
preferLocalBuild = true;
|
||||
|
||||
})
|
Loading…
Reference in New Issue
Block a user