Skip to content

Commit

Permalink
chore(templates/packages): pass the __inputs__ to callPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Nov 19, 2023
1 parent d7b39da commit 5c45df2
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
stdenv,
runtimeShell,
__inputs__,
}:

stdenv.mkDerivation {
Expand All @@ -19,6 +20,9 @@ stdenv.mkDerivation {
chmod +x $out/bin/hello-unfree
'';

passthru = {
test = __inputs__;
};
meta = {
description = "An example package with unfree license (for testing)";
maintainers = [ lib.maintainers.oxij ];
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ omnibus, inputs }:
{
omnibus,
inputs,
self,
}:
omnibus.pops.packages {
src = ./__fixture;
inputs = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion local/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
{
examples = omnibus.load {
src = ./examples;
src = ../examples;
transformer = [ (_cursor: dir: if dir ? default then dir.default else dir) ];
inputs = inputs.nixpkgs.lib.recursiveUpdate omnibus.lib.loaderInputs {
inherit inputs;
Expand Down
24 changes: 17 additions & 7 deletions src/pops/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@ let
inherit (nixpkgs.lib) makeScope;
in
makeScope newScope (
self:
let
inherit (self) callPackage;
in
pkgs:
((super.load load).addLoadExtender {
load.loader = _: path: callPackage path { };
load = {
loader =
__inputs__: path:
(pkgs.overrideScope (_: _: { inherit __inputs__; })).callPackage path { };
transformer = [ (_cursor: dir: if dir ? default then dir.default else dir) ];
};
}).addExporters
[
(POP.extendPop flops.haumea.pops.exporter (
self: _super: {
exports = {
overlay =
final: prev:
(self.layouts.self.addLoadExtender { load.inputs.inputs.nixpkgs = final; })
.exports.default;
(self.layouts.self.addLoadExtender {
load = {
inputs.inputs.nixpkgs = final;
loader =
__inputs__: path:
(__inputs__.inputs.nixpkgs.extend (_: _: { inherit __inputs__; })).callPackage
path
{ };
};
}).exports.default;
};
}
))
Expand Down

0 comments on commit 5c45df2

Please sign in to comment.