Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

porting from 20.03 to 20.09: '_module' missing #81

Open
qknight opened this issue Dec 1, 2023 · 3 comments
Open

porting from 20.03 to 20.09: '_module' missing #81

qknight opened this issue Dec 1, 2023 · 3 comments

Comments

@qknight
Copy link
Member

qknight commented Dec 1, 2023

Using nixcloud-webservices nixpkgs-20.03 and porting on nixpkgs for tags/20.09 the first commit in the bisect which fails is:

commit dcdd232939232d04c1132b4cc242dd3dac44be8c
Refs: [HEAD], 18.09-beta-65536-gdcdd23293923
Author:     Silvan Mosberger <[email protected]>
AuthorDate: Mon Mar 16 21:05:52 2020 +0100
Commit:     Silvan Mosberger <[email protected]>
CommitDate: Tue Mar 17 19:19:39 2020 +0100

    lib/modules: Remove internal _module attribute from config

    The _module option is added as an internal option set, and it messes up
    the results of module evaluations, requiring people to manually filter
    _modules out.

    If people depend on this, they can still use config._module from inside
    the modules, exposing _module as an explicitly declared user option. Or
    alternatively with the _module attribute now returned by evalModules.
---
 lib/modules.nix | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

error message nixos-rebuild build ...

while evaluating 'mkDict' at /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:6:14, called from /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:13:37:
while evaluating anonymous function at /etc/nixos/nixpkgs/lib/attrsets.nix:234:10, called from undefined position:
while evaluating 'mkEntry' at /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:7:22, called from /etc/nixos/nixpkgs/lib/attrsets.nix:234:16:
while evaluating 'toPython' at /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:4:14, called from /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:7:44:
while evaluating the attribute 'user' at /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:24:9:
attribute '_module' missing, at /etc/nixos/nixcloud-webservices/modules/core/dbshell/default.nix:24:16

commits between broken commit and 20.09

root@mail /e/n/nixpkgs# git log dcdd232939232d04c1132b4cc242dd3dac44be8c..cd63096d6d88 --oneline | cut -d " " -f 1 | wc
  27120   27120  352560

NixOS/nixpkgs@dcdd232

@qknight qknight changed the title porting from 20.03 to 20.09, first commit with issues is porting from 20.03 to 20.09: '_module' missing Dec 3, 2023
@qknight
Copy link
Member Author

qknight commented Dec 3, 2023

This line causing this error message is:

user = cfg._module.args.mkUniqueUser dbcfg.user;

And is gone once I hack it into:

    #user = cfg._module.args.mkUniqueUser dbcfg.user;
    user = dbcfg.user;

dbcfg.user is mattermost
cfg._module.args.mkUniqueUser dbcfg.user is mattermost-ncchat

@qknight
Copy link
Member Author

qknight commented Dec 3, 2023

mkUniqueUser is injected from base.nix:

    config = lib.mkMerge [
    { _module.args.mkUnique = suffix:
        if lib.hasPrefix config.uniqueName suffix then suffix
        else if isHashed suffix then suffix
        else if suffix == wsName then config.uniqueName
        else "${config.uniqueName}-${suffix}";

      _module.args.mkUniqueUser = mkUniqueUserGroup "user";
      _module.args.mkUniqueGroup = mkUniqueUserGroup "group";

qknight added a commit that referenced this issue Dec 4, 2023
@qknight
Copy link
Member Author

qknight commented Dec 4, 2023

I've added a quick fix but this needs some more thinking and also some test to check if the generated https://github.com/nixcloud/nixcloud-webservices/blob/master/documentation/nixcloud.webservices.md#database-abstraction-for-userdb-creation is working

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

No branches or pull requests

1 participant