move disko-install into disko package

This commit is contained in:
Jörg Thalheim 2024-03-07 16:43:43 +01:00 committed by mergify[bot]
parent a2009bc2b4
commit 72818e54ec
4 changed files with 19 additions and 14 deletions

View file

@ -28,7 +28,10 @@
in
{
disko = pkgs.callPackage ./package.nix { };
disko-install = pkgs.callPackage ./disko-install.nix { };
# alias to make `nix run` more convenient
disko-install = self.packages.${system}.disko.overrideAttrs (old: {
name = "disko-install";
});
default = self.packages.${system}.disko;
} // pkgs.lib.optionalAttrs (!pkgs.buildPlatform.isRiscV64) {
disko-doc = pkgs.callPackage ./doc.nix { };

View file

@ -240,7 +240,7 @@ let
machine.succeed("echo -n 'additionalSecret' > /tmp/additionalSecret.key")
machine.succeed("echo -n 'secretsecret' > /tmp/secret.key")
${lib.optionalString (testMode == "direct") ''
# running direct mode
# running direct mode
machine.succeed("${tsp-format}")
machine.succeed("${tsp-mount}")
machine.succeed("${tsp-mount}") # verify that the command is idempotent

View file

@ -1,6 +1,6 @@
{ stdenvNoCC, makeWrapper, lib, path }:
{ stdenvNoCC, makeWrapper, lib, path, nix, coreutils }:
stdenvNoCC.mkDerivation rec {
stdenvNoCC.mkDerivation (finalAttrs: {
name = "disko";
src = ./.;
nativeBuildInputs = [
@ -8,13 +8,15 @@ stdenvNoCC.mkDerivation rec {
];
installPhase = ''
mkdir -p $out/bin $out/share/disko
cp -r cli.nix default.nix disk-deactivate lib $out/share/disko
sed \
-e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" \
-e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \
disko > $out/bin/disko
chmod 755 $out/bin/disko
wrapProgram $out/bin/disko --prefix NIX_PATH : "nixpkgs=${path}"
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"
wrapProgram "$out/bin/$i" \
--prefix PATH : ${lib.makeBinPath [ nix coreutils ]} \
--prefix NIX_PATH : "nixpkgs=${path}"
done
'';
meta = with lib; {
description = "Format disks with nix-config";
@ -22,5 +24,6 @@ stdenvNoCC.mkDerivation rec {
license = licenses.mit;
maintainers = with maintainers; [ lassulus ];
platforms = platforms.linux;
mainProgram = finalAttrs.name;
};
}
})

View file

@ -1,11 +1,10 @@
{ pkgs ? import <nixpkgs> { }, self }:
let
disko-install = pkgs.callPackage ../../disko-install.nix { };
toplevel = self.nixosConfigurations.testmachine.config.system.build.toplevel;
dependencies = [
pkgs.stdenv.drvPath
toplevel
self.nixosConfigurations.testmachine.config.system.build.toplevel
self.nixosConfigurations.testmachine.config.system.build.diskoScript
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);