-
Notifications
You must be signed in to change notification settings - Fork 107
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
Home-manager external modules from flakes #106
Comments
you could try using |
I followed your Only downside is that I need to specify the commit hash I want to fetch (as far as I can tell). Which makes it harder to update. But it's not a big deal. Thanks 🙌 |
I was just looking at the core branch and thought about this, it would be good if extern has a specialArgs attribute. It would also be useful for mobile-nixos usage, which will be getting flakes support soon. |
Just inherit the modules into the empty attribute set... |
Hi, is there a good example on the proper usage? I'm trying to import nix-doom-emacs as described in the docs but I'm having some issues. extern/default.nix: { inputs }: with inputs;
let
hmModules = {
inherit (nix-doom-emacs.hmModule) hmModule; # I've tried without .hmModule to the same effect
};
in
{
modules = [
home.nixosModules.home-manager
ci-agent.nixosModules.agent-profile
];
overlays = [
nur.overlay
devshell.overlay
emacs.overlay
(final: prev: {
deploy-rs = deploy.packages.${prev.system}.deploy-rs;
})
];
# passed to all nixos modules
specialArgs = {
inherit hmModules; # sidenote - I think this needs changing as it's "hm-modules" still in the current core branch
overrideModulesPath = "${override}/nixos/modules";
hardware = nixos-hardware.nixosModules;
};
} users/profiles/emacs/default.nix: { config, lib, pkgs, hmModules, ... }:
{
imports = [ hmModules.hmModule ];
programs.doom-emacs = {
enable = true;
package = pkgs.emacsPgtkGcc;
doomPrivateDir = ./doom.d;
};
services.emacs = {
enable = true;
#package = programs.doom-emacs.package;
};
} The error I get: $ flk home e7240 figgyc switch --show-trace
error: --- EvalError ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
at: (303:28) in file: /nix/store/pz44872rmpd7ygqfmdcwh4ac6hk1hy4s-source/lib/modules.nix
302| value = builtins.addErrorContext (context name)
303| (args.${name} or config._module.args.${name});
| ^
304| }) requiredArgs);
infinite recursion encountered
(use '--show-trace' to show detailed location information) |
for one thing, specialArgs only affects the nixos configurations and not home-manager. So you would have to do the import in your user profile:
Then you can use the modulle in any user profile. But I have no idea how you got an infinite recursion error, I would have thought the error would be from the file not being called with hmModule. |
I fixed the typo in lastest core, also put a bit of documentation up last night, I'll expand with this example later. But for now, get it working. Also made it available by default from the community branch. |
Yeah that works perfectly. Thanks! |
I was wondering if there is a way to allow adding home-manager modules like we add other external modules in the
flake.nix
file.The use case I'm trying to solve is adding nix-doom-emacs's module to my user.
The workaround I currently have in place is to define:
Where I import the HM module for my user.
But this defines my username in the
flake.nix
file, which is not ideal.Can you see any way to, I guess, either provide a mechanism that will import the HM modules for all users, or provide inputs to the user nix files, so that they can be imported there, like in the example above?
The text was updated successfully, but these errors were encountered: