From b558dac7a95a8007151e8f0d2757a33eb5d8871d Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 21 Oct 2025 21:59:12 +0200 Subject: [PATCH] flake.nix: Add nix run .#open-manual Great for reviewing the rendered manual --- flake.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/flake.nix b/flake.nix index 8d3d963be..418f3180f 100644 --- a/flake.nix +++ b/flake.nix @@ -471,6 +471,27 @@ } ); + apps = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}.native; + opener = if pkgs.stdenv.isDarwin then "open" else "xdg-open"; + in + { + open-manual = { + type = "app"; + program = "${pkgs.writeShellScript "open-nix-manual" '' + manual_path="${self.packages.${system}.nix-manual}/share/doc/nix/manual/index.html" + if ! ${opener} "$manual_path"; then + echo "Failed to open manual with ${opener}. Manual is located at:" + echo "$manual_path" + fi + ''}"; + meta.description = "Open the Nix manual in your browser"; + }; + } + ); + devShells = let makeShell = import ./packaging/dev-shell.nix { inherit lib devFlake; };