nix: splice the package properly (#234)
Use callPackage on the wrapper as well. Fixes #232. That change also breaks the public interface a bit to keep things simple.
This commit is contained in:
parent
64ca98a15b
commit
94f1c8d9c5
4 changed files with 34 additions and 37 deletions
|
|
@ -4,5 +4,5 @@
|
|||
}:
|
||||
{
|
||||
lib = import ./nix/lib.nix { inherit nixpkgs; };
|
||||
system-manager = pkgs.callPackage ./package.nix { };
|
||||
}
|
||||
// import ./packages.nix { inherit pkgs; }
|
||||
|
|
|
|||
16
flake.nix
16
flake.nix
|
|
@ -34,21 +34,17 @@
|
|||
{
|
||||
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 (
|
||||
{ pkgs, system }:
|
||||
import ./packages.nix { inherit pkgs; }
|
||||
// {
|
||||
default = self.packages.${system}.system-manager;
|
||||
{
|
||||
default = pkgs.callPackage ./package.nix { };
|
||||
}
|
||||
);
|
||||
|
||||
overlays = {
|
||||
packages = final: _prev: import ./packages.nix { pkgs = final; };
|
||||
default = self.overlays.packages;
|
||||
default = final: _prev: {
|
||||
system-manager = final.callPackage ./package.nix { };
|
||||
};
|
||||
};
|
||||
|
||||
# Only useful for quick tests
|
||||
|
|
@ -70,7 +66,7 @@
|
|||
(eachSystem (
|
||||
{ system, ... }:
|
||||
{
|
||||
system-manager = self.packages.${system}.system-manager;
|
||||
system-manager = self.packages.${system}.default;
|
||||
}
|
||||
))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ let
|
|||
};
|
||||
# Pass the wrapped system-manager binary down
|
||||
# TODO: Use nixpkgs version by default.
|
||||
inherit (import ../packages.nix { inherit pkgs; })
|
||||
system-manager
|
||||
;
|
||||
system-manager = pkgs.callPackage ../package.nix { };
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
lib ? pkgs.lib,
|
||||
}:
|
||||
let
|
||||
cargoManifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
||||
system-manager-unwrapped = pkgs.callPackage (
|
||||
{
|
||||
lib,
|
||||
|
||||
rustPlatform,
|
||||
cargo,
|
||||
dbus,
|
||||
pkg-config,
|
||||
nix,
|
||||
clippy,
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
|
||||
runCommand,
|
||||
makeBinaryWrapper,
|
||||
}:
|
||||
let
|
||||
cargoManifest = (lib.importTOML ./Cargo.toml).package;
|
||||
system-manager-unwrapped = rustPlatform.buildRustPackage {
|
||||
pname = "system-manager";
|
||||
version = cargoManifest.version;
|
||||
src = lib.fileset.toSource {
|
||||
|
|
@ -37,27 +38,29 @@ let
|
|||
];
|
||||
|
||||
preCheck = ''
|
||||
${lib.getExe pkgs.cargo} clippy
|
||||
${lib.getExe cargo} clippy
|
||||
|
||||
# Stop the Nix command from trying to create /nix/var/nix/profiles.
|
||||
#
|
||||
# https://nix.dev/manual/nix/2.24/command-ref/new-cli/nix3-profile#profiles
|
||||
export NIX_STATE_DIR=$TMPDIR
|
||||
'';
|
||||
}
|
||||
) { };
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit system-manager-unwrapped;
|
||||
system-manager =
|
||||
pkgs.runCommand "system-manager"
|
||||
runCommand "system-manager"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.pkgsBuildHost.makeBinaryWrapper ];
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
passthru = {
|
||||
# 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.
|
||||
unwrapped = system-manager-unwrapped;
|
||||
};
|
||||
}
|
||||
''
|
||||
makeWrapper \
|
||||
${system-manager-unwrapped}/bin/system-manager \
|
||||
$out/bin/system-manager \
|
||||
--prefix PATH : ${lib.makeBinPath [ pkgs.nix ]}
|
||||
'';
|
||||
}
|
||||
--prefix PATH : ${lib.makeBinPath [ nix ]}
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue