-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
chore: convert flake to flake parts and add git-hooks #1599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm down with all these changes. On-push hooks sounds like a nice QoL improvement!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added minor and optional comments.
What I would do here is to format the file with nixfmt-rfc-style.
flake.nix
Outdated
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
flake = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the parts we don't need
flake.nix
Outdated
imports = [ | ||
inputs.git-hooks-nix.flakeModule | ||
]; | ||
systems = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be shortened with: https://github.com/loophp/nix-shell/blob/4a8220125e9537dfa316b49e2b9cf77e977c86af/flake.nix#L20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might submit a PR to fix this and some other minor improvements.
imports = [ | ||
inputs.git-hooks-nix.flakeModule | ||
]; | ||
systems = import systems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to import systems in the inputs attribute (https://github.com/loophp/nix-shell/blob/4a8220125e9537dfa316b49e2b9cf77e977c86af/flake.nix#L9).
{ config, system, ... }: | ||
let | ||
overlay = final: prev: { | ||
asciinema-scenario = final.rustPlatform.buildRustPackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; }; | ||
inherit (pkgs.lib) getVersion; | ||
pkgs = import nixpkgs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkgs is already provided by the flake.parts framework, use it as such: https://flake.parts/overlays#consuming-an-overlay
That'd be great, I thinks the flake can see some improvements anyway. I'm pretty new to flake-parts though, so it's good to have some people around who have used it for longer :D |
This PR adds
The reason I set on-push for the hooks is, that people could get quite annoyed when having to check for proper formatting on every commit. Since we doe merge PRs anyway, we can require proper formatting on push and ease local development for contributors.
I'd like to hear feedback from other contributors here on what to add or to change before I merge this into main.