forked from wizardsardine/liana
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
97 lines (82 loc) · 2.59 KB
/
flake.nix
File metadata and controls
97 lines (82 loc) · 2.59 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
description = "Dev shell to help contributing to liana";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
lipo.url = "github:edouardparis/lipo-flake";
};
outputs = { self, nixpkgs, flake-utils, crane, fenix, lipo, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; config = { allowUnfree = true; };};
inherit (pkgs) lib;
toolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-Hn2uaQzRLidAWpfmRwSRdImifGUCAb9HeAqTYFXWeQk=";
};
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
lianaPackages = import ./nix/liana.nix {
inherit craneLib pkgs lib;
lipo = lipo.packages.${system}.lipo;
rootPath = ./.;
};
lianaBusinessPackages = import ./nix/liana-business.nix {
inherit craneLib pkgs lib;
lipo = lipo.packages.${system}.lipo;
rootPath = ./.;
};
# Common build inputs for all shells
commonBuildInputs = with pkgs; [
expat
fontconfig
freetype
freetype.dev
libGL
pkg-config
udev
wayland
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
];
# Minimal shell without Rust toolchain
minimalShell = pkgs.mkShell rec {
buildInputs = commonBuildInputs;
LD_LIBRARY_PATH =
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
};
# Full development shell with Rust toolchain
devShell = pkgs.mkShell rec {
buildInputs = commonBuildInputs ++ [ toolchain ];
LD_LIBRARY_PATH =
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
};
releaseShell = pkgs.mkShell {
buildInputs = [
pkgs.zip
pkgs.unzip
pkgs.gnutar
pkgs.dpkg
pkgs.rcodesign
] ++ [ toolchain ];
};
in {
packages = {
liana = lianaPackages;
liana-business = lianaBusinessPackages;
};
devShells = {
minimal = minimalShell;
release = releaseShell;
default = devShell;
};
}
);
}