-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
89 lines (86 loc) · 2.79 KB
/
flake.nix
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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
purs-nix.url = "github:purs-nix/purs-nix";
purs-nix.inputs.nixpkgs.follows = "nixpkgs";
npmlock2nix.url = "github:nix-community/npmlock2nix";
npmlock2nix.flake = false;
};
outputs = inputs@{ self, flake-parts, nixpkgs, ... }:
flake-parts.lib.mkFlake { inherit self; } {
systems = [ "x86_64-linux" "x86_64-darwin" ];
imports = [
./nix/purs-nix/flake-module.nix
];
perSystem = { self', config, system, pkgs, lib, ... }: {
purs-nix = self.inputs.purs-nix {
inherit system;
overlays =
[
(self: super:
let
build = config.purs-nix-multi.build-local-package;
in
{
foo = build self ./foo;
bar = build self ./bar;
qux = build self ./qux;
})
];
};
packages = {
inherit (config.purs-nix.ps-pkgs)
foo bar qux;
bar-js = self'.packages.bar.purs-nix-info-extra.ps.modules.Main.bundle {
esbuild = {
format = "cjs";
};
};
qux-js = self'.packages.qux.purs-nix-info-extra.ps.modules.Main.bundle {
esbuild = {
format = "cjs";
};
};
};
apps =
let
nodejsApp = name: script: {
type = "app";
program = pkgs.writeShellApplication {
inherit name;
text = ''
set -x
${lib.getExe pkgs.nodejs} ${script}
'';
};
};
in
{
bar = nodejsApp "bar" self'.packages.bar-js;
qux = nodejsApp "qux" self'.packages.qux-js;
};
devShells.default = pkgs.mkShellNoCC rec {
name = "purescript-multi-nix";
packages =
let
ps-tools = inputs.purs-nix.inputs.ps-tools.legacyPackages.${system};
in
[
config.purs-nix.purescript
config.purs-nix-multi.multi-command
ps-tools.for-0_15.purescript-language-server
ps-tools.for-0_15.purs-tidy
pkgs.nixpkgs-fmt
];
shellHook = ''
echo -e "\033[1;31m### 🔨 Welcome to ${name} devshell ###\n\033[0m"
echo -e "\033[1;36m[Commands]\n\033[0m"
echo "${lib.concatMapStringsSep "\n" (p: " ${lib.getName p} \t: ${p.meta.description or ""}") packages}" | ${pkgs.util-linux}/bin/column -t -s $'\t'
echo
'';
};
formatter = pkgs.nixpkgs-fmt;
};
};
}