Custom mpvscripts packages without cloning nixpkgs

I’d like to pull in an mpv script as a package accessible by home-manager without having to clone, modify, and extend nixpkgs. Ideally, I’d like to keep the package definitions with my local configuration. I’m not sure how to accomplish this…

Any advise, direction, or other help would be appreciated.

skippable background which may help you tailor replies:

I’m a newbie using a flake-based system configuration with home-manager as a module. I’m vaguely aware of overlays, but unsure how to apply them in this case. Complicating matters is that mpvscripts pkgs have a non-trivial structure; at least to me, relative to a self-contained C package… I’m familiar with fetchFromGithub and prefetching to get the hash, but not much beyond that. The biggest problem is that I’m not quite sure where to start, or what nix knowledge would be relevant for this… Thanks.

1 Like

Did you look at https://nix.dev/tutorials/packaging-existing-software or Package parameters and overrides with callPackage — nix.dev documentation?

1 Like

Home-manger has a nice module if you use that.
You can then extend the scripts option like I did in my config:

1 Like

Uh… I meant to come back and reply once I got things working but holy **** It’s been 7 days … I should take a break from configuring my NixOS (at least 3 of those days were spent bashing my head against Yubikey/PGP stuff)… Anyways;

Both of these were quite a big help, and allowed for quite a few things to “click” for me.

@Nebucatnetzer 's answer was most applicable and informative. While I’m not creating a module (yet), the principles were easily transferable. Your example, combined with another repo I found that set up shaders, helped me greatly in configuring mine: mpv.nix - Pastebin.com

@waffle8946 thank you for the reference. I didn’t end up using it much here but those will be quite useful to me in the future.