Coder Social home page Coder Social logo

anyrun-nixos-options's Introduction

anyrun-nixos-options

An anyrun plugin that lets you search NixOS options.

how 2 build?

nix build ... or cargo build optionally :)

Configuration

This plugin requires a config in your anyrun config directory called nixos_options.ron. The file looks like this:

Config(
  options: {":prefix": ["/path/to/options.json"] }, // You can obtain NixOS's options.json using config.system.build.manual.optionsJSON
  min_score: 0, // Optional, the minimum score of entries to show. Set it to a larger value on slow machines. Default: 0
  nixpkgs_url: "https://github.com/NixOS/nixpkgs/blob/nixos-unstable", // Optional, URL to Nixpkgs tree. Set it to use the same branch as you're using. Defaults to the unstable url.
  max_entries: Some(10) // max_entries specific to this plugin. Set to None to disable
)

Important: Make sure to set a max_entries either in your anyrun config, or in this plugin's config. Without that, the plugin will be VERY slow, since there exist over 16 thousand options to search through at the time of writing this. I have set mine to 10, since even that value is enough for it to go off-screen, so you shouldn't lose any data.

Using this with NixOS?

Under flakes, the following instructions will apply:

  1. Use the anyrun home-manager module
  2. Add the plugin to your anyrun plugins list
programs.anyrun.config = {
    # ...
    plugins = [
        inputs.anyrun-nixos-options.packages.${pkgs.system}.default
        # other plugins that you might have
    ];
    # ...
};
  1. Create a config file for it:
#                  ↓ make sure osConfig is in the argument set
{inputs, pkgs, osConfig,  ...}: {
    programs.anyrun.extraConfigFiles."nixos-options.ron".text = let
        #               ↓ home-manager refers to the nixos configuration as osConfig
        nixos-options = osConfig.system.build.manual.optionsJSON + "/share/doc/nixos/options.json";
        # merge your options
        options = builtins.toJSON {
          ":nix" = [nixos-options];
        };
        # or alternatively if you wish to read any other documentation options, such as home-manager
        # get the docs-json package from the home-manager flake
        # hm-options = inputs.home-manager.packages.${pkgs.system}.docs-json + "/share/doc/home-manager/options.json";
        # options = builtins.toJSON {
        #   ":nix" = [nixos-options];
        #   ":hm" = [hm-options];
        #   ":something-else" = [some-other-option];
        #   ":nall" = [nixos-options hm-options some-other-option];
        # };

    in ''
        Config(
            // add your option paths
            options: ${options},
         )
    '';
}
  1. You are done. Rebuild your system and run anyrun as usual. :nix should bring up your NixOS (and any other configured) options

Without flakes, inputs... generally should be changed to or depending on your usage.

anyrun-nixos-options's People

Contributors

jappie3 avatar n3oney avatar notashelf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jappie3

anyrun-nixos-options's Issues

make max_entries configurable

to fit anyrun in my screen (and avoid crashes) I must set the max entries value to something like 5, which displays way too few results for other plugins

might be a good idea to have max entries configurable specific to this plugin, similar to how the symbols plugin does it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.