This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
81 lines (75 loc) · 2.02 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
{
description = "A collection of risc0 related packages";
nixConfig = {
extra-substituters = [
"https://risc0pkgs.cachix.org"
];
extra-trusted-public-keys = [
"risc0pkgs.cachix.org-1:EY5UazX0/Q7hGCm6xQSgKX6UkpzyOf07pxjfhhRK7kE="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, rust-overlay, ... }:
let
eachSystem = systems: f:
let
# Merge together the outputs for all systems.
op = attrs: system:
let
ret = f system;
op = attrs: key: attrs //
{
${key} = (attrs.${key} or { })
// { ${system} = ret.${key}; };
}
;
in
builtins.foldl' op attrs (builtins.attrNames ret);
in
builtins.foldl' op { } systems;
eachDefaultSystem = eachSystem [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
in
{
herculesCI.ciSystems = [ "x86_64-linux" ];
overlays.default = import ./overlay.nix;
templates.default = {
path = ./templates/default;
description = "risc0 project template";
};
}
// eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
self.overlays.default
];
};
lib = pkgs.recurseIntoAttrs (pkgs.callPackage ./lib { pkgs = pkgs; });
in
{
inherit (pkgs) lib;
packages = {
inherit (pkgs) r0vm;
};
formatter = pkgs.nixpkgs-fmt;
checks.format = pkgs.runCommand "format-check" { buildInputs = [ pkgs.nixpkgs-fmt ]; } ''
set -euo pipefail
cd ${self}
nixpkgs-fmt --check .
touch $out
'';
});
}