From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 Received: by atuin.qyliss.net (Postfix, from userid 496) id 3E1A89D7A; Sun, 12 Dec 2021 14:11:45 +0000 (UTC) Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 25A7D9DE1; Sun, 12 Dec 2021 14:11:25 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id CA8EC9DCA; Sun, 12 Dec 2021 14:11:21 +0000 (UTC) Received: from mail.yuka.dev (mail.yuka.dev [195.39.247.168]) by atuin.qyliss.net (Postfix) with ESMTPS id 568689D38 for ; Sun, 12 Dec 2021 14:11:19 +0000 (UTC) From: Yureka DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuka.dev; s=mail; t=1639318278; bh=GdMJ2stzof+cwH8xBQEp21F6V90bB2OyJOcnYfdZxNQ=; h=From:To:Cc:Subject:Date; b=HSLUI9KiLTs7LGGyXq/8WimeIH820UfEzJLLsX9T7k/FEOru+ddFhvyRkyGT4Uqyz 5NgYTcSjnXNOEKAJPGvzs4il2k8+SVMQRyRmchKaqR9gMJGqn5bEU1fd8aCqsgpf7/ Ckb6YJm81fddwwznoLy8fF4PXKBcQv3QJVOnQ/r0= To: devel@spectrum-os.org Subject: [PATCH] use statically linked cryptsetup in initramfs Date: Sun, 12 Dec 2021 15:11:14 +0100 Message-Id: <20211212141114.3238230-1-yuka@yuka.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: QOXDIXGWPZGIXJILU5UXP2KGST736SSP X-Message-ID-Hash: QOXDIXGWPZGIXJILU5UXP2KGST736SSP X-MailFrom: yuka@yuka.dev X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Yureka X-Mailman-Version: 3.3.4 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --- 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