Compare commits

..

5 commits

Author SHA1 Message Date
Bruno BELANYI f9eaffdaf3 nix: flake: add markdownlint pre-commit hook
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-01 17:43:35 +02:00
Bruno BELANYI dc8a3ca8d1 git: ignore generated pre-commit configuration 2021-06-01 17:43:35 +02:00
Bruno BELANYI a45ffc71ad nix: add direnv integration 2021-06-01 17:43:35 +02:00
Bruno BELANYI a57a6d38bd nix: add pre-commit-hooks 2021-06-01 17:43:35 +02:00
Bruno BELANYI 140726a6ff nix: add flake 2021-05-31 22:02:22 +02:00
4 changed files with 155 additions and 0 deletions

8
.envrc Normal file
View file

@ -0,0 +1,8 @@
use_flake() {
watch_file flake.nix
watch_file flake.lock
eval "$(nix print-dev-env)"
}
use flake
eval "$shellHooks"

1
.gitignore vendored
View file

@ -1 +1,2 @@
/public/
.pre-commit-config.yaml

69
flake.lock Normal file
View file

@ -0,0 +1,69 @@
{
"nodes": {
"futils": {
"locked": {
"lastModified": 1622445595,
"narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "master",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1622282707,
"narHash": "sha256-+GOrUDsdneUqrOm9d+9bHXjEVoVcU8tm14WGVzbt6gg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6933d068c5d2fcff398e802f7c4e271bbdab6705",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-utils": [
"futils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1621411868,
"narHash": "sha256-R+7OQ2JYFCb3E7Jl7LhRifzMVCR6Gl8R98zYsNhZtJ8=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "2e7fac06108b4fc81f5ff9ed9a02bc4f6ede7001",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "master",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"futils": "futils",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}

77
flake.nix Normal file
View file

@ -0,0 +1,77 @@
{
description = "Ambroisie's blog";
inputs = {
futils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "master";
};
# https://nixpk.gs/pr-tracker.html?pr=124808
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, futils, nixpkgs, pre-commit-hooks } @ inputs:
futils.lib.eachDefaultSystem (system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
in
{
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt = {
enable = true;
};
markdown-lint = {
enable = true;
name = "Lint each post's markdown";
entry =
let
pkg = pkgs.nodePackages.markdownlint-cli;
in
"${pkg}/bin/markdownlint";
types = [ "markdown" ];
};
};
};
};
devShell = pkgs.mkShell {
name = "blog";
buildInputs = with pkgs; [
gnumake
hugo
];
inherit (self.checks.${system}.pre-commit) shellHook;
};
}
);
}