Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save worldofpeace/4c8b238241ae6c79adce1707cddf0544 to your computer and use it in GitHub Desktop.
Save worldofpeace/4c8b238241ae6c79adce1707cddf0544 to your computer and use it in GitHub Desktop.
Improvements I think we need for aliases

Improvements I think we need for aliases

  1. Warnings when they're used
nix-build -A adobeReader

warning: adobeReader is an alias for adobe-reader. You should migrate to using this attribute.

these derivations will be built:
  /nix/store/rhk415qc3k4mil0avfwn4yf5p8myrjmp-AdbeRdr9.5.5-1_i486linux_enu.tar.bz2.drv
  /nix/store/xazabpg7c6zd1dpkz8k1l68wjjf2n7j1-adobe-reader-9.5.5-1.drv
these paths will be fetched (74.70 MiB download, 324.70 MiB unpacked):

Basically the same with what's going on in mkRenamedOptionModule

  1. Split throws into a removed.nix

We need to require a message for every removed attribute in all-packages, python-packages.nix etc. Currently it's just whatever people choose to write in aliases.nix and that looks kinda cheap. It'd be nice if it was structured almost the same to how mkRemovedOptionModule is.

# mkRemovedOptionModule is like

throw "The option `${showOption optionName}' can no longer be used since it's been removed. ${replacementInstructions}";

message = ''
  The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.
  ${replacementInstructions}
'';

# removed.nix can be like
throw "The package `${packageName}' can no longer be used since it's been removed. ${migrationMessage}";

message = ''
  The attribute definition `${packageName}' in ${showFiles opt.files} has been removed; please remove it.
  ${migrationMessage}
'';

and please some docs on package removal.

  1. Release engineering needs to make it a goal to phase these out

Like a collective effort every two releases to remove old aliases in aliases.nix and removed.nix. Are we expected to keep these forever?

  1. add automation to detect the loss of an attribute name (ofborg) so that if you make a PR, remove an attribute name, and not add it back to aliases, or removed, you're told off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment