Skip to content

Commit

Permalink
move disko-install into disko package
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Mar 9, 2024
1 parent a2009bc commit 72818e5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down
2 changes: 1 addition & 1 deletion lib/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions package.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{ stdenvNoCC, makeWrapper, lib, path }:
{ stdenvNoCC, makeWrapper, lib, path, nix, coreutils }:

stdenvNoCC.mkDerivation rec {
stdenvNoCC.mkDerivation (finalAttrs: {
name = "disko";
src = ./.;
nativeBuildInputs = [
makeWrapper
];
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";
homepage = "https://github.com/nix-community/disko";
license = licenses.mit;
maintainers = with maintainers; [ lassulus ];
platforms = platforms.linux;
mainProgram = finalAttrs.name;
};
}
})
3 changes: 1 addition & 2 deletions tests/disko-install/default.nix
Original file line number Diff line number Diff line change
@@ -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);

Expand Down

0 comments on commit 72818e5

Please sign in to comment.