nixpkgs/pkgs/tools/filesystems/stratisd/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

123 lines
2.8 KiB
Nix
Raw Normal View History

2022-08-01 12:42:58 +00:00
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, cargo
, rustc
2022-08-01 12:42:58 +00:00
, pkg-config
, asciidoc
2022-10-19 02:09:16 +00:00
, ncurses
, glibc
2022-08-01 12:42:58 +00:00
, dbus
, cryptsetup
, util-linux
, lvm2
2022-08-01 12:42:58 +00:00
, systemd
, xfsprogs
, thin-provisioning-tools
, clevis
, jose
, jq
, curl
, tpm2-tools
, coreutils
, clevisSupport ? false
, nixosTests
2022-08-01 12:42:58 +00:00
}:
stdenv.mkDerivation rec {
pname = "stratisd";
version = "3.6.5";
2022-08-01 12:42:58 +00:00
src = fetchFromGitHub {
owner = "stratis-storage";
repo = pname;
rev = "refs/tags/stratisd-v${version}";
hash = "sha256-qgf5Q2MAY8PAYlplvTX+YjYfDFLfddpyIG4S/IIYbsU=";
2022-08-01 12:42:58 +00:00
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit pname version src;
hash = "sha256-Bu87uHEcMKB+TX8gWHD1vRazOkqJSZKQcsPiaKXrGFE=";
2022-08-01 12:42:58 +00:00
};
postPatch = ''
substituteInPlace udev/61-stratisd.rules \
--replace stratis-base32-decode "$out/lib/udev/stratis-base32-decode" \
--replace stratis-str-cmp "$out/lib/udev/stratis-str-cmp"
substituteInPlace systemd/stratis-fstab-setup \
--replace stratis-min "$out/bin/stratis-min" \
--replace systemd-ask-password "${systemd}/bin/systemd-ask-password" \
--replace sleep "${coreutils}/bin/sleep" \
--replace udevadm "${systemd}/bin/udevadm"
2022-08-01 12:42:58 +00:00
'';
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
cargo
rustc
2022-08-01 12:42:58 +00:00
pkg-config
asciidoc
2022-10-19 02:09:16 +00:00
ncurses # tput
2022-08-01 12:42:58 +00:00
];
buildInputs = [
glibc
glibc.static
2022-08-01 12:42:58 +00:00
dbus
cryptsetup
util-linux
systemd
lvm2
2022-08-01 12:42:58 +00:00
];
outputs = [ "out" "initrd" ];
2023-05-03 22:43:21 +00:00
env.EXECUTABLES_PATHS = lib.makeBinPath ([
2022-08-01 12:42:58 +00:00
xfsprogs
thin-provisioning-tools
] ++ lib.optionals clevisSupport [
clevis
jose
jq
cryptsetup
curl
tpm2-tools
coreutils
]);
2022-10-19 02:09:16 +00:00
makeFlags = [ "PREFIX=${placeholder "out"}" "INSTALL=install" ];
buildFlags = [ "build-all" ];
2022-08-01 12:42:58 +00:00
doCheck = true;
checkTarget = "test";
# remove files for supporting dracut
postInstall = ''
2023-05-03 22:43:21 +00:00
mkdir -p "$initrd/bin"
cp "$out/lib/dracut/modules.d/90stratis/stratis-rootfs-setup" "$initrd/bin"
2023-05-03 22:43:21 +00:00
mkdir -p "$initrd/lib/systemd/system"
substitute "$out/lib/dracut/modules.d/90stratis/stratisd-min.service" \
"$initrd/lib/systemd/system/stratisd-min.service" \
2023-05-03 22:43:21 +00:00
--replace mkdir "${coreutils}/bin/mkdir"
mkdir -p "$initrd/lib/udev/rules.d"
cp udev/61-stratisd.rules "$initrd/lib/udev/rules.d"
2022-08-01 12:42:58 +00:00
rm -r "$out/lib/dracut"
rm -r "$out/lib/systemd/system-generators"
'';
passthru.tests = nixosTests.stratis // {
inherit (nixosTests.installer-systemd-stage-1) stratisRoot;
};
2022-08-01 12:42:58 +00:00
meta = with lib; {
description = "Easy to use local storage management for Linux";
homepage = "https://stratis-storage.github.io";
license = licenses.mpl20;
maintainers = with maintainers; [ nickcao ];
platforms = [ "x86_64-linux" ];
};
}