From e17a6a604e478bab6ba88fb049c5bdbe494fb0cf Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 2 Jan 2025 21:32:30 +0100 Subject: [PATCH 1/2] docs: Use defaultText This is a bit more useful and passes the stricter rules I apply in flake-parts docs. --- src/modules/outputs.nix | 8 ++++++++ src/modules/scripts.nix | 2 ++ src/modules/tasks.nix | 2 ++ src/modules/top-level.nix | 1 + 4 files changed, 13 insertions(+) diff --git a/src/modules/outputs.nix b/src/modules/outputs.nix index 819f4e4d3..adb56211d 100644 --- a/src/modules/outputs.nix +++ b/src/modules/outputs.nix @@ -8,6 +8,14 @@ ncdu = pkgs.ncdu; }; }; + defaultText = lib.literalExpression '' + { + git = pkgs.git; + foo = { + ncdu = pkgs.ncdu; + }; + } + ''; description = '' Nix outputs for `devenv build` consumption. ''; diff --git a/src/modules/scripts.nix b/src/modules/scripts.nix index de69288ec..58386dd05 100644 --- a/src/modules/scripts.nix +++ b/src/modules/scripts.nix @@ -18,11 +18,13 @@ let type = types.package; description = "The package to use to run the script."; default = pkgs.bash; + defaultText = lib.literalExpression "pkgs.bash"; }; binary = lib.mkOption { type = types.str; description = "Override the binary name if it doesn't match package name"; default = config.package.pname; + defaultText = lib.literalExpression "config.package.pname"; }; description = lib.mkOption { type = types.str; diff --git a/src/modules/tasks.nix b/src/modules/tasks.nix index 79ff97db8..24b10f663 100644 --- a/src/modules/tasks.nix +++ b/src/modules/tasks.nix @@ -31,10 +31,12 @@ let type = types.str; description = "Override the binary name if it doesn't match package name"; default = config.package.pname; + defaultText = lib.literalExpression "config.package.pname"; }; package = lib.mkOption { type = types.package; default = pkgs.bash; + defaultText = lib.literalExpression "pkgs.bash"; description = "Package to install for this task."; }; command = lib.mkOption { diff --git a/src/modules/top-level.nix b/src/modules/top-level.nix index 191ff40b9..cc9a5732c 100644 --- a/src/modules/top-level.nix +++ b/src/modules/top-level.nix @@ -70,6 +70,7 @@ in type = types.package; description = "The stdenv to use for the developer environment."; default = pkgs.stdenv; + defaultText = lib.literalExpression "pkgs.stdenv"; }; unsetEnvVars = lib.mkOption { From 753cb88f533061f14033375b78f411b4c03ef0da Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:37:49 +0000 Subject: [PATCH 2/2] Auto generate docs/reference/options.md --- docs/reference/options.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/reference/options.md b/docs/reference/options.md index 0542f4619..f3c20806d 100644 --- a/docs/reference/options.md +++ b/docs/reference/options.md @@ -35913,11 +35913,12 @@ outputOf (attribute set) ``` { + git = pkgs.git; foo = { - ncdu = ; + ncdu = pkgs.ncdu; }; - git = ; } + ``` *Declared by:* @@ -65487,7 +65488,7 @@ package *Default:* -` ` +` pkgs.bash ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/scripts.nix](https://github.com/cachix/devenv/blob/main/src/modules/scripts.nix) @@ -65508,7 +65509,7 @@ string *Default:* -` "bash" ` +` config.package.pname ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/scripts.nix](https://github.com/cachix/devenv/blob/main/src/modules/scripts.nix) @@ -72461,7 +72462,7 @@ package *Default:* -` ` +` pkgs.stdenv ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/top-level.nix](https://github.com/cachix/devenv/blob/main/src/modules/top-level.nix) @@ -72498,7 +72499,7 @@ package *Default:* -` ` +` pkgs.bash ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/tasks.nix](https://github.com/cachix/devenv/blob/main/src/modules/tasks.nix) @@ -72561,7 +72562,7 @@ string *Default:* -` "bash" ` +` config.package.pname ` *Declared by:* - [https://github.com/cachix/devenv/blob/main/src/modules/tasks.nix](https://github.com/cachix/devenv/blob/main/src/modules/tasks.nix)