1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-07 22:36:53 +03:00

ci: add nixpkgs-fmt check

This commit is contained in:
zimbatm 2019-12-31 12:27:51 +01:00
parent abd0de3269
commit f555c9cc5f
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7
4 changed files with 22 additions and 0 deletions

View File

@ -145,6 +145,7 @@ with rec
# version from `package.yaml` and create a dummy module that we inject in the # version from `package.yaml` and create a dummy module that we inject in the
# `ghci` command. # `ghci` command.
niv-devshell = haskellPackages.shellFor { niv-devshell = haskellPackages.shellFor {
buildInputs = [ pkgs.nixpkgs-fmt ];
packages = ps: [ ps.niv ]; packages = ps: [ ps.niv ];
shellHook = '' shellHook = ''
repl_for() { repl_for() {

View File

@ -2,6 +2,7 @@
import sources.nixpkgs { import sources.nixpkgs {
overlays = [ overlays = [
(_: pkgs: { inherit sources; }) (_: pkgs: { inherit sources; })
(_: pkgs: { nixpkgs-fmt = import pkgs.sources.nixpkgs-fmt {}; })
(_: pkgs: { termtosvg = pkgs.callPackage ./termtosvg.nix {}; }) (_: pkgs: { termtosvg = pkgs.callPackage ./termtosvg.nix {}; })
]; ];
config = {}; config = {};

View File

@ -11,6 +11,18 @@
"url": "https://github.com/NixOS/nixpkgs-channels/archive/d85e435b7bded2596d7b201bcd938c94d8a921c1.tar.gz", "url": "https://github.com/NixOS/nixpkgs-channels/archive/d85e435b7bded2596d7b201bcd938c94d8a921c1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"nixpkgs-fmt": {
"branch": "master",
"description": "Nix code formatter for nixpkgs [maintainer=@zimbatm]",
"homepage": "https://nix-community.github.io/nixpkgs-fmt/",
"owner": "nix-community",
"repo": "nixpkgs-fmt",
"rev": "2a64f4b6a597d0d62004ffcec3ae4fd83cd1efc8",
"sha256": "01kx4y1d4c5fjvpcffk92pk9hdbgg5j9h2ryqy2hfm54s7mb0k63",
"type": "tarball",
"url": "https://github.com/nix-community/nixpkgs-fmt/archive/2a64f4b6a597d0d62004ffcec3ae4fd83cd1efc8.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"termtosvg": { "termtosvg": {
"branch": "develop", "branch": "develop",
"description": "Record terminal sessions as SVG animations", "description": "Record terminal sessions as SVG animations",

View File

@ -2,6 +2,7 @@
#!nix-shell -i bash #!nix-shell -i bash
#!nix-shell -I nixpkgs=./nix #!nix-shell -I nixpkgs=./nix
#!nix-shell -p nix #!nix-shell -p nix
#!nix-shell -p nixpkgs-fmt
#!nix-shell --pure #!nix-shell --pure
unset NIX_SSL_CERT_FILE unset NIX_SSL_CERT_FILE
@ -32,4 +33,11 @@ fi
# Build and create a root # Build and create a root
nix-build ${nixargs[@]} nix-build ${nixargs[@]}
echo "Formatting"
if ! nixpkgs-fmt --check . ; then
echo
echo 'run `nixpkgs-fmt .` to fix this issue'
exit 1
fi
echo "all good" echo "all good"