mlvzk / manix Goto Github PK
View Code? Open in Web Editor NEWA fast CLI documentation searcher for Nix.
License: Mozilla Public License 2.0
A fast CLI documentation searcher for Nix.
License: Mozilla Public License 2.0
$ RUST_BACKTRACE=1 manix list
# listDfs (lib/lists.nix)
Depth-First Search (DFS) for lists `list != []`.
`before a b == true` means that `b` depends on `a` (there's an
edge from `b` to `a`).
Example:
listDfs true hasPrefix [ "/home/user" "other" "/" "/home" ]
== { minimal = "/"; # minimal element
visited = [ "/home/user" ]; # seen elements (in reverse order)
rest = [ "/home" "other" ]; # everything else
}
listDfs true hasPrefix [ "/home/user" "other" "/" "/home" "/" ]
== { cycle = "/"; # cycle encountered at this element
loops = [ "/" ]; # and continues to these elements
visited = [ "/" "/home/user" ]; # elements leading to the cycle (in reverse order)
rest = [ "/home" "other" ]; # everything else
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: StripPrefixError(())', src/libcore/result.rs:1188:5
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::result::unwrap_failed
9: manix::comments_docsource::CommentDocumentation::pretty_printed
10: manix::DocEntry::pretty_printed
11: manix::main
12: std::rt::lang_start::{{closure}}
13: std::panicking::try::do_call
14: __rust_maybe_catch_panic
15: std::rt::lang_start_internal
16: main
17: __libc_start_main
18: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Was hoping to use this to look up functions while writing Nix code but it doesn't output anything:
$ manix lib.listToAttrs
Building Home Manager Options cache...
Building NixOS Options cache...
Building Nixpkgs Tree cache...
Building Nixpkgs Documentation cache...
Here's what I found in nixpkgs: lib.listToAttrs
I don't know if it's related but I'm using home-manager.users
to use home-manager in my configuration.nix. And I'm using niv
so I don't have any home-manager channel.
manix 1272c45
❯ manix notmuch nix-shell
Failed to load Home Manager Options cache file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Here's what I found in nixpkgs: python39Packages.notmuch pkgsTargetTarget.notmuch-mutt pkgsTargetTarget.notmuch-addrlookup pkgsTargetTarget.notmuch-bower pkgsTargetTarget.notmuch python37Packages.notmuch buildPackages.notmuch-mutt buildPackages.notmuch buildPackages.notmuch-bower buildPackages.notmuch-addrlookup notmuch-mutt python3Packages.notmuch python38Packages.notmuch pkgsMusl.notmuch-bower pkgsMusl.notmuch-mutt pkgsMusl.notmuch-addrlookup pkgsMusl.notmuch pkgsBuildHost.notmuch-addrlookup pkgsBuildHost.notmuch pkgsBuildHost.notmuch-bower pkgsBuildHost.notmuch-mutt pkgsBuildTarget.notmuch-mutt pkgsBuildTarget.notmuch-addrlookup pkgsBuildTarget.notmuch pkgsBuildTarget.notmuch-bower python27Packages.notmuch vimPlugins.deoplete-notmuch __splicedPackages.notmuch-addrlookup __splicedPackages.notmuch __splicedPackages.notmuch-mutt __splicedPackages.notmuch-bower emacs27Packages.counsel-notmuch emacs27Packages.notmuch-bookmarks emacs27Packages.helm-notmuch emacs27Packages.notmuch emacs27Packages.notmuch-labeler pkgsStatic.notmuch-addrlookup pkgsStatic.notmuch-mutt pkgsStatic.notmuch-bower pkgsStatic.notmuch notmuch-addrlookup targetPackages.notmuch targetPackages.notmuch-addrlookup targetPackages.notmuch-mutt targetPackages.notmuch-bower pypyPackages.notmuch pkgsHostTarget.notmuch pkgsHostTarget.notmuch-bower pkgsHostTarget.notmuch-mutt pkgsHostTarget.notmuch-addrlookup and 38 more.
"x86_64-linux"
Linux 5.7.10-zen1, NixOS, 20.09pre-git (Nightingale)
yes
yes
nix-env (Nix) 2.3.7
"nixos-20.09pre237686.96069f7d890"
/run/current-system/nixpkgs
Running manix straight from an install produces the following error:
Building Nixpkgs comments cache...
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/comments_docsource.rs:178:65
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Havent been able to get around this
Hey @mlvzk thanks for this awesome package.
I'm getting two errors in spite of getting results
Failed to load Nixpkgs Tree cache file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Failed to load Nixpkgs Documentation cache file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Nixpkgs Comments
────────────────────
Any clue what I'm doing wrong. Thanks
Building Nixpkgs comments cache...
Building Home Manager Options cache...
Building NixOS Options cache...
Failed to update NixOS Options
Caused by:
0: Failed to perform IO on a cache file
1: No such file or directory (os error 2)
manix 0.6.2
macOS
I'm configuring Home-Manager from my system's configuration, defined in a
Flake.
I don't use channels and I'd like to avoid setting those, not to give them a
chance to go out of sync with the inputs of the Flake.
Nevertheless, I have Home Manager registered in the
nix.registry
option.
I currently get this error when rebuilding the manix cache:
❯ manix --update-cache test
Building Home Manager Options cache...
Failed to update Home Manager Options
Caused by:
0: Failed to perform IO on a cache file
1: No such file or directory (os error 2)
Tip: If you installed your home-manager through configuration.nix you can fix this error by adding the home-manager channel with this command: nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager && nix-channel --update
Would it be feasible to index Home Manager options from the Flake registry
instead of a channel?
Hey, great project but I have a little suggestion - Implement some sort of type
highlighting. This is my current temp workaround:
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --ansi --preview="manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain"
I am just adding the symbol >
in front of the type. Seems to get the job done :)
Thanks for this project, and good luck 👍
Is it possible to use this tool to index and search options from user define modules? Thanks!
The data that the generated JSON documentation from options can provide should be used as a documentation source.
This would imply:
I'm getting the following error when updating the cache:
❯ manix "" -u --source hm_options
Building Home Manager Options cache...
Failed to update Home Manager Options
Caused by:
0: Failed to perform IO on a cache file
1: No such file or directory (os error 2)
Tip: If you installed your home-manager through configuration.nix you can fix this error by adding the home-manager channel with this command: nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager && nix-channel --update
Building NixOS Options cache...
Building Nixpkgs Tree cache...
Building Nixpkgs Documentation cache...
Here are my channels:
❯ nix-channel --list
home-manager https://github.com/rycee/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-unstable
I am using manix 0.6.3. Have I missed something?
It could be nice. My nix config uses a lot of them and it speeds the compile time a lot. Especially when nixos-unstable moves forward and my compile time takes like 3 hours.
nix.dev has a nice template for that using github actions and niv. https://github.com/nix-dot-dev/getting-started-nix-template
Personally I also use nix-build-uncached.
This section truncates the output with a hardcoded SHOW_MAX_LEN
. I'd like to be able to dump all matches. Could also the output be made more grep
friendly?
Can it provide completions for common shells? I guess https://docs.rs/clap_complete/latest/clap_complete can be helpful. TIA!
Hi, thanks for working on this, it's awesome!
I was wondering if it would be possible to add a --source
option (or something like that) so it can only search in a specific source (e.g. only search Home Manager options)?
For example, if I search for programs.chromium
, I currently get this result:
❯ manix -s programs.chromium
HomeManager Options
────────────────────
# programs.chromium.package
The Chromium package to use.
type: package
HomeManager Options
────────────────────
# programs.chromium.extensions
List of Chromium extensions to install.
To find the extension ID, check its URL on the
<link xlink:href="https://chrome.google.com/webstore/category/extensions">Chrome Web Store</link>.
type: list of strings
HomeManager Options
────────────────────
# programs.chromium.enable
Whether to enable Chromium.
type: boolean
NixOS Options
────────────────────
# programs.chromium.enable
Whether to enable <command>chromium</command> policies.
type: boolean
NixOS Options
────────────────────
# programs.chromium.defaultSearchProviderSuggestURL
Chromium default search provider url for suggestions.
type: null or string
NixOS Options
────────────────────
# programs.chromium.homepageLocation
Chromium default homepage
type: null or string
NixOS Options
────────────────────
# programs.chromium.extensions
List of chromium extensions to install.
For list of plugins ids see id in url of extensions on
<link xlink:href="https://chrome.google.com/webstore/category/extensions">chrome web store</link>
page. To install a chromium extension not included in the chrome web
store, append to the extension id a semicolon ";" followed by a URL
pointing to an Update Manifest XML file. See
<link xlink:href="https://www.chromium.org/administrators/policy-list-3#ExtensionInstallForcelist">ExtensionInstallForcelist</link>
for additional details.
type: list of strings
NixOS Options
────────────────────
# programs.chromium.extraOpts
Extra chromium policy options. A list of available policies
can be found in the Chrome Enterprise documentation:
<link xlink:href="https://cloud.google.com/docs/chrome-enterprise/policies/">https://cloud.google.com/docs/chrome-enterprise/policies/</link>
Make sure the selected policy is supported on Linux and your browser version.
type: attribute set
NixOS Options
────────────────────
# programs.chromium.defaultSearchProviderSearchURL
Chromium default search provider url.
type: null or string
When I'm only interested in seeing Home Manager options. I could filter the results out using grep
or ripgrep
but I think it would be more efficient to only search in the sources I'm interested in.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.