diff --git a/README.md b/README.md index 21979ae..41c4139 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,18 @@ --- -It is forbidden to modify this readme → read the comments in flake.nix! +_A collection of common devshell modules specified via [`numtide/devshell`][devshell]._ + +## Why? + +- Avoid repetition and reuse common best practices. +- Provide a collection of components to "kill the toil" in the devshell in different scenarios. +- Integrate DevShell concerns with the wider config management in `nix`: cross-reference variables. + +## Usage + +This is a prototype: consult usage with your Resident SRE. + +For more details: → read the comments in flake.nix! + +[devshell]: https://github.com/numtide/devshell diff --git a/commit-msg.sh b/commit-msg.sh new file mode 100644 index 0000000..10e0c9e --- /dev/null +++ b/commit-msg.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +conform enforce --commit-msg-file \$1 diff --git a/flake.lock b/flake.lock index fa9c5cd..baafdb9 100644 --- a/flake.lock +++ b/flake.lock @@ -668,11 +668,11 @@ }, "nixpkgs_13": { "locked": { - "lastModified": 1648219316, - "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", + "lastModified": 1655211057, + "narHash": "sha256-Zs5wm2GuW2nER9uYpgAAxuEqEK3LTo3Y+lwaWn/YYHk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", + "rev": "1712ecaa5118815292f57d6669c3c81d84d842b3", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8a9cc7e..c69a548 100644 --- a/flake.nix +++ b/flake.nix @@ -48,11 +48,22 @@ # -------------------------------------- # Hooks: use the default company-wide git hooks # -------------------------------------- - hooks = {extraModulesPath, ...}: { + hooks = { + extraModulesPath, + pkgs, + ... + }: let + nixpkgs' = nixpkgs.${pkgs.system}; + in { inherit _file; imports = ["${extraModulesPath}/git/hooks.nix"]; git.hooks.enable = true; git.hooks.pre-commit.text = builtins.readFile ./pre-commit.sh; + git.hooks.commit-msg.text = builtins.readFile ./commit-msg.sh; + packages = with nixpkgs'; [ + conform + editorconfig-checker + ]; }; # --------------------------------------