patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH] use statically linked cryptsetup in initramfs
@ 2021-12-12 14:11 Yureka
  2022-02-16  0:10 ` Alyssa Ross
  0 siblings, 1 reply; 2+ messages in thread
From: Yureka @ 2021-12-12 14:11 UTC (permalink / raw)
  To: devel; +Cc: Yureka

---
 host/initramfs/default.nix | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/host/initramfs/default.nix b/host/initramfs/default.nix
index ba6ede2..91e598f 100644
--- a/host/initramfs/default.nix
+++ b/host/initramfs/default.nix
@@ -2,15 +2,38 @@
 
 { lib, stdenv, runCommand, writeReferencesToFile, pkgsStatic
 , busybox, cpio, cryptsetup, linux, lvm2
+, fetchpatch
 }:
 
-let
-  cryptsetup' = cryptsetup;
-in
 let
   inherit (lib) cleanSource cleanSourceWith concatMapStringsSep;
 
-  cryptsetup = cryptsetup'.override { lvm2 = lvm2.override { udev = null; }; };
+  # https://github.com/NixOS/nixpkgs/pull/148948
+  cryptsetup = (pkgsStatic.cryptsetup.override {
+    lvm2 = (pkgsStatic.lvm2.override {
+      udev = null;
+    }).overrideAttrs (old: {
+      patches = (old.patches or []) ++ [
+        (fetchpatch {
+          url = "https://raw.githubusercontent.com/NixOS/nixpkgs/bf8b0d818a6c5fa65f318603756762af492c1a0c/pkgs/os-specific/linux/lvm2/no-shared.diff";
+          sha256 = "sha256-t67Osvcn92R7q9V+KDW+SyJDmajzVbnTPONlokcBU9U=";
+        })
+      ];
+      configureFlags = old.configureFlags ++ [ "--enable-static_link" ];
+      makeFlags = old.makeFlags ++ [ "libdm.device-mapper" ];
+      installPhase = ''
+        install -D -t $out/lib libdm/ioctl/libdevmapper.a
+        make -C libdm install_include
+        make -C libdm install_pkgconfig
+      '';
+      outputs = [ "out" ];
+    });
+  }).overrideAttrs (old: {
+    NIX_LDFLAGS = "";
+    configureFlags = old.configureFlags ++ [
+      "--enable-static-cryptsetup"
+    ];
+  });
 
   packages = [
     cryptsetup pkgsStatic.mdevd pkgsStatic.execline
-- 
2.34.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-16  0:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 14:11 [PATCH] use statically linked cryptsetup in initramfs Yureka
2022-02-16  0:10 ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).