From a0b9f9ffe688c86bfc04c35655d783289e3484ba Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Wed, 30 Dec 2020 01:47:42 -0700 Subject: [PATCH] hooks: declare nixpkgs-fmt pre-commit hook --- .pre-commit-config.yaml | 5 +++++ CONTRIBUTING.md | 4 +++- pkgs/applications/blockchains/miningcore/deps.nix | 3 ++- shell.nix | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f1ed697 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/nix-community/nixpkgs-fmt + rev: master + hooks: + - id: nixpkgs-fmt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 708b368..a0ed5fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,9 @@ the `template` branch to provide a host of useful NixOS configurations available "out of the box". If you wish to contribute such an expression please follow these guidelines: -* format your code with [`nixpkgs-fmt`][nixpkgs-fmt] +* format your code with [`nixpkgs-fmt`][nixpkgs-fmt]. You can run the `hooks` + command inside the nix shell to install a pre-commit hook that does this + for you. * The commit message follows the same semantics as [nixpkgs][nixpkgs]. * You can use a `#` symbol to specify ambiguities. For example, `develop#zsh: ` would tell me that your updating the diff --git a/pkgs/applications/blockchains/miningcore/deps.nix b/pkgs/applications/blockchains/miningcore/deps.nix index 315b34a..aaba0d7 100644 --- a/pkgs/applications/blockchains/miningcore/deps.nix +++ b/pkgs/applications/blockchains/miningcore/deps.nix @@ -6,7 +6,8 @@ let inherit sha256; url = "${nugetUrlBase}/${name}/${version}"; }; -in [ +in +[ (fetchNuGet { name = "Microsoft.AspNetCore.App.Runtime.linux-x64"; diff --git a/shell.nix b/shell.nix index d55dd5f..e197743 100644 --- a/shell.nix +++ b/shell.nix @@ -37,6 +37,7 @@ pkgs.mkDevShell { nixos-install nixos-generate-config nixos-enter + pre-commit ]; env = { inherit name; }; @@ -54,6 +55,11 @@ pkgs.mkDevShell { category = "main"; package = flk; } + { + name = "hooks"; + help = "install git hooks"; + command = "pre-commit install"; + } { name = "grip"; help = python38Packages.grip.meta.description;