pinpox / lollypops

Lollypop Operations - NixOS Deployment Tool
https://pinpox.github.io/lollypops/
GNU General Public License v3.0
118 stars 17 forks source link

`mkTaskForHost` is broken unless `hmModule` is imported #12

Closed cmacrae closed 1 year ago

cmacrae commented 1 year ago

Hey @pinpox 👋

Thanks for creating and sharing this project. I'm wanting to try it out, but I'm hitting some issues in the setup.
It seems that, unless you have lollypops.hmModule in your imports, then mkTaskForHost fails with:

error: attribute 'home-manager' missing

       at /nix/store/4j85s6wjcip9fncm3n47j44gj31wrwn1-source/flake.nix:112:44:

          111|                           ++ mkSeclist hostConfig.config
          112|                           ++ mkSeclistUser hostConfig.config.home-manager.users;
             |                                            ^
          113|                         };

       … while evaluating the attribute 'config.home-manager.users'

       at /nix/store/1zzy0v6laha6r67l0n3wqkgqiwvvj7hv-source/lib/modules.nix:341:9:

          340|         options = checked options;
          341|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          342|         _module = checked (config._module);

       … while calling 'flatten'

       at /nix/store/1zzy0v6laha6r67l0n3wqkgqiwvvj7hv-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

       at /nix/store/4j85s6wjcip9fncm3n47j44gj31wrwn1-source/flake.nix:32:42:

           31|               # Build steps for all secrets of all users
           32|               mkSeclistUser = homeUsers: pkgs.lib.lists.flatten (builtins.attrValues (builtins.mapAttrs
             |                                          ^
           33|                 (user: userconfig: [

       … while calling 'mkSeclistUser'

       at /nix/store/4j85s6wjcip9fncm3n47j44gj31wrwn1-source/flake.nix:32:31:

           31|               # Build steps for all secrets of all users
           32|               mkSeclistUser = homeUsers: pkgs.lib.lists.flatten (builtins.attrValues (builtins.mapAttrs
             |                               ^
           33|                 (user: userconfig: [

       … from call site

       at /nix/store/4j85s6wjcip9fncm3n47j44gj31wrwn1-source/flake.nix:112:30:

          111|                           ++ mkSeclist hostConfig.config
          112|                           ++ mkSeclistUser hostConfig.config.home-manager.users;
             |                              ^
          113|                         };

       … while evaluating the attribute 'text' of the derivation 'CommonTasks.yml'

       at /nix/store/1zzy0v6laha6r67l0n3wqkgqiwvvj7hv-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'text' of the derivation 'Taskfile.yml'

       at /nix/store/1zzy0v6laha6r67l0n3wqkgqiwvvj7hv-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'text' of the derivation 'go-task-runner'

       at /nix/store/1zzy0v6laha6r67l0n3wqkgqiwvvj7hv-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

As you can see, home-manager isn't in scope.
If I import lollypops.hmModule then the issue goes away (well, then I'm met with another problem, but I'll raise a separate issue for that).

Figured I'd bring this to your attention, because not everyone will want to use Lollypops to manage their home-manager config.

Let me know if there's any more info I can provide :)

pinpox commented 1 year ago

Thanks for reporting this! I'll take a look after the holidays, should be an easy fix. If you are impatient you are of course free to submit a PR :)

pinpox commented 1 year ago

@cmacrae Duplictade of #11 I think. It should be fixed with the latest commit!

Feel free to reopen if the issue still persists

cmacrae commented 1 year ago

That's great, it's working now! Thank you very much :)