Skip to content

Commit

Permalink
fix: also do special nix instantiation for supflake nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Jun 30, 2023
1 parent 9683ecf commit 10270dc
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions grow/newImportSignatureFor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,39 @@ This file implements the unique import signature of each block.
deSystemize,
}: cfg: let
self = cfg.inputs.self.sourceInfo // {rev = cfg.inputs.self.sourceInfo.rev or "not-a-commit";};
instantiateNixpkgsWith = system:
instantiateNixpkgsWith = system: nixpkgs:
(
if cfg.nixpkgsConfig != {}
then
(import cfg.inputs.nixpkgs {
(import nixpkgs {
inherit system;
config = cfg.nixpkgsConfig;
})
# numtide/nixpkgs-unfree blocks re-import
else cfg.inputs.nixpkgs.legacyPackages.${system}
else nixpkgs.legacyPackages.${system}
)
// {inherit (cfg.inputs.nixpkgs) outPath sourceInfo;};
// {inherit (nixpkgs) outPath sourceInfo;};
in
system: cells: additionalInputs: (
system: cells: additionalInputs: let
currentNixpkgs =
if additionalInputs ? nixpkgs
then additionalInputs.nixpkgs
else if cfg.inputs ? nixpkgs
then cfg.inputs.nixpkgs
else null;
in (
(deSystemize system (cfg.inputs // additionalInputs))
// {
inherit self;
cells = deSystemize system cells; # recursion on cells
}
// l.optionalAttrs (cfg.inputs ? nixpkgs) {
// l.optionalAttrs (currentNixpkgs != null) {
nixpkgs =
(instantiateNixpkgsWith system)
(instantiateNixpkgsWith system currentNixpkgs)
//
# mimick deSystemize behaviour
(builtins.mapAttrs
(system: _: instantiateNixpkgsWith system)
cfg.inputs.nixpkgs.legacyPackages);
(system: _: instantiateNixpkgsWith system currentNixpkgs)
currentNixpkgs.legacyPackages);
}
)

0 comments on commit 10270dc

Please sign in to comment.