Novice question: debugging a package fix: can I locally override just a single line of a long multi-line string in a package?

thanks to both of you. for my edification I want to try both routes that jtojnar suggested. Starting with the nix-build based off a local edit to a clone of the pkgs repo…

I’m realizing that, regardless of the strategy I pick, I should first establish a baseline for myself: reproduce the error I’m trying to fix. So I did the following, from the freshly cloned packages repo, I’m trying to trigger installPhase code to run:

  1. git checkout 22.05 (as that is what’s in my system’s file’s system.stateVersion value)
  2. did not make my planned edits yet
  3. from the root of the git repo, ran nix-build --expr 'let pkgs = import ./. {}; in pkgs.dictDBCollector { dictlist = []; }'
  4. now try to reproduce the error by getting installPhase to execute…
    • Reading the nixos-rebuild manpage I think build-vm would be nice or even test (so I don’t add another boot entry for this tinkering). I’ve tried both:
      • nixos-rebuild --show-trace build-vm -I nixpkgs="$PWD"
      • nixos-rebuild --show-trace test -I nixpkgs="$PWD"
    • both of those^ commands result all sorts of lines of my /etc/nixos/*.nix files having issues. Issues I don’t see day to day when I run nixos-rebuild switch on a regular basis (just managing personal package selections). here’s a snippet of the error:
       error: The option `fonts.enableDefaultPackages' does not exist. Definition values:
       - In `/etc/nixos/configuration.nix': true
    
    I can comment that out just to get this test font package’s config to move the test along, but then some other mundane thing causes a similar error: virtualisation.vmVariant.users.users.qsu.linger' does not exist.

I’m guessing I’m just misunderstanding how the repo is relating to my real system, or I’m misunderstanding the suggested approach?