forked from cloud-hypervisor/cloud-hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
76 lines (71 loc) · 2.02 KB
/
flake.nix
File metadata and controls
76 lines (71 loc) · 2.02 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
{
description = "Cyberus Hypervisor for SAP / Apeiro";
inputs = {
dried-nix-flakes.url = "github:cyberus-technology/dried-nix-flakes";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11";
# Convenient Nix tooling to build Rust projects.
crane.url = "github:ipetkov/crane/master";
# Get proper Rust toolchain, independent of pkgs.rustc.
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
let
dnf = (inputs.dried-nix-flakes.for inputs).override {
systems = [ "x86_64-linux" ];
};
inherit (dnf)
exportOutputs
;
in
exportOutputs (
{
self,
# Keep list sorted:
crane,
nixpkgs,
rust-overlay,
...
}:
let
pkgs = nixpkgs.legacyPackages;
lib = pkgs.lib;
rust-bin = (rust-overlay.lib.mkRustBin { }) pkgs;
in
{
formatter = pkgs.nixfmt-tree;
devShells.default = pkgs.mkShellNoCC {
inputsFrom = builtins.attrValues self.packages;
packages = with pkgs; [
gitlint
rustup
];
};
packages =
let
jsonFilter = path: _type: builtins.match ".*json$" path != null;
sourceFilter = path: type: (jsonFilter path type) || (craneLib.filterCargoSources path type);
src = lib.cleanSourceWith {
src = self;
filter = sourceFilter;
name = "source";
};
rustToolchain = rust-bin.stable.latest.default;
craneLib = crane.mkLib pkgs;
craneLib' = craneLib.overrideToolchain rustToolchain;
cloud-hypervisor = pkgs.callPackage ./chv.nix {
inherit (pkgs.cloud-hypervisor) meta;
inherit src;
craneLib = craneLib';
};
in
{
default = cloud-hypervisor;
inherit cloud-hypervisor;
};
}
);
}