From 4c67fce376d290acdd7da9d8abe1075292f37709 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Sun, 30 Jun 2024 17:43:38 -0400 Subject: [PATCH] move all other packages --- flake.nix | 29 +----------- packages/doc-locations-json/default.nix | 4 +- packages/lib-doc/default.nix | 15 +----- .../libsets/default.nix | 2 +- packages/manual-assets/default.nix | 2 +- .../md-manual/default.nix | 13 ++--- .../nixpkgs-doc/default.nix | 2 +- .../options-doc/default.nix | 2 +- .../python-interp-table/default.nix | 47 ++++++++++++------- 9 files changed, 46 insertions(+), 70 deletions(-) rename nixpkgs-doc/libsets.nix => packages/libsets/default.nix (99%) rename nixpkgs-doc/md-manual.nix => packages/md-manual/default.nix (87%) rename nixpkgs-doc/nixpkgs-doc.nix => packages/nixpkgs-doc/default.nix (88%) rename nixpkgs-doc/options-doc.nix => packages/options-doc/default.nix (96%) rename nixpkgs-doc/doc-support/python-interpreter-table.nix => packages/python-interp-table/default.nix (61%) diff --git a/flake.nix b/flake.nix index 4a1b3e7..30d5b06 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ }; outputs = - inputs@{ self, ... }: + inputs: inputs.snowfall-lib.mkFlake { inherit inputs; src = ./.; @@ -19,32 +19,5 @@ title = "Aux Manual Generator"; }; }; - outputs-builder = - channels: - let - pkgs = channels.nixpkgs; - spkgs = self.packages.${pkgs.system}; - libsets = (import ./nixpkgs-doc/libsets.nix); - in - { - packages = { - lib-docs = pkgs.callPackage ./nixpkgs-doc/doc-support/lib-function-docs.nix { - inherit - libsets - pkgs - spkgs - inputs - ; - }; - doc-locations-json = pkgs.callPackage ./nixpkgs-doc/doc-support/lib-function-locations.nix { - inherit libsets pkgs; - }; - md-manual = pkgs.callPackage ./nixpkgs-doc/md-manual.nix { inherit spkgs inputs; }; - python-interp-table = pkgs.callPackage ./nixpkgs-doc/doc-support/python-interpreter-table.nix { }; - options-doc = pkgs.callPackage ./nixpkgs-doc/options-doc.nix { inherit pkgs inputs; }; - nixpkgs-doc = pkgs.callPackage ./nixpkgs-doc/nixpkgs-doc.nix { inherit inputs; }; - manual-assets = pkgs.callPackage ./nixpkgs-doc/manual-assets.nix { }; - }; - }; }; } diff --git a/packages/doc-locations-json/default.nix b/packages/doc-locations-json/default.nix index 4565376..a748502 100644 --- a/packages/doc-locations-json/default.nix +++ b/packages/doc-locations-json/default.nix @@ -1,4 +1,4 @@ -{ pkgs, libsets }: +{ pkgs, ... }: let revision = pkgs.lib.trivial.revisionWithDefault (pkgs.rev or "master"); @@ -22,7 +22,7 @@ let builtins.map (subsetname: { subsetname = subsetname; functions = libDefPos [ ] toplib.${subsetname}; - }) (builtins.map (x: x.name) libsets); + }) (builtins.map (x: x.name) pkgs.libsets); nixpkgsLib = pkgs.lib; diff --git a/packages/lib-doc/default.nix b/packages/lib-doc/default.nix index e79d71a..1c27e9b 100644 --- a/packages/lib-doc/default.nix +++ b/packages/lib-doc/default.nix @@ -1,9 +1,5 @@ # Generates the documentation for library functions via nixdoc. -{ - pkgs, - libsets, - inputs, -}: +{ pkgs, inputs, ... }: let inherit (pkgs) stdenv lib nixdoc; @@ -25,15 +21,10 @@ stdenv.mkDerivation { else nixdoc -c "$name" -d "lib.$name: $description" -l ${pkgs.doc-locations-json} -f "$baseName/default.nix" > "$out/$name.md" fi - echo "$out/$name.md" >> "$out/index.md" } mkdir -p "$out" - cat > "$out/index.md" << 'EOF' - ```{=include=} sections auto-id-prefix=auto-generated - EOF - ${lib.concatMapStrings ( { name, @@ -43,8 +34,6 @@ stdenv.mkDerivation { '' docgen ${name} ${baseName} ${lib.escapeShellArg description} '' - ) libsets} - - echo '```' >> "$out/index.md" + ) pkgs.libsets} ''; } diff --git a/nixpkgs-doc/libsets.nix b/packages/libsets/default.nix similarity index 99% rename from nixpkgs-doc/libsets.nix rename to packages/libsets/default.nix index 8fa1982..8f6dd86 100644 --- a/nixpkgs-doc/libsets.nix +++ b/packages/libsets/default.nix @@ -1,4 +1,4 @@ -[ +_: [ { name = "asserts"; description = "assertion functions"; diff --git a/packages/manual-assets/default.nix b/packages/manual-assets/default.nix index c551e9c..83a2733 100644 --- a/packages/manual-assets/default.nix +++ b/packages/manual-assets/default.nix @@ -1,4 +1,4 @@ -{ stdenvNoCC }: +{ stdenvNoCC, ... }: stdenvNoCC.mkDerivation { pname = "aux-manual-assets"; version = "0.0.0"; diff --git a/nixpkgs-doc/md-manual.nix b/packages/md-manual/default.nix similarity index 87% rename from nixpkgs-doc/md-manual.nix rename to packages/md-manual/default.nix index 172541f..23e38b6 100644 --- a/nixpkgs-doc/md-manual.nix +++ b/packages/md-manual/default.nix @@ -1,11 +1,12 @@ { lib, + pkgs, nixos-render-docs, python3, perl, stdenvNoCC, - spkgs, inputs, + ... }: stdenvNoCC.mkDerivation { name = "nixpkgs-manual-md"; @@ -24,10 +25,10 @@ stdenvNoCC.mkDerivation { ''; postPatch = '' - ln -s ${spkgs.options-doc.optionsJSON}/share/doc/nixos/options.json ./config-options.json + ln -s ${pkgs.options-doc.optionsJSON}/share/doc/nixos/options.json ./config-options.json ''; - pythonInterpreterTable = spkgs.python-interp-table; + pythonInterpreterTable = pkgs.python-interp-table; passAsFile = [ "pythonInterpreterTable" ]; @@ -36,7 +37,7 @@ stdenvNoCC.mkDerivation { cat \ ./functions/library.md.in \ - ${spkgs.lib-docs}/index.md \ + ${pkgs.lib-docs}/index.md \ > ./functions/library.md substitute ./manual.md.in ./manual.md \ --replace-fail '@MANUAL_VERSION@' '${lib.version}' @@ -44,7 +45,7 @@ stdenvNoCC.mkDerivation { mkdir out mkdir out/assets - cp ${spkgs.manual-assets}/* out/assets/ + cp ${pkgs.manual-assets}/* out/assets/ mv preface.chapter.md out/index.md mv build-helpers out/build-helpers @@ -56,7 +57,7 @@ stdenvNoCC.mkDerivation { mv hooks out/hooks mv languages-frameworks out/languages-frameworks mkdir out/lib - cp ${spkgs.lib-docs}/*.md out/lib/ + cp ${pkgs.lib-docs}/*.md out/lib/ rm out/lib/index.md mv module-system out/module-system mv packages out/packages diff --git a/nixpkgs-doc/nixpkgs-doc.nix b/packages/nixpkgs-doc/default.nix similarity index 88% rename from nixpkgs-doc/nixpkgs-doc.nix rename to packages/nixpkgs-doc/default.nix index b8022c2..8949342 100644 --- a/nixpkgs-doc/nixpkgs-doc.nix +++ b/packages/nixpkgs-doc/default.nix @@ -1,4 +1,4 @@ -{ stdenv, inputs }: +{ stdenv, inputs, ... }: stdenv.mkDerivation { pname = "nixpkgs-doc-src"; version = "unstable"; diff --git a/nixpkgs-doc/options-doc.nix b/packages/options-doc/default.nix similarity index 96% rename from nixpkgs-doc/options-doc.nix rename to packages/options-doc/default.nix index 80124c5..2c61e62 100644 --- a/nixpkgs-doc/options-doc.nix +++ b/packages/options-doc/default.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs }: +{ pkgs, inputs, ... }: let inherit (pkgs.lib) hasPrefix removePrefix; in diff --git a/nixpkgs-doc/doc-support/python-interpreter-table.nix b/packages/python-interp-table/default.nix similarity index 61% rename from nixpkgs-doc/doc-support/python-interpreter-table.nix rename to packages/python-interp-table/default.nix index 6f2b342..42d6d07 100644 --- a/nixpkgs-doc/doc-support/python-interpreter-table.nix +++ b/packages/python-interp-table/default.nix @@ -1,14 +1,26 @@ -# For debugging, run in this directory: -# nix eval --impure --raw --expr 'import ./python-interpreter-table.nix {}' -{ pkgs ? (import ../.. { config = { }; overlays = []; }) }: +{ + pkgs ? ( + import ../.. { + config = { }; + overlays = [ ]; + } + ), + ... +}: let lib = pkgs.lib; inherit (lib.attrsets) attrNames filterAttrs; - inherit (lib.lists) elem filter map naturalSort reverseList; - inherit (lib.strings) concatStringsSep; + inherit (lib.lists) + filter + map + naturalSort + reverseList + ; - isPythonInterpreter = name: - /* NB: Package names that don't follow the regular expression: + isPythonInterpreter = + name: + /* + NB: Package names that don't follow the regular expression: - `python-cosmopolitan` is not part of `pkgs.pythonInterpreters`. - `_prebuilt` interpreters are used for bootstrapping internally. - `python3Minimal` contains python packages, left behind conservatively. @@ -16,7 +28,8 @@ let */ (lib.strings.match "(pypy|python)([[:digit:]]*)" name) != null; - interpreterName = pname: + interpreterName = + pname: let cuteName = { cpython = "CPython"; @@ -26,16 +39,15 @@ let in "${cuteName.${interpreter.implementation}} ${interpreter.pythonVersion}"; - interpreters = reverseList (naturalSort ( - filter isPythonInterpreter (attrNames pkgs.pythonInterpreters) - )); + interpreters = reverseList ( + naturalSort (filter isPythonInterpreter (attrNames pkgs.pythonInterpreters)) + ); - aliases = pname: + aliases = + pname: attrNames ( - filterAttrs (name: value: - isPythonInterpreter name - && name != pname - && interpreterName name == interpreterName pname + filterAttrs ( + name: _: isPythonInterpreter name && name != pname && interpreterName name == interpreterName pname ) pkgs ); @@ -45,7 +57,8 @@ let interpreter = interpreterName pname; }) interpreters; - toMarkdown = data: + toMarkdown = + data: let line = package: '' | ${package.pname} | ${join ", " package.aliases or [ ]} | ${package.interpreter} |