pre-commit #23

Merged
Gonne merged 3 commits from nerf/nixConfig:pre-commit into main 2023-11-09 15:20:45 +00:00
Showing only changes of commit 715c10c418 - Show all commits

View file

@ -146,8 +146,7 @@ machine. The only technically required file in there is `configuration.nix`. So
A good skeleton is probably:
```
flake-inputs:
{config, pkgs, lib, ... }: {
{config, pkgs, lib, flake-inputs, ... }: {
imports = [
./hardware-configuration.nix
@ -170,6 +169,10 @@ In your hardware
configuration you should basically only write you filesystem layout and your hostPlatform. The bootloading stuff
is already taken care of by `../../roles`.
The `flake-inputs` argument is optional, but you can use it if you need to get a hold of the flake inputs,
else this is a complete normal nixos system configuration module (with a lot of settings already imorted
from `../../roles`).
As of moment of writing `network.nix` should contain ip, nameserver and default gateway setup. As parts of
this is constant across all systems and will undergo refactor soon.
@ -278,3 +281,31 @@ something like this:
{lib, pkgs, config, ...} :
<module code >
```
# Contributing
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)).
nerf marked this conversation as resolved Outdated
Outdated
Review

missing closing parenthesis

missing closing parenthesis
So here are some Guidelines.
## Coding style and linting.
If you run `nix flake check` there are automated checks in place, please make sure to pass them.
Gonne marked this conversation as resolved Outdated
Outdated
Review

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. ```
Outdated
Review

ahh of course that should be nix flake check

ahh of course that should be `nix flake check`
There is also a code autoformatter (`alejandra`) incorporated into those. If you want to run
it you can do so over the development shell or by running `nix fmt`.
You can also install
Gonne marked this conversation as resolved Outdated
Outdated
Review
$ 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' ```
Outdated
Review

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 ```
Outdated
Review

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
Outdated
Review
$ 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`.
Outdated
Review

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?
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
all the checks manually `pre-commit run -a`. This will also run the autoformatter.
## Process for submitting changes
1. If it is something bigger, please open an issue first describing what and why you want to do something.
If it is just something small, skip this step.
2. Fork the repo and implement your changes in a branch on your fork. Afterwards open a pull request (possibly mentioning the issue).
Against the main branch.
- Your branch should be based on an up to date version of main, if it is not consider rebasing.
3. You will need to find someone with the proper rights to approve of your changes, but most of the time there will be request
for changes first.