biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / filesystems / stratisd / default.nix
blob89261aeac396ac0797d068270d6c61c06a33dc32
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , rustPlatform
5 , cargo
6 , rustc
7 , pkg-config
8 , asciidoc
9 , ncurses
10 , glibc
11 , dbus
12 , cryptsetup
13 , util-linux
14 , lvm2
15 , python3
16 , systemd
17 , xfsprogs
18 , thin-provisioning-tools
19 , clevis
20 , jose
21 , jq
22 , curl
23 , tpm2-tools
24 , coreutils
25 , clevisSupport ? false
26 , nixosTests
29 stdenv.mkDerivation rec {
30   pname = "stratisd";
31   version = "3.7.2";
33   src = fetchFromGitHub {
34     owner = "stratis-storage";
35     repo = pname;
36     rev = "refs/tags/stratisd-v${version}";
37     hash = "sha256-pxLf/YLd7vdAjGRQDvJvwhJXpMUiI3dge5Y5x895SPA=";
38   };
40   cargoDeps = rustPlatform.fetchCargoTarball {
41     inherit src;
42     hash = "sha256-btSj69yBbnbK+jdWdMi3rQGKMOLWcwY5Zn3hmEWk/Hs=";
43   };
45   postPatch = ''
46     substituteInPlace udev/61-stratisd.rules \
47       --replace-fail stratis-base32-decode "$out/lib/udev/stratis-base32-decode" \
48       --replace-fail stratis-str-cmp       "$out/lib/udev/stratis-str-cmp"
50     substituteInPlace systemd/stratis-fstab-setup \
51       --replace-fail stratis-min           "$out/bin/stratis-min" \
52       --replace-fail systemd-ask-password  "${systemd}/bin/systemd-ask-password" \
53       --replace-fail sleep                 "${coreutils}/bin/sleep" \
54       --replace-fail udevadm               "${systemd}/bin/udevadm"
55   '';
57   strictDeps = true;
59   nativeBuildInputs = [
60     rustPlatform.cargoSetupHook
61     rustPlatform.bindgenHook
62     cargo
63     rustc
64     pkg-config
65     asciidoc
66     ncurses # tput
67   ];
69   buildInputs = [
70     glibc
71     glibc.static
72     dbus
73     cryptsetup
74     util-linux
75     systemd
76     lvm2
77     (python3.withPackages (ps: [ ps.dbus-python ]))
78   ];
80   outputs = [ "out" "initrd" ];
82   env.EXECUTABLES_PATHS = lib.makeBinPath ([
83     xfsprogs
84     thin-provisioning-tools
85   ] ++ lib.optionals clevisSupport [
86     clevis
87     jose
88     jq
89     cryptsetup
90     curl
91     tpm2-tools
92     coreutils
93   ]);
95   makeFlags = [ "PREFIX=${placeholder "out"}" "INSTALL=install" ];
96   buildFlags = [ "build-all" ];
98   doCheck = true;
99   checkTarget = "test";
101   # remove files for supporting dracut
102   postInstall = ''
103     mkdir -p "$initrd/bin"
104     cp "$out/lib/dracut/modules.d/90stratis/stratis-rootfs-setup" "$initrd/bin"
105     mkdir -p "$initrd/lib/systemd/system"
106     substitute "$out/lib/dracut/modules.d/90stratis/stratisd-min.service" \
107       "$initrd/lib/systemd/system/stratisd-min.service" \
108       --replace-fail mkdir "${coreutils}/bin/mkdir"
109     mkdir -p "$initrd/lib/udev/rules.d"
110     cp udev/61-stratisd.rules "$initrd/lib/udev/rules.d"
111     rm -r "$out/lib/dracut"
112     rm -r "$out/lib/systemd/system-generators"
113   '';
115   passthru.tests = nixosTests.stratis // {
116     inherit (nixosTests.installer-systemd-stage-1) stratisRoot;
117   };
119   meta = with lib; {
120     description = "Easy to use local storage management for Linux";
121     homepage = "https://stratis-storage.github.io";
122     license = licenses.mpl20;
123     maintainers = with maintainers; [ nickcao ];
124     platforms = [ "x86_64-linux" ];
125   };