Files
gio/flake.nix
T
Elias Naur a3f147541f flake.*: add Nix development environment
This change adds a Nix flake capable of setting up an environment
for building Gio programs for Linux and Android, on top of the
platforms that only needs Go (Windows, WASM).

To use the flake, install Nix 2.4 or later and enable experimental
support for flakes. Then, you can launch a development shell with

$ alias nix='nix --extra-experimental-features "nix-command flakes"'
$ nix develop sourcehut:~eliasnaur/gio

The environment can also be applied to the current shell, which is
useful in combination with direnv:

$ . <(nix print-dev-env sourcehut:~eliasnaur/gio)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-03-28 17:48:13 +02:00

56 lines
1.5 KiB
Nix

# SPDX-License-Identifier: Unlicense OR MIT
{
description = "Gio build environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
android.url = "github:tadfisher/android-nixpkgs";
android.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, android }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
devShells = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
};
android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs;
[
build-tools-31-0-0
cmdline-tools-latest
emulator
platform-tools
platforms-android-31
ndk-bundle
]);
in
{
default = with pkgs; mkShell {
ANDROID_SDK_ROOT = "${android-sdk}/share/android-sdk";
JAVA_HOME = jdk8.home;
packages = [
android-sdk
jdk8
clang
] ++ (if stdenv.isLinux then [
vulkan-headers
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXfixes
libGL
pkgconfig
] else [ ]);
};
}
);
};
}