Skip to content

lang: Turn URL literals into a hard error#15151

Closed
Mic92 wants to merge 3 commits intoNixOS:masterfrom
Mic92:deprecated-url-literals
Closed

lang: Turn URL literals into a hard error#15151
Mic92 wants to merge 3 commits intoNixOS:masterfrom
Mic92:deprecated-url-literals

Conversation

@Mic92
Copy link
Member

@Mic92 Mic92 commented Feb 5, 2026

This removes the experimental feature 'no-url-literals' which disabled URL literals.
URL literals are now disabled by default.

However, a new deprecated feature 'url-literals' is added to re-enable them for transitional purposes.

Unquoted URLs are deprecated and will be removed in a future release.

Depends on #15150

@Mic92 Mic92 requested a review from edolstra as a code owner February 5, 2026 00:20
@github-actions github-actions bot added documentation new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority labels Feb 5, 2026
@Mic92 Mic92 force-pushed the deprecated-url-literals branch from 6c6a3b8 to f6250b3 Compare February 5, 2026 00:24
Mic92 and others added 2 commits February 5, 2026 01:29
Co-authored-by: piegames <git@piegames.de>
Co-authored-by: eldritch horrors <pennae@lix.systems>
This removes the experimental feature 'no-url-literals' which disabled URL literals.
URL literals are now disabled by default.

However, a new deprecated feature 'url-literals' is added to re-enable them for transitional purposes.

Unquoted URLs are deprecated and will be removed in a future release.
@Mic92 Mic92 force-pushed the deprecated-url-literals branch from f6250b3 to 1cee2e7 Compare February 5, 2026 00:30
Comment on lines +26 to +29
/**
* Just because writing `DeprecatedFeature::UrlLiterals` is way too long
*/
using Dep = DeprecatedFeature;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems too generic IMO. Dep could get mistaken for "dependency"

Copy link
Member Author

@Mic92 Mic92 Feb 5, 2026

Choose a reason for hiding this comment

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

Might be better to discuss this in #15150
instead, which adds deprecated features, unless you want to not have this as an intermediate PR.

Comment on lines +84 to +85
* Semi-magic conversion to and from json.
* See the nlohmann/json readme for more details.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this mean? Can we also stick with JSON_IMPL for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will have to read up on the original commit from Lix, why it has been done this way. I can have a look at JSON_IMPL.

@Mic92 Mic92 marked this pull request as draft February 5, 2026 00:51
@edolstra
Copy link
Member

edolstra commented Feb 5, 2026

To be honest, I've never seen the point in removing URL literals. All this will do is break people's Nix expressions for no good reason.

Unquoted URLs are deprecated and will be removed in a future release.

They should never be removed entirely because it breaks the ability of Nix to build old Nix expressions.

@Mic92
Copy link
Member Author

Mic92 commented Feb 5, 2026

Unquoted URLs are deprecated and will be removed in a future release.

They should never be removed entirely because it breaks the ability of Nix to build old Nix expressions.

So we have viable 3 options here:

  • Drop the experimental flag and keep the language as is.
  • Warn about usage as described in Add a warning infrastructure #10281
  • Disable the feature by default and have a way to re-enable it has been implemented here.

I think I am leaning towards warnings as well because injecting feature flags can be quiet annoying when nix is used somewhere inside another tool.

@edolstra
Copy link
Member

edolstra commented Feb 5, 2026

Yeah, a generic warning infrastructure sounds good.

@roberth
Copy link
Member

roberth commented Feb 6, 2026

Indeed it was idea-approved

@Ericson2314
Copy link
Member

Closed in favor of #15326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants