Open damidoug opened 2 months ago
Hey there! If you're using Snowfall Lib you don't need to export nixosModules
manually, the library does all of that for you. If you want to consume your flake from another one later then you can add it as an input and include the module just like you've posted here. Do you have a specific problem you're running into? What have you tried so far?
Sorry for the delay, that's working.
Sorry for re-open, but i did an change in my code and I cant make it work, this is my repo to you check: https://github.com/damianodoug/better-nixos-hardware
I I want to use in other flake like:
nixos-hardware = { audio = enabled; network = enabled; cpu.intel = enabled; gpu.nvidia = enabled; ssd = enabled; },,,,
when I try to import always have errors, don't find etc... please give me an help with this, feel free to fix my code, and show me how can I import without errors. thanks.
well you have snowfall.root
set to ./nix
which doesn't exist
https://github.com/damianodoug/better-nixos-hardware/blob/main/flake.nix#L20
Fixed, but the error still.
error: attribute 'default' missing
at /nix/store/ks7p2hwhimyabbgj5ry9bi66alykxz7s-source/flake.nix:76:9:
75| impermanence.nixosModules.impermanence
76| nixos-hardware.nixosModules.default
don't meter if I set
systems.modules.nixos = with inputs; [
nixos-hardware.nixosModules.default or nixos-hardware.nixosModules.nixos-hardware
];
Experiencing a similar issue - I have a flake with a snowfall namespace of "matrix". Then, I want to include this as an input in a private flake and enable various options
Example home-manager config:
{
matrix = {
programs.terminal.tools.git.enable = true;
}
}
But the result is
error: The option `matrix' does not exist
When looking at the flake outputs for the flake, I see the exported nixosModules, but darwinModules, homeModules, lib, and others show a status of unknown
.
In the private flake, I've tried including it like so without success:
systems.modules.darwin = with inputs; [
matrix.darwinModules # as well as matrix.darwinModules."programs/terminal/tools/git"
];
homes.modules = with inputs; [
matrix.homeModules
];
Perhaps I'm just not making sense of how to export or reference the modules, but it would be nice if this were possible.
@brenix darwinModules
, homeModules
and nixosModules
should each have .default
(or the output name) on the end when importing them
as in your example:
systems.modules.darwin = with inputs; [
matrix.darwinModules.default
];
homes.modules = with inputs; [
matrix.homeModules.default
];
When looking at the flake outputs for the flake, I see the exported nixosModules, but darwinModules, homeModules, lib, and others show a status of
unknown
.
this is because nix is unable to understand some of these output types, however it is able to evaluate them
@brenix
darwinModules
,homeModules
andnixosModules
should each have.default
(or the output name) on the end when importing themas in your example:
systems.modules.darwin = with inputs; [ matrix.darwinModules.default ]; homes.modules = with inputs; [ matrix.homeModules.default ];
@pinkcreeper100 I tried this too, but end up seeing something along the lines of:
error: attribute 'default' missing
at /nix/store/ddqgwxavciip90zmc6aab7xx6668prn8-source/flake.nix:56:9:
55| homes.modules = with inputs; [
56| matrix.homeModules.default
and @damidoug, nixos-hardware doesn't provide default
you can see the modules it provides in the flake.nix
@brenix try setting an alias within matrix
also it appears that if you import something like matrix.homeModules.theme.gtk
it might work
ignore this
@pinkcreeper100 Thanks for helping out here - I unfortunately am still not able to achieve what I thought was possible here. Dropping into nix repl
and running a = builtins.getFlake (toString ./.)
and listing things, I am able to see all of my modules (darwin/home/nixos) and can confirm there is no default unless using an alias. However it seems this can only be used to target a specific path.
I even went as far as specifying every module individually under sytems.modules... and home.modules.. which appears to get me closer but seeing other errors now. One other thing I thought to do was create something like a modules/home/default.nix
and use the snowfall lib to recursively import all files under that, then set that as the default alias. This doesn't seem like the right approach but I'm running out of ideas haha.
My hope was that I could simply include all modules with one line in my flake, then consume those modules. Will poke around a bit more.
@brenix mhm the only way i can see is doing it similar to snowflakeos
see the modules and installer template(s)
Snowfall.lib is the best nixos library ever, but i'm noob in flakes and I'm trying to make an module to use in others flakes, this is my example flake.nix
in my package i have the modules/nixos folder and inside i have the options like audio/default.nix etc... see one of default.nix file example.
now i want to make this my nixos-hardware available to import in other flake like
and use like
how can I do it? thanks.