summary refs log tree commit diff
path: root/pkgs/applications/virtualization/lkl/default.nix
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2017-01-16 21:24:21 +0000
committerDan Peebles <pumpkin@me.com>2017-01-16 21:24:32 +0000
commitf1a9bc356ecaef1d399ed7f245d7160c87427a9c (patch)
tree951beb9c4cac1f1548ef7cc82dbb62240496feb8 /pkgs/applications/virtualization/lkl/default.nix
parentbb8ded9a78b61f2a23b2e4a0e516533ae0c0d1d4 (diff)
downloadnixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar.gz
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar.bz2
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar.lz
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar.xz
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.tar.zst
nixpkgs-f1a9bc356ecaef1d399ed7f245d7160c87427a9c.zip
lkl: init
Diffstat (limited to 'pkgs/applications/virtualization/lkl/default.nix')
-rw-r--r--pkgs/applications/virtualization/lkl/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/applications/virtualization/lkl/default.nix b/pkgs/applications/virtualization/lkl/default.nix
new file mode 100644
index 00000000000..752dfb9ce16
--- /dev/null
+++ b/pkgs/applications/virtualization/lkl/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, bc, python, fuse, libarchive }:
+
+stdenv.mkDerivation rec {
+  name = "lkl-${stdenv.lib.substring 0 7 rev}";
+  rev  = "8a0fc49c2d13d5ae5e591d859d78035c368469b0";
+
+  buildInputs = [ bc python fuse libarchive ];
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner  = "copumpkin"; # TODO: use 'lkl' here once https://github.com/lkl/linux/pull/294 is merged
+    repo   = "linux";
+    sha256 = "07k1mq25a907l1ivlgwxycx2vc0fmir3da4xrjkj2v87c7siqvwf";
+  };
+
+  installPhase = ''
+    mkdir -p $out/{bin,lib}
+
+    # This tool assumes a different directory structure so let's point it at the right location
+    cp tools/lkl/bin/lkl-hijack.sh $out/bin
+    substituteInPlace $out/bin/lkl-hijack.sh --replace '/../' '/../lib'
+
+    cp tools/lkl/{cptofs,cpfromfs,fs2tar,lklfuse} $out/bin
+    cp -r tools/lkl/include $out
+    cp tools/lkl/liblkl*.{a,so} $out/lib
+  '';
+
+  # We turn off format and fortify because of these errors (fortify implies -O2, which breaks the jitter entropy code):
+  #   fs/xfs/xfs_log_recover.c:2575:3: error: format not a string literal and no format arguments [-Werror=format-security]
+  #   crypto/jitterentropy.c:54:3: error: #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy.c."
+  hardeningDisable = [ "format" "fortify" ];
+
+  makeFlags = "-C tools/lkl";
+
+  enableParallelBuilds = true;
+
+  meta = with stdenv.lib; {
+    description = "LKL (Linux Kernel Library) aims to allow reusing the Linux kernel code as extensively as possible with minimal effort and reduced maintenance overhead";
+    platforms   = platforms.linux; # Darwin probably works too but I haven't tested it
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ copumpkin ];
+  };
+}