Nixify scripts using mission-control (#72)
https://github.com/Platonic-Systems/mission-control
This commit is contained in:
parent
61bd08b503
commit
ec7db3ca04
9 changed files with 86 additions and 24 deletions
12
.vscode/tasks.json
vendored
12
.vscode/tasks.json
vendored
|
@ -6,10 +6,14 @@
|
|||
{
|
||||
"label": "Ghcid",
|
||||
"type": "shell",
|
||||
// You may also use bin/run-via-tmux if you have tmux
|
||||
// This is useful if you often see ghost ghcid left behind by VSCode reloads.
|
||||
"command": "bin/run",
|
||||
"args": [],
|
||||
"command": "nix",
|
||||
"args": [
|
||||
"develop",
|
||||
"-c",
|
||||
",",
|
||||
"run"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
|
@ -20,4 +24,4 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -7,12 +7,13 @@ Get a Haskell development environment up and running quickly. Thanks to Nix, thi
|
|||
- [fourmolu](https://github.com/fourmolu/fourmolu) autoformatting
|
||||
- [Relude](https://github.com/kowainik/relude#relude) as Prelude.
|
||||
- `.hlint.yaml` is [from relude](https://github.com/kowainik/relude/blob/main/.hlint.yaml)
|
||||
- Devshell scripts (`,` prefixed) are provided via [mission-control](https://github.com/Platonic-Systems/mission-control)
|
||||
|
||||
If you have an *existing* Haskell project, you should probably use https://github.com/srid/haskell-flake instead.
|
||||
|
||||
## Getting Started
|
||||
|
||||
*tldr: Install Nix, enable Flakes, open in VSCode and run `bin/run`.*
|
||||
*tldr: Install Nix, enable Flakes, open in VSCode and run `, run`.*
|
||||
|
||||
For details, see: https://srid.ca/haskell-template/start
|
||||
|
||||
|
@ -21,7 +22,7 @@ For details, see: https://srid.ca/haskell-template/start
|
|||
- Run `nix flake update` to update all flake inputs.
|
||||
- Run `nix --option sandbox false build .#check -L` to run the flake checks.
|
||||
- Run `treefmt` in nix shell to autoformat the project. This uses [treefmt](https://github.com/numtide/treefmt), which uses `./treefmt.toml` (where fourmolu and nixpkgs-fmt are specified).
|
||||
- Run `bin/hoogle` to start Hoogle with packages in your cabal file.
|
||||
- Run `, docs` to start Hoogle with packages in your cabal file.
|
||||
- Run the application without installing: `nix run github:srid/haskell-template` (or `nix run .` from checkout)
|
||||
- Common workflows
|
||||
- Adding library dependencies in Nix: https://srid.ca/haskell-template/dependency
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
echo http://127.0.0.1:8888
|
||||
exec nix develop -i -c hoogle serve -p 8888 --local
|
4
bin/repl
4
bin/repl
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
exec nix develop -i -c cabal -- repl
|
4
bin/run
4
bin/run
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
exec nix develop -i -c ghcid -c "cabal repl exe:haskell-template" --warnings -T :main
|
34
flake.lock
generated
34
flake.lock
generated
|
@ -18,6 +18,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-root": {
|
||||
"locked": {
|
||||
"lastModified": 1671295174,
|
||||
"narHash": "sha256-5K+wdsB5TYSmI6HeexOMvJTZTBdXb9RbiFwXRtQkE3M=",
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"rev": "bb96b89f65d7c47457303f2385798a09f4a1dd5a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"haskell-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1668167720,
|
||||
|
@ -33,6 +48,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mission-control": {
|
||||
"inputs": {
|
||||
"flake-root": "flake-root"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1671297603,
|
||||
"narHash": "sha256-0fotrPbgV4WyJwh9RZ/eSWALMeAKr+n3JCQZU130BLI=",
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "mission-control",
|
||||
"rev": "ede1ce90f17223f32ae21f2b12b8c26fd95a707e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "mission-control",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670148586,
|
||||
|
@ -71,6 +104,7 @@
|
|||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"haskell-flake": "haskell-flake",
|
||||
"mission-control": "mission-control",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-flake": "treefmt-flake"
|
||||
}
|
||||
|
|
42
flake.nix
42
flake.nix
|
@ -5,6 +5,7 @@
|
|||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
haskell-flake.url = "github:srid/haskell-flake";
|
||||
treefmt-flake.url = "github:srid/treefmt-flake";
|
||||
mission-control.url = "github:Platonic-Systems/mission-control";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
||||
|
@ -13,9 +14,11 @@
|
|||
imports = [
|
||||
inputs.haskell-flake.flakeModule
|
||||
inputs.treefmt-flake.flakeModule
|
||||
inputs.mission-control.flakeModule
|
||||
];
|
||||
perSystem = { self', config, pkgs, ... }: {
|
||||
haskellProjects.default = {
|
||||
perSystem = { self', lib, config, pkgs, ... }: {
|
||||
# The "main" project. You can have multiple projects, but this template has only one.
|
||||
haskellProjects.main = {
|
||||
packages = {
|
||||
haskell-template.root = ./.;
|
||||
};
|
||||
|
@ -34,7 +37,40 @@
|
|||
cabal-fmt
|
||||
fourmolu;
|
||||
};
|
||||
packages.default = self'.packages.haskell-template;
|
||||
mission-control.scripts = {
|
||||
docs = {
|
||||
description = "Start Hoogle server for project dependencies";
|
||||
command = ''
|
||||
echo http://127.0.0.1:8888
|
||||
hoogle serve -p 8888 --local
|
||||
'';
|
||||
category = "Dev Tools";
|
||||
};
|
||||
repl = {
|
||||
description = "Start the cabal repl";
|
||||
command = ''
|
||||
cabal repl "$@"
|
||||
'';
|
||||
category = "Dev Tools";
|
||||
};
|
||||
fmt = {
|
||||
description = "Auto-format the source tree";
|
||||
command = "treefmt";
|
||||
category = "Dev Tools";
|
||||
};
|
||||
run = {
|
||||
description = "Run the project with ghcid auto-recompile";
|
||||
command = ''
|
||||
ghcid -c "cabal repl exe:haskell-template" --warnings -T :main
|
||||
'';
|
||||
category = "Primary";
|
||||
};
|
||||
};
|
||||
packages.default = self'.packages.main-haskell-template;
|
||||
devShells.default =
|
||||
config.mission-control.installToDevShell config.devShells.main;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@ builds:
|
|||
- "*.x86_64-linux.*"
|
||||
exclude:
|
||||
# https://github.com/srid/haskell-flake/issues/21
|
||||
- "checks.*.default-hls"
|
||||
- "checks.*.main-hls"
|
||||
|
|
|
@ -5,7 +5,7 @@ import Main.Utf8 qualified as Utf8
|
|||
{- |
|
||||
Main entry point.
|
||||
|
||||
The `bin/run` script will invoke this function.
|
||||
The `, run` script will invoke this function.
|
||||
-}
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
|
Loading…
Reference in a new issue