Skip to content

Minor fixes for emptyValues#160487

Merged
infinisil merged 2 commits intoNixOS:masterfrom
infinisil:emptyValueFixes
Feb 22, 2022
Merged

Minor fixes for emptyValues#160487
infinisil merged 2 commits intoNixOS:masterfrom
infinisil:emptyValueFixes

Conversation

@infinisil
Copy link
Member

@infinisil infinisil commented Feb 17, 2022

Motivation for this change

Split off from #132448 since it's mostly separate change.

This fixes two emptyValue values and adds some test cases for emptyValues.

Originally I also wanted to use these emptyValue's as defaults when no default is specified for an option, but I think that might not be a great idea.

Things done
  • Wrote and ran lib tests successfully with lib/tests/modules.sh

@infinisil infinisil added the 6.topic: module system About "NixOS" module system internals label Feb 17, 2022
@infinisil infinisil requested a review from roberth February 17, 2022 17:02
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

👍

lib/types.nix Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
emptyValue = { };
emptyValue = { }; # no .value attr, meaning unset

nitpick: fight the misunderstanding that the empty value would be { } here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, pushed this change

An empty list is [], not {}!

Also, non-empty lists shouldn't have a default of an empty list!
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 17, 2022
@infinisil infinisil merged commit 67596d3 into NixOS:master Feb 22, 2022
@infinisil infinisil deleted the emptyValueFixes branch February 22, 2022 14:52
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tweag-nix-dev-update-25/18003/1

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

Labels

6.topic: module system About "NixOS" module system internals 10.rebuild-darwin: 0 This PR does not cause any packages 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.

3 participants