-
-
Save polendri/f1cd3d5e3d3375b1125c2a9f27c5a1bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "mygame"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | |
naersk.url = "github:nmattia/naersk"; | |
utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, nixpkgs, naersk, utils }: | |
utils.lib.eachDefaultSystem (system: | |
let | |
packageName = "mygame"; | |
pkgs = nixpkgs.legacyPackages.${system}; | |
shellInputs = with pkgs; [ | |
cargo | |
clang | |
rls | |
rustc | |
]; | |
appNativeBuildInputs = with pkgs; [ | |
pkg-config | |
]; | |
appBuildInputs = appRuntimeInputs ++ (with pkgs; [ | |
alsaLib | |
udev | |
vulkan-headers | |
vulkan-tools | |
vulkan-validation-layers | |
x11 | |
]); | |
appRuntimeInputs = with pkgs; [ | |
vulkan-loader | |
xlibs.libXcursor | |
xlibs.libXi | |
xlibs.libXrandr | |
]; | |
in { | |
packages.${packageName} = naersk.lib.${system}.buildPackage { | |
pname = packageName; | |
root = ./.; | |
nativeBuildInputs = appNativeBuildInputs; | |
buildInputs = appBuildInputs; | |
}; | |
defaultPackage = self.packages.${packageName}; | |
apps.${packageName} = utils.lib.mkApp { | |
drv = self.packages.${packageName}; | |
}; | |
defaultApp = self.apps.${packageName}; | |
devShells.${packageName} = pkgs.mkShell { | |
nativeBuildInputs = appNativeBuildInputs; | |
buildInputs = shellInputs ++ appBuildInputs; | |
shellHook = '' | |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath appRuntimeInputs}" | |
''; | |
}; | |
devShell = self.devShells.${system}.${packageName}; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment