Skip to content
Open

Nix #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
inputs = {
self.submodules = true;
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs = { nixpkgs, self, ... }: let
mkPkgs = system: import nixpkgs {
inherit system;
overlays = [ self.overlays.game3 ];
};
in {
overlays = rec {
default = game3;
game3 = final: prev: {
fastnoise2 = final.callPackage ./nix/fastnoise.nix { };
game3 = final.callPackage ./nix/game3.nix { };
};
};

packages.x86_64-linux = rec {
default = game3;
inherit (mkPkgs "x86_64-linux") fastnoise2 game3;
};
};
}
49 changes: 49 additions & 0 deletions nix/fastnoise.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
stdenv,
fetchFromGitHub,
cmake,
lib,
}:

# let
# fastsimd = fetchFromGitHub {
# owner = "Auburn";
# repo = "FastSIMD";
# rev = "16450dae9528727e500e7254f635a671f9c7ee2d";
# hash = "sha256-86JqDMXbeK7Q0PgeFhKa7h2Jpl7Sa5tZNfyInhXF8tU=";
# };
# in

stdenv.mkDerivation (finalAttrs: {
pname = "fastnoise2";
# version = "1.1.1";
version = "0-unstable-2024-09-27";

src = fetchFromGitHub {
owner = "Auburn";
repo = "FastNoise2";
# tag = "v${finalAttrs.version}";
# hash = "sha256-bmJ2iTmAAEYSZgsyLU8ZJsRnM2LH/4a2ITKGFJEDdvY=";
rev = "9937723493bb6fd1b8f1491bf9ce251a8867226b";
hash = "sha256-1JchJhg1Xn95mU5uMY1zv8kBNAlLOV9K+BrbFleZ46U=";
};

# postPatch = ''
# sed -i '/CPMAddPackage/,+4d' src/CMakeLists.txt
# sed -i '1i add_subdirectory(${fastsimd} fastsimd)' src/CMakeLists.txt
# '';

nativeBuildInputs = [
cmake
];

cmakeFlags = [
# (lib.cmakeBool "FASTNOISE2_TOOLS" false)
(lib.cmakeBool "FASTNOISE2_NOISETOOL" false)
];

meta = {
description = "Modular node graph based noise generation library using SIMD, C++17 and templates";
license = lib.licenses.mit;
};
})
81 changes: 81 additions & 0 deletions nix/game3.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
stdenv,
meson,
ninja,
cmake,
pkg-config,
flex,
bison,
opusfile,
libvorbis,
libxcb,
libpng,
curl,
glibmm_2_68,
freetype,
libGL,
libGLU,
glfw3,
asio,
lz4,
boost,
libsigcxx30,
leveldb,
fastnoise2,
glm,
libbfd,
libx11,
libnoise,
lib,
}:

stdenv.mkDerivation {
pname = "game3";
version = "1.0.0";

src = ../.;

postPatch = ''
substituteInPlace src/meson.build \
--replace-fail '-lnoise' '-lnoise-static'
'';

nativeBuildInputs = [
meson
ninja
cmake
pkg-config
flex
bison
];

buildInputs = [
opusfile
libvorbis
libxcb
libpng
curl
glibmm_2_68
freetype
libGL
libGLU
glfw3
asio
lz4
boost
libsigcxx30
leveldb
fastnoise2
libbfd
libx11
libnoise
glm
];

meta = {
description = "the third game";
mainProgram = "game3";
license = lib.licenses.agpl3Plus;
platforms = lib.platforms.linux;
};
}