Skip to content

Comments

treewide: add missing installPhase hooks#333527

Draft
Sigmanificient wants to merge 1 commit intoNixOS:stagingfrom
Sigmanificient:add-missing-install-hooks
Draft

treewide: add missing installPhase hooks#333527
Sigmanificient wants to merge 1 commit intoNixOS:stagingfrom
Sigmanificient:add-missing-install-hooks

Conversation

@Sigmanificient
Copy link
Member

@Sigmanificient Sigmanificient commented Aug 9, 2024

Description of changes

This was done throw the following command:

grep -rP "installPhase ="
    | cut -d ':' -f 1 \
    | xargs -i sh -c "grep -P 'runHook\s+preInstall' {} >/dev/null ||
echo '{}'" | python add_missing_hooks.py

with the following script:
https://gist.github.com/Sigmanificient/c68e03d1ad750a83233c6ab05761cbf2

2432 hits, 68 miss are to be dealt with manually

Applying the following:

  installPhase = ''
+  runHook preInstall
+
  ...
+
+  runHook postInstall
'';

for matching:

(?P<decl>installPhase\s+=\s+(?:let(?:(?!\s+in\s+)(?:.|\n))+\s+in\s+)?)
'{2,3}\n?(?P<ident>\s+)?(?P<block>(?:(?!'{2,3};)(?:\n|.)?)+)(?P<quotes>'{2,3});

and (@emilazy suggestion):

- installPhase = "...";
+ installPhase = "runHook preInstall; ...; runHook postInstall";

matching:

(?P<ident>[ ]+)?(?P<decl>installPhase\s+=\s+)"(?P<block>.*)";

Extra edits

Some minor adjustment were done to pass green on the CI:

  • replaced tabs to spaces in pkgs/build-support/dotnet/dotnetenv/build-solution.nix
  • removed stdenv/linux, glibc to avoid rebuilding stdenv

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: kernel The Linux kernel 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: emacs Text editor 6.topic: printing Drivers, CUPS & Co. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: vim Advanced text editor 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: steam Steam game store/launcher (store.steampowered.com) 6.topic: stdenv Standard environment 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: pantheon The Pantheon desktop environment 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: testing Tooling for automated testing of packages and modules 6.topic: cinnamon Desktop environment 6.topic: Enlightenment DE The Enlightenment Desktop Environment 6.topic: mate The MATE Desktop Environment 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: julia Julia is a high-level, high-performance dynamic language for technical computing. 6.topic: php PHP is a general-purpose scripting language geared towards web development. labels Aug 9, 2024
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 18, 2025
@github-actions github-actions bot removed 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. labels Mar 18, 2025
@Sigmanificient Sigmanificient force-pushed the add-missing-install-hooks branch from 491d549 to 6c5fa78 Compare March 24, 2025 04:38
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 2, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 20, 2025
@qweered
Copy link
Contributor

qweered commented Jan 22, 2026

Do you plan to work on this? Nice cleanup

@Sigmanificient
Copy link
Member Author

@qweered this can be regenerated at any time

@Sigmanificient Sigmanificient force-pushed the add-missing-install-hooks branch 2 times, most recently from 7aea2c4 to 3f6d88a Compare January 22, 2026 00:37
@nixpkgs-ci nixpkgs-ci bot removed 2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md labels Jan 22, 2026
Copy link
Member Author

@Sigmanificient Sigmanificient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found an issue with cudatext while reviewing the diff

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 6.topic: COSMIC COSMIC is a software platform for designing beautiful user experiences and removed 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: windows Running, or buiding, packages on Windows 6.topic: Enlightenment DE The Enlightenment Desktop Environment 6.topic: cuda Parallel computing platform and API 6.topic: php PHP is a general-purpose scripting language geared towards web development. 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions labels Jan 22, 2026
This was done using the following command:

grep -rP "installPhase ="
    | cut -d ':' -f 1 \
    | xargs -i sh -c "grep -P 'runHook\s+preInstall' {} >/dev/null ||
echo '{}'" | python add_missing_hooks.py

applying the following script:
https://gist.github.com/Sigmanificient/c68e03d1ad750a83233c6ab05761cbf2
@Sigmanificient Sigmanificient force-pushed the add-missing-install-hooks branch from 3f6d88a to c1d467b Compare January 22, 2026 00:52
@Sigmanificient
Copy link
Member Author

Sigmanificient commented Jan 22, 2026

removed the 2 problematic hit manually:

  • pkgs/applications/editors/cudatext/default.nix
  • pkgs/applications/networking/cluster/hadoop/default.nix

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: cinnamon Desktop environment 6.topic: coq A formal proof management system 6.topic: COSMIC COSMIC is a software platform for designing beautiful user experiences 6.topic: docker tools Open-source software for deploying and running of containerized applications 6.topic: dotnet Language: .NET 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: games Gaming on NixOS 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: hardware Drivers, Firmware and Kernels 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: julia Julia is a high-level, high-performance dynamic language for technical computing. 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: kernel The Linux kernel 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: mate The MATE Desktop Environment 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: nvidia Nvidia-specific issues and fixes 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: pantheon The Pantheon desktop environment 6.topic: printing Drivers, CUPS & Co. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: rocm ROCm is an Advanced Micro Devices software stack for graphics processing unit programming. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: stdenv Standard environment 6.topic: tcl Dynamic, multi-paradigm programming language 6.topic: testing Tooling for automated testing of packages and modules 6.topic: updaters Tooling for (semi-)automated updating of packages 6.topic: vim Advanced text editor 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch.

Projects

Status: New
Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants