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

Minor issues/suggestions on flake.nix and .gitignore #2453

Open
4 tasks
LEXUGE opened this issue Jun 20, 2024 · 4 comments
Open
4 tasks

Minor issues/suggestions on flake.nix and .gitignore #2453

LEXUGE opened this issue Jun 20, 2024 · 4 comments

Comments

@LEXUGE
Copy link
Contributor

LEXUGE commented Jun 20, 2024

ARTIQ Feature Request

Problem this request addresses

Several minor issues/suggestions on flake.nix and .gitignore

  • add result produced by nix to .gitignore, and refactor .gitignore.
  • format flake.nix by nixpkgs-fmt, a formatter used by nixpkgs.
  • use flake-utils to avoid boilerplates like openocd-bscanspi-f and manually writing out pkgs-aarch64 and pkgs
  • use pre-commit-hooks to automatically check formatting and lints with flake8, nixpkgs-fmt, and rustfmt before commit and with nix flake check.

Additional context

I locally tested flake8 lint, it seems the python codebase has a lot of lint errors.

@sbourdeauducq
Copy link
Member

  • to automatically check formatting and lints with flake8, nixpkgs-fmt

Is nixpkgs-fmt available on non-Nix platforms?

@LEXUGE
Copy link
Contributor Author

LEXUGE commented Jun 20, 2024

You can install by cargo.

@bloxx12
Copy link
Contributor

bloxx12 commented Dec 1, 2024

  • format flake.nix by nixpkgs-fmt, a formatter used by nixpkgs.

archived by now, nixfmt is the new replacement. (there's alejandra as well.)

  • use flake-utils to avoid boilerplates like openocd-bscanspi-f and manually writing out pkgs-aarch64 and pkgs

I'd heavily advise against this, the same thing can be done using a few lines of simple nix code. flake-utils just adds an extra abstraction layer. Furthermore, artiq only outputs stuff for two different architectures, so you'd be defining the systems in a list anyways, and at this point it'd be much easier to just do that without an abstraction library.

@bloxx12
Copy link
Contributor

bloxx12 commented Dec 2, 2024

A minor follow up to this: adding a formatter would make working in the flake a lot easier. Alejandra and nixfmt are both great choices, and flakes output a formatter.<system> option, which would make adding a formatter as easy as adding formatter.x86-64-linux = pkgs.nixfmt-classic/pkgs.nixfmt-rfc-style/pkgs.alejandra to the flake and then running nix fmt in the repository.

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

3 participants