Possibly other setup needed via home-manager on nix-on-droid
573 opened this issue · comments
Tried all install methods I could find here but in my case have to put yet another one.
But the problem (visible) only via nix-on-droid as it seems was that neither nix-doc callPackage
produced any output nor the plugin seemed to have been generated at the place(s) expected, regarding the documentation pointers mentioned above.
So I ended up doing this in my home.nix
# ~/.config/nixpkgs/home.nix (excerpt)
{ pkgs ? import <nixpkgs> { }, config, lib, ... }:
with lib;
let
nix-doc = import ./program/nix-doc/default.nix { inherit (pkgs) stdenv; inherit (pkgs) rustPlatform; inherit (pkgs) fetchFromGitHub; inherit pkgs; };
in
{
home.packages = with pkgs; [ (nix-doc) ];
home.file = {
nixConf = {
text = ''
plugin-files = ${nix-doc}/lib/libnix_doc_plugin.so
'';
};
};
}
# ~/.config/nixpkgs/program/nix-doc/default.nix
{ stdenv, rustPlatform, fetchFromGitHub, pkgs, ... }:
rustPlatform.buildRustPackage rec {
pname = "nix-doc";
version = "v0.4.0";
src = fetchFromGitHub {
repo = pname;
owner = "lf-";
rev = version;
sha256 = "1im5qiszp5nk04083r9il05kybmrqa41bvm1axzd1r6bzdvw8xzq";
};
buildInputs = with pkgs; [ boost nix ];
nativeBuildInputs = with pkgs; [ pkg-config ];
# https://github.com/lf-/nix-doc/pull/5
cargoSha256 = "0w8xnv497niwqv6gm0n49kd795p493312kilcbi0cqmm0v49zryz";
doCheck = false;
meta = with stdenv.lib; {
homepage = url;
license = licenses.lgpl3;
description = "A Nix documentation lookup tool that quickly dumps the docs of the library function";
};
}
This built both nix-doc
and lib/libnix_doc_plugin
for me.
Not sure what the plugin issue is (does the version in nixpkgs work? (Yes it's two versions behind but those versions only add stuff people on Nix 3 with my particular PR care about)). However, I can say what your CLI issue probably is:
nix-doc searches relative to your current working directory. It's analogous to grep. You can give it a second argument to where your nixpkgs is, but I usually just run it from my local checkout.
Our CLI experience isn't great, which is why someone basically forked the tool to focus on this, with caching and specialization for nixpkgs (I think I linked the fork/reimagining in related works? If not, check the forks list of this repo, one of the people who forked it has their tool on their profile). The way I suggest you use nix-doc is in the repl with the plugin as it's far faster than the CLI and is guaranteed to be accurate.
@lf- thanks for the quick followup, I'm fine with the plugin, it is working great.
I am closing this ticket for now, just wanted to make sure the setup method is cached somewhere it may help other users.