-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
95 lines (77 loc) · 2.63 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
inputs = {
devenv.url = "github:cachix/devenv";
flake-parts.url = "github:hercules-ci/flake-parts";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
naersk.url = "github:nix-community/naersk";
neovim.url = "github:rivi-lang/rivi-loader?dir=packages/neovim";
nix2container.inputs.nixpkgs.follows = "nixpkgs";
nix2container.url = "github:nlewo/nix2container";
nixpkgs.url = "github:nixos/nixpkgs/23.05";
};
outputs =
inputs@{ self
, devenv
, flake-parts
, flake-utils
, naersk
, nixpkgs
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [
inputs.devenv.flakeModule
];
perSystem = { pkgs, lib, config, inputs', ... }:
let
naersk' = pkgs.callPackage naersk { };
nativeBuildInputs = with pkgs; [
pkgconfig
vulkan-loader
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
(pkgs.darwin.apple_sdk_11_0.callPackage "${toString self.inputs.nixpkgs}/pkgs/os-specific/darwin/moltenvk" {
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) AppKit Foundation Metal QuartzCore;
inherit (pkgs.darwin.apple_sdk_11_0) MacOSX-SDK Libsystem;
inherit (pkgs.darwin) cctools sigtool;
})
];
in
{
packages.neovim = inputs'.neovim.packages.default;
packages.capabilities = naersk'.buildPackage rec {
inherit nativeBuildInputs;
pname = "capabilities";
src = ./.;
LD_LIBRARY_PATH = "${pkgs.vulkan-loader}/lib";
overrideMain = old: {
preConfigure = ''
cargo_build_options="$cargo_build_options --example ${pname}"
'';
};
};
packages.gpus = naersk'.buildPackage rec {
inherit nativeBuildInputs;
pname = "gpus";
src = ./.;
LD_LIBRARY_PATH = "${pkgs.vulkan-loader}/lib";
overrideMain = old: {
preConfigure = ''
cargo_build_options="$cargo_build_options --example ${pname}"
'';
};
};
packages.default = config.packages.capabilities;
devenv.shells.default = {
env.RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
packages = with pkgs; [
rustc
cargo
spirv-tools
spirv-cross
] ++ config.packages.default.nativeBuildInputs;
};
};
};
}