parent
357b9fafda
commit
0f37d0ef05
3 changed files with 23 additions and 33 deletions
12
flake.lock
generated
12
flake.lock
generated
|
@ -54,16 +54,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648246591,
|
"lastModified": 1648667273,
|
||||||
"narHash": "sha256-GDyLjj64sA65MPMlOtzs5DHPK4O5O8u6jMYKiGHgaPU=",
|
"narHash": "sha256-eQUb40xDyv0Ye3oMzGz6tcHPF9y9Xhq1QksV9h7uEDk=",
|
||||||
"ref": "master",
|
"ref": "spec-type",
|
||||||
"rev": "3a4289e086d48b409c8c6eb51de1d9e405c7f379",
|
"rev": "4648a98d91f754ae0f7a3d035a1aaa871eb1b4fc",
|
||||||
"revCount": 20,
|
"revCount": 34,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"ref": "master",
|
"ref": "spec-type",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
||||||
}
|
}
|
||||||
|
|
36
flake.nix
36
flake.nix
|
@ -11,7 +11,7 @@
|
||||||
lint-utils = {
|
lint-utils = {
|
||||||
type = "git";
|
type = "git";
|
||||||
url = "https://gitlab.homotopic.tech/nix/lint-utils.git";
|
url = "https://gitlab.homotopic.tech/nix/lint-utils.git";
|
||||||
ref = "master";
|
ref = "spec-type"; # https://gitlab.homotopic.tech/nix/lint-utils/-/merge_requests/4
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
# Change GHC version here. To get the appropriate value, run:
|
# Change GHC version here. To get the appropriate value, run:
|
||||||
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
|
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
|
||||||
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
|
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
|
||||||
haskellFormatter = "fourmoluStandardGhc8107"; # The formatter to use from inputs.lint-utils
|
|
||||||
|
|
||||||
project = returnShellEnv:
|
project = returnShellEnv:
|
||||||
hp.developPackage {
|
hp.developPackage {
|
||||||
|
@ -53,24 +52,20 @@
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lintSpec = {
|
||||||
|
nixpkgs-fmt = { };
|
||||||
|
cabal-fmt = { };
|
||||||
|
fourmolu = {
|
||||||
|
ghcOpts = "-o-XTypeApplications -o-XImportQualifiedPost";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Checks the shell script using ShellCheck
|
# Checks the shell script using ShellCheck
|
||||||
checkedShellScript = name: text:
|
checkedShellScript = name: text:
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
inherit name text;
|
inherit name text;
|
||||||
}) + "/bin/${name}";
|
}) + "/bin/${name}";
|
||||||
|
|
||||||
# Concat a list of Flake apps to produce a new app that runs all of them
|
|
||||||
# in sequence.
|
|
||||||
concatApps = apps:
|
|
||||||
{
|
|
||||||
type = "app";
|
|
||||||
program = checkedShellScript "concatApps"
|
|
||||||
(pkgs.lib.strings.concatMapStringsSep
|
|
||||||
"\n"
|
|
||||||
(app: app.program)
|
|
||||||
apps);
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Used by `nix build` & `nix run` (prod exe)
|
# Used by `nix build` & `nix run` (prod exe)
|
||||||
|
@ -80,18 +75,13 @@
|
||||||
|
|
||||||
# Used by `nix run ...`
|
# Used by `nix run ...`
|
||||||
apps = {
|
apps = {
|
||||||
format = concatApps [
|
format = inputs.lint-utils.mkApp.${system} lintSpec;
|
||||||
inputs.lint-utils.apps.${system}.${haskellFormatter}
|
|
||||||
inputs.lint-utils.apps.${system}.cabal-fmt
|
|
||||||
inputs.lint-utils.apps.${system}.nixpkgs-fmt
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Used by `nix flake check` (but see next attribute)
|
# Used by `nix flake check` (but see next attribute)
|
||||||
checks = {
|
checks =
|
||||||
format-haskell = inputs.lint-utils.linters.${system}.${haskellFormatter} ./.;
|
inputs.lint-utils.mkChecks.${system} lintSpec ./.
|
||||||
format-cabal = inputs.lint-utils.linters.${system}.cabal-fmt ./.;
|
// {
|
||||||
format-nix = inputs.lint-utils.linters.${system}.nixpkgs-fmt ./.;
|
|
||||||
hls = checkedShellScript "hls" "${hp.haskell-language-server}/bin/haskell-language-server";
|
hls = checkedShellScript "hls" "${hp.haskell-language-server}/bin/haskell-language-server";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Main.Utf8 (withUtf8)
|
import Main.Utf8 qualified as Utf8
|
||||||
|
|
||||||
{- |
|
{- |
|
||||||
Main entry point.
|
Main entry point.
|
||||||
|
@ -11,5 +11,5 @@ import Main.Utf8 (withUtf8)
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
-- For withUtf8, see https://serokell.io/blog/haskell-with-utf8
|
-- For withUtf8, see https://serokell.io/blog/haskell-with-utf8
|
||||||
withUtf8 $ do
|
Utf8.withUtf8 $ do
|
||||||
putStrLn "Hello 🌎"
|
putStrLn "Hello 🌎"
|
||||||
|
|
Loading…
Reference in a new issue