Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: stdenv.lib -> lib #109425

Merged
merged 7 commits into from Jan 15, 2021
Merged

treewide: stdenv.lib -> lib #109425

merged 7 commits into from Jan 15, 2021

Conversation

siraben
Copy link
Member

@siraben siraben commented Jan 15, 2021

Motivation for this change

Further progress on #108938. References to stdenv.lib are still plenty abound, to make reviewing and debugging easier I'm performing changes to entire subdirectories in separate commits (will be squashed at the end). The process was initially manual but I've mostly automated it.

I would run the following command and discard changes on non-Nix files.

$ nix-shell -p coreutils # macOS sed behaves differently
$ find pkgs/applications -type f -print0 | xargs -0 sed --in-place='' -E "s/stdenv\.lib/lib/"

Then I made a step.sh

#! /usr/bin/env nix-shell
#! nix-shell --pure -i bash -p coreutils nix

# Find the file with the evaluation error
theFile=$(nix-env -f . -qaP --xml --out-path --show-trace --meta 2>&1 >/dev/null | sed -E "s/.*'lib'.*at (.*):.*:.*/\1/" | tail -n 1)
# Print it
echo "$theFile"
# Replace the first occurence of stdenv with lib, stdenv
sed --in-place='' '0,/stdenv/s/stdenv/lib, stdenv/' "$theFile"

Then I ran

$ while true; do ./step.sh; done
./nixpkgs/pkgs/applications/networking/mailreaders/imapfilter.nix
./nixpkgs/pkgs/applications/networking/iptraf/default.nix
./nixpkgs/pkgs/applications/networking/irc/irssi/default.nix
...

Whenever an error appeared, I interrupted and fixed it manually. Some interesting errors I found after the replacement were

  • let lib = stdenv.lib (leads to infinite recursion)

  • applications

  • data

  • desktops

  • development

  • games

  • misc

  • os-specific

  • servers

  • shells

  • tools

  • top-level

@siraben siraben changed the title Stdenv lib treewide: stdenv.lib -> lib Jan 15, 2021
@siraben siraben changed the title treewide: stdenv.lib -> lib [staging-next] treewide: stdenv.lib -> lib Jan 15, 2021
@siraben siraben changed the base branch from master to staging-next January 15, 2021 06:14
@siraben
Copy link
Member Author

siraben commented Jan 15, 2021

Rebased on staging-next because of all the whitespace errors.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

LGTM

assuming no rebuilds, or package changes

@siraben
Copy link
Member Author

siraben commented Jan 15, 2021

@jonringer Should I rebase on master? If this gets merged to master, and staging-next has my whitespace cleanups, won't we have a merge conflict when we try to merge staging-next into master?

@siraben
Copy link
Member Author

siraben commented Jan 15, 2021

On second thought, this is a harmless change and the goal is quicker deprecation of stdenv.lib, so I will rebase on master.

@siraben siraben changed the base branch from staging-next to master January 15, 2021 06:39
@siraben siraben changed the title [staging-next] treewide: stdenv.lib -> lib treewide: stdenv.lib -> lib Jan 15, 2021
@siraben siraben force-pushed the stdenv-lib branch 2 times, most recently from 0b796a4 to fc186d5 Compare January 15, 2021 07:08
@ofborg ofborg bot added the 6.topic: stdenv Standard environment label Jan 15, 2021
@SuperSandro2000
Copy link
Member

@siraben can you please take a look at the rebuilds ofborg listed and move them to a separate PR?

@Mic92
Copy link
Member

Mic92 commented Jan 15, 2021

It is worldofgoo, sil and mendeley.

@siraben
Copy link
Member Author

siraben commented Jan 15, 2021

@SuperSandro2000 I took a look at the changed paths.

  • worldofgoo is changed because of trailing whitespace in unpackPhase
  • sil is changed because of trailing whitespace in prePatch
  • mendeley is changed because of trailing whitespace in installPhase

None of these changes affect the build in any way.

@Mic92
Copy link
Member

Mic92 commented Jan 15, 2021

@SuperSandro2000 I took a look at the changed paths.

* worldofgoo is changed because of trailing whitespace in unpackPhase

* sil is changed because of trailing whitespace in prePatch

* mendeley is changed because of trailing whitespace in installPhase

None of these changes affect the build in any way.

I am fine with those changes. The would otherwise affect the editorconfig ci check.

@Mic92 Mic92 merged commit 3c6230c into NixOS:master Jan 15, 2021
@siraben siraben deleted the stdenv-lib branch January 15, 2021 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants