Use devShells instead of ./scripts
parent
1975fc3eda
commit
8b6ee9a76d
69
flake.nix
69
flake.nix
|
@ -61,6 +61,7 @@
|
||||||
unordered-containers
|
unordered-containers
|
||||||
];
|
];
|
||||||
license = nixpkgs.lib.licenses.gpl3Plus;
|
license = nixpkgs.lib.licenses.gpl3Plus;
|
||||||
|
passthru = { inherit pkgs; };
|
||||||
};
|
};
|
||||||
thisNative = this "ghc922";
|
thisNative = this "ghc922";
|
||||||
in
|
in
|
||||||
|
@ -72,6 +73,72 @@
|
||||||
program = "${thisNative}/bin/4r";
|
program = "${thisNative}/bin/4r";
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.default = thisNative.env;
|
devShells =
|
||||||
|
let unwords = nixpkgs'.lib.concatStringsSep " ";
|
||||||
|
options = [
|
||||||
|
"-Wall"
|
||||||
|
"-Wcompat"
|
||||||
|
"-Wincomplete-uni-patterns"
|
||||||
|
"-Wredundant-constraints"
|
||||||
|
"-Wmissing-export-lists"
|
||||||
|
"-Wincomplete-record-updates"
|
||||||
|
"-Wmissing-deriving-strategies"
|
||||||
|
];
|
||||||
|
extensions = [
|
||||||
|
"-XNoImplicitPrelude"
|
||||||
|
"-XNoFieldSelectors"
|
||||||
|
"-XOverloadedRecordDot"
|
||||||
|
"-XDuplicateRecordFields"
|
||||||
|
"-XBangPatterns"
|
||||||
|
"-XBinaryLiterals"
|
||||||
|
"-XBlockArguments"
|
||||||
|
"-XConstraintKinds"
|
||||||
|
"-XDataKinds"
|
||||||
|
"-XDeriveFunctor"
|
||||||
|
"-XDeriveGeneric"
|
||||||
|
"-XDerivingStrategies"
|
||||||
|
"-XFlexibleContexts"
|
||||||
|
"-XFlexibleInstances"
|
||||||
|
"-XGADTs"
|
||||||
|
"-XGeneralizedNewtypeDeriving"
|
||||||
|
"-XHexFloatLiterals"
|
||||||
|
"-XImportQualifiedPost"
|
||||||
|
"-XInstanceSigs"
|
||||||
|
"-XKindSignatures"
|
||||||
|
"-XLambdaCase"
|
||||||
|
"-XMultiParamTypeClasses"
|
||||||
|
"-XNumericUnderscores"
|
||||||
|
"-XOverloadedStrings"
|
||||||
|
"-XScopedTypeVariables"
|
||||||
|
"-XStandaloneDeriving"
|
||||||
|
"-XTupleSections"
|
||||||
|
"-XTypeApplications"
|
||||||
|
"-XTypeOperators"
|
||||||
|
"-XTypeSynonymInstances"
|
||||||
|
"-XUndecidableInstances"
|
||||||
|
];
|
||||||
|
findFiles = "$(find app -name '*.hs')";
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
default =
|
||||||
|
thisNative.env.overrideAttrs (a: {
|
||||||
|
nativeBuildInputs = a.nativeBuildInputs ++ [ thisNative.passthru.pkgs.fourmolu ];
|
||||||
|
});
|
||||||
|
ghci = default.overrideAttrs (_: {
|
||||||
|
shellHook = ''
|
||||||
|
ghci ${unwords (options ++ extensions)} ${findFiles}
|
||||||
|
exit $?
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
fourmolu = default.overrideAttrs (_: {
|
||||||
|
shellHook = ''
|
||||||
|
fourmolu --mode inplace \
|
||||||
|
--indentation 2 --check-idempotence --import-export-comma-style leading \
|
||||||
|
${unwords (map (e: "-o ${e}") (options ++ extensions))} \
|
||||||
|
${findFiles}
|
||||||
|
exit $?
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
OPTS="-Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wmissing-export-lists -Wincomplete-record-updates -Wmissing-deriving-strategies"
|
|
||||||
|
|
||||||
EXTS="-XNoImplicitPrelude -XNoFieldSelectors -XOverloadedRecordDot -XDuplicateRecordFields -XBangPatterns -XBinaryLiterals -XBlockArguments -XConstraintKinds -XDataKinds -XDeriveFunctor -XDeriveGeneric -XDerivingStrategies -XFlexibleContexts -XFlexibleInstances -XGADTs -XGeneralizedNewtypeDeriving -XHexFloatLiterals -XImportQualifiedPost -XInstanceSigs -XKindSignatures -XLambdaCase -XMultiParamTypeClasses -XNumericUnderscores -XOverloadedStrings -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XTypeSynonymInstances -XUndecidableInstances"
|
|
||||||
|
|
||||||
FILES=$(find app -name '*.hs')
|
|
||||||
|
|
||||||
nix develop -c ghci $OPTS $EXTS $FILES
|
|
Loading…
Reference in New Issue