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

feat(flake): simplify flake template #153

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hugosenari
Copy link

What: Make flake template less verbose
Why: The main focus of project is for non nix users, making template less verbose could reduce friction/fear
How: Add a lib method to flake (like flake-utils) but only for devShell
TODO: Update documentation

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I like the idea. I left a few comments, let me know what you think

flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
template/flake.nix Outdated Show resolved Hide resolved
Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more ideas. Almost there.

flake.nix Outdated Show resolved Hide resolved
flake.nix Outdated
Comment on lines 35 to 38
flakeTOML = inputs: path: eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}.extend self.overlay;
in {
devShell = pkgs.devshell.fromTOML path;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flakeTOML = inputs: path: eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}.extend self.overlay;
in {
devShell = pkgs.devshell.fromTOML path;
flakeTOML = nixpkgs: path: eachSystem (system:
let devshell = import ./. { pkgs = nixpkgs.legacyPackages.${system}; }
in {
devShell = devshell.fromTOML path;

Like this, no new instance of nixpkgs is being created. Each instance adds quite a big overhead to nix evaluation. Composition over inheritance :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the idea but it didn't work :(

When run `nix develop it says...

error: package "devshell.cli" not found

Changed PR to draft until we solve this

Should I revert?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted ☹

template/flake.nix Outdated Show resolved Hide resolved
@hugosenari hugosenari marked this pull request as draft December 10, 2021 22:55
@hugosenari hugosenari marked this pull request as ready for review December 13, 2021 15:05
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

Successfully merging this pull request may close these issues.

None yet

2 participants