Deeply-curried functions are pretty error-prone in untyped languages
like Nix. This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.
Let's add a version that uses attrset-passing form, to provide some
minimal level of sanity-checking.
This also provides defaults for keep and extra (these are often
unneeded by the user).
These statements are taken from the `lib/test/release.nix` tests,
which previously also worked on darwin.
Unblocks https://github.com/NixOS/nix/pull/8569 when backported
This reverts commit c59c6b1c57.
This was a bit too ambitious, because no warnings were previously
triggered when `string` was nested e.g. `attrsOf string`, `nullOr
string`, etc.
Support for nested type deprecation warnings was introduced in
4b54aedee5, but had to be reverted in
a36e6760e9 because it caused infinite
recursion for some users, and I couldn't remember that it was reverted.
The type has given a warning on use since [4 years ago](03392cd336b128a1639c648baf0f6c1a1271e0d2), I think it's safe to move the deprecation to the next stage: An error instead of a warning.
Before this commit, getExe assumes that if `meta.mainProgram` is unset,
it has a main program that's named after the package name.
While this is probable, it leads to a bad error when the assumption does
not hold. If the user called `getExe` themselves, they might narrow down
the location of the assumption quite easily, but if that's not the case,
they'll have to go down the rabbit hole to figure out what went wrong.
For example, a NixOS module may use `lib.getExe` on a package-typed option
which is then used in the system configuration. This then typically leads
to a failure *after* deployment, which is bad, and it's quite likely that
the user will debug the package output contents before digging through the
NixOS module, which is bad.
Furthermore the `getExe` call is rather inconspicuous as it does not
contain something like "/bin/foo", which is bad.
Also modules can be hard to read for a newbie, which is bad.
All of this can be avoided by requiring `meta.mainProgram`.
Many packages already have the attribute, and I would expect 80% of
`getExe` usages to be covered by 20% of packages, because plenty of
packages aren't used with `getExe` anyway.
Finally we could make an effort to set `mainProgram` semi-automatically
using `nix-index`.
Deeply-curried functions are pretty error-prone in untyped languages
like Nix. This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.
Let's switch to attrset-passing form, to provide some minimal level
of sanity-checking.
mkOption does not require a `type` argument and does not set the
resulting attribute if it is not given. Consequently, we need to be
prepared to merge options that have no type information.
Add support for Nvidia's Bluefield 2 plattform as a compilation
target. There exists a version with and without crypto support,
while the crypto supported version is the most common one.
Support for the non-crypto version can be easily added in the future,
if needed.
For a datasheet of the hardware, see:
https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/documents/datasheet-nvidia-bluefield-2-dpu.pdf
Signed-off-by: Markus Theil <theil.markus@gmail.com>
This is a non-trivial refactor that slightly changes the semantics
of the internal definition lists.
Whereas previously only individual list items would trigger the exception,
now the error is promoted to the whole list.
This is mostly ok, because we compute the value, it is wrong to ignore a definition.
However, we don't always compute the value. For instance `readOnly`
only needs to count definitions. That won't be possible anymore when
the error is raised for one of the items. As a consequence, an error
will be raised for the errant definition instead of the number of
definitions.
Having the current bash hash present in the nixpkgs tree makes Nix
detect bash as a runtime dependency of nixpkgs, which in turns messes up
`fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660
Because downstream code expects to use `==` on platform attrsets, we
are unfortunately not able to throw a useful error message when the
`sharedLibrary` attribute is accessed.
When users do a comparison like:
stdenv.hostPlatform == pkgsStatic.stdenv.hostPlatform
... in a situation where `stdenv.hostPlatform.hasSharedLibraries`,
they expect this to return `false`. Unfortunately Nix does a deep
equality comparison here, and ends up forcing the
`pkgsStatic.stdenv.hostPlatform.extensions.sharedLibrary` attribute,
which throws the error.
Rather than returning `null`, this commit instead simply omits the
`extensions.sharedLibrary` attribute. This provides the user with a
more-useful error message: instead of waiting until the `null` is
used (and hoping that produces an error), the user will get an error
about the `extensions.sharedLibrary` attribute being missing, at the
position where it was referenced.
Big thanks to @trofi for his PR to add
`NIX_VALIDATE_EVAL_NONDETERMINISM` to Nix, which I am now using. It
made tracking this down really easy!
Fixes#244045
This commit adds `hasSharedLibraries` to `lib.systems`.
We need `plat.hasSharedLibraries` in order to know whether or not to
expect `gcc` (and many other tools) to emit shared libraries (like
`libgcc_s.so`). Many of the GNU build scripts are smart enough that
if you configure them with `--enable-shared` on a platform (such as
`arm-none-eabi`) that doesn't support dynamic linking, they will
simply skip the shared libraries instead of aborting the
`configurePhase`. Unfortunately the missing shared libraries in the
final build product cause very hard-to-troubleshoot problems later
on.
The alternative to introducing `hasSharedLibraries` would be to set
`isStatic` in these situations. However doing so causes
`make-derivation.nix` to insert `-static` between the `pname` and
`hostPlatform` suffix, which is undesirable.
If at some point in the future we eliminate the `-static` suffix,
then `hasSharedLibraries` can be made equal to `!isStatic`.
often sections aren't needed when using globalSection
currently one has to `sections = { }` when using only globalSection
```
lib.generators.toINIWithGlobalSection { } {
globalSection = {
background_color = "1d202199";
};
sections = { };
};
````
* licenses: add opubl
* texlive: fix license for npp-for-context and lshort-german
This unbreaks evaluation for `texlive.combine { inherit (texlive) scheme-full;
pkgFilter = (_: true) }`. The problem doesn't manifest for the default pkgFilter
as `npp-for-context` is a doc-only-package (that by the way has recently been
removed from texlive).
toLosslessStringMaybe is not used by anything other than lib/tests,
so it can be private to that file.
I don't think this function was terribly well thought-through. If
people start using it, we will become permanently dependent on the
ability to test platforms for equality. It also makes the
elaboration process more fragile, because it encourages code outside
of nixpkgs to become sensitive to the minute details of how
elaboration happens.
The eminent Donald E. Knuth should be recognized as having equal
standing with such entities as IBM, Apple, and the Personal
Computer. We should acknowledge this by including him as a "vendor".
Also, `gnu-config` recognizes `mmix-knuth-*` triples (and in fact
requires `vendor="knuth"` when `cpu="mmix"`) -- so we sort of have
to. But we should do it anyways.
This will let us make assertions involving _module.args.pkgs, which
is not an option but a value attribute, and therefore doesn't have
its own highestPrio to inspect. The new function gives us that info.
with docbook gone and MD the default these aren't needed any more. we
can't remove them yet because there's thousands of uses, but maybe some
day we can.
no longer supported. warning when used would not be appropriate, and
docbook has been on the way out for long enough that throwing an error
should not be necessary either.
We already have examples for these, but since we didn't actually
recognise the doubles, it wasn't possible to build any packages for
them without setting allowUnsupportedSystem.
Previously it would fail with
error: attribute 'nonexistent' missing
at nixpkgs/lib/filesystem.nix:29:10:
28| if dirOf path == path then "directory"
29| else (readDir (dirOf path)).${baseNameOf path};
| ^
30|