pre-commit #23

Merged
Gonne merged 3 commits from nerf/nixConfig:pre-commit into main 2023-11-09 15:20:45 +00:00
Owner

Consistent code style and code linting. This pull request also introduces nix checks (available with nix flake check), that checks those
conditions. Also introduces a shell (available with nix develop that sets up git hooks and pre-commit to run the formatter and checks
by hand, as well as automatically on commit).

Consistent code style and code linting. This pull request also introduces nix checks (available with `nix flake check`), that checks those conditions. Also introduces a shell (available with `nix develop` that sets up git hooks and pre-commit to run the formatter and checks by hand, as well as automatically on commit).
nerf added 2 commits 2023-11-07 08:33:03 +00:00
nerf force-pushed pre-commit from 2634f89d6f to e5bce573da 2023-11-07 23:27:31 +00:00 Compare
nerf force-pushed pre-commit from e5bce573da to 563e4708f4 2023-11-07 23:55:57 +00:00 Compare
nerf changed title from WIP: pre-commit to pre-commit 2023-11-07 23:58:43 +00:00
Gonne requested changes 2023-11-08 13:47:11 +00:00
Gonne left a comment
Owner

Not a full review yet.

Not a full review yet.
README.md Outdated
@ -281,0 +287,4 @@
Like with all FS projects, you are welcome to contribute. Work is done usually by the person that is most annoyed
by the circumstances or by the person that didn't run fast enough. So we are happy if we get help. That doesn't
mean that we don't need to have some level of quality, people after us needs to work with it. It is live infrastructure
and downtime hurts someone (and in the wrong moment even really bad (Matheball ticket sales for example).
Owner

missing closing parenthesis

missing closing parenthesis
nerf marked this conversation as resolved
README.md Outdated
@ -281,0 +292,4 @@
So here are some Guidelines.
## Coding style and linting.
If you run `nix check` there are automated checks in place, please make sure to pass them.
Owner

If I run that, I get

$ nix check
error: 'check' is not a recognised command
Try 'nix --help' for more information.
If I run that, I get ``` $ nix check error: 'check' is not a recognised command Try 'nix --help' for more information. ```
Author
Owner

ahh of course that should be nix flake check

ahh of course that should be `nix flake check`
Gonne marked this conversation as resolved
README.md Outdated
@ -281,0 +295,4 @@
If you run `nix check` there are automated checks in place, please make sure to pass them.
There is also a code autoformatter (`alejandra`) incorporated into those. You can also install
them into your local git repository as pre-commit hooks, and setting up a shell that has
even more tooling by running `nix develop`. That will give you a bash in which you can run
Owner
$ nix develop
error: flake 'git+file:///home/…/nixConfig' does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux', 'packages.x86_64-linux.devShell.x86_64-linux', 'legacyPackages.x86_64-linux.devShell.x86_64-linux', 'devShell.x86_64-linux' or 'defaultPackage.x86_64-linux'
``` $ nix develop error: flake 'git+file:///home/…/nixConfig' does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux', 'packages.x86_64-linux.devShell.x86_64-linux', 'legacyPackages.x86_64-linux.devShell.x86_64-linux', 'devShell.x86_64-linux' or 'defaultPackage.x86_64-linux' ```
Owner

More info for reference:

$ nix flake show
git+file:///home/…/nixConfig?ref=pre-commit&rev=04469765541ab58d9777d5fd74b7e43ba6fe0e97
├───apps
│   └───x86_64-linux
├───checks
│   └───x86_64-linux
│       └───pre-commit: derivation 'pre-commit-run'
├───devShells
│   └───x86_64-linux
│       └───default: development environment 'nix-shell'
├───formatter: unknown
├───legacyPackages
warning: │   └───x86_64-linux: omitted (use '--legacy' to show)
├───nixosConfigurations
│   └───ghatanothoa: NixOS configuration
├───nixosModules
├───overlays
└───packages
    └───x86_64-linux

More info for reference: ``` $ nix flake show git+file:///home/…/nixConfig?ref=pre-commit&rev=04469765541ab58d9777d5fd74b7e43ba6fe0e97 ├───apps │ └───x86_64-linux ├───checks │ └───x86_64-linux │ └───pre-commit: derivation 'pre-commit-run' ├───devShells │ └───x86_64-linux │ └───default: development environment 'nix-shell' ├───formatter: unknown ├───legacyPackages warning: │ └───x86_64-linux: omitted (use '--legacy' to show) ├───nixosConfigurations │ └───ghatanothoa: NixOS configuration ├───nixosModules ├───overlays └───packages └───x86_64-linux ```
Author
Owner

That is weird. To cite the nix reference

Flake output attributes

If no flake output attribute is given, nix develop tries the following flake output attributes:

  • devShells.<system>.default
  • packages.<system>.default

If a flake output name is given, nix develop tries the following flake output attributes:

  • devShells.<system>.<name>
  • packages.<system>.<name>
  • legacyPackages.<system>.<name>

That matches the paths from your nix flake show but not from the error message of your nix develop. So I think that is a problem on your side. What is your nix version?

There are two old related issues error message bug and change output names

You might try nix develop .#default to set the default explicitly

That is weird. To cite the [nix reference](https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-develop) > # Flake output attributes >If no flake output attribute is given, `nix develop` tries the following flake output attributes: > - devShells.\<system>.default > - packages.\<system>.default > > If a flake output name is given, `nix develop` tries the following flake output attributes: > - devShells.\<system>.\<name> > - packages.\<system>.\<name> > - legacyPackages.\<system>.\<name> That matches the paths from your `nix flake show` but not from the error message of your `nix develop`. So I think that is a problem on your side. What is your nix version? There are two old related issues [error message bug](https://github.com/NixOS/nix/issues/5880) and [change output names](https://github.com/NixOS/nix/issues/5532) You might try `nix develop .#default` to set the default explicitly
Owner
$ nix --version
nix (Nix) 2.6.0

The first link suggests that this has been resolved in version 2.7.0.

``` $ nix --version nix (Nix) 2.6.0 ``` The first link suggests that this has been resolved in version `2.7.0`.
Author
Owner

2.18.0 is the current version, I think you should upgrade, did the nix develop .#default work?

`2.18.0` is the current version, I think you should upgrade, did the `nix develop .#default` work?
Gonne marked this conversation as resolved
nerf force-pushed pre-commit from 563e4708f4 to 0446976554 2023-11-09 01:31:47 +00:00 Compare
nerf changed title from pre-commit to WIP: pre-commit 2023-11-09 01:44:02 +00:00
Author
Owner

I noticed something I might want to change, so marking is as WIP for now.

I noticed something I might want to change, so marking is as WIP for now.
nerf force-pushed pre-commit from 0446976554 to 6fdeaf9f85 2023-11-09 14:52:02 +00:00 Compare
nerf changed title from WIP: pre-commit to pre-commit 2023-11-09 14:53:30 +00:00
nerf requested review from Gonne 2023-11-09 14:53:50 +00:00
nerf force-pushed pre-commit from 6fdeaf9f85 to 715c10c418 2023-11-09 14:59:15 +00:00 Compare
nerf changed title from pre-commit to WIP: pre-commit 2023-11-09 15:01:46 +00:00
nerf changed title from WIP: pre-commit to pre-commit 2023-11-09 15:04:00 +00:00
Gonne approved these changes 2023-11-09 15:20:30 +00:00
Gonne merged commit 715c10c418 into main 2023-11-09 15:20:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Fachschaft/nixConfig#23
No description provided.