use treemft and also enable stylua
works well with CI
This commit is contained in:
parent
ae72391e42
commit
330feb587f
3 changed files with 57 additions and 20 deletions
24
.github/workflows/flake-check.yml
vendored
24
.github/workflows/flake-check.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: "nix build and flake check"
|
||||
name: "nix flake and fmt check"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
@ -6,20 +6,8 @@ jobs:
|
|||
flake-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v30
|
||||
with:
|
||||
github_access_token: ${{ secrets.github_token }}
|
||||
- run: nix flake check
|
||||
|
||||
nixfmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v30
|
||||
with:
|
||||
github_access_token: ${{ secrets.github_token }}
|
||||
- name: install nixfmt
|
||||
run: nix-env -f <nixpkgs> -iAP nixfmt-rfc-style
|
||||
- name: check that nix files are formatted correctly
|
||||
run : nixfmt --check
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v30
|
||||
with:
|
||||
github_access_token: ${{ secrets.github_token }}
|
||||
- run: nix flake check
|
||||
|
|
37
flake.lock
generated
37
flake.lock
generated
|
@ -84,6 +84,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1733097829,
|
||||
"narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
|
@ -91,7 +107,8 @@
|
|||
"nixpkgs-borg": "nixpkgs-borg",
|
||||
"nixpkgs-evolution": "nixpkgs-evolution",
|
||||
"nixpkgs-master": "nixpkgs-master",
|
||||
"sops-nix": "sops-nix"
|
||||
"sops-nix": "sops-nix",
|
||||
"treefmt": "treefmt"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
|
@ -113,6 +130,24 @@
|
|||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735135567,
|
||||
"narHash": "sha256-8T3K5amndEavxnludPyfj3Z1IkcFdRpR23q+T0BVeZE=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "9e09d30a644c57257715902efbb3adc56c79cf28",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
16
flake.nix
16
flake.nix
|
@ -11,6 +11,7 @@
|
|||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
treefmt.url = "github:numtide/treefmt-nix";
|
||||
nixpkgs-borg.url = "github:cything/nixpkgs/borg";
|
||||
nixpkgs-master.url = "github:nixos/nixpkgs/master";
|
||||
nixpkgs-evolution.url = "github:nixos/nixpkgs/a49023bcb550bcd84e1fa8afcbe7aa8bc0850bf4";
|
||||
|
@ -21,6 +22,7 @@
|
|||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
treefmt,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
|
@ -65,10 +67,22 @@
|
|||
};
|
||||
}
|
||||
);
|
||||
|
||||
treefmtEval = forEachSystem (
|
||||
pkgs:
|
||||
treefmt.lib.evalModule pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt.enable = true;
|
||||
programs.stylua.enable = true;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
|
||||
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
|
||||
formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
|
||||
checks = forEachSystem (pkgs: {
|
||||
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
||||
});
|
||||
|
||||
nixosConfigurations =
|
||||
let
|
||||
|
|
Loading…
Add table
Reference in a new issue