nixpkgs/pkgs/by-name/di/disko/package.nix

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

56 lines
1.5 KiB
Nix
Raw Normal View History

2024-01-07 12:46:27 +00:00
{ stdenvNoCC
, makeWrapper
, lib
, fetchFromGitHub
, bash
, nix
, nixos-install
2024-03-06 11:25:34 +00:00
, coreutils
2024-10-11 19:56:05 +00:00
, testers
2024-01-07 12:46:27 +00:00
}:
stdenvNoCC.mkDerivation (finalAttrs: {
2024-05-27 19:49:14 +00:00
pname = "disko";
2024-10-29 03:03:43 +00:00
version = "1.9.0";
2024-01-07 12:46:27 +00:00
src = fetchFromGitHub {
owner = "nix-community";
repo = "disko";
rev = "v${finalAttrs.version}";
2024-10-29 03:03:43 +00:00
hash = "sha256-CI27qHAbc3/tIe8sb37kiHNaeCqGxNimckCMj0lW5kg=";
2024-01-07 12:46:27 +00:00
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ bash ];
installPhase = ''
2024-03-06 11:25:34 +00:00
runHook preInstall
2024-01-07 12:46:27 +00:00
mkdir -p $out/bin $out/share/disko
2024-03-06 11:25:34 +00:00
cp -r install-cli.nix cli.nix default.nix disk-deactivate lib $out/share/disko
for i in disko disko-install; do
sed -e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" "$i" > "$out/bin/$i"
chmod 755 "$out/bin/$i"
2024-10-11 19:56:05 +00:00
wrapProgram "$out/bin/$i" \
--set DISKO_VERSION "${finalAttrs.version}" \
--prefix PATH : ${lib.makeBinPath [ nix coreutils nixos-install ]}
2024-03-06 11:25:34 +00:00
done
runHook postInstall
2024-01-07 12:46:27 +00:00
'';
doInstallCheck = true;
installCheckPhase = ''
2024-03-06 11:25:34 +00:00
runHook preInstallCheck
2024-01-07 12:46:27 +00:00
$out/bin/disko --help
2024-03-06 11:25:34 +00:00
$out/bin/disko-install --help
runHook postInstallCheck
2024-01-07 12:46:27 +00:00
'';
2024-10-11 19:56:05 +00:00
passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
2024-01-07 12:46:27 +00:00
meta = {
homepage = "https://github.com/nix-community/disko";
description = "Declarative disk partitioning and formatting using nix";
license = lib.licenses.mit;
mainProgram = "disko";
2024-10-11 19:57:02 +00:00
maintainers = with lib.maintainers; [ mic92 lassulus iFreilicht ];
2024-01-07 12:46:27 +00:00
platforms = lib.platforms.linux;
};
})