Migrate Nix shell config to Flake
This commit is contained in:
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1701952659,
|
||||
"narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
39
flake.nix
Normal file
39
flake.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
description = "BASE Demo Game";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
system = "x86_64-linux";
|
||||
opengl = "/run/opengl-driver";
|
||||
in {
|
||||
devShells.${system}.default = with pkgs; mkShell {
|
||||
name = "base-demo";
|
||||
|
||||
buildInputs = [
|
||||
xorg.libXtst
|
||||
alsa-lib
|
||||
jdk17
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo
|
||||
echo
|
||||
echo "======================================================================================================"
|
||||
echo "Welcome to BASE Demo Game NixOS flake shell environment"
|
||||
echo "Remember to provide following LD environment variable in order to run the game outside this shell"
|
||||
echo
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
|
||||
echo "======================================================================================================"
|
||||
echo
|
||||
echo
|
||||
'';
|
||||
|
||||
LD_LIBRARY_PATH = "${opengl}/lib:${xorg.libXtst}/lib:${alsa-lib}/lib";
|
||||
};
|
||||
};
|
||||
}
|
||||
43
shell.nix
43
shell.nix
@@ -1,43 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
# Because of high dependency on native libraries like OpenGL and OpenAL
|
||||
# on the NixOS the BASE engine requires few modifications.
|
||||
# Basically this shell.nix could be enough, however the OpenGL is highly tied with the hardware,
|
||||
# so the following change needs to be applied in the configuration.nix (or your flake configuration, whatever):
|
||||
# hardware.opengl = {
|
||||
# enable = true;
|
||||
# extraPackages = with pkgs; [
|
||||
# libGL
|
||||
# ];
|
||||
# setLdLibraryPath = true;
|
||||
# };
|
||||
#
|
||||
# Also for GNOME environments, the Editor requires the libglassgtk3.so library,
|
||||
# so it is available via xorg.libXtst package mentioned already in the shell definition below.
|
||||
|
||||
let
|
||||
opengl = "/run/opengl-driver";
|
||||
in pkgs.mkShell {
|
||||
name = "BASE NixOS runtime";
|
||||
|
||||
buildInputs = [
|
||||
pkgs.xorg.libXtst # Required by editor on GNOME environments (due to libglassgtk3.so dependency)
|
||||
pkgs.alsa-lib # Either alsa or jack or pulseaudio library is required by game engine via OpenAL native library
|
||||
];
|
||||
|
||||
# OpenGL needs to be configured via /etc/nixos/configuration.nix
|
||||
LD_LIBRARY_PATH = "${opengl}/lib:${pkgs.xorg.libXtst}/lib:${pkgs.alsa-lib}/lib";
|
||||
|
||||
shellHook = ''
|
||||
echo
|
||||
echo
|
||||
echo "======================================================================================================"
|
||||
echo "Welcome to BASE NixOS shell environment"
|
||||
echo "Remember to provide following LD environment variable in order to run application outside this shell:"
|
||||
echo
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
|
||||
echo "======================================================================================================"
|
||||
echo
|
||||
echo
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user