Open pluiedev opened 1 month ago
Perhaps this could be something that is handled by mkDerivation
? As it is right now, this pattern makes overriding sources much harder, as they will be different depending on the platform.
Perhaps this could be something that is handled by
mkDerivation
?
You are right, maybe we should have a unified pattern like srcForSystem
.
Perhaps this could be something that is handled by
mkDerivation
?You are right, maybe we should have a unified pattern like
srcForSystem
.
This is not as important for src
, but for version
it definitely is needed if versions differ by platform. See #313741. Hence srcForSystem
is too specific to src
.
Also after considering this further, this seems like unnecessary boilerplate. If a platform isn't listed in meta.platforms
then we shouldn't have to eval src
or version
in the first place.
I'd rather just remove the need for such a throw
at all.
Currently there's a lot of code in Nixpkgs that selectively use a different src/hash/rev/etc. depending on the target system. This is especially common in proprietary software that have different download links for pre-built binaries, for instance, in UT1999, the url and hash are different for each given platform:
Searching through the entire repository, there are 69 occurrences of this pattern, given by running
rg -l '.\$\{stdenv.hostPlatform.system\} or \(throw' | wc -l
. Without theor (throw
part, it's more like 205 occurrences. In my opinion, this already makes it common enough to justify having a library function that simplifies this.List of files that feature this pattern