Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
feat(fmt): treefmt-nix support (#65)
Browse files Browse the repository at this point in the history
- `nix fmt`
- `nix flake check`
  • Loading branch information
storopoli committed Dec 19, 2023
1 parent 724570d commit a32e67b
Show file tree
Hide file tree
Showing 12 changed files with 14,811 additions and 9,501 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9

- name: Cache Nix artifacts
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Test ${{ matrix.jl-file }}
run: |
nix develop -L . --command bash -c "julia -e 'using Pkg; Pkg.instantiate()'"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_flake_lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update Flake Lock File
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00

jobs:
lockfile:
Expand All @@ -16,6 +16,6 @@ jobs:
uses: DeterminateSystems/update-flake-lock@v20
with:
pr-title: "fix: update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR
pr-labels: | # Labels to be set on the PR
dependencies
automated
37 changes: 36 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";

outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks, treefmt-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small;
inherit (pkgs.texlive) latexmk pgf pgfplots tikzsymbols biblatex beamer;
Expand All @@ -20,12 +22,21 @@
julia = pkgs.julia-bin.overrideDerivation (oldAttrs: { doInstallCheck = false; });

in
{
rec {
formatter = treefmtEval.config.build.wrapper;

checks = {
formatting = treefmtEval.config.build.check self;
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
typos.enable = true;
treefmt = {
enable = true;
};
};
settings = {
treefmt.package = treefmtEval.config.build.wrapper;
};
};
};
Expand Down
Loading

0 comments on commit a32e67b

Please sign in to comment.