Merge pull request #795 from Jayman2000/binlore-for-disko-commands

This commit is contained in:
Felix Uhl authored and GitHub committed 2024-09-24 07:45:17 +02:00
commit c61e50b63a
1 file changed
+34 -27
+34 -27
View File
@@ -1,29 +1,36 @@
{ stdenvNoCC, makeWrapper, lib, path, nix, coreutils, nixos-install-tools }: { stdenvNoCC, makeWrapper, lib, path, nix, coreutils, nixos-install-tools, binlore }:
stdenvNoCC.mkDerivation (finalAttrs: { let
name = "disko"; self = stdenvNoCC.mkDerivation (finalAttrs: {
src = ./.; name = "disko";
nativeBuildInputs = [ src = ./.;
makeWrapper nativeBuildInputs = [
]; makeWrapper
installPhase = '' ];
mkdir -p $out/bin $out/share/disko installPhase = ''
cp -r install-cli.nix cli.nix default.nix disk-deactivate lib $out/share/disko mkdir -p $out/bin $out/share/disko
cp -r install-cli.nix cli.nix default.nix disk-deactivate lib $out/share/disko
for i in disko disko-install; do for i in disko disko-install; do
sed -e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" "$i" > "$out/bin/$i" sed -e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" "$i" > "$out/bin/$i"
chmod 755 "$out/bin/$i" chmod 755 "$out/bin/$i"
wrapProgram "$out/bin/$i" \ wrapProgram "$out/bin/$i" \
--prefix PATH : ${lib.makeBinPath [ nix coreutils nixos-install-tools ]} \ --prefix PATH : ${lib.makeBinPath [ nix coreutils nixos-install-tools ]} \
--prefix NIX_PATH : "nixpkgs=${path}" --prefix NIX_PATH : "nixpkgs=${path}"
done done
''; '';
meta = with lib; { # Otherwise resholve thinks that disko and disko-install might be able to execute their arguments
description = "Format disks with nix-config"; passthru.binlore.out = binlore.synthesize self ''
homepage = "https://github.com/nix-community/disko"; execer cannot bin/.disko-wrapped
license = licenses.mit; execer cannot bin/.disko-install-wrapped
maintainers = with maintainers; [ lassulus ]; '';
platforms = platforms.linux; meta = with lib; {
mainProgram = finalAttrs.name; 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;
};
});
in self