mirror of
https://github.com/NixOS/bundlers.git
synced 2024-09-11 07:05:23 +03:00
fix: protect drv if it cannot be converted to a string
This commit is contained in:
parent
aa68785e30
commit
3476034902
12
flake.nix
12
flake.nix
@ -21,15 +21,17 @@
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||
|
||||
# Backwards compatibility helper for pre Nix2.6 bundler API
|
||||
program = p: with builtins; with p; "${outPath}/bin/${
|
||||
program = p: with builtins; with (protect p); "${outPath}/bin/${
|
||||
if p?meta && p.meta?mainProgram then
|
||||
meta.mainProgram
|
||||
else (parseDrvName (unsafeDiscardStringContext p.name)).name
|
||||
}";
|
||||
|
||||
protect = drv: if drv?outPath then drv else throw "provided installable is not a derivation and not coercible to an outPath";
|
||||
in {
|
||||
defaultBundler = builtins.listToAttrs (map (system: {
|
||||
name = system;
|
||||
value = drv: self.bundlers.${system}.toArx drv;
|
||||
value = drv: self.bundlers.${system}.toArx (protect drv);
|
||||
}) supportedSystems)
|
||||
# Backwards compatibility helper for pre Nix2.6 bundler API
|
||||
// {__functor = s: nix-bundle.bundlers.nix-bundle;};
|
||||
@ -51,17 +53,17 @@
|
||||
(nixpkgs.legacyPackages.${system}.dockerTools.buildLayeredImage {
|
||||
name = drv.name or drv.pname or "image";
|
||||
tag = "latest";
|
||||
contents = [ drv ];
|
||||
contents = if drv?outPath then drv else throw "provided installable is not a derivation and not coercible to an outPath";
|
||||
});
|
||||
|
||||
toBuildDerivation = drv:
|
||||
(import ./report/default.nix {
|
||||
inherit drv;
|
||||
drv = protect drv;
|
||||
pkgs = nixpkgsFor.${system};}).buildtimeDerivations;
|
||||
|
||||
toReport = drv:
|
||||
(import ./report/default.nix {
|
||||
inherit drv;
|
||||
drv = protect drv;
|
||||
pkgs = nixpkgsFor.${system};}).runtimeReport;
|
||||
|
||||
identity = drv: drv;
|
||||
|
Loading…
Reference in New Issue
Block a user