Hihi. Lets say I just cloned a new version of the nixpkgs repository and now want to read the manpage for configuration.nix
to check the options and sketch my new configuration. How can I do it?
Specifically, I expect something like
$ nix build '.#pkgs.something.like.nixos.manpage' # What to put here?
to run this expression and build ./result
pointing to the manpage. So, what is the correct way to build the manpage from scratch?
There is a README.md in the NixOS manual directory, which will point you to the relevant part of the manual.
1 Like
Thank you, I think I came to an answer, kind of. I didn’t mention this explicitly, but I was interested in using nix-flake infrastructure to build this. In other words, I assume that I do not have a direct access to nixos/release.nix
, but only to the top-level nixpkgs
expression.
With this limitation, I think it is not possible to build the manpage currently because the top-level expression does not contain (or I did not found) the link to the manpage expression. But it is not so hard to fix this. After the following trivial nixpkgs
change I was able to do what I was looking for:
diff --git a/flake.nix b/flake.nix
index 43c9f00dea30..f112fb9efe8e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -107,5 +107,10 @@
*/
readOnlyPkgs = ./nixos/modules/misc/nixpkgs/read-only.nix;
};
+
+ configurationManual = (import ./nixos/release.nix {
+ nixpkgs = self;
+ }).nixos-configuration-reference-manpage.x86_64-linux;
+
};
}
So now I can call my custom flake.nix which refers to the nixpkgs flake as nixpkgs
nix build '.#packages.x86_64-linux.nixpkgs.configurationManual'
and get the page I want.
In that case, you should be able to use the following in in your flake:
(import "${nixpkgs}/nixos/release.nix" {
inherit nixpkgs;
}).nixos-configuration-reference-manpage.x86_64-linux
Or alternately, take it from your system:
self.outputs.nixosConfigurations./* your hostname here */.config.system.build.manual.nixos-configuration-reference-manpage
Or if you do not have a system, you can create one on the fly with:
(nixpkgs.legacyPackages.x86_64-linux.nixos {}).config.system.build.manual.nixos-configuration-reference-manpage
2 Likes