Skip to content
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

The option self does not exist - when attempting to add a new top-level flake output and leveraging it #117

Closed
x10an14 opened this issue Feb 3, 2023 · 6 comments
Labels
question Further information is requested

Comments

@x10an14
Copy link

x10an14 commented Feb 3, 2023

Hi!

I'm trying to make a top-level flake output variable allowedUnfreePackages, which I intend to reference through the self parameter made/created for me by flake-parts.

I already leverage the self parameter in my module system (see previous commits of below branch), so that works fine.
I do not understand the error message though, as self obviously exists. Why does it think it's an option?

(I have tried with assigning a inputs.nixpkgs.lib.option to the top-level flake output variable instead, but I got nowhere with that avenue of attack).

My attempt can be found in the HEAD commit of this branch: https://git.sr.ht/~x10an14/nix-configs/log/global-unfree-predicate

@roberth
Copy link
Member

roberth commented Feb 3, 2023

self is only a module argument, not an option, let alone an option you can define a value for. The value of self comes directly from Nix.

In order to make your allowedUnfreePackages global, it doesn't have to be in flake, but you do have to declare it, as it seems that you want to merge definitions from multiple places.

What you're trying to solve is not a unique problem though. I think the right solution is to have a better nixpkgs module, and perhaps also a home manager module that integrates with the pkgs constructed by that nixpkgs module.

Refs #74

@roberth roberth added the question Further information is requested label Feb 3, 2023
@x10an14
Copy link
Author

x10an14 commented Feb 5, 2023

I solved it without flake-parts for now. Subscribed to #74 for progress updates.

Ideally, I wish to assign this allowedUnfreePackages option to a flake-global variable, instead of config.
(Due config only being available after home-manager.lib.homeManagerConfiguration or nixpkgs.lib.nixosSystem invocations).

@roberth
Copy link
Member

roberth commented Feb 5, 2023

Aren't you invoking those functions from within a scope that has the flake-parts config? You could then forward it.

I'll close this, but feel free to ask questions.

@roberth roberth closed this as completed Feb 5, 2023
@x10an14
Copy link
Author

x10an14 commented Feb 5, 2023

(...) I'll close this, but feel free to ask questions.

Thanks!

Aren't you invoking those functions from within a scope that has the flake-parts config? You could then forward it.

I already tried asking for guidance/help with that over at your Matrix channel, but I didn't feel comfortable continuing the discussion to be honest.

I felt there was too much of a disconnect between the respective perspectives of the ones in the know, and the newbie who knows next to nothing (me). It didn't make me feel as if I could ask for help without becoming too much of a bother.

To be clear; I suspect no ill will - a lot gets missed/misunderstood with written chat.
I just didn't feel like it was possible to communicate due to lack of what I'd call a "common platform of understanding".


I still do not understand the differences/similarities/intricacies of config from within the contexts of the referenced function invocations here, and the config.flake mentioned in your documentation. I have no idea what I don't understand, which makes it nigh impossible for me to know what questions to ask, let alone how to formulate them correctly.

(And this from a ~2yrs nix(os) user who has experience from writing and using of options with the nixos/home-manager config specialArgs variable).

I just know that at some times/places these are different configs, and at others they are not. Not really managed to find examples showing this interplay between them/how to leverage config.flake.

@roberth
Copy link
Member

roberth commented Feb 5, 2023

Hi @x10an14,

The way flake-parts uses the module system is more complicated than NixOS, so don't despair :)
It seems that I've underestimated the difficulty of developing new modules. I'll make an attempt at filling in some of the missing documentation about the module system specifically.

at some times/places these are different configs,

That deserves an article of its own.

@drupol
Copy link

drupol commented Mar 14, 2023

Looking forward to it!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants