Flake check of home-manager configurations

Hello. Do you check flake based configurations of home-manager? I want something similar to nix flake check s on nixosConfigurations and I have found several ways to do that but they are kind of meh.

I use nix eval .\#homeConfigurations --apply 'builtins.mapAttrs (_n: v: v.activationPackage.drvPath)' on Github Actions but it does not integrate with flake checks in a way I would be aware of. I have tried assigning HM activation packages to checks set but it starts pulling every dependency so I had to use nix flake check --eval-only but… it does not compose with other checks like GitHub - cachix/pre-commit-hooks.nix: Seamless integration of https://pre-commit.com git hooks with Nix. . HM activation packages could be assigned to packages set and nix flake check only evaluates them but it does not work if nmd was not pulled yet.

I have also tried combining checks set with this expression

       let
          hmConfigs = nixpkgs.lib.filterAttrs
            (_n: v: v.activationPackage.system == system)
            self.homeConfigurations;
        in nixpkgs.lib.mapAttrs (n: v:
          pkgs.runCommand "${n}-drvPath" { } "echo ${
            builtins.unsafeDiscardStringContext v.activationPackage.drvPath
          } > $out") hmConfigs

. It does not pull dependencies because string contexts were discarded and it does pull nmd if any of HM manual options were enabled. It is pretty good but also looks like a hack.

If you have any other ideas how to check HM configurations then let me know :slight_smile:.

1 Like