Skip to content

Commit 05ff1d9

Browse files
committed
fix: add system-manager-unwrapped back to packages
1 parent 9f8f766 commit 05ff1d9

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

flake.nix

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
{
3535
lib = import ./nix/lib.nix { inherit nixpkgs; };
3636

37+
# The unwrapped version takes nix from the PATH, it will fail if nix
38+
# cannot be found.
39+
# The wrapped version has a reference to the nix store path, so nix is
40+
# part of its runtime closure.
3741
packages = eachSystem (
3842
{ pkgs, system }:
3943
import ./packages.nix { inherit pkgs; }

packages.nix

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
}:
55
let
66
cargoManifest = (pkgs.lib.importTOML ./Cargo.toml).package;
7-
in
8-
{
9-
system-manager = pkgs.callPackage (
7+
system-manager-unwrapped = pkgs.callPackage (
108
{
119
rustPlatform,
1210
dbus,
1311
pkg-config,
14-
makeWrapper,
1512
nix,
1613
clippy,
1714
}:
@@ -31,7 +28,6 @@ in
3128
buildInputs = [ dbus ];
3229
nativeBuildInputs = [
3330
pkg-config
34-
makeWrapper
3531
];
3632

3733
nativeCheckInputs = [
@@ -41,12 +37,20 @@ in
4137
preCheck = ''
4238
${lib.getExe pkgs.cargo} clippy
4339
'';
44-
45-
# TODO: Is prefixing nix here the correct approach?
46-
postFixup = ''
47-
wrapProgram $out/bin/system-manager \
48-
--prefix PATH : ${lib.makeBinPath [ nix ]}
49-
'';
5040
}
5141
) { };
42+
in
43+
{
44+
inherit system-manager-unwrapped;
45+
system-manager =
46+
pkgs.runCommand "system-manager"
47+
{
48+
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
49+
}
50+
''
51+
makeWrapper \
52+
${system-manager-unwrapped}/bin/system-manager \
53+
$out/bin/system-manager \
54+
--prefix PATH : ${lib.makeBinPath [ pkgs.nix ]}
55+
'';
5256
}

0 commit comments

Comments
 (0)