diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f825b56 --- /dev/null +++ b/default.nix @@ -0,0 +1,11 @@ +let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + call-flake = import ( + (fetchTarball { + url = "https://github.com/divnix/call-flake/archive/${lock.nodes.call-flake.locked.rev}.tar.gz"; + sha256 = lock.nodes.call-flake.locked.narHash; + }) + + "/flake.nix" + ); +in +call-flake.outputs { } ./. diff --git a/docs/org/loaders.org b/docs/org/loaders.org deleted file mode 100644 index 23bc1fc..0000000 --- a/docs/org/loaders.org +++ /dev/null @@ -1,108 +0,0 @@ -:PROPERTIES: -:ID: da553274-7bc3-4ce0-a314-89a0bfb87a4a -:header-args: :noweb tangle :comments noweb :exports both -:PRJ-DIR: ../.. -:EXP-DIR: ../../examples -:END: -#+TITLE: loaders -#+AUTHOR: GuangTao Zhang -#+EMAIL: gtrunsec@hardenedlinux.org -#+DATE: 2023-11-19 Sun 15:16 - - -#+begin_quote -Please note that in Pops, the outputs/results should not be directly printed, but instead, they wll be exported through the exports property under the pop object. -#+end_quote - - -* packages -:PROPERTIES: -:CODE-DIR: ../../src/pops -:END: - -- function: ~omnibus.pops.pacakges~ - -that function is responsible for loading packages in a tree structure and nixpkgs.callPackage <>automatically. - -#+begin_src nix :tangle (concat (org-entry-get (point) "CODE-DIR" t) "/packages.nix") -{ super, root }: -load: -let - inherit - (root.errors.requiredInputs load.inputs "omnibus.pops.packages" [ "nixpkgs" ]) - nixpkgs - ; - inherit (nixpkgs) newScope; - inherit (nixpkgs.lib) makeScope; -in -makeScope newScope ( - selfScope: - ((super.load load).addLoadExtender { - load = { - loader = - __inputs__: path: - (selfScope.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; - loader = - __inputs__: path: - (__inputs__.inputs.nixpkgs.extend (_: _: { inherit __inputs__; })).callPackage - path - { }; - }; - }).exports.default; - }; - } - )) - ] -) -#+end_src - -- *pops.packages* have an arg named by anti-namespace of *__inputs__* in the scopePackages, that *__inptus__* can pass all args same as haumea.inputs, such as {super,self, ...} => {__inputs__.self, __inputs__.super, inputs.{...} } - - -** Example - -#+begin_src nix :tangle (concat (org-entry-get nil "EXP-DIR" t) "/packages/default.nix") -{ - omnibus, - inputs, - self, -}: -omnibus.pops.packages { - src = ./__fixture; - inputs = { - nixpkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; - }; -} -# => out.exports { default = {...}, packages = {...}; } -#+end_src - - -+ exports - -#+begin_src nix -nix-repl> :p Flake.examples.packages.exports.default -{ hello1 = «derivation /nix/store/kc6j6vssi60h1yn3kafc7v8ywn1j35lp-example-unfree-package-2.0.drv»; hello2 = «derivation / -nix/store/v0qa0lw6jhzcwj68zz939kn8ixmiabnb-example-unfree-package-3.0.drv»; } -#+end_src - - - default (packageSet) - - overlay - #+begin_src nix :tangle (concat (org-entry-get nil "EXP-DIR" t) "/packagesOverlay.nix") -{ super, omnibus }: -let - nixos-23_05 = omnibus.flake.inputs.nixos-23_05; -in -nixos-23_05.legacyPackages.x86_64-linux.extend super.packages.exports.overlay - #+end_src diff --git a/docs/org/pops.org b/docs/org/pops.org index 3353c10..bd66a1d 100644 --- a/docs/org/pops.org +++ b/docs/org/pops.org @@ -10,7 +10,7 @@ #+DATE: 2023-11-19 Sun 15:16 #+begin_quote -Please note that in Pops, the outputs/results should not be directly printed, but instead, they wll be exported through the exports property under the pop object. +Please note that in Pops, the outputs/results should not be directly printed, but instead, they will be exported through the exports property under the pop object. #+end_quote * Loaders