2024-10-09 18:15:43 +03:00
|
|
|
{ stdenvNoCC, makeWrapper, lib, path, nix, coreutils, nixos-install-tools, binlore, diskoVersion }:
|
2022-12-09 16:22:45 +03:00
|
|
|
|
2024-09-23 19:39:13 +03:00
|
|
|
let
|
|
|
|
self = stdenvNoCC.mkDerivation (finalAttrs: {
|
|
|
|
name = "disko";
|
|
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/share/disko
|
|
|
|
cp -r install-cli.nix cli.nix default.nix disk-deactivate lib $out/share/disko
|
2024-03-07 18:43:43 +03:00
|
|
|
|
2024-09-23 19:39:13 +03:00
|
|
|
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"
|
|
|
|
wrapProgram "$out/bin/$i" \
|
2024-10-09 18:15:43 +03:00
|
|
|
--set DISKO_VERSION "${diskoVersion}" \
|
2024-09-23 19:39:13 +03:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ nix coreutils nixos-install-tools ]} \
|
|
|
|
--prefix NIX_PATH : "nixpkgs=${path}"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
# Otherwise resholve thinks that disko and disko-install might be able to execute their arguments
|
|
|
|
passthru.binlore.out = binlore.synthesize self ''
|
|
|
|
execer cannot bin/.disko-wrapped
|
|
|
|
execer cannot bin/.disko-install-wrapped
|
|
|
|
'';
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Format disks with nix-config";
|
|
|
|
homepage = "https://github.com/nix-community/disko";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ lassulus ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
mainProgram = finalAttrs.name;
|
|
|
|
};
|
|
|
|
});
|
2024-09-26 13:56:38 +03:00
|
|
|
in
|
|
|
|
self
|