NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.13k stars 14.17k forks source link

`setup.sh` Developer Experience #295037

Open roberth opened 2 years ago

roberth commented 2 years ago

Issue description

Working on setup.sh is pretty awful. Unless you cobble together your own workflow for it, it looks like

  1. make a tiny change
  2. mass-rebuild

This iteration cycle is longer than it needs to be and makes adequate testing practically infeasible to the point where we don't do it.

Goal

Before doing significant work on setup.sh I think we should pay attention to the developer experience.

Describe when this issues should be considered done

Artturin commented 2 years ago

a way to try override setup.sh for a single derivation, to allow experimentation (shortest feedback cycle while working on the implementation)

https://github.com/NixOS/nixpkgs/blob/0446732359536566de33d8893bd4c682174e31e2/pkgs/stdenv/adapters.nix#L45-L53

  # Override the setup script of stdenv.  Useful for testing new
  # versions of the setup script without causing a rebuild of
  # everything.
  #
  # Example:
  #   randomPkg = import ../bla { ...
  #     stdenv = overrideSetup stdenv ../stdenv/generic/setup-latest.sh;
  #   };
  overrideSetup = stdenv: setupScript: stdenv.override { inherit setupScript; };

or stdenv.override { setupScript = ./pkgs/stdenv/generic/setup.sh; }