-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
110 lines (99 loc) · 3.23 KB
/
Copy pathflake.nix
File metadata and controls
110 lines (99 loc) · 3.23 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
description = "bit – Git-compatible version control in MoonBit";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
moonbit-overlay.url = "github:moonbit-community/moonbit-overlay";
moon-registry = {
url = "git+https://mooncakes.io/git/index";
flake = false;
};
# Typed task runner + language-agnostic test runner used in place of the
# old justfile. See Taskfile.pkl and Test.pkl at the repo root.
pkfire.url = "github:mizchi/pkfire";
pkfire.inputs.nixpkgs.follows = "nixpkgs";
pkspec.url = "github:mizchi/pkspec";
pkspec.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
flake = {
overlays.default = _final: prev: {
bit = prev.callPackage ./package.nix {
moonRegistryIndex = inputs.moon-registry;
};
};
};
perSystem =
{ system, ... }:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.moonbit-overlay.overlays.default ];
config.allowBroken = true;
};
bit = pkgs.callPackage ./package.nix {
moonRegistryIndex = inputs.moon-registry;
};
# Strip workspace-local deps so buildCachedRegistry only resolves
# packages that actually exist on mooncakes.io.
bitMod = (import ./nix/parse-moon-mod.nix { inherit (pkgs) lib; }) ./modules/bit/moon.mod;
registryOnlyMod = bitMod // {
deps = pkgs.lib.filterAttrs (
name: _: !(pkgs.lib.hasPrefix "mizchi/bit_" name || pkgs.lib.hasPrefix "mizchi/bitx_" name)
) bitMod.deps;
};
registryOnlyModFile = pkgs.writeText "moon.mod.json" (builtins.toJSON registryOnlyMod);
moonHome = pkgs.moonPlatform.bundleWithRegistry {
cachedRegistry = pkgs.moonPlatform.buildCachedRegistry {
moonModJson = registryOnlyModFile;
registryIndexSrc = inputs.moon-registry;
};
};
pkfire = inputs.pkfire.packages.${system}.default;
pkspec = inputs.pkspec.packages.${system}.default;
in
{
packages = {
default = bit;
inherit bit pkfire pkspec;
};
apps = {
default = {
type = "app";
program = "${bit}/bin/bit";
};
bit = {
type = "app";
program = "${bit}/bin/bit";
};
pkfire = {
type = "app";
program = "${pkfire}/bin/pkf";
};
pkspec = {
type = "app";
program = "${pkspec}/bin/pkspec";
};
};
devShells.default = pkgs.mkShellNoCC {
packages = [
moonHome
pkgs.git
pkgs.pnpm
pkgs.nodejs
pkfire
pkspec
];
env.MOON_HOME = "${moonHome}";
};
};
};
}