1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-10-04 00:47:24 +03:00
also drop Ormolu Live temporarily
This commit is contained in:
Alexander Esgen 2023-01-02 18:47:20 +01:00 committed by Mark Karpov
parent a4a9f4500b
commit 4b0bcc2945
26 changed files with 1344 additions and 728 deletions

View File

@ -1,24 +0,0 @@
steps:
- label: Build and test with GHC 9.0.2
command: |
nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc902
timeout: 100
- label: Build and test with GHC 9.2.4
command: |
nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc924
timeout: 100
- wait
- label: Check formatting
command: |
./format.sh
git diff --exit-code --color=always
- wait
- label: Build and deploy Ormolu Live
command: |
if [[ $BUILDKITE_BRANCH == "master" ]]; then
ormolu-live/deploy.sh
else
nix-build -A ormoluLive.ormoluLive -j 1 \
--arg ormoluLiveLink false --argstr ormoluCompiler ghc8107
fi
timeout: 100

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

View File

@ -24,10 +24,9 @@ jobs:
- uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.nixos.org https://cache.iog.io
accept-flake-config = true
- name: Build binary
run: nix-build -A binaries.${{ matrix.targetOS }}
run: nix build -L .#binaries/${{ matrix.targetOS }}
- name: Prepare upload
run: |
cd result/bin

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ dist-*/
dist/
stack.yaml.lock
result*
.pre-commit-config.yaml
# These are touched on every :reload in GHCi.
# https://gitlab.haskell.org/ghc/ghc/-/issues/22669

View File

@ -40,7 +40,7 @@ To regenerate outputs that have changed, you can set the
## Formatting
Use `format.sh` script to format Ormolu with the current version of Ormolu.
If Ormolu is not formatted like this, the CI will fail.
Use `nix run .#format` script to format Ormolu with the current version of
Ormolu. If Ormolu is not formatted like this, the CI will fail.
[issues]: https://github.com/tweag/ormolu/issues

View File

@ -69,12 +69,11 @@ $ yay -S ormolu
The easiest way to build the project is with Nix:
```console
$ nix-build -A ormolu
$ nix build
```
Note that you will need to add [IOHK Hydra binary
cache][iohk-hydra-binary-cache], otherwise building may take a very long
time.
Make sure to accept the IOG binary cache configuration, otherwise building may
take a very long time.
Alternatively, `stack` could be used as follows:
@ -83,19 +82,15 @@ $ stack build # to build
$ stack install # to install
```
To use Ormolu directly from GitHub with Nix, this snippet may come in handy:
To use Ormolu directly from GitHub with Nix flakes, this snippet may come in handy:
```nix
let
pkgs = import <nixpkgs> { };
source = pkgs.fetchFromGitHub {
owner = "tweag";
repo = "ormolu";
rev = "c1d8a8083cf1492545b8deed342c6399fe9873ea"; # update as necessary
# do not forget to update the hash:
sha256 = "sha256-3XxKuWqZnFa9s3mY7OBD+uEn/fGxPmC8jdevx7exy9o=";
};
in (import source { }).ormoluExe # this is e.g. the executable derivation
{
inputs.ormolu.url = "github:tweag/ormolu";
outputs = { ormolu, ... }: {
# use ormolu.packages.${system}.default here
};
}
```
## Usage
@ -264,7 +259,7 @@ It's possible to try Ormolu on arbitrary packages from Hackage. For that
execute (from the root of the cloned repo):
```console
$ nix-build -A hackage.<package>
$ nix build .#hackage.<package>
```
Then inspect `result/log.txt` for possible problems. The derivation will
@ -293,7 +288,6 @@ Copyright © 2018present Tweag I/O
[design-cpp]: https://github.com/tweag/ormolu/blob/master/DESIGN.md#cpp
[emacs-package]: https://github.com/vyorkin/ormolu.el
[haskell-src-exts]: https://hackage.haskell.org/package/haskell-src-exts
[iohk-hydra-binary-cache]: https://input-output-hk.github.io/haskell.nix/tutorials/getting-started.html#setting-up-the-binary-cache
[neoformat]: https://github.com/sbdchd/neoformat
[releases]: https://github.com/tweag/ormolu/releases
[ormolu-action]: https://github.com/marketplace/actions/ormolu-action

View File

@ -15,12 +15,12 @@ import Control.Monad
import Data.Bool (bool)
import Data.List (intercalate, sort)
import qualified Data.Map as Map
import Data.Maybe (fromMaybe, mapMaybe)
import Data.Maybe (fromMaybe, mapMaybe, maybeToList)
import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import Data.Version (showVersion)
import Development.GitRev
import Language.Haskell.TH.Env (envQ)
import Options.Applicative
import Ormolu
import Ormolu.Diff.Text (diffText, printTextDiff)
@ -224,12 +224,9 @@ optsParserInfo =
verStr =
intercalate
"\n"
[ unwords
[ "ormolu",
showVersion version,
$gitBranch,
$gitHash
],
[ unwords $
["ormolu", showVersion version]
<> maybeToList $$(envQ @String "ORMOLU_REV"),
"using ghc-lib-parser " ++ VERSION_ghc_lib_parser
]
exts :: Parser (a -> a)

View File

@ -1,12 +1,3 @@
packages: . ormolu-live extract-hackage-info
packages: . extract-hackage-info
constraints: ormolu +dev
-- miso does not specify bounds on servant
constraints: servant >=0.18 && <0.20
-- prune unnecessary dependencies
constraints: warp -x509, wai-app-static -cryptonite
-- due to GHCJS 8.10
allow-older: ghc-lib-parser:base

View File

@ -1,307 +0,0 @@
{ ormoluCompiler ? "ghc924",
ormoluLiveLink ? true
}:
let
pkgs = import ./nix/pkgs.nix;
hsPkgs = pkgs.haskell-nix.project {
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "ormolu";
src = ./.;
keepGitDir = true;
};
projectFileName = "cabal.project";
compiler-nix-name = ormoluCompiler;
modules =
let
gitTH = name: baseDir: { pkgs, lib, ... }: {
packages."${name}".components.exes."${name}" = {
build-tools =
lib.mkForce [ pkgs.buildPackages.buildPackages.gitReallyMinimal ];
extraSrcFiles = [ "${baseDir}.git/**/*" ];
};
};
in [
{
packages.ormolu.writeHieFiles = true;
}
({ pkgs, lib, ... }: lib.mkIf pkgs.stdenv.hostPlatform.isGhcjs {
reinstallableLibGhc = false;
packages.ormolu = {
writeHieFiles = lib.mkForce false;
};
packages.ormolu-live.ghcOptions =
lib.optional (!ormoluLiveLink) "-fno-code";
packages.ghc-lib-parser.patches = [
# see https://github.com/ghcjs/ghcjs/issues/836
./nix/lexer-no-unlifted-newtypes.patch
];
})
(gitTH "ormolu" "")
(gitTH "ormolu-live" "../")
];
};
ormolu = hsPkgs.ormolu;
ormoluLib = ormolu.components.library;
ormoluExe = ormolu.components.exes.ormolu;
ormolize = import ./nix/ormolize {
inherit pkgs;
ormolu = ormoluExe;
};
extractHackageInfo = hsPkgs.extract-hackage-info.components.exes.extract-hackage-info;
ormoluLive = hsPkgs.projectCross.ghcjs.hsPkgs.ormolu-live.components.exes.ormolu-live
.overrideAttrs (_: pkgs.lib.optionalAttrs (!ormoluLiveLink) {
outputs = [ "out" ];
installPhase = ''
mkdir -p $out
'';
});
expectedFailures = [
"Agda"
"brittany"
"esqueleto"
"haxl"
"hlint"
"leksah"
"lens"
"pandoc"
"pipes"
"postgrest"
"purescript"
];
ormolizedPackages =
let
ormolizeOverlay = self: super: { };
ormolizablePackages = pkgs.haskellPackages.override {
overrides = ormolizeOverlay;
};
in doCheck: pkgs.lib.mapAttrs (name: p: ormolize {
package = p;
inherit doCheck;
expectedFailures =
if pkgs.lib.lists.any (x: x == name) expectedFailures
then ./expected-failures + "/${name}.txt"
else null;
}) ormolizablePackages;
in {
ormoluTests = ormolu.checks.tests;
ormolu = ormoluExe; # for compatibility
inherit ormoluLib ormoluExe ormoluCompiler;
dev = let shellFor = packages: hsPkgs.shellFor {
inherit packages;
tools = {
cabal = "latest";
haskell-language-server = "latest";
};
withHoogle = false;
exactDeps = false;
}; in {
inherit hsPkgs;
ormoluShell = shellFor (ps: [ ps.ormolu ]);
ormoluLiveShell = shellFor (ps: [ ps.ormolu-live ]);
extractHackageInfoShell = shellFor (ps: [ ps.extract-hackage-info ]);
cabalAndOrmolu = pkgs.mkShell {
buildInputs = [
(hsPkgs.tool "cabal" "latest")
ormoluExe
];
};
};
hackage = ormolizedPackages false;
hackageTests = with pkgs.lib; pkgs.recurseIntoAttrs (
let ps = [
"Agda"
"QuickCheck"
"ShellCheck"
"aeson"
"attoparsec"
"aws"
"brick"
"brittany"
"capability"
"cassava"
"conduit"
"cryptonite"
"diagrams-core"
"distributed-process"
"esqueleto"
"fay"
"graphql-engine"
"hakyll"
"haxl"
"hedgehog"
"hledger"
"hlint"
"http-client"
"idris"
"intero"
"leksah"
"lens"
"megaparsec"
"optics"
"pandoc"
"parsec3"
"pipes"
"postgrest"
"purescript"
"raaz"
"servant"
"servant-server"
"stack"
"tensorflow"
"text_2_0_1"
"tls"
"unpacked-containers"
"yesod-core"
];
in listToAttrs (map (p: nameValuePair p (ormolizedPackages true).${p}) ps)
);
regionTests = pkgs.stdenv.mkDerivation {
name = "ormolu-region-tests";
src = ./region-tests;
buildInputs = [
ormoluExe
pkgs.diffutils
];
doCheck = true;
buildPhase = ''
cp src.hs result-all-implicit.hs
ormolu --check-idempotence --mode inplace result-all-implicit.hs
cp src.hs result-all-explicit.hs
ormolu --check-idempotence --mode inplace --start-line 1 --end-line 18 result-all-explicit.hs
cp src.hs result-only-start.hs
ormolu --check-idempotence --mode inplace --start-line 1 result-only-start.hs
cp src.hs result-only-end.hs
ormolu --check-idempotence --mode inplace --end-line 18 result-only-end.hs
cp src.hs result-6-7.hs
ormolu --check-idempotence --mode inplace --start-line 6 --end-line 7 result-6-7.hs
cp src.hs result-6-8.hs
ormolu --check-idempotence --mode inplace --start-line 6 --end-line 8 result-6-8.hs
cp src.hs result-9-12.hs
ormolu --check-idempotence --mode inplace --start-line 9 --end-line 12 result-9-12.hs
cp src.hs result-17-18.hs
ormolu --check-idempotence --mode inplace --start-line 17 --end-line 18 result-17-18.hs
'';
checkPhase = ''
echo result-all-implicit.hs
diff --color=always expected-result-all.hs result-all-implicit.hs
echo result-all-explicit.hs
diff --color=always expected-result-all.hs result-all-explicit.hs
echo result-only-start.hs
diff --color=always expected-result-all.hs result-only-start.hs
echo result-only-end.hs
diff --color=always expected-result-all.hs result-only-end.hs
echo result-6-7.hs
diff --color=always expected-result-6-7.hs result-6-7.hs
echo result-6-8.hs
diff --color=always expected-result-6-8.hs result-6-8.hs
echo result-9-12.hs
diff --color=always expected-result-9-12.hs result-9-12.hs
echo result-17-18.hs
diff --color=always expected-result-17-18.hs result-17-18.hs
'';
installPhase = ''
mkdir "$out"
find . -name '*.hs' -exec cp --parents {} $out \;
'';
};
fixityTests = pkgs.stdenv.mkDerivation {
name = "ormolu-fixity-tests";
src = ./fixity-tests;
buildInputs = [
ormoluExe
pkgs.diffutils
];
doCheck = true;
buildPhase = ''
cp test-0-input.hs test-0-no-extra-info.hs
ormolu --check-idempotence --mode inplace --no-cabal test-0-no-extra-info.hs
cp test-0-input.hs test-0-with-fixity-info-manual.hs
ormolu --check-idempotence --mode inplace --no-cabal --fixity 'infixr 8 .=' test-0-with-fixity-info-manual.hs
cp test-0-input.hs test-0-with-fixity-info-dotormolu.hs
ormolu --check-idempotence --mode inplace test-0-with-fixity-info-dotormolu.hs
cp test-1-input.hs test-1-no-extra-info.hs
ormolu --check-idempotence --mode inplace --no-cabal test-1-no-extra-info.hs
cp test-1-input.hs test-1-with-fixity-info-manual.hs
ormolu --check-idempotence --mode inplace --no-cabal --fixity 'infixr 8 .=' --fixity 'infixr 5 #' test-1-with-fixity-info-manual.hs
cp test-1-input.hs test-1-with-fixity-info-dotormolu.hs
ormolu --check-idempotence --mode inplace test-1-with-fixity-info-dotormolu.hs
'';
checkPhase = ''
echo test-0-no-extra-info.hs
diff --color=always test-0-no-extra-info-expected.hs test-0-no-extra-info.hs
echo test-0-with-fixity-info-manual.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-manual.hs
echo test-0-with-fixity-info-dotormolu.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-dotormolu.hs
echo test-1-no-extra-info.hs
diff --color=always test-1-no-extra-info-expected.hs test-1-no-extra-info.hs
echo test-1-with-fixity-info-manual.hs
diff --color=always test-1-with-fixity-info-expected.hs test-1-with-fixity-info-manual.hs
echo test-1-with-fixity-info-dotormolu.hs
diff --color=always test-1-with-fixity-info-expected.hs test-1-with-fixity-info-dotormolu.hs
'';
installPhase = ''
mkdir "$out"
find . -name '*.hs' -exec cp --parents {} $out \;
'';
};
binaries = let hsPkgsOpt = hsPkgs.appendModule {
modules = [{
dontStrip = false;
dontPatchELF = false;
enableDeadCodeElimination = true;
}];
}; in {
Linux = hsPkgsOpt.projectCross.musl64.hsPkgs.ormolu.components.exes.ormolu;
macOS = pkgs.runCommand "ormolu-macOS" {
buildInputs = [ pkgs.macdylibbundler ];
} ''
mkdir -p $out/bin
cp ${hsPkgsOpt.hsPkgs.ormolu.components.exes.ormolu}/bin/ormolu $out/bin/ormolu
chmod 755 $out/bin/ormolu
dylibbundler -b \
-x $out/bin/ormolu \
-d $out/bin \
-p '@executable_path'
'';
Windows = hsPkgsOpt.projectCross.mingwW64.hsPkgs.ormolu.components.exes.ormolu;
};
} // pkgs.lib.optionalAttrs (pkgs.lib.hasPrefix "ghc92" ormoluCompiler) {
inherit extractHackageInfo;
weeder = pkgs.runCommand
"ormolu-weeder" {
buildInputs = [ (hsPkgs.tool "weeder" "2.4.0") ];
} ''
mkdir -p $out
export XDG_CACHE_HOME=$TMPDIR/cache
weeder --config ${./weeder.dhall} \
--hie-directory ${ormoluLib.hie} \
--hie-directory ${ormoluExe.hie} \
--hie-directory ${ormolu.components.tests.tests.hie}
'';
} // pkgs.lib.optionalAttrs (pkgs.lib.hasPrefix "ghc810" ormoluCompiler) {
ormoluLive = {
inherit ormoluLive;
website = pkgs.stdenv.mkDerivation {
name = "ormolu-live-website";
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "ormolu-live-www";
src = ./.;
subDir = "ormolu-live/www";
};
buildInputs = [ pkgs.closurecompiler ];
installPhase = ''
cp -r . $out
ORMOLU_LIVE=${ormoluLive}/bin/ormolu-live.jsexe
# ADVANCED/SIMPLE optimizations break semantics :(
closure-compiler \
$ORMOLU_LIVE/all.js --externs $ORMOLU_LIVE/all.js.externs \
-O WHITESPACE_ONLY --jscomp_off=checkVars -W QUIET \
--js_output_file $out/all.min.js
'';
};
};
}

View File

@ -0,0 +1,88 @@
{ pkgs, ormolu }:
let
inherit (pkgs) lib;
expectedFailures = [
"Agda"
"brittany"
"esqueleto"
"haxl"
"hlint"
"leksah"
"lens"
"pandoc"
"pipes"
"postgrest"
"purescript"
];
ormolizedPackages =
let
ormolize = import ../nix/ormolize { inherit pkgs ormolu; };
ormolizeOverlay = _self: _super: { };
ormolizablePackages = pkgs.haskellPackages.override {
overrides = ormolizeOverlay;
};
in
doCheck: lib.mapAttrs
(name: p: ormolize {
package = p;
inherit doCheck;
expectedFailures =
if lib.lists.any (x: x == name) expectedFailures
then ./. + "/${name}.txt"
else null;
})
ormolizablePackages;
in
{
hackage = ormolizedPackages false;
hackageTests =
let
ps = [
"Agda"
"QuickCheck"
"ShellCheck"
"aeson"
"attoparsec"
"aws"
"brick"
"brittany"
"capability"
"cassava"
"conduit"
"cryptonite"
"diagrams-core"
"distributed-process"
"esqueleto"
"fay"
"graphql-engine"
"hakyll"
"haxl"
"hedgehog"
"hledger"
"hlint"
"http-client"
"idris"
"intero"
"leksah"
"lens"
"megaparsec"
"optics"
"pandoc"
"parsec3"
"pipes"
"postgrest"
"purescript"
"raaz"
"servant"
"servant-server"
"stack"
"tensorflow"
"text_2_0_1"
"tls"
"unpacked-containers"
"yesod-core"
];
in
pkgs.recurseIntoAttrs (lib.genAttrs ps (p: (ormolizedPackages true).${p}));
}

View File

@ -14,13 +14,11 @@ cleanup()
rm -rf "$WDIR"; exit
}
EXTRACTION_APP="$(nix-build -A extractHackageInfo --no-out-link)/bin/extract-hackage-info"
mkdir "$HOOGLE_DATABASE"
curl "https://hackage.haskell.org/packages/hoogle.tar.gz" | tar -xz -C "$HOOGLE_DATABASE"
curl "https://hackage.haskell.org/packages/top" -o "$HACKAGE_DATABASE"
"$EXTRACTION_APP" "$HOOGLE_DATABASE" "$HACKAGE_DATABASE" -o "$OUTPUT"
nix run .#extract-hackage-info -- "$HOOGLE_DATABASE" "$HACKAGE_DATABASE" -o "$OUTPUT"
cp "$OUTPUT" "extract-hackage-info/hackage-info.bin"

View File

@ -1 +0,0 @@
(import ../default.nix { }).dev.extractHackageInfoShell

45
fixity-tests/default.nix Normal file
View File

@ -0,0 +1,45 @@
{ pkgs, ormolu }:
{
fixityTests = pkgs.stdenv.mkDerivation {
name = "ormolu-fixity-tests";
src = ./.;
buildInputs = [
ormolu
pkgs.diffutils
];
doCheck = true;
buildPhase = ''
cp test-0-input.hs test-0-no-extra-info.hs
ormolu --check-idempotence --mode inplace --no-cabal test-0-no-extra-info.hs
cp test-0-input.hs test-0-with-fixity-info-manual.hs
ormolu --check-idempotence --mode inplace --no-cabal --fixity 'infixr 8 .=' test-0-with-fixity-info-manual.hs
cp test-0-input.hs test-0-with-fixity-info-dotormolu.hs
ormolu --check-idempotence --mode inplace test-0-with-fixity-info-dotormolu.hs
cp test-1-input.hs test-1-no-extra-info.hs
ormolu --check-idempotence --mode inplace --no-cabal test-1-no-extra-info.hs
cp test-1-input.hs test-1-with-fixity-info-manual.hs
ormolu --check-idempotence --mode inplace --no-cabal --fixity 'infixr 8 .=' --fixity 'infixr 5 #' test-1-with-fixity-info-manual.hs
cp test-1-input.hs test-1-with-fixity-info-dotormolu.hs
ormolu --check-idempotence --mode inplace test-1-with-fixity-info-dotormolu.hs
'';
checkPhase = ''
echo test-0-no-extra-info.hs
diff --color=always test-0-no-extra-info-expected.hs test-0-no-extra-info.hs
echo test-0-with-fixity-info-manual.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-manual.hs
echo test-0-with-fixity-info-dotormolu.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-dotormolu.hs
echo test-1-no-extra-info.hs
diff --color=always test-1-no-extra-info-expected.hs test-1-no-extra-info.hs
echo test-1-with-fixity-info-manual.hs
diff --color=always test-1-with-fixity-info-expected.hs test-1-with-fixity-info-manual.hs
echo test-1-with-fixity-info-dotormolu.hs
diff --color=always test-1-with-fixity-info-expected.hs test-1-with-fixity-info-dotormolu.hs
'';
installPhase = ''
mkdir "$out"
find . -name '*.hs' -exec cp --parents {} $out \;
'';
};
}

934
flake.lock Normal file
View File

@ -0,0 +1,934 @@
{
"nodes": {
"HTTP": {
"flake": false,
"locked": {
"lastModified": 1451647621,
"narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=",
"owner": "phadej",
"repo": "HTTP",
"rev": "9bc0996d412fef1787449d841277ef663ad9a915",
"type": "github"
},
"original": {
"owner": "phadej",
"repo": "HTTP",
"type": "github"
}
},
"blank": {
"locked": {
"lastModified": 1625557891,
"narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=",
"owner": "divnix",
"repo": "blank",
"rev": "5a5d2684073d9f563072ed07c871d577a6c614a8",
"type": "github"
},
"original": {
"owner": "divnix",
"repo": "blank",
"type": "github"
}
},
"cabal-32": {
"flake": false,
"locked": {
"lastModified": 1603716527,
"narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=",
"owner": "haskell",
"repo": "cabal",
"rev": "48bf10787e27364730dd37a42b603cee8d6af7ee",
"type": "github"
},
"original": {
"owner": "haskell",
"ref": "3.2",
"repo": "cabal",
"type": "github"
}
},
"cabal-34": {
"flake": false,
"locked": {
"lastModified": 1640353650,
"narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=",
"owner": "haskell",
"repo": "cabal",
"rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd",
"type": "github"
},
"original": {
"owner": "haskell",
"ref": "3.4",
"repo": "cabal",
"type": "github"
}
},
"cabal-36": {
"flake": false,
"locked": {
"lastModified": 1641652457,
"narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=",
"owner": "haskell",
"repo": "cabal",
"rev": "f27667f8ec360c475027dcaee0138c937477b070",
"type": "github"
},
"original": {
"owner": "haskell",
"ref": "3.6",
"repo": "cabal",
"type": "github"
}
},
"cardano-shell": {
"flake": false,
"locked": {
"lastModified": 1608537748,
"narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=",
"owner": "input-output-hk",
"repo": "cardano-shell",
"rev": "9392c75087cb9a3d453998f4230930dea3a95725",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "cardano-shell",
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": [
"haskellNix",
"tullia",
"std",
"flake-utils"
],
"nixpkgs": [
"haskellNix",
"tullia",
"std",
"nixpkgs"
]
},
"locked": {
"lastModified": 1663445644,
"narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=",
"owner": "numtide",
"repo": "devshell",
"rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"dmerge": {
"inputs": {
"nixlib": [
"haskellNix",
"tullia",
"std",
"nixpkgs"
],
"yants": [
"haskellNix",
"tullia",
"std",
"yants"
]
},
"locked": {
"lastModified": 1659548052,
"narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=",
"owner": "divnix",
"repo": "data-merge",
"rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497",
"type": "github"
},
"original": {
"owner": "divnix",
"repo": "data-merge",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1635892615,
"narHash": "sha256-harGbMZr4hzat2BWBU+Y5OYXlu+fVz7E4WeQzHi5o8A=",
"owner": "input-output-hk",
"repo": "flake-compat",
"rev": "eca47d3377946315596da653862d341ee5341318",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"ghc-8.6.5-iohk": {
"flake": false,
"locked": {
"lastModified": 1600920045,
"narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=",
"owner": "input-output-hk",
"repo": "ghc",
"rev": "95713a6ecce4551240da7c96b6176f980af75cae",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"ref": "release/8.6.5-iohk",
"repo": "ghc",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gomod2nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"utils": "utils"
},
"locked": {
"lastModified": 1655245309,
"narHash": "sha256-d/YPoQ/vFn1+GTmSdvbSBSTOai61FONxB4+Lt6w/IVI=",
"owner": "tweag",
"repo": "gomod2nix",
"rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "gomod2nix",
"type": "github"
}
},
"hackage": {
"flake": false,
"locked": {
"lastModified": 1668561455,
"narHash": "sha256-7F7G7auywqrpqflR5qxSg+lwcZMor009G1miwEvYrts=",
"owner": "input-output-hk",
"repo": "hackage.nix",
"rev": "ccd32d7f97a5ce5e4f89167ef75b8a30a4565647",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "hackage.nix",
"type": "github"
}
},
"haskellNix": {
"inputs": {
"HTTP": "HTTP",
"cabal-32": "cabal-32",
"cabal-34": "cabal-34",
"cabal-36": "cabal-36",
"cardano-shell": "cardano-shell",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"ghc-8.6.5-iohk": "ghc-8.6.5-iohk",
"hackage": "hackage",
"hpc-coveralls": "hpc-coveralls",
"hydra": "hydra",
"nixpkgs": [
"haskellNix",
"nixpkgs-unstable"
],
"nixpkgs-2003": "nixpkgs-2003",
"nixpkgs-2105": "nixpkgs-2105",
"nixpkgs-2111": "nixpkgs-2111",
"nixpkgs-2205": "nixpkgs-2205",
"nixpkgs-unstable": "nixpkgs-unstable",
"old-ghc-nix": "old-ghc-nix",
"stackage": "stackage",
"tullia": "tullia"
},
"locked": {
"lastModified": 1668600639,
"narHash": "sha256-7KECcJ+UEzJt2IXUFS0rs4Jt5MpNzIm6bUFB8aGHEFM=",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "a88458a496c5e2d3ae889bb22c24f1b4d8e7fa5a",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "haskell.nix",
"type": "github"
}
},
"hpc-coveralls": {
"flake": false,
"locked": {
"lastModified": 1607498076,
"narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=",
"owner": "sevanspowell",
"repo": "hpc-coveralls",
"rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430",
"type": "github"
},
"original": {
"owner": "sevanspowell",
"repo": "hpc-coveralls",
"type": "github"
}
},
"hydra": {
"inputs": {
"nix": "nix",
"nixpkgs": [
"haskellNix",
"hydra",
"nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1646878427,
"narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=",
"owner": "NixOS",
"repo": "hydra",
"rev": "28b682b85b7efc5cf7974065792a1f22203a5927",
"type": "github"
},
"original": {
"id": "hydra",
"type": "indirect"
}
},
"lowdown-src": {
"flake": false,
"locked": {
"lastModified": 1633514407,
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
"owner": "kristapsdz",
"repo": "lowdown",
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
"type": "github"
},
"original": {
"owner": "kristapsdz",
"repo": "lowdown",
"type": "github"
}
},
"mdbook-kroki-preprocessor": {
"flake": false,
"locked": {
"lastModified": 1661755005,
"narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=",
"owner": "JoelCourtney",
"repo": "mdbook-kroki-preprocessor",
"rev": "93adb5716d035829efed27f65f2f0833a7d3e76f",
"type": "github"
},
"original": {
"owner": "JoelCourtney",
"repo": "mdbook-kroki-preprocessor",
"type": "github"
}
},
"n2c": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"haskellNix",
"tullia",
"std",
"nixpkgs"
]
},
"locked": {
"lastModified": 1665039323,
"narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=",
"owner": "nlewo",
"repo": "nix2container",
"rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a",
"type": "github"
},
"original": {
"owner": "nlewo",
"repo": "nix2container",
"type": "github"
}
},
"nix": {
"inputs": {
"lowdown-src": "lowdown-src",
"nixpkgs": "nixpkgs",
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1643066034,
"narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=",
"owner": "NixOS",
"repo": "nix",
"rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "2.6.0",
"repo": "nix",
"type": "github"
}
},
"nix-nomad": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": [
"haskellNix",
"tullia",
"nix2container",
"flake-utils"
],
"gomod2nix": "gomod2nix",
"nixpkgs": [
"haskellNix",
"tullia",
"nixpkgs"
],
"nixpkgs-lib": [
"haskellNix",
"tullia",
"nixpkgs"
]
},
"locked": {
"lastModified": 1658277770,
"narHash": "sha256-T/PgG3wUn8Z2rnzfxf2VqlR1CBjInPE0l1yVzXxPnt0=",
"owner": "tristanpemble",
"repo": "nix-nomad",
"rev": "054adcbdd0a836ae1c20951b67ed549131fd2d70",
"type": "github"
},
"original": {
"owner": "tristanpemble",
"repo": "nix-nomad",
"type": "github"
}
},
"nix2container": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1658567952,
"narHash": "sha256-XZ4ETYAMU7XcpEeAFP3NOl9yDXNuZAen/aIJ84G+VgA=",
"owner": "nlewo",
"repo": "nix2container",
"rev": "60bb43d405991c1378baf15a40b5811a53e32ffa",
"type": "github"
},
"original": {
"owner": "nlewo",
"repo": "nix2container",
"type": "github"
}
},
"nixago": {
"inputs": {
"flake-utils": [
"haskellNix",
"tullia",
"std",
"flake-utils"
],
"nixago-exts": [
"haskellNix",
"tullia",
"std",
"blank"
],
"nixpkgs": [
"haskellNix",
"tullia",
"std",
"nixpkgs"
]
},
"locked": {
"lastModified": 1661824785,
"narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=",
"owner": "nix-community",
"repo": "nixago",
"rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixago",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1632864508,
"narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "82891b5e2c2359d7e58d08849e4c89511ab94234",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.05-small",
"type": "indirect"
}
},
"nixpkgs-2003": {
"locked": {
"lastModified": 1620055814,
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-20.03-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-2105": {
"locked": {
"lastModified": 1659914493,
"narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-21.05-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-2111": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-21.11-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-2205": {
"locked": {
"lastModified": 1663981975,
"narHash": "sha256-TKaxWAVJR+a5JJauKZqibmaM5e/Pi5tBDx9s8fl/kSE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "309faedb8338d3ae8ad8f1043b3ccf48c9cc2970",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-22.05-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"id": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "indirect"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1671271954,
"narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1663905476,
"narHash": "sha256-0CSwRKaYravh9v6qSlBpM0gNg0UhKT2lL7Yn6Zbx7UM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e14f9fb57315f0d4abde222364f19f88c77d2b79",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1653581809,
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1654807842,
"narHash": "sha256-ADymZpr6LuTEBXcy6RtFHcUZdjKTBRTMYwu19WOx17E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fc909087cc3386955f21b4665731dbdaceefb1d8",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1665087388,
"narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"old-ghc-nix": {
"flake": false,
"locked": {
"lastModified": 1631092763,
"narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=",
"owner": "angerman",
"repo": "old-ghc-nix",
"rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8",
"type": "github"
},
"original": {
"owner": "angerman",
"ref": "master",
"repo": "old-ghc-nix",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": [
"flake-utils"
],
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1672659856,
"narHash": "sha256-9vJvy5O87WyIYZGzFaHMeRTishV0SNDeSewvnyRCrMI=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "2d947ef03b7cba461aab65a5df1ede03be567068",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": [
"haskellNix",
"flake-utils"
],
"haskellNix": "haskellNix",
"nixpkgs": [
"haskellNix",
"nixpkgs-unstable"
],
"pre-commit-hooks": "pre-commit-hooks"
}
},
"stackage": {
"flake": false,
"locked": {
"lastModified": 1668561558,
"narHash": "sha256-kPphlxLhorScEWLushwUInuSRSCNpeL5Q12pYDqo3dk=",
"owner": "input-output-hk",
"repo": "stackage.nix",
"rev": "0feb1639188527219bee04656693a043e1864ecb",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "stackage.nix",
"type": "github"
}
},
"std": {
"inputs": {
"blank": "blank",
"devshell": "devshell",
"dmerge": "dmerge",
"flake-utils": "flake-utils_3",
"makes": [
"haskellNix",
"tullia",
"std",
"blank"
],
"mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor",
"microvm": [
"haskellNix",
"tullia",
"std",
"blank"
],
"n2c": "n2c",
"nixago": "nixago",
"nixpkgs": "nixpkgs_4",
"yants": "yants"
},
"locked": {
"lastModified": 1665513321,
"narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=",
"owner": "divnix",
"repo": "std",
"rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4",
"type": "github"
},
"original": {
"owner": "divnix",
"repo": "std",
"type": "github"
}
},
"tullia": {
"inputs": {
"nix-nomad": "nix-nomad",
"nix2container": "nix2container",
"nixpkgs": [
"haskellNix",
"nixpkgs"
],
"std": "std"
},
"locked": {
"lastModified": 1666200256,
"narHash": "sha256-cJPS8zBu30SMhxMe7I8DWutwqMuhPsEez87y9gxMKc4=",
"owner": "input-output-hk",
"repo": "tullia",
"rev": "575362c2244498e8d2c97f72861510fa72e75d44",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "tullia",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"yants": {
"inputs": {
"nixpkgs": [
"haskellNix",
"tullia",
"std",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660507851,
"narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=",
"owner": "divnix",
"repo": "yants",
"rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96",
"type": "github"
},
"original": {
"owner": "divnix",
"repo": "yants",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

149
flake.nix Normal file
View File

@ -0,0 +1,149 @@
{
inputs = {
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
flake-utils.follows = "haskellNix/flake-utils";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
inherit (inputs.haskellNix) config;
overlays = [ inputs.haskellNix.overlay ];
};
inherit (pkgs) lib haskell-nix;
inherit (haskell-nix) haskellLib;
defaultGHCVersion = "ghc925";
ghcVersions = [ "ghc902" defaultGHCVersion ];
perGHC = lib.genAttrs ghcVersions (ghcVersion:
let
hsPkgs = pkgs.haskell-nix.cabalProject {
src = ./.;
compiler-nix-name = ghcVersion;
modules = [{
packages.ormolu.writeHieFiles = true;
packages.ormolu.components.exes.ormolu.preBuild =
lib.mkIf (self ? rev) ''export ORMOLU_REV=${self.rev}'';
}];
};
inherit (hsPkgs.ormolu.components.exes) ormolu;
hackageTests = import ./expected-failures { inherit pkgs ormolu; };
regionTests = import ./region-tests { inherit pkgs ormolu; };
fixityTests = import ./fixity-tests { inherit pkgs ormolu; };
packages = lib.recurseIntoAttrs ({
inherit ormolu;
ormoluTests = haskellLib.collectChecks' hsPkgs;
dev = { inherit hsPkgs; };
} // hackageTests // regionTests // fixityTests
// lib.optionalAttrs (ghcVersion == defaultGHCVersion) {
inherit (hsPkgs.extract-hackage-info.components.exes) extract-hackage-info;
weeder = pkgs.runCommand
"ormolu-weeder"
{
buildInputs = [ (hsPkgs.tool "weeder" "2.4.0") ];
} ''
mkdir -p $out
export XDG_CACHE_HOME=$TMPDIR/cache
weeder --config ${./weeder.dhall} \
--hie-directory ${hsPkgs.ormolu.components.library.hie} \
--hie-directory ${hsPkgs.ormolu.components.exes.ormolu.hie} \
--hie-directory ${hsPkgs.ormolu.components.tests.tests.hie}
'';
});
in
packages // {
ci = pkgs.linkFarmFromDrvs "ormolu-ci-${ghcVersion}"
(lib.attrValues (flake-utils.lib.flattenTree packages));
});
defaultGHC = perGHC.${defaultGHCVersion};
binaries =
let
hsPkgs = defaultGHC.dev.hsPkgs.appendModule {
modules = [{
dontStrip = false;
dontPatchELF = false;
enableDeadCodeElimination = true;
}];
};
ormoluExe = hsPkgs: hsPkgs.hsPkgs.ormolu.components.exes.ormolu;
in
lib.recurseIntoAttrs {
Linux = ormoluExe hsPkgs.projectCross.musl64;
macOS = pkgs.runCommand "ormolu-macOS"
{
nativeBuildInputs = [ pkgs.macdylibbundler ];
} ''
mkdir -p $out/bin
cp ${ormoluExe hsPkgs}/bin/ormolu $out/bin/ormolu
chmod 755 $out/bin/ormolu
dylibbundler -b \
-x $out/bin/ormolu \
-d $out/bin \
-p '@executable_path'
'';
Windows = ormoluExe hsPkgs.projectCross.mingwW64;
};
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
deadnix.enable = true;
};
};
in
{
packages = flake-utils.lib.flattenTree {
inherit binaries pre-commit-check;
default = defaultGHC.ormolu;
};
apps = {
default = flake-utils.lib.mkApp {
drv = defaultGHC.ormolu;
exePath = "/bin/ormolu";
};
extract-hackage-info = flake-utils.lib.mkApp {
drv = defaultGHC.extract-hackage-info;
exePath = "/bin/extract-hackage-info";
};
format = flake-utils.lib.mkApp {
drv = pkgs.writeShellApplication {
name = "ormolu-format";
text = builtins.readFile ./nix/format.sh;
runtimeInputs = [
(defaultGHC.dev.hsPkgs.tool "cabal" "latest")
defaultGHC.ormolu
];
};
};
};
devShells = {
default = defaultGHC.dev.hsPkgs.shellFor {
tools = {
cabal = "latest";
haskell-language-server = "latest";
};
withHoogle = false;
exactDeps = false;
inherit (pre-commit-check) shellHook;
};
};
legacyPackages = defaultGHC // perGHC;
});
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
};
}

View File

@ -1,18 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell default.nix -A dev.cabalAndOrmolu -i bash --pure
#
# Format Ormolu using current version of Ormolu.
set -e
export LANG="C.UTF-8"
cabal format
pushd extract-hackage-info && cabal format && popd
pushd ormolu-live && cabal format && popd
ormolu -m inplace $(find app -type f -name "*.hs")
ormolu -m inplace $(find src -type f -name "*.hs-boot" -o -name "*.hs")
ormolu -m inplace $(find tests -type f -name "*.hs")
ormolu -m inplace $(find ormolu-live/src -type f -name "*.hs")
ormolu -m inplace $(find extract-hackage-info/src -type f -name "*.hs")

10
nix/format.sh Executable file
View File

@ -0,0 +1,10 @@
# Format Ormolu using current version of Ormolu.
export LANG="C.UTF-8"
cabal format
(cd extract-hackage-info && cabal format)
export dirs="src app tests extract-hackage-info/src"
# shellcheck disable=SC2046,SC2086
ormolu -m inplace $(find $dirs -type f -name "*.hs" -o -name "*.hs-boot")

View File

@ -1,79 +0,0 @@
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index f3a3109..12505db 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -44,10 +44,6 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
-{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE UnboxedSums #-}
-{-# LANGUAGE UnliftedNewtypes #-}
-{-# LANGUAGE PatternSynonyms #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
@@ -57,7 +53,7 @@ module GHC.Parser.Lexer (
Token(..), lexer, lexerDbg,
ParserOpts(..), mkParserOpts,
PState (..), initParserState, initPragState,
- P(..), ParseResult(POk, PFailed),
+ P(..), ParseResult(..),
allocateComments, allocatePriorComments, allocateFinalComments,
MonadP(..),
getRealSrcLoc, getPState,
@@ -2325,25 +2321,17 @@ data LayoutContext
deriving Show
-- | The result of running a parser.
-newtype ParseResult a = PR (# (# PState, a #) | PState #)
-
--- | The parser has consumed a (possibly empty) prefix of the input and produced
--- a result. Use 'getPsMessages' to check for accumulated warnings and non-fatal
--- errors.
---
--- The carried parsing state can be used to resume parsing.
-pattern POk :: PState -> a -> ParseResult a
-pattern POk s a = PR (# (# s , a #) | #)
-
--- | The parser has consumed a (possibly empty) prefix of the input and failed.
---
--- The carried parsing state can be used to resume parsing. It is the state
--- right before failure, including the fatal parse error. 'getPsMessages' and
--- 'getPsErrorMessages' must return a non-empty bag of errors.
-pattern PFailed :: PState -> ParseResult a
-pattern PFailed s = PR (# | s #)
-
-{-# COMPLETE POk, PFailed #-}
+data ParseResult a
+ = POk -- ^ The parser has consumed a (possibly empty) prefix
+ -- of the input and produced a result. Use 'getMessages'
+ -- to check for accumulated warnings and non-fatal errors.
+ PState -- ^ The resulting parsing state. Can be used to resume parsing.
+ a -- ^ The resulting value.
+ | PFailed -- ^ The parser has consumed a (possibly empty) prefix
+ -- of the input and failed.
+ PState -- ^ The parsing state right before failure, including the fatal
+ -- parse error. 'getMessages' and 'getErrorMessages' must return
+ -- a non-empty bag of errors.
-- | Test whether a 'WarningFlag' is set
warnopt :: WarningFlag -> ParserOpts -> Bool
@@ -3111,7 +3099,7 @@ srcParseErr
srcParseErr options buf len loc = mkPlainErrorMsgEnvelope loc (PsErrParse token details)
where
token = lexemeToString (offsetBytes (-len) buf) len
- pattern_ = decodePrevNChars 8 buf
+ pattern = decodePrevNChars 8 buf
last100 = decodePrevNChars 100 buf
doInLast100 = "do" `isInfixOf` last100
mdoInLast100 = "mdo" `isInfixOf` last100
@@ -3122,7 +3110,7 @@ srcParseErr options buf len loc = mkPlainErrorMsgEnvelope loc (PsErrParse token
, ped_do_in_last_100 = doInLast100
, ped_mdo_in_last_100 = mdoInLast100
, ped_pat_syn_enabled = ps_enabled
- , ped_pattern_parsed = pattern_ == "pattern "
+ , ped_pattern_parsed = pattern == "pattern "
}
-- Report a parse failure, giving the span of the previous token as

View File

@ -5,48 +5,48 @@
, expectedFailures ? null
, doCheck ? false
}:
pkgs.stdenv.mkDerivation rec {
name = package.name + "-ormolized";
src = package.src;
buildInputs = [
ormolu
pkgs.haskellPackages.cpphs
pkgs.diffutils
pkgs.glibcLocales
];
LANG = "en_US.UTF-8";
buildPhase = ''
hs_files=$(find . -name '*.hs' -o -name '*.hsig')
for hs_file in $hs_files; do
pkgs.stdenv.mkDerivation rec {
name = package.name + "-ormolized";
src = package.src;
buildInputs = [
ormolu
pkgs.haskellPackages.cpphs
pkgs.diffutils
pkgs.glibcLocales
];
LANG = "en_US.UTF-8";
buildPhase = ''
hs_files=$(find . -name '*.hs' -o -name '*.hsig')
for hs_file in $hs_files; do
# drop includes
sed -i '/^#include/d' "$hs_file"
# drop includes
sed -i '/^#include/d' "$hs_file"
# deal with CPP
cpphs "$hs_file" --noline -DARCH_X86 > "''${hs_file}-nocpp" 2> /dev/null
# deal with CPP
cpphs "$hs_file" --noline -DARCH_X86 > "''${hs_file}-nocpp" 2> /dev/null
# annoyingly, cpphs cannot modify files in place
mv "''${hs_file}-nocpp" "$hs_file"
# annoyingly, cpphs cannot modify files in place
mv "''${hs_file}-nocpp" "$hs_file"
# preserve the original
cp "$hs_file" "''${hs_file}-original"
done
# preserve the original
cp "$hs_file" "''${hs_file}-original"
done
((ormolu --check-idempotence --mode inplace $hs_files; echo $? > exit_code) || true) 2> log.txt
((ormolu --check-idempotence --mode inplace $hs_files; echo $? > exit_code) || true) 2> log.txt
'';
inherit doCheck;
checkPhase =
if expectedFailures == null
then ''
echo "No failures expected"
if (( $(cat exit_code) != 0 )); then exit 1; fi
''
else ''
diff --ignore-blank-lines --color=always ${expectedFailures} log.txt
'';
inherit doCheck;
checkPhase =
if expectedFailures == null
then ''
echo "No failures expected"
if (( $(cat exit_code) != 0 )); then exit 1; fi
''
else ''
diff --ignore-blank-lines --color=always ${expectedFailures} log.txt
'';
installPhase = ''
mkdir "$out"
find . \( -name '*.hs-original' -o -name '*.hs' -o -name '*.hsig-original' -o -name '*.hsig' -o -name '*.cabal' \) -exec cp --parents {} $out \;
cp log.txt $out/log.txt
'';
}
installPhase = ''
mkdir "$out"
find . \( -name '*.hs-original' -o -name '*.hs' -o -name '*.hsig-original' -o -name '*.hsig' -o -name '*.cabal' \) -exec cp --parents {} $out \;
cp log.txt $out/log.txt
'';
}

View File

@ -1,5 +0,0 @@
let
sources = import ./sources.nix { };
haskellNix = import sources.haskellNix { };
in
import haskellNix.sources.nixpkgs-unstable haskellNix.nixpkgsArgs

View File

@ -1,14 +0,0 @@
{
"haskellNix": {
"branch": "master",
"description": "Alternative Haskell Infrastructure for Nixpkgs",
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "4b252a25630910f47fd2961dd3545efd01178980",
"sha256": "1c3ivm8zy9ch0wwj0nlqx3gq1322xspqgqr379k4zhcrnzdf4sca",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/4b252a25630910f47fd2961dd3545efd01178980.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View File

@ -1,194 +0,0 @@
# This file has been generated by Niv.
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
if spec ? ref then spec.ref else
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
submodules = if spec ? submodules then spec.submodules else false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules == true
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{}
else {};
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> {}
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else {};
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }

View File

@ -4,7 +4,7 @@ version: 0.5.2.0
license: BSD-3-Clause
license-file: LICENSE.md
maintainer: Mark Karpov <mark.karpov@tweag.io>
tested-with: ghc ==9.0.2 ghc ==9.2.4
tested-with: ghc ==9.0.2 ghc ==9.2.5
homepage: https://github.com/tweag/ormolu
bug-reports: https://github.com/tweag/ormolu/issues
synopsis: A formatter for Haskell source code
@ -127,7 +127,7 @@ executable ormolu
containers >=0.5 && <0.7,
filepath >=1.2 && <1.5,
ghc-lib-parser >=9.4 && <9.5,
gitrev >=1.3 && <1.4,
th-env >=0.1.1 && <0.2,
optparse-applicative >=0.14 && <0.18,
ormolu,
text >=0.2 && <3.0

53
region-tests/default.nix Normal file
View File

@ -0,0 +1,53 @@
{ pkgs, ormolu }:
{
regionTests = pkgs.stdenv.mkDerivation {
name = "ormolu-region-tests";
src = ./.;
buildInputs = [
ormolu
pkgs.diffutils
];
doCheck = true;
buildPhase = ''
cp src.hs result-all-implicit.hs
ormolu --check-idempotence --mode inplace result-all-implicit.hs
cp src.hs result-all-explicit.hs
ormolu --check-idempotence --mode inplace --start-line 1 --end-line 18 result-all-explicit.hs
cp src.hs result-only-start.hs
ormolu --check-idempotence --mode inplace --start-line 1 result-only-start.hs
cp src.hs result-only-end.hs
ormolu --check-idempotence --mode inplace --end-line 18 result-only-end.hs
cp src.hs result-6-7.hs
ormolu --check-idempotence --mode inplace --start-line 6 --end-line 7 result-6-7.hs
cp src.hs result-6-8.hs
ormolu --check-idempotence --mode inplace --start-line 6 --end-line 8 result-6-8.hs
cp src.hs result-9-12.hs
ormolu --check-idempotence --mode inplace --start-line 9 --end-line 12 result-9-12.hs
cp src.hs result-17-18.hs
ormolu --check-idempotence --mode inplace --start-line 17 --end-line 18 result-17-18.hs
'';
checkPhase = ''
echo result-all-implicit.hs
diff --color=always expected-result-all.hs result-all-implicit.hs
echo result-all-explicit.hs
diff --color=always expected-result-all.hs result-all-explicit.hs
echo result-only-start.hs
diff --color=always expected-result-all.hs result-only-start.hs
echo result-only-end.hs
diff --color=always expected-result-all.hs result-only-end.hs
echo result-6-7.hs
diff --color=always expected-result-6-7.hs result-6-7.hs
echo result-6-8.hs
diff --color=always expected-result-6-8.hs result-6-8.hs
echo result-9-12.hs
diff --color=always expected-result-9-12.hs result-9-12.hs
echo result-17-18.hs
diff --color=always expected-result-17-18.hs result-17-18.hs
'';
installPhase = ''
mkdir "$out"
find . -name '*.hs' -exec cp --parents {} $out \;
'';
};
}

View File

@ -1 +0,0 @@
(import ./default.nix { }).dev.ormoluShell

View File

@ -2,7 +2,6 @@ resolver: lts-19.20
packages:
- '.'
- ormolu-live
- extract-hackage-info
extra-deps: