Nixpkgs: mkRenamedOptionModule doesn't work in submodules

Created on 22 Aug 2020  路  3Comments  路  Source: NixOS/nixpkgs

Describe the bug

I'm working on a home-manager module, where I now want to rename

programs.firefox.profiles.<name>.privacy.enableSettings

to

programs.firefox.profiles.<name>.privacy.settings.enable

The problem is, that list of submodules.

I tried to add

imports = [
  (mkRenamedOptionModule
    [ "privacy" "enableSettings" ]
    [ "privacy" "settings" "enable" ])
];

to the programs.firefox.profiles.<name> module, but that causes the error

warning: Git tree '/home/user/dotfiles' is dirty
warning: Git tree '/home/user/dotfiles' is dirty
error: --- ThrownError ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ nix-build
The option `programs.firefox.profiles.main.warnings' defined in `/home/user/dotfiles/nur-packages/hm-modules/programs/firefox-privacy.nix' does not exist.
(use '--show-trace' to show detailed location information)

There are 135 unread and relevant news items.
Read them by running the command 'home-manager news'.

because each submodule doesn't have a separate warning system.

Obviously doing

imports = [
  (mkRenamedOptionModule
    [ "programs" "firefox" "profiles" "privacy" "enableSettings" ]
    [ "programs" "firefox" "profiles" "privacy" "settings" "enable" ])
];

doesn't work either, because it's missing the profile name.

To Reproduce

Try to rename a suboption in an option of type types.attrsOf (types.submodule ({ config, ... }: {.

The error I got can be seen on my nur-packages' GitLab (on tag nixpkgs-issue-96006 which I created for this occasion).

Expected behavior

Unclear. I guess warnings would be propagated upwards, somehow, using magic?

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.7.16, NixOS, 20.09.20200821.4a87da1 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4pre20200721_ff314f1
  • channels(user): ""
  • channels(root): "nixos-20.09pre237781.32b46dd897a"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
module system

Most helpful comment

I've got a plan for fixing this! Will work on this soon probably :)

All 3 comments

cc @Infinisil

I've got a plan for fixing this! Will work on this soon probably :)

See PR above ^ :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

copumpkin picture copumpkin  路  3Comments

grahamc picture grahamc  路  3Comments

domenkozar picture domenkozar  路  3Comments

vaibhavsagar picture vaibhavsagar  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments