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

Failing to build own packages in the standard #71

Closed
Alfrheim opened this issue Apr 26, 2024 · 5 comments
Closed

Failing to build own packages in the standard #71

Alfrheim opened this issue Apr 26, 2024 · 5 comments

Comments

@Alfrheim
Copy link

I have my own flake and want to add a new package.
I was trying to adapt my flake with some of your configurations and couldn't make the pkgs/default.nix work.
Seems that the flake.nix is calling it with system instead of {inherit pkgs}.
I found the solution looking at you own nixos configuration.

So, I'm not sure if it's for my own flake or that maybe something changed and the template needs to be changed.

Thanks for making it public!

@Shensen1
Copy link

Can you link the fix pls?

@Edgaras1
Copy link

Can you link the fix pls?

See #54

@Alfrheim
Copy link
Author

packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});

Here is where the system is passed.

In nix-config is like this:

https://github.com/Misterio77/nix-config/blob/705976cada91cfe64c479db8e498db46ba21a3e8/flake.nix#L123

Also the pkgs/default.nix is different:

https://github.com/Misterio77/nix-config/blob/705976cada91cfe64c479db8e498db46ba21a3e8/pkgs/default.nix#L1

@Misterio77
Copy link
Owner

Fixed in bb8a72b!

@Misterio77
Copy link
Owner

A quick explanation on the differences between pkgs: and {pkgs ? import <nixpkgs> {}}:

The former has to be called passing pkgs (e.g. nixpkgs.legacyPackages.${system}) as the single argument, while the latter is to be passed inside an attrset where it has the name pkgs (e.g. { pkgs = nixpkgs.legacyPackages.${system}; }.

The latter's advantage is that you can expand it with optional arguments without breaking where it's called, and you can provide fallback values (such as import <nixpkgs> { }, which uses channels/nix_path).

Otherwise, it's just a style choice; I went with the former in the template as it's easier to grok.

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

No branches or pull requests

4 participants