-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
93 lines (85 loc) · 3.46 KB
/
Copy pathflake.nix
File metadata and controls
93 lines (85 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
description = "FUNAR";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-25.11";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
perSystem = { system, self', ... }:
let
# Pin GHC version for easier, explicit upgrades later
ghcVersion = "9103";
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
(_: prev: {
haskellPackages = prev.haskell.packages."ghc${ghcVersion}";
})
];
};
hearts = pkgs.haskellPackages.callCabal2nix "hearts"
(pkgs.lib.cleanSource ./hearts) { };
haskell-code = pkgs.haskellPackages.callCabal2nix "haskell-code"
(pkgs.lib.cleanSource ./haskell-code) { };
in {
formatter = pkgs.nixfmt;
devShells = {
default = pkgs.haskellPackages.shellFor {
packages = _: [ hearts haskell-code ];
nativeBuildInputs = [ pkgs.haskellPackages.doctest ];
buildInputs = [
pkgs.cabal-install
pkgs.elmPackages.elm pkgs.elmPackages.elm-test pkgs.elmPackages.elm-format pkgs.elmPackages.elm-review
self'.packages.hls
self'.formatter
pkgs.nodejs
pkgs.typescript
pkgs.typescript-language-server
];
shellHook = ''
export PS1="\n\[\033[1;32m\][nix-shell:\W \[\033[1;31m\]FUNAR\[\033[1;32m\]]\$\[\033[0m\] "
echo -e "\n\033[1;31m ♣ ♠ Welcome to FUNAR! ♥ ♦ \033[0m\n"
echo -e " Use the following command to open VSCode in this directory:\n"
echo " code ."
'';
};
withVSCode = self.devShells.${system}.default.overrideAttrs (old:
let
vscode = pkgs.vscode-with-extensions.override {
vscodeExtensions = with pkgs.vscode-extensions; [
bbenoist.nix
haskell.haskell
justusadam.language-haskell
];
};
in {
buildInputs = old.buildInputs ++ [ vscode ];
shellHook = old.shellHook + ''
echo -e "\n All required extensions should be pre-installed and ready."'';
});
};
packages = {
inherit hearts haskell-code;
inherit (pkgs) cabal-install;
hls = pkgs.haskell-language-server.override {
supportedGhcVersions = [ ghcVersion ];
};
# HACK: We rely on how `shellFor` constructs its `nativeBuildInputs`
# in order to grab the `ghcWithPackages` from out of there. That way
# we're able to globally install this GHC in the Docker image and
# get rid of direnv as a dependency.
ghcForFunar =
builtins.head self.devShells.${system}.default.nativeBuildInputs;
watch = pkgs.writeShellScriptBin "watch-and-commit" ''
${
pkgs.lib.getExe pkgs.watch
} -n 10 "git add . && git commit -m update && git push"
'';
};
};
};
}