Clean nix configuration

* Point to more recent nixpkgs commit. This fixes build issue with python
  3.7.3 (only on darwin?).

* Separate shell.nix and default.nix. This is so that lorri can be used for
  development.

* Add nix output to .gitignore.

* Format *.nix using nixfmt.

* Use gitignore for filtering files in nix derivation.
This commit is contained in:
Luc Tielen 2019-06-19 22:48:47 +02:00 committed by Mark Karpov
parent c13a515b28
commit 6b73283246
6 changed files with 36 additions and 29 deletions

View File

@ -31,7 +31,7 @@ jobs:
command: nix-build command: nix-build
- run: - run:
name: Generate Haddocks name: Generate Haddocks
command: nix-build --attr doc command: nix-build --attr ormolu.doc
- store_artifacts: - store_artifacts:
path: result-doc/share/doc path: result-doc/share/doc
destination: haddock destination: haddock

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ cabal.sandbox.config
dist-*/ dist-*/
dist/ dist/
stack.yaml stack.yaml
result*

View File

@ -1,24 +1,19 @@
let pkgs = import ./nix/nixpkgs; let
compiler = "ghc864"; pkgs = import ./nix/nixpkgs;
sourceRegex = [ gitignoreSource = import ./nix/gitignore { inherit (pkgs) lib; };
"^app.*$" compiler = "ghc864";
"^data.*$" source = gitignoreSource ./.;
"^ormolu.cabal$" haskellPackages = pkgs.haskell.packages.${compiler}.override {
"^src.*$" overrides = (self: super:
"^tests.*$" super // {
"^.*\.md$" "ormolu" = super.callCabal2nix "ormolu" source { };
]; });
haskellPackages = pkgs.haskell.packages.${compiler}.override };
{ overrides = (self: super: in {
super // ormolu = haskellPackages.ormolu;
{ "ormolu" = super.callCabal2nix "ormolu" (pkgs.lib.sourceByRegex ./. sourceRegex) {}; ormolu-shell = haskellPackages.shellFor {
}); packages = ps: [ ps.ormolu ];
}; buildInputs = [ pkgs.cabal-install ];
in if pkgs.lib.inNixShell };
then haskellPackages.shellFor }
{ packages = (ps: [ ps.ormolu ]);
buildInputs = [
pkgs.cabal-install
];
}
else haskellPackages.ormolu

View File

@ -0,0 +1,8 @@
{ lib }:
let
rev = "ec5dd0536a5e4c3a99c797b86180f7261197c124";
sha256 = "0k2r8y21rn4kr5dmddd3906x0733fs3bb8hzfpabkdav3wcy3klv";
url = "https://github.com/hercules-ci/gitignore/archive/${rev}.tar.gz";
nixGitIgnore = builtins.fetchTarball { inherit url sha256; };
in (import nixGitIgnore { inherit lib; }).gitignoreSource

View File

@ -1,8 +1,10 @@
let let
rev = "f52505fac8c82716872a616c501ad9eff188f97f"; rev = "454eea84a757ca5f733c4ec0f234eba2281c74eb";
sha256 = "0q2m2qhyga9yq29yz90ywgjbn9hdahs7i8wwlq7b55rdbyiwa5dy"; sha256 = "1k9jbix4w43brqlfmvwy218pf5fbmzsnc08shaww9qfdl1rdlaxy";
pkgs = import (builtins.fetchTarball { nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256; inherit sha256;
}) { config.allowUnfree = true; }; };
pkgs = import nixpkgs { config.allowUnfree = true; };
in pkgs in pkgs

1
shell.nix Normal file
View File

@ -0,0 +1 @@
(import ./default.nix).ormolu-shell