Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: lucasew <[email protected]>
  • Loading branch information
lucasew committed Jan 8, 2025
1 parent 79571c4 commit b0192d8
Show file tree
Hide file tree
Showing 232 changed files with 1,356 additions and 3,654 deletions.
24 changes: 6 additions & 18 deletions nixos/doc/manual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@
}:

let
inherit (pkgs) buildPackages runCommand docbook_xsl_ns;

inherit (pkgs.lib)
hasPrefix
removePrefix
flip
foldr
types
lib.mkOption
escapeShellArg
concatMapStringsSep
sourceFilesBySuffices
;
inherit (pkgs) buildPackages runCommand docbook_xsl_ns lib;

common = import ./common.nix;

Expand All @@ -35,7 +23,7 @@ let
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
# you'd need to include `extraSources = [ pkgs.customModules ]`
prefixesToStrip = map (p: "${toString p}/") ([ prefix ] ++ extraSources);
stripAnyPrefixes = flip (foldr removePrefix) prefixesToStrip;
stripAnyPrefixes = lib.flip (lib.foldr lib.removePrefix) prefixesToStrip;

optionsDoc = buildPackages.nixosOptionsDoc {
inherit options revision baseOptionsJSON warningsAreErrors;
Expand All @@ -61,9 +49,9 @@ let
declarations =
map
(decl:
if hasPrefix (toString ../../..) (toString decl)
if lib.hasPrefix (toString ../../..) (toString decl)
then
let subpath = removePrefix "/" (removePrefix (toString ../../..) (toString decl));
let subpath = lib.removePrefix "/" (lib.removePrefix (toString ../../..) (toString decl));
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
else decl)
opt.declarations;
Expand All @@ -86,7 +74,7 @@ let
substituteInPlace ./configuration/configuration.md \
--replace-fail \
'@MODULE_CHAPTERS@' \
${lib.escapeShellArg (concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
${lib.escapeShellArg (lib.concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
substituteInPlace ./nixos-options.md \
--replace-fail \
'@NIXOS_OPTIONS_JSON@' \
Expand All @@ -105,7 +93,7 @@ in rec {
# Generate the NixOS manual.
manualHTML = runCommand "nixos-manual-html"
{ nativeBuildInputs = [ buildPackages.nixos-render-docs ];
inputs = sourceFilesBySuffices ./. [ ".md" ];
inputs = lib.sourceFilesBySuffices ./. [ ".md" ];
meta.description = "The NixOS manual in HTML format";
allowedReferences = ["out"];
}
Expand Down
6 changes: 2 additions & 4 deletions nixos/lib/eval-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ evalConfigArgs@
}:

let
inherit (lib) lib.optional;

evalModulesMinimal = (import ./default.nix {
inherit lib;
# Implicit use of feature is noted in implementation.
Expand All @@ -68,15 +66,15 @@ let
_file = ./eval-config.nix;
key = _file;
config = lib.mkMerge (
(optional (system != null) {
(lib.optional (system != null) {
# Explicit `nixpkgs.system` or `nixpkgs.localSystem` should override
# this. Since the latter defaults to the former, the former should
# default to the argument. That way this new default could propagate all
# they way through, but has the last priority behind everything else.
nixpkgs.system = lib.mkDefault system;
})
++
(optional (pkgs != null) {
(lib.optional (pkgs != null) {
# This should be default priority, so it conflicts with any user-defined pkgs.
nixpkgs.pkgs = pkgs;
})
Expand Down
Loading

0 comments on commit b0192d8

Please sign in to comment.