-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Document using out-of-tree modules with flakes #1783
Comments
Maybe out of scope for this specific issue, but I think documenting some of the de-facto flake standards that are popping up might be a good idea (and also fix this issue). Currently it seems to be |
I don't understand |
Currently I use
to match the pattern used by the NixOS ones. The activation packages and configurations are not modules, but final configurations and is a different thing. For that I would suggest |
Let's get this quickly standardized before we see to many flakes with different attributes. |
I currently do Also as I am preparing to extract modules, I'm thinking about naming the related output attribute… Currently I am tempted to use Especially for the |
So by using legacyPackages you can distinguish between an error in the home-manager configuration or in the flakes configuration.
|
This discussion is probably relevant to #1856, which ads a |
Hi, I'm the author of the PR #1697 where I was in the process of documenting flake usage with home-manager. PR #1856 seems relevant aswell as this one (#1783). Have been a bit busy lately, but would like to finish up the documentation on flakes now. How should we organize this? Should I continue working where I left of in #1697 or are the other PRs duplicates we should combine? |
I don't think #1697 and #1856 are duplicates, my pr only implements a |
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting. If you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesIf you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort. |
Hey, I was just reading through all the related issues regarding flake output naming conventions, but it is really hard to gather the convention you decided on (if there even was made a decision yet). Is this somewhere documented or is there currently still ongoing effort? I searched around but didn't find anything. If I just overlooked it, then please point me to the right direction :) |
homeConfigurations is what Edit: Ah, it's #1856, as I helpfully linked a while ago ;) |
As I understood I thought that this topic is about having re-usable home manager modules. I.e. incomplete home-manager configuration (e.g. without And I still not sure how to do that. How do we "package" modules in flakes?E.g. how do I package {
outputs = { self, ... }: {
homeManagerModules = { numlock-module = import ./modules/misc/numlock.nix; };
};
} Or should it also have access to flake inputs like in {
# some inputs setup
outputs = { self, hm-utils, ... }@inputs: {
homeManagerModules = {
numlock-module = hm-utils.lib.importModule ./modules/misc/numlock.nix { inherit inputs; };
};
};
} How to consume such flakes in home-manager (be it part of system config or be it standalone)?This is even more mystery for me? { ... }: {
imports = [ ./modules/misc/numlock.nix ];
home.username = "vagrant";
home.homeDirectory = "/home/vagrant";
home.stateVersion = "21.03";
} But how do I start depending on flake-packaged module in standalone version? { ... }:
let
inputs = {
some-nix-modules = builtins.getFlake "github:some/nix-modules";
};
in {
imports = [
some-nix-modules.homeManagerModules.numlock-module
./home-parts/xorg.nix
];
_module.args.inputs = inputs; # to allow access to other inputs?
home.username = "vagrant";
home.homeDirectory = "/home/vagrant";
home.stateVersion = "21.03";
} How do I model dependencies between modules?E.g. having local module { ... }: {
require = [ ./modules/misc/numlock.nix ];
xsession.numlock.enable = true;
} Now that { inputs, ... }: {
require = [ inputs.some-nix-modules.homeManagerModules.numlock-module ];
xsession.numlock.enable = true;
} |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/home-manager-shell-nix-shell-for-your-home-manager-config/24632/1 |
This thread is long enough that I've lost the thread. I think it's apparent that
Note that this isn't just a pointer to the entry point module(s). Rather it takes modules, and sets them up, most importantly with the appropriate Nixpkgs instance to get everything woven together. This weaving is the responsibility of the However, some projects benefit from distributing modules, not whole configurations. All I've tried to do above is sum up the state of things, which seem more confused in the thread than I'd expect. So... I really think all that needs to be decided on is a name for the flake output attribute: to be used, so the community can do this consistently. Here are options I saw in the thread:
Personally, I like Anyway, that's my vote. Also, let me know if I read this thread too quickly, and if the issue is actually more than just picking a good name for the flake output attribute. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-flake-wrapping-a-nix-module-using-home-manager/39162/6 |
Created a PR to push this forward. |
Home Manager would benefit from having a section documenting how to use out-of-tree modules.
nix-sops
support using it as a module inhome-manager
configuration? Mic92/sops-nix#62CC users who recently opened flake related issues: @pinpox @terlar @roosemberth
I think this could be tackled in #1697 if @pinpox wants to.
The text was updated successfully, but these errors were encountered: