I am jockeying between learning Nix fundamentals and just diving in.
I would like to modify a package that already exists in nixpkgs. The package maps one attribute set in the package definition directly to a yaml config for the package, and the goal is to insert some new yaml stuff.
I mean the relevant .nix
file in nixos/modules
looks like:
{ config, lib, pkgs, ... }:
options.services.myservice = {
enable = lib.mkEnableOption "myservice";
settings = { <... attribute set with a bunch of mkOption ...> };
}
where settings
gets converted to the yaml config for the service.
The goal for me is just to hack, I’m not immediately thinking of a PR or anything. To be able to modify the package config, I could either add new mkOption
in settings
or hardcode some attributes directly into settings
.
What I really am asking about here is what is the best way to integrate my changes into a running NixOS system. I know about two options for modifying packages: overlays or maintaining a fork of nixpkgs
. I have been told in the Matrix chat that there is likely no way to add new mkOption
using an overlay. I have found working with a fork to be pretty cumbersome mainly because the repository is so large. There is a delay of several seconds even cd
ing into the repository. I am not a git guru but also played around with using a shallow clone. However, this presented other problems in rebasing the fork on origin
whenever I want to resync.
So is it really true I cannot achieve my goal with an overlay? If so is there any method of locally modifying a package other than a fork? Or if I have to use a fork, are there best practices for working with the huge repository, especially when I just have some small changes? Or is it just going to be a big, slow repo?