Skip to content

Commit d91c659

Browse files
authored
Merge pull request #3 from iancleary/feat/linting
Add devShells and formatter
2 parents dc859b4 + 0c50c46 commit d91c659

File tree

5 files changed

+75
-18
lines changed

5 files changed

+75
-18
lines changed

.yamllint.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
extends: default
3+
rules:
4+
line-length:
5+
max: 80
6+
level: warning

flake.nix

+26-18
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,39 @@
1010
};
1111
};
1212

13-
outputs = inputs @ { self
13+
outputs =
14+
inputs @ { self
1415
, nixpkgs
1516
, nixpkgs-unstable
1617
, neovim-plugins
17-
}:
18-
let
19-
overlays = {
20-
unstable = final: prev: {
21-
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
22-
inherit (nixpkgs-unstable.legacyPackages.${prev.system}) neovim-unwrapped;
18+
}:
19+
let
20+
forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
21+
overlays = {
22+
unstable = final: prev: {
23+
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
24+
inherit (nixpkgs-unstable.legacyPackages.${prev.system}) neovim-unwrapped;
25+
};
26+
neovimPlugins = neovim-plugins.overlays.default;
2327
};
24-
neovimPlugins = neovim-plugins.overlays.default;
25-
};
2628

27-
legacyPackages = builtins.currentSystem (system:
28-
import inputs.nixpkgs {
29+
legacyPackages = builtins.currentSystem (system:
30+
import inputs.nixpkgs {
2931
inherit system;
3032
overlays = builtins.attrValues overlays;
3133
config.allowUnfree = true;
3234
}
33-
);
34-
in
35-
{
36-
overlays.default = neovim-plugins.overlays.default; # pass through the neovim-plugins overlay
37-
homeManagerModules.default = import ./default.nix;
38-
homeManagerModules.home-manager = import ./default.nix;
39-
};
35+
);
36+
in
37+
{
38+
overlays.default = neovim-plugins.overlays.default; # pass through the neovim-plugins overlay
39+
homeManagerModules.default = import ./default.nix;
40+
homeManagerModules.home-manager = import ./default.nix;
41+
42+
devShells = forAllSystems (system: {
43+
lint = nixpkgs.legacyPackages.${system}.callPackage ./shells/lint.nix { };
44+
});
45+
46+
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixpkgs-fmt);
47+
};
4048
}

justfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# list recipes
2+
help:
3+
just --list
4+
5+
# Update the flake lock file
6+
update:
7+
nix flake update
8+
9+
# Lint all files (similar to GitHub Actions), setup nix-shell
10+
lint:
11+
nix develop --accept-flake-config .#lint
12+
13+
# format all the files, when in a nix-shell
14+
format:
15+
nixpkgs-fmt .
16+
17+
# check all files (similar to GitHub Actions), when in a nix-shell
18+
check:
19+
actionlint
20+
yamllint .
21+
selene .
22+
stylua --check .
23+
statix check
24+
nixpkgs-fmt --check .
25+
26+
# Check flake evaluation
27+
flake:
28+
nix flake check --no-build --all-systems

selene.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[rules]
2+
undefined_variable = "allow"
3+
unscoped_variables = "allow"

shells/lint.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ pkgs, ... }:
2+
3+
pkgs.mkShellNoCC {
4+
nativeBuildInputs = with pkgs; [
5+
actionlint
6+
selene
7+
stylua
8+
statix
9+
nixpkgs-fmt
10+
yamllint
11+
];
12+
}

0 commit comments

Comments
 (0)