add more pre-commit-hooks
This commit is contained in:
parent
93331e06f3
commit
21a610df37
3 changed files with 35 additions and 27 deletions
1
.envrc
1
.envrc
|
|
@ -1 +1,2 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
use flake
|
use flake
|
||||||
|
|
|
||||||
51
flake.nix
51
flake.nix
|
|
@ -23,17 +23,14 @@
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
|
|
||||||
systems = [
|
systems = [
|
||||||
"aarch64-darwin"
|
|
||||||
"aarch64-linux"
|
|
||||||
"x86_64-darwin"
|
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
|
lib = nixpkgs.lib.extend (_final: _prev: inputs.synix.lib or { });
|
||||||
|
|
||||||
mkNixosConfiguration =
|
mkNixosConfiguration =
|
||||||
system: modules:
|
system: modules:
|
||||||
nixpkgs.lib.nixosSystem {
|
lib.nixosSystem {
|
||||||
inherit system modules;
|
inherit system modules;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs outputs lib;
|
inherit inputs outputs lib;
|
||||||
|
|
@ -53,8 +50,6 @@
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forAllSystems (pkgs: import ./pkgs pkgs);
|
|
||||||
|
|
||||||
overlays = import ./overlays { inherit inputs; };
|
overlays = import ./overlays { inherit inputs; };
|
||||||
|
|
||||||
nixosModules = import ./modules/nixos;
|
nixosModules = import ./modules/nixos;
|
||||||
|
|
@ -63,6 +58,8 @@
|
||||||
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
|
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
packages = forAllSystems (pkgs: import ./pkgs pkgs);
|
||||||
|
|
||||||
devShells = forAllSystems (pkgs: {
|
devShells = forAllSystems (pkgs: {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
shellHook = "export FLAKE_PATH=$(pwd)";
|
shellHook = "export FLAKE_PATH=$(pwd)";
|
||||||
|
|
@ -72,25 +69,33 @@
|
||||||
formatter = forAllSystems (
|
formatter = forAllSystems (
|
||||||
pkgs:
|
pkgs:
|
||||||
let
|
let
|
||||||
inherit (self.checks.${pkgs.system}.pre-commit-check.config) package configFile;
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
script = ''
|
inherit (self.checks.${system}.pre-commit-check.config) package configFile;
|
||||||
${pkgs.lib.getExe package} run --all-files --config ${configFile}
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
pkgs.writeShellScriptBin "pre-commit-run" script
|
pkgs.writeShellScriptBin "pre-commit-run" "${lib.getExe package} run --all-files --config ${configFile}"
|
||||||
);
|
);
|
||||||
|
|
||||||
checks = forAllSystems (pkgs: {
|
checks = forAllSystems (
|
||||||
pre-commit-check = inputs.git-hooks.lib.${pkgs.system}.run {
|
pkgs:
|
||||||
src = ./.;
|
let
|
||||||
hooks = {
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
nixfmt.enable = true;
|
in
|
||||||
|
{
|
||||||
|
pre-commit-check = inputs.git-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
actionlint.enable = true;
|
||||||
|
nixfmt.enable = true;
|
||||||
|
shellcheck.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
yamllint.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
build-packages = pkgs.linkFarm "flake-packages-${system}" self.packages.${system};
|
||||||
build-packages = pkgs.linkFarm "flake-packages-${pkgs.system}" self.packages.${pkgs.system};
|
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${system}" (
|
||||||
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${pkgs.system}" (
|
self.overlays.modifications pkgs pkgs
|
||||||
self.overlays.modifications pkgs pkgs
|
);
|
||||||
);
|
}
|
||||||
});
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
# synix packages accessible through 'pkgs.synix'
|
# synix packages accessible through 'pkgs.synix'
|
||||||
synix-packages = final: prev: { synix = inputs.synix.packages."${final.system}"; };
|
synix-packages = final: _prev: {
|
||||||
|
synix = inputs.synix.packages."${final.stdenv.hostPlatform.system}";
|
||||||
|
};
|
||||||
|
|
||||||
# packages in `pkgs/` accessible through 'pkgs.local'
|
# packages in `pkgs/` accessible through 'pkgs.local'
|
||||||
local-packages = final: prev: { local = import ../pkgs { pkgs = final; }; };
|
local-packages = final: _prev: { local = import ../pkgs { pkgs = final; }; };
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/Overlays
|
# https://nixos.wiki/wiki/Overlays
|
||||||
modifications =
|
modifications =
|
||||||
|
|
@ -20,7 +22,7 @@
|
||||||
# old-stable nixpkgs accessible through 'pkgs.old-stable'
|
# old-stable nixpkgs accessible through 'pkgs.old-stable'
|
||||||
old-stable-packages = final: prev: {
|
old-stable-packages = final: prev: {
|
||||||
old-stable = import inputs.nixpkgs-old-stable {
|
old-stable = import inputs.nixpkgs-old-stable {
|
||||||
inherit (final) system;
|
inherit (final.stdenv.hostPlatform) system;
|
||||||
inherit (prev) config;
|
inherit (prev) config;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -28,7 +30,7 @@
|
||||||
# unstable nixpkgs accessible through 'pkgs.unstable'
|
# unstable nixpkgs accessible through 'pkgs.unstable'
|
||||||
unstable-packages = final: prev: {
|
unstable-packages = final: prev: {
|
||||||
unstable = import inputs.nixpkgs-unstable {
|
unstable = import inputs.nixpkgs-unstable {
|
||||||
inherit (final) system;
|
inherit (final.stdenv.hostPlatform) system;
|
||||||
inherit (prev) config;
|
inherit (prev) config;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue