Skip to content

Instantly share code, notes, and snippets.

@cmacrae
Created June 7, 2019 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmacrae/02e2db0d99912988369a0d1ea3721461 to your computer and use it in GitHub Desktop.
Save cmacrae/02e2db0d99912988369a0d1ea3721461 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
fix = { src
, name ? "${src.name}-fix"
, patches ? []
, postPatch ? ""
}: stdenv.mkDerivation {
preferLocalBuild = true;
allowSubstitutes = false;
inherit name src patches postPatch;
installPhase = "cp -R ./ $out";
dontFixup = true;
dontStrip = true;
};
nixpkgs = fix {
name = "lheckemann-kernel-preempt-voluntary";
src = fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "19.03";
sha256 = "0q2m2qhyga9yq29yz90ywgjbn9hdahs7i8wwlq7b55rdbyiwa5dy";
};
patches = [
(fetchurl { name = "lheckemann-kernel-preempt-voluntary"; # https://github.com/NixOS/nixpkgs/pull/61162
url = "https://github.com/NixOS/nixpkgs/pull/62462.patch";
sha256 = "004zcr2a2h6p1564k6305i3vz0p6ssm3swrm8b7b5v63xxjhkzvf"; })
];
};
sdImage = writeText "sdImage"
''
{ pkgs, config, ... }:
{
imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix"
];
nixpkgs.localSystem.system = "aarch64-linux";
sdImage.bootSize = 2048;
boot.kernelPackages = pkgs.linuxPackages_latest;
}
'';
in stdenv.mkDerivation {
name = "custom-aarch64-linux-sdImage";
shellHook = ''
cd ${nixpkgs}/nixos
nix-build -A config.system.build.sdImage \
-I nixos-config=${sdImage} default.nix
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment