I’ve been messing around with nix flakes to configure my NixOS system and to put the final touches on I wanted to write an overlay of Neovim with the plugins and everything configured with Lua and then use this overlay to install neovim-qt. After reading various docs on Overlays, I get the fundamentals but I don’t get where to look to find a list of all the configurable options that an overlay provides? Typically I can look in the home-mananger nix decleration of a package for the options exposed or nixpkgs for the options in configuration.nix. Any help that will dive deeper into overlays or where to find their options would be greatly appreciated!

  • ck_@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    So we need to unpack two things here

    options is what you typically need to specify in your configuration.nix or via home-manager. They can be found here

    Overlays are mostly used to overwrite attributes or build inputs, eg. (final: prev: { foo = prev.foo.override { bar = "baz"; }; })

    Now I am not particularly sure about how home-manager and neovim work together, but it looks like the module takes an option to set the program, so I’d consider just plucking your neovim-qt program right in there.

    • Cebidaez@lemmy.sdf.orgOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Inside of this example would the sets that are changeable inside of .override like bar for example be the definitions made within the .nix file for a respective package? I’m trying to understand how I know what can be overridden.

      • ck_@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        You can override derivation inputs and derivation attributes. Let’s take for example the nano editor.

        You can enable tidy support by overriding the enableTidy input like so:

        (final: prev: { nano = prev.nano.override { enableTidy = true; }; })

        You can also override build steps, eg. if you want to apply an upstream patch because you don’t want to wait for the next release version, you’d do it like this.

        (final: prev: { nano = prev.nano.overrideAttrs ( old: { patches = (old.patches or [] ) ++ [ ./filename.patch ]; }); })

        Now the thing about overlays is this: if you change a package in an overlay, all packages depending on that package, either directly or indirectly, will pull in that modified version, which is an extremely powerful tool as you can probably imagine.