flake: setup nix-formatter-pack

This commit is contained in:
Tobias Happ 2022-10-26 12:27:01 +02:00
parent 4050f7f992
commit 5d1b67e856
3 changed files with 83 additions and 8 deletions

View file

@ -3,7 +3,7 @@ on:
pull_request:
push:
jobs:
cachix:
lint:
runs-on: ubuntu-latest
steps:
@ -13,8 +13,5 @@ jobs:
- name: Install nix
uses: cachix/install-nix-action@v18
- name: Run formatter
run: nix fmt -- --check .
- name: Run statix
run: nix run nixpkgs#statix -- check
- name: Run nix-formatter-pack-check
run: nix build .#checks.x86_64-linux.nix-formatter-pack-check

55
flake.lock generated
View file

@ -21,6 +21,28 @@
"type": "github"
}
},
"nix-formatter-pack": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nmd": "nmd",
"nmt": "nmt"
},
"locked": {
"lastModified": 1666720474,
"narHash": "sha256-iWojjDS1D19zpeZXbBdjWb9MiKmVVFQCqtJmtTXgPx8=",
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"rev": "14876cc8fe94a3d329964ecb073b4c988c7b61f5",
"type": "github"
},
"original": {
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1664019863,
@ -52,9 +74,42 @@
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-formatter-pack": "nix-formatter-pack",
"nixpkgs": "nixpkgs",
"nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap"
}

View file

@ -13,9 +13,14 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-formatter-pack = {
url = "github:Gerschtli/nix-formatter-pack";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-for-bootstrap, home-manager }:
outputs = { self, nixpkgs, nixpkgs-for-bootstrap, home-manager, nix-formatter-pack }:
let
forEachSystem = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
@ -30,6 +35,20 @@
type = "app";
program = "${pkgs'.callPackage ./nix-on-droid { }}/bin/nix-on-droid";
};
formatterPackArgsFor = forEachSystem (system: {
inherit nixpkgs system;
checkFiles = [ ./. ];
config.tools = {
deadnix = {
enable = true;
noLambdaPatternNames = true;
};
nixpkgs-fmt.enable = true;
statix.enable = true;
};
});
in
{
apps.aarch64-linux = {
@ -37,7 +56,11 @@
nix-on-droid = app;
};
formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
checks = forEachSystem (system: {
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgsFor.${system};
});
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
lib.nixOnDroidConfiguration =
{ config