-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathflake.nix
61 lines (54 loc) · 1.87 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
{
description = "uefi-rs";
inputs = {
# We follow the latest stable release of nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
inputs@{ self, nixpkgs, ... }:
let
# Systems definition for dev shells and exported packages,
# independent of the NixOS configurations and modules defined here. We
# just use "every system" here to not restrict any user. However, it
# likely happens that certain packages don't build for/under certain
# systems.
systems = nixpkgs.lib.systems.flakeExposed;
forAllSystems =
function: nixpkgs.lib.genAttrs systems (system: function nixpkgs.legacyPackages.${system});
# We directly instantiate the functionality, without using an
# nixpkgs overlay.
# https://github.com/oxalica/rust-overlay/blob/f4d5a693c18b389f0d58f55b6f7be6ef85af186f/docs/reference.md?plain=1#L26
rustToolchain =
pkgs:
let
rust-bin = (inputs.rust-overlay.lib.mkRustBin { }) pkgs;
rustToolchainBuilder = import ./nix/rust-toolchain.nix;
in
rustToolchainBuilder { inherit rust-bin; };
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
nixfmt-rfc-style
# Integration test dependencies
swtpm
qemu
# Rust toolchain
(rustToolchain pkgs)
# Other
cargo-llvm-cov
mdbook
yamlfmt
which # used by "cargo xtask fmt"
];
# Set ENV vars.
# OVMF_CODE="${pkgs.OVMF.firmware}";
# OVMF_VARS="${pkgs.OVMF.variables}";
# OVMF_SHELL="${pkgs.edk2-uefi-shell}";
};
});
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}