summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-2.nix
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-08-23 13:32:05 +0300
committerVladimír Čunát <vcunat@gmail.com>2015-10-03 14:08:55 +0200
commitcd3088455d518b4416cfaec569b9614d92f97023 (patch)
treedfdcd92e226dbaff8e577143712e698ef6749baf /nixos/modules/system/boot/stage-2.nix
parent54dcadad6c979ba94360a6b5959d16a4c00c0116 (diff)
downloadnixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar.gz
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar.bz2
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar.lz
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar.xz
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.tar.zst
nixlib-cd3088455d518b4416cfaec569b9614d92f97023.zip
nixos/stage-2: Build readonly-mountpoint with normal mkDerivation phases
This way the binary gets stripped & rpath-shrinked etc. as usual.
We'd seem to get a runtime reference to gcc otherwise.

TODO: Maybe we should be able to set e.g. 'dontUnpack = true;'
to make this more pretty.
Diffstat (limited to 'nixos/modules/system/boot/stage-2.nix')
-rw-r--r--nixos/modules/system/boot/stage-2.nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index c0ef4e02d1ff..b67f42a017e6 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -7,11 +7,14 @@ let
   kernel = config.boot.kernelPackages.kernel;
   activateConfiguration = config.system.activationScripts.script;
 
-  readonlyMountpoint = pkgs.runCommand "readonly-mountpoint" {} ''
-    mkdir -p $out/bin
-    cc -O3 ${./readonly-mountpoint.c} -o $out/bin/readonly-mountpoint
-    strip -s $out/bin/readonly-mountpoint
-  '';
+  readonlyMountpoint = pkgs.stdenv.mkDerivation {
+    name = "readonly-mountpoint";
+    unpackPhase = "true";
+    installPhase = ''
+      mkdir -p $out/bin
+      cc -O3 ${./readonly-mountpoint.c} -o $out/bin/readonly-mountpoint
+    '';
+  };
 
   bootStage2 = pkgs.substituteAll {
     src = ./stage-2-init.sh;