fix: add system-manager-unwrapped back to packages

This commit is contained in:
eureka-cpu 2025-03-19 13:23:21 -07:00
parent 9f8f766c3b
commit 05ff1d9c91
2 changed files with 19 additions and 11 deletions

View file

@ -34,6 +34,10 @@
{ {
lib = import ./nix/lib.nix { inherit nixpkgs; }; lib = import ./nix/lib.nix { inherit nixpkgs; };
# The unwrapped version takes nix from the PATH, it will fail if nix
# cannot be found.
# The wrapped version has a reference to the nix store path, so nix is
# part of its runtime closure.
packages = eachSystem ( packages = eachSystem (
{ pkgs, system }: { pkgs, system }:
import ./packages.nix { inherit pkgs; } import ./packages.nix { inherit pkgs; }

View file

@ -4,14 +4,11 @@
}: }:
let let
cargoManifest = (pkgs.lib.importTOML ./Cargo.toml).package; cargoManifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in system-manager-unwrapped = pkgs.callPackage (
{
system-manager = pkgs.callPackage (
{ {
rustPlatform, rustPlatform,
dbus, dbus,
pkg-config, pkg-config,
makeWrapper,
nix, nix,
clippy, clippy,
}: }:
@ -31,7 +28,6 @@ in
buildInputs = [ dbus ]; buildInputs = [ dbus ];
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
makeWrapper
]; ];
nativeCheckInputs = [ nativeCheckInputs = [
@ -41,12 +37,20 @@ in
preCheck = '' preCheck = ''
${lib.getExe pkgs.cargo} clippy ${lib.getExe pkgs.cargo} clippy
''; '';
# TODO: Is prefixing nix here the correct approach?
postFixup = ''
wrapProgram $out/bin/system-manager \
--prefix PATH : ${lib.makeBinPath [ nix ]}
'';
} }
) { }; ) { };
in
{
inherit system-manager-unwrapped;
system-manager =
pkgs.runCommand "system-manager"
{
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
}
''
makeWrapper \
${system-manager-unwrapped}/bin/system-manager \
$out/bin/system-manager \
--prefix PATH : ${lib.makeBinPath [ pkgs.nix ]}
'';
} }