-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlk.nix
29 lines (28 loc) · 952 Bytes
/
lk.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
{ stdenv, project, which, imagemagick, python, preBuild ? "", extraAttrs ? {} }:
stdenv.mkDerivation ({
name = "littlekernel-${project}";
src = builtins.path {
filter = stdenv.lib.cleanSourceFilter;
path = ./.;
name = "lk-src";
};
inherit preBuild;
makeFlags = [ "PROJECT=${project}" ];
hardeningDisable = [ "format" ];
nativeBuildInputs = [
which
imagemagick.__spliced.buildBuild # work around a bug in nixpkgs
python
];
installPhase = ''
mkdir -p $out/nix-support
cp -r build-${project}/{config.h,lk.*} $out
cat <<EOF > $out/nix-support/hydra-metrics
lk.bin $(stat --printf=%s $out/lk.bin) bytes
lk.elf $(stat --printf=%s $out/lk.elf) bytes
EOF
echo "file binary-dist $out/lk.bin" >> $out/nix-support/hydra-build-products
echo "file binary-dist $out/lk.elf" >> $out/nix-support/hydra-build-products
'';
ARCH_arm64_TOOLCHAIN_PREFIX = "aarch64-none-elf-";
} // extraAttrs)