-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
60 lines (52 loc) · 1.77 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
{
description = "Nix overlay for Saber projects.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
goki-cli.url = "github:GokiProtocol/goki-cli/master";
goki-cli.flake = false;
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, goki-cli }:
let
rustOverlay = import rust-overlay;
supportedSystems = flake-utils.lib.defaultSystems;
gokiOverlay = import "${goki-cli}/overlay.nix";
overlayBasic = import ./overlay.nix;
overlayWithRust = final: prev:
(nixpkgs.lib.composeExtensions rustOverlay overlayBasic) final prev;
overlayDefault = final: prev:
(nixpkgs.lib.composeExtensions overlayWithRust gokiOverlay) final prev;
systemOutputs = flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ overlayDefault ];
};
env = import ./env.nix { inherit pkgs; };
in
{
packages = pkgs.saber;
devShells = {
default = import ./shell.nix { inherit pkgs; };
};
});
in
{
overlays = {
default = overlayDefault;
basic = overlayBasic;
withRust = overlayWithRust;
};
lib = rec {
inherit supportedSystems;
rustPlatformStable = overlayWithRust.rustStable.rustPlatform;
buildFlakeOutputs = import ./lib/buildFlakeOutputs.nix {
inherit nixpkgs flake-utils;
inherit supportedSystems systemOutputs;
};
defaultFlakeOutputs = buildFlakeOutputs { };
};
} // systemOutputs;
}