fix: remove compat with old bundler API

This commit is contained in:
Tom Bereknyei 2022-06-23 23:59:22 -04:00
parent b11f6a6b4d
commit 1629b6b0d6
2 changed files with 19 additions and 47 deletions

View File

@ -36,7 +36,9 @@
"nix-utils": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1632973430,
@ -69,37 +71,25 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1629252929,
"narHash": "sha256-Aj20gmGBs8TG7pyaQqgbsqAQ6cB+TVuL18Pk3DPBxcQ=",
"owner": "nixos",
"lastModified": 1653936696,
"narHash": "sha256-M6bJShji9AIDZ7Kh7CPwPBPb/T7RiVev2PAcOi4fxDQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3788c68def67ca7949e0864c27638d484389363d",
"rev": "ce6aa13369b667ac2542593170993504932eb836",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "NixOS",
"ref": "22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1634782485,
"narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=",
"path": "/nix/store/p53cz6rh27q40g9i0q98k3vfrz6lm12w-source",
"rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nix-bundle": "nix-bundle",
"nix-utils": "nix-utils",
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_2"
}
}
},

View File

@ -8,7 +8,9 @@
description = "Example bundlers";
inputs.nix-utils.url = "github:juliosueiras-nix/nix-utils";
inputs.nix-utils.inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-bundle.url = "github:matthewbauer/nix-bundle";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/22.05";
outputs = { self, nixpkgs, nix-bundle, nix-utils }: let
# System types to support.
@ -29,19 +31,14 @@
in {
defaultBundler = builtins.listToAttrs (map (system: {
name = system;
value = drv: self.bundlers.${system}.toArx drv;
}) supportedSystems)
# Backwards compatibility helper for pre Nix2.6 bundler API
// {__functor = s: nix-bundle.bundlers.nix-bundle;};
value = drv: self.bundlers.${system}.default drv;
}) supportedSystems);
bundlers = let n =
(forAllSystems (system: {
# Backwards compatibility helper for pre Nix2.6 bundler API
toArx = drv: (nix-bundle.bundlers.nix-bundle ({
program = if drv?program then drv.program else (program drv);
inherit system;
})) // (if drv?program then {} else {name=
(builtins.parseDrvName drv.name).name;});
bundlers =
(forAllSystems (system: rec {
default = toArx;
toArx = drv: nix-bundle.bundlers.nix-bundle {inherit system; program=program drv;};
toRPM = drv: nix-utils.bundlers.rpm {inherit system; program=program drv;};
@ -67,20 +64,5 @@
identity = drv: drv;
}
));
in with builtins;
# Backwards compatibility helper for pre Nix2.6 bundler API
listToAttrs (map
(name: {
inherit name;
value = builtins.trace "The bundler API has been updated to require the form `bundlers.<system>.<name>`. The previous API will be deprecated in Nix 2.7. See `https://github.com/NixOS/nix/pull/5456/`"
({system,program}@drv: self.bundlers.${system}.${name}
(drv // {
name = baseNameOf drv.program;
outPath = dirOf (dirOf drv.program);
}));
})
(attrNames n.x86_64-linux))
//
n;
};
}