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; };
|
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; };
|
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; }
|
{
|
||||||
// {
|
default = pkgs.callPackage ./package.nix { };
|
||||||
default = self.packages.${system}.system-manager;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
overlays = {
|
overlays = {
|
||||||
packages = final: _prev: import ./packages.nix { pkgs = final; };
|
default = final: _prev: {
|
||||||
default = self.overlays.packages;
|
system-manager = final.callPackage ./package.nix { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Only useful for quick tests
|
# Only useful for quick tests
|
||||||
|
|
@ -70,7 +66,7 @@
|
||||||
(eachSystem (
|
(eachSystem (
|
||||||
{ system, ... }:
|
{ 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
|
# Pass the wrapped system-manager binary down
|
||||||
# TODO: Use nixpkgs version by default.
|
# TODO: Use nixpkgs version by default.
|
||||||
inherit (import ../packages.nix { inherit pkgs; })
|
system-manager = pkgs.callPackage ../package.nix { };
|
||||||
system-manager
|
|
||||||
;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
{
|
{
|
||||||
pkgs ? import <nixpkgs> { },
|
lib,
|
||||||
lib ? pkgs.lib,
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cargoManifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
|
||||||
system-manager-unwrapped = pkgs.callPackage (
|
|
||||||
{
|
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
|
cargo,
|
||||||
dbus,
|
dbus,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
nix,
|
nix,
|
||||||
clippy,
|
clippy,
|
||||||
}:
|
|
||||||
rustPlatform.buildRustPackage {
|
runCommand,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cargoManifest = (lib.importTOML ./Cargo.toml).package;
|
||||||
|
system-manager-unwrapped = rustPlatform.buildRustPackage {
|
||||||
pname = "system-manager";
|
pname = "system-manager";
|
||||||
version = cargoManifest.version;
|
version = cargoManifest.version;
|
||||||
src = lib.fileset.toSource {
|
src = lib.fileset.toSource {
|
||||||
|
|
@ -37,27 +38,29 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
${lib.getExe pkgs.cargo} clippy
|
${lib.getExe cargo} clippy
|
||||||
|
|
||||||
# Stop the Nix command from trying to create /nix/var/nix/profiles.
|
# 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
|
# https://nix.dev/manual/nix/2.24/command-ref/new-cli/nix3-profile#profiles
|
||||||
export NIX_STATE_DIR=$TMPDIR
|
export NIX_STATE_DIR=$TMPDIR
|
||||||
'';
|
'';
|
||||||
}
|
};
|
||||||
) { };
|
|
||||||
in
|
in
|
||||||
{
|
runCommand "system-manager"
|
||||||
inherit system-manager-unwrapped;
|
|
||||||
system-manager =
|
|
||||||
pkgs.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 \
|
makeWrapper \
|
||||||
${system-manager-unwrapped}/bin/system-manager \
|
${system-manager-unwrapped}/bin/system-manager \
|
||||||
$out/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