Skip to content

treewide: replace stdenv.is with stdenv.hostPlatform.is#341407

Merged
emilazy merged 2 commits intoNixOS:masterfrom
Artturin:stdenvshorthandtreewide
Sep 24, 2024
Merged

treewide: replace stdenv.is with stdenv.hostPlatform.is#341407
emilazy merged 2 commits intoNixOS:masterfrom
Artturin:stdenvshorthandtreewide

Conversation

@Artturin
Copy link
Member

@Artturin Artturin commented Sep 12, 2024

Approve or thumbs up to show that you approve of the idea, or request changes on the first file to discuss why you don't think it's a good idea.

Join https://matrix.to/#/#stdenv:nixos.org to discuss

I'll reset to master and rerun the commands before merge.
Further replacements can be done in the PR where the warnings are added.
The commits can be added to .git-blame-ignore-revs in a separate PR

treewide: replace stdenv.is with stdenv.hostPlatform.is

In preparation for the deprecation of stdenv.isX.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of stdenv.isDarwin will get in the way

One example of why this is bad and especially affects compiler packages
#343059

There are too many files to go through manually but a treewide should
get users thinking when they see a hostPlatform.isX in a place where it
doesn't make sense.

fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd  "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd  "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd  "originalStdenv.is" "originalStdenv.hostPlatform.is"

The rebuilds are due to src ./. or similar

image

https://gist.github.com/Artturin/4cc1e73fc612cb7a79459a9bb6bc27a3

@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: haskell General-purpose, statically typed, purely functional programming language 6.topic: qt/kde Object-oriented framework for GUI creation 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: emacs Text editor 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 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: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: agda A dependently typed programming language / interactive theorem prover 6.topic: nim Nim programing language 6.topic: LXQt The Lightweight Qt 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: flakes The experimental Nix feature 6.topic: lib The Nixpkgs function library 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system 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. 6.topic: k3s Kubernates distribution (https://k3s.io/) 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: dotnet Language: .NET 6.topic: flutter Open-source UI software development kit for cross-platform applications labels Sep 12, 2024
msfjarvis added a commit to msfjarvis/dotfiles that referenced this pull request Sep 26, 2024
sternenseemann added a commit that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
imincik added a commit to imincik/geospatial-nix that referenced this pull request Sep 27, 2024
msfjarvis added a commit to msfjarvis/dotfiles that referenced this pull request Sep 30, 2024
@nim65s nim65s mentioned this pull request Oct 27, 2024
13 tasks
Rhys-T added a commit to Rhys-T/nur-packages that referenced this pull request Nov 4, 2024
@pluiedev pluiedev mentioned this pull request Dec 10, 2024
13 tasks
@wolfgangwalther wolfgangwalther mentioned this pull request Dec 22, 2024
13 tasks
@Artturin Artturin deleted the stdenvshorthandtreewide branch July 23, 2025 12:57
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: agda A dependently typed programming language / interactive theorem prover 6.topic: dotnet Language: .NET 6.topic: emacs Text editor 6.topic: Enlightenment DE The Enlightenment Desktop Environment 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: flakes The experimental Nix feature 6.topic: flutter Open-source UI software development kit for cross-platform applications 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: haskell General-purpose, statically typed, purely functional programming language 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: k3s Kubernates distribution (https://k3s.io/) 6.topic: lib The Nixpkgs function library 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: LXQt The Lightweight Qt Desktop Environment 6.topic: mate The MATE Desktop Environment 6.topic: nim Nim programing language 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: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: php PHP is a general-purpose scripting language geared towards web development. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 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: vim Advanced text editor 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants