forked from NexusSocial/skilltree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
79 lines (76 loc) · 2.54 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
{
description = "skilltree flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# eachDefaultSystem and other utility functions
utils.url = "github:numtide/flake-utils";
# Replacement for rustup
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, utils, fenix, }:
# This helper function abstracts over the host platform.
# See https://github.com/numtide/flake-utils#eachdefaultsystem--system---attrs
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
system = "${system}";
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
# Brings in the rust toolchain from the standard file
# that rustup/cargo uses.
rustToolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-rLP8+fTxnPHoR96ZJiCa/5Ans1OojI7MLsmSqR2ip8o=";
};
rustPlatform = pkgs.makeRustPlatform {
inherit (rustToolchain) cargo rustc;
};
in
# See https://nixos.wiki/wiki/Flakes#Output_schema
{
# `nix develop` pulls all of this in to become your shell.
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
pkgs.pkg-config
pkgs.androidenv.androidPkgs_9_0.androidsdk
# Common cargo tools we often use
pkgs.cargo-deny
pkgs.cargo-expand
pkgs.cargo-binutils
pkgs.cargo-apk
# cmake for openxr
pkgs.cmake
];
# see https://github.com/NixOS/nixpkgs/blob/95b81c96f863ca8911dffcda45d1937efcd66a4b/pkgs/games/jumpy/default.nix#L60C5-L60C38
buildInputs = [
pkgs.zstd
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
alsa-lib
libxkbcommon
udev
vulkan-loader
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Cocoa
rustPlatform.bindgenHook
# # This is missing on mac m1 nix, for some reason.
# # see https://stackoverflow.com/a/69732679
pkgs.libiconv
];
};
# This only formats the nix files.
formatter = pkgs.nixpkgs-fmt;
}
);
}