summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/freeciv/default.nix138
-rw-r--r--packages/freecol/default.nix64
-rw-r--r--packages/intel-vtune.patch514
-rw-r--r--packages/unciv/default.nix76
-rw-r--r--packages/vintagestory/default.nix113
5 files changed, 905 insertions, 0 deletions
diff --git a/packages/freeciv/default.nix b/packages/freeciv/default.nix
new file mode 100644
index 0000000..a49069f
--- /dev/null
+++ b/packages/freeciv/default.nix
@@ -0,0 +1,138 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ autoreconfHook,
+ lua5_3,
+ pkg-config,
+ python3,
+ zlib,
+ bzip2,
+ curl,
+ xz,
+ gettext,
+ libiconv,
+ icu,
+ SDL2,
+ SDL2_mixer,
+ SDL2_image,
+ SDL2_ttf,
+ SDL2_gfx,
+ freetype,
+ fluidsynth,
+ sdl2Client ? false,
+ gtkClient ? false,
+ gtk3,
+ wrapGAppsHook3,
+ qtClient ? true,
+ qt5,
+ server ? true,
+ readline,
+ enableSqlite ? true,
+ sqlite,
+}:
+
+stdenv.mkDerivation rec {
+ pname = "freeciv";
+ version = "3.1.5";
+
+ src = fetchFromGitHub {
+ owner = "freeciv";
+ repo = "freeciv";
+ rev = "R${lib.replaceStrings [ "." ] [ "_" ] version}";
+ hash = "sha256-+kAV9Jz0aQpzeVUFp3so+rYbWOn52NuxRwE8kP5hzM8=";
+ };
+
+ postPatch = ''
+ for f in {common,utility}/*.py; do
+ substituteInPlace $f \
+ --replace '/usr/bin/env python3' ${python3.interpreter}
+ done
+ for f in bootstrap/*.sh; do
+ patchShebangs $f
+ done
+ '';
+
+ nativeBuildInputs =
+ [
+ autoreconfHook
+ pkg-config
+ ]
+ ++ lib.optionals qtClient [ qt5.wrapQtAppsHook ]
+ ++ lib.optionals gtkClient [ wrapGAppsHook3 ];
+
+ buildInputs =
+ [
+ lua5_3
+ zlib
+ bzip2
+ curl
+ xz
+ gettext
+ libiconv
+ icu
+ SDL2
+ SDL2_mixer
+ SDL2_image
+ SDL2_ttf
+ SDL2_gfx
+ freetype
+ fluidsynth
+ ]
+ ++ lib.optionals gtkClient [ gtk3 ]
+ ++ lib.optionals qtClient [ qt5.qtbase ]
+ ++ lib.optional server readline
+ ++ lib.optional enableSqlite sqlite;
+
+ dontWrapQtApps = true;
+ dontWrapGApps = true;
+
+ # configure is not smart enough to look for SDL2 headers under
+ # .../SDL2, but thankfully $SDL2_PATH is almost exactly what we want
+ preConfigure = ''
+ export CPPFLAGS="$(echo $SDL2_PATH | sed 's#/nix/store/#-I/nix/store/#g')"
+ '';
+ configureFlags =
+ [ "--enable-shared" ]
+ ++ lib.optionals sdl2Client [
+ "--enable-client=sdl2"
+ "--enable-sdl-mixer=sdl2"
+ ]
+ ++ lib.optionals qtClient [
+ "--enable-client=qt"
+ "--enable-sdl-mixer=sdl2"
+ "--with-qtver=qt5"
+ "--with-qt5-includes=${qt5.qtbase.dev}/include"
+ ]
+ ++ lib.optionals gtkClient [ "--enable-client=gtk3.22" ]
+ ++ lib.optional enableSqlite "--enable-fcdb=sqlite3"
+ ++ lib.optional (!gtkClient) "--enable-fcmp=cli"
+ ++ lib.optional (!server) "--disable-server";
+
+ postFixup =
+ lib.optionalString qtClient ''
+ wrapQtApp $out/bin/freeciv-qt
+ ''
+ + lib.optionalString gtkClient ''
+ wrapGApp $out/bin/freeciv-gtk3.22
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Multiplayer (or single player), turn-based strategy game";
+ longDescription = ''
+ Freeciv is a Free and Open Source empire-building strategy game
+ inspired by the history of human civilization. The game commences in
+ prehistory and your mission is to lead your tribe from the stone age
+ to the space age...
+ '';
+ homepage = "http://www.freeciv.org"; # http only
+ license = lib.licenses.gpl2Plus;
+ maintainers = with lib.maintainers; [ pierron ];
+ platforms = lib.platforms.unix;
+ hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
+ broken = qtClient && stdenv.hostPlatform.isDarwin; # Missing Qt5 development files
+ };
+}
+
diff --git a/packages/freecol/default.nix b/packages/freecol/default.nix
new file mode 100644
index 0000000..e2562ad
--- /dev/null
+++ b/packages/freecol/default.nix
@@ -0,0 +1,64 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ autoreconfHook,
+ lua5_3,
+ pkg-config,
+ python3,
+ zlib,
+ bzip2,
+ curl,
+ xz,
+ gettext,
+ libiconv,
+ icu,
+ SDL2,
+ SDL2_mixer,
+ SDL2_image,
+ SDL2_ttf,
+ SDL2_gfx,
+ freetype,
+ fluidsynth,
+ sdl2Client ? false,
+ gtkClient ? false,
+ gtk3,
+ wrapGAppsHook3,
+ qtClient ? true,
+ qt5,
+ server ? true,
+ readline,
+ enableSqlite ? true,
+ sqlite,
+}:
+
+stdenv.mkDerivation rec {
+ pname = "freecol";
+ version = "1.2.0";
+
+ src = fetchFromGitHub {
+ owner = "FreeCol";
+ repo = "freecol";
+ rev = "stable";
+ hash = "sha256-+kAV9Jz0aQpzeVUFp3so+rYbWOn52NuxRwE8kP5hzM8=";
+ };
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Multiplayer (or single player), turn-based strategy game";
+ longDescription = ''
+ Freeciv is a Free and Open Source empire-building strategy game
+ inspired by the history of human civilization. The game commences in
+ prehistory and your mission is to lead your tribe from the stone age
+ to the space age...
+ '';
+ homepage = "http://www.freeciv.org"; # http only
+ license = lib.licenses.gpl2Plus;
+ maintainers = with lib.maintainers; [ pierron ];
+ platforms = lib.platforms.unix;
+ hydraPlatforms = lib.platforms.linux; # sdl-config times out on darwin
+ broken = qtClient && stdenv.hostPlatform.isDarwin; # Missing Qt5 development files
+ };
+}
+
diff --git a/packages/intel-vtune.patch b/packages/intel-vtune.patch
new file mode 100644
index 0000000..54f2518
--- /dev/null
+++ b/packages/intel-vtune.patch
@@ -0,0 +1,514 @@
+From 9ee4876f0e0c7ba153ccaf69b42310ee8c25dca0 Mon Sep 17 00:00:00 2001
+From: Albert Safin <xzfcpw@gmail.com>
+Date: Fri, 26 Apr 2024 18:47:53 +0000
+Subject: [PATCH 1/4] libsafec: init at 3.3.0
+
+---
+ pkgs/by-name/li/libsafec/package.nix | 46 ++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+ create mode 100644 pkgs/by-name/li/libsafec/package.nix
+
+diff --git a/pkgs/by-name/li/libsafec/package.nix b/pkgs/by-name/li/libsafec/package.nix
+new file mode 100644
+index 00000000000000..7d65d84f695ef6
+--- /dev/null
++++ b/pkgs/by-name/li/libsafec/package.nix
+@@ -0,0 +1,46 @@
++{
++ stdenv,
++ lib,
++ fetchFromGitHub,
++ fetchpatch,
++ autoreconfHook,
++ perl,
++}:
++
++stdenv.mkDerivation (finalAttrs: {
++ pname = "safeclib";
++ version = "3.3.0";
++
++ src = fetchFromGitHub {
++ owner = "rurban";
++ repo = "safeclib";
++ rev = "refs/tags/v${finalAttrs.version}";
++ hash = "sha256-vwMyxGgJvvv2Nlo14HKZtq8YnmAVqAHDvBL6CUmbaYQ=";
++ };
++
++ patches = [
++ # Fix linking error.
++ # Upstreamed in v3.4.0, but intel-opeapi-vtune wants libsafec-3.3.so.3.
++ (fetchpatch {
++ name = "0001-add-pic_flag-to-RETPOLINE-cflags-and-ldflags.patch";
++ url = "https://github.com/rurban/safeclib/commit/23ae79fe84a3fa5d995b8c6b9be70587e37a6cd8.patch";
++ hash = "sha256-iv9OZJT9WILug1vVmUgIh8RxGAx8accwR1R0LOxYqYQ=";
++ })
++ ];
++
++ nativeBuildInputs = [ autoreconfHook ];
++
++ buildInputs = [ perl ];
++
++ env = {
++ CFLAGS = "-Wno-error=dangling-pointer";
++ };
++
++ meta = {
++ description = "Libc extension with all C11 Annex K functions";
++ homepage = "https://github.com/rurban/safeclib";
++ license = lib.licenses.mit;
++ maintainers = [ lib.maintainers.xzfc ];
++ platforms = lib.platforms.all;
++ };
++})
+
+From e85bff2164b9e9058dff94c11cd93b73d3efb43b Mon Sep 17 00:00:00 2001
+From: Albert Safin <xzfcpw@gmail.com>
+Date: Fri, 26 Apr 2024 20:03:57 +0000
+Subject: [PATCH 2/4] intel-oneapi-vtune: init at 2025.0.1
+
+---
+ .../by-name/in/intel-oneapi-vtune/package.nix | 142 ++++++++++++++++++
+ pkgs/by-name/in/intel-oneapi-vtune/update.sh | 42 ++++++
+ 2 files changed, 184 insertions(+)
+ create mode 100644 pkgs/by-name/in/intel-oneapi-vtune/package.nix
+ create mode 100755 pkgs/by-name/in/intel-oneapi-vtune/update.sh
+
+diff --git a/pkgs/by-name/in/intel-oneapi-vtune/package.nix b/pkgs/by-name/in/intel-oneapi-vtune/package.nix
+new file mode 100644
+index 00000000000000..2de5be57e8446c
+--- /dev/null
++++ b/pkgs/by-name/in/intel-oneapi-vtune/package.nix
+@@ -0,0 +1,142 @@
++{
++ alsa-lib,
++ atk,
++ autoPatchelfHook,
++ cairo,
++ cups,
++ dbus,
++ elfutils,
++ expat,
++ fetchurl,
++ file-rename,
++ glib,
++ gtk3,
++ kmod,
++ lib,
++ libdrm,
++ libndctl,
++ libsafec,
++ libxcrypt-legacy,
++ libxkbcommon,
++ mesa,
++ ncurses5,
++ nspr,
++ nss,
++ opencl-clang,
++ p7zip,
++ pango,
++ stdenv,
++ systemd,
++ wrapGAppsHook3,
++ xorg,
++}:
++
++stdenv.mkDerivation (
++ finalAttrs:
++ let
++ versionMajorMinor = lib.versions.majorMinor finalAttrs.version;
++ in
++ {
++ pname = "intel-oneapi-vtune";
++ version = "2025.0.1";
++
++ src = fetchurl {
++ url = "https://installer.repos.intel.com/oneapi/vtune/lin/intel.oneapi.lin.vtune,v=2025.0.1%2B14/cupPayload.cup";
++ sha256 = "1pzh0kx7wxwr48rbv7wfkpkixqxsaass3xkpwhvvkdm09v5fhm7h";
++ };
++
++ nativeBuildInputs = [
++ autoPatchelfHook
++ file-rename
++ p7zip
++ wrapGAppsHook3
++ ];
++
++ buildInputs = [
++ alsa-lib
++ atk
++ cairo
++ cups
++ dbus
++ elfutils
++ expat
++ glib
++ gtk3
++ kmod
++ libdrm
++ libndctl
++ libsafec
++ libxcrypt-legacy
++ libxkbcommon
++ mesa
++ ncurses5
++ nspr
++ nss
++ opencl-clang
++ pango
++ stdenv.cc.cc.lib
++ xorg.libX11
++ xorg.libXcomposite
++ xorg.libXdamage
++ xorg.libXext
++ xorg.libXfixes
++ xorg.libXrandr
++ xorg.libxcb
++ ];
++
++ unpackPhase = ''
++ runHook preUnpack
++
++ 7za x $src _installdir/vtune/${versionMajorMinor}
++
++ # Fix percent-encoded filenames, e.g. "libstdc%2B%2B.so.6" -> "libstdc++.so.6"
++ find -depth -name '*%*' -execdir rename 's/%2B/+/g; s/%5B/[/g; s/%5D/]/g' {} \;
++
++ runHook postUnpack
++ '';
++
++ installPhase = ''
++ runHook preInstall
++
++ mkdir -p $out/opt/intel/oneapi
++ mv _installdir/vtune $out/opt/intel/oneapi
++ ln -s $out/opt/intel/oneapi/vtune/{${versionMajorMinor},latest}
++
++ mkdir -p $out/bin
++ for bin in vtune vtune-backend vtune-gui; do
++ ln -s $out/opt/intel/oneapi/vtune/${versionMajorMinor}/bin64/$bin $out/bin/
++ done
++
++ mkdir -p $out/share/applications
++ cp $out/opt/intel/oneapi/vtune/${versionMajorMinor}/bin64/vtune-gui.desktop $out/share/applications/
++ sed -i $out/share/applications/vtune-gui.desktop -e "
++ s|^Exec=.*|Exec=vtune-gui|g;
++ s|^Icon=./|Icon=$out/opt/intel/oneapi/vtune/${versionMajorMinor}/bin64/|g;
++ "
++
++ runHook postInstall
++ '';
++
++ autoPatchelfIgnoreMissingDeps = [
++ "libffi.so.6" # Used in vendored python
++ "libgdbm.so.4" # Used in vendored python
++ "libgdbm_compat.so.4" # Used in vendored python
++ "libsycl.so.8" # Used in bin64/self_check_apps/matrix.dpcpp/matrix.dpcpp
++ ];
++
++ runtimeDependencies = [
++ systemd # for zygote (vtune-gui)
++ ];
++
++ passthru.updateScript = ./update.sh;
++
++ meta = {
++ changelog = "https://www.intel.com/content/www/us/en/developer/articles/release-notes/vtune-profiler-release-notes.html";
++ description = "Performance analysis tool for x86-based machines";
++ homepage = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html";
++ license = lib.licenses.unfree;
++ maintainers = [ lib.maintainers.xzfc ];
++ platforms = [ "x86_64-linux" ];
++ };
++ }
++)
+diff --git a/pkgs/by-name/in/intel-oneapi-vtune/update.sh b/pkgs/by-name/in/intel-oneapi-vtune/update.sh
+new file mode 100755
+index 00000000000000..5536c846f8e844
+--- /dev/null
++++ b/pkgs/by-name/in/intel-oneapi-vtune/update.sh
+@@ -0,0 +1,42 @@
++#!/usr/bin/env nix-shell
++#!nix-shell -i bash -p curl jq common-updater-scripts
++
++set -e
++
++# Check on https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler-download.html
++DOWNLOAD_ID=bef05a56-52f3-40ad-a91a-040a98316680
++
++INSTALLER_URL=$(
++ curl --silent "https://www.intel.com/libs/apps/intel/idz/productsinfo?downloadId=$DOWNLOAD_ID" |
++ jq -r '
++ .downloads.downloads.productVersionsBuilds[0].files[]
++ | select (.operatingSystem == "Linux" and .fileType == "Custom Package")
++ .url
++ ' |
++ uniq
++)
++echo "INSTALLER_URL=$INSTALLER_URL"
++[ "$INSTALLER_URL" ] || exit 1
++
++{
++ read -r CUP_URL
++ read -r VERSION
++} < <(
++ curl --silent "$INSTALLER_URL" |
++ sed '0,/^__CONTENT__$/d' |
++ tar -zx -O --wildcards './packages/intel.oneapi.lin.vtune,v=*/manifest.json' |
++ jq -r '
++ [(.payloads[] | select (.fileName == "cupPayload.cup") | .url),
++ (.version | split("+")[0])
++ ][]
++ '
++)
++echo "CUP_URL=$CUP_URL"
++echo "VERSION=$VERSION"
++[ "$CUP_URL" ] || exit 1
++[ "$VERSION" ] || exit 1
++
++CUP_HASH=$(nix-prefetch-url "$CUP_URL")
++echo "CUP_HASH=$CUP_HASH"
++
++update-source-version intel-oneapi-vtune "$VERSION" "$CUP_HASH" "$CUP_URL"
+
+From 26dc08626bcef7802e58d4e1d50b99ab71f1a60d Mon Sep 17 00:00:00 2001
+From: Albert Safin <xzfcpw@gmail.com>
+Date: Fri, 26 Apr 2024 20:05:57 +0000
+Subject: [PATCH 3/4] intel-vtune-sepdk: init
+
+---
+ .../linux/intel-vtune-sepdk/default.nix | 106 ++++++++++++++++++
+ pkgs/top-level/linux-kernels.nix | 2 +
+ 2 files changed, 108 insertions(+)
+ create mode 100644 pkgs/os-specific/linux/intel-vtune-sepdk/default.nix
+
+diff --git a/pkgs/os-specific/linux/intel-vtune-sepdk/default.nix b/pkgs/os-specific/linux/intel-vtune-sepdk/default.nix
+new file mode 100644
+index 00000000000000..bd69321476c538
+--- /dev/null
++++ b/pkgs/os-specific/linux/intel-vtune-sepdk/default.nix
+@@ -0,0 +1,106 @@
++{
++ bash,
++ coreutils,
++ gnugrep,
++ gnused,
++ intel-oneapi-vtune,
++ kernel,
++ kmod,
++ lib,
++ makeWrapper,
++ p7zip,
++ procps,
++ python3,
++ shadow,
++ stdenv,
++ which,
++}:
++
++let
++ binPath = lib.makeBinPath [
++ bash
++ coreutils
++ gnugrep
++ gnused
++ kmod
++ procps
++ python3
++ shadow
++ which
++ ];
++ libexecDir = "\${out}/libexec/intel-vtune-sepdk";
++ modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86";
++ versionMajorMinor = lib.versions.majorMinor intel-oneapi-vtune.version;
++in
++stdenv.mkDerivation {
++ pname = "intel-vtune-sepdk";
++ version = "${intel-oneapi-vtune.version}-${kernel.version}";
++
++ inherit (intel-oneapi-vtune) src;
++
++ hardeningDisable = [ "pic" ];
++
++ nativeBuildInputs = [
++ makeWrapper
++ p7zip
++ ] ++ kernel.moduleBuildDependencies;
++
++ makeFlags = [
++ "KERNEL_SRC_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
++ "KERNEL_VERSION=${kernel.modDirVersion}" # Output of `uname -r`
++ "MACH=x86_64" # Output of `uname -m`
++ "SMP=1"
++ "VERBOSE=1"
++ "INSTALL=${libexecDir}"
++ ];
++
++ unpackPhase = ''
++ runHook preUnpack
++ 7za x $src _installdir/vtune/${versionMajorMinor}/sepdk
++ cd _installdir/vtune/${versionMajorMinor}/sepdk/src
++ runHook postUnpack
++ '';
++
++ prePatch = ''
++ # Allow using --load-in-tree-driver option
++ substituteInPlace insmod-sep pax/insmod-pax socperf/src/insmod-socperf \
++ --replace-fail IS_INTREE_DRIVER_OS=0 IS_INTREE_DRIVER_OS=1
++ '';
++
++ preBuild = ''
++ makeFlags="$makeFlags KBUILD_EXTRA_SYMBOLS=$PWD/socperf/src/Module.symvers"
++ '';
++
++ preInstall = "mkdir -p ${libexecDir}";
++
++ postInstall = ''
++ # Install wrappers to bin
++ for i in insmod-sep pax/insmod-pax socperf/src/insmod-socperf \
++ rmmod-sep pax/rmmod-pax socperf/src/rmmod-socperf; do
++ sed -i '
++ s/^PATH=/# &/;
++ # Do not check for su to make it usable with clean PATH (e.g. as systemd service)
++ s/\(\bCOMMANDS_TO_CHECK="[^"]*\)''${SU}\([^"]*"\)/\1\2/;
++ ' ${libexecDir}/$i
++ makeWrapper ${libexecDir}/$i $out/bin/''${i##*/} --prefix PATH : "${binPath}"
++ done
++
++ # Install kernel modules
++ mkdir -p ${modDestDir}/{socperf,sepdk/sep,sepdk/pax}
++ ln -s ${libexecDir}/sep5-*.ko ${modDestDir}/sepdk/sep/sep5.ko
++ ln -s ${libexecDir}/pax/pax-*.ko ${modDestDir}/sepdk/pax/pax.ko
++ ln -s ${libexecDir}/socperf/src/socperf3-*.ko ${modDestDir}/socperf/socperf3.ko
++ '';
++
++ meta = {
++ description = "Kernel module for Intel VTune Profiler";
++ homepage = "https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2024-0/sep-driver.html";
++ license = [
++ lib.licenses.bsd3
++ lib.licenses.gpl2Only
++ lib.licenses.unfree
++ ];
++ maintainers = [ lib.maintainers.xzfc ];
++ platforms = [ "x86_64-linux" ];
++ };
++}
+diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix
+index 3cabaec2c7b14f..9b07bbcd7189bc 100644
+--- a/pkgs/top-level/linux-kernels.nix
++++ b/pkgs/top-level/linux-kernels.nix
+@@ -392,6 +392,8 @@ in {
+
+ intel-speed-select = if lib.versionAtLeast kernel.version "5.3" then callPackage ../os-specific/linux/intel-speed-select { } else null;
+
++ intel-vtune-sepdk = callPackage ../os-specific/linux/intel-vtune-sepdk { };
++
+ ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers {};
+
+ ivsc-driver = callPackage ../os-specific/linux/ivsc-driver {};
+
+From 4a32ac7311f23d4a17f6f294d19e1df5afc4f90d Mon Sep 17 00:00:00 2001
+From: Albert Safin <xzfcpw@gmail.com>
+Date: Fri, 26 Apr 2024 20:07:19 +0000
+Subject: [PATCH 4/4] nixos/vtune: init module
+
+---
+ .../manual/release-notes/rl-2505.section.md | 2 +
+ nixos/modules/module-list.nix | 1 +
+ nixos/modules/programs/vtune.nix | 74 +++++++++++++++++++
+ 3 files changed, 77 insertions(+)
+ create mode 100644 nixos/modules/programs/vtune.nix
+
+diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
+index 2367ba3ba7d7ec..eb0224fa18c195 100644
+--- a/nixos/modules/module-list.nix
++++ b/nixos/modules/module-list.nix
+@@ -313,6 +313,7 @@
+ ./programs/vim.nix
+ ./programs/virt-manager.nix
+ ./programs/wavemon.nix
++ ./programs/vtune.nix
+ ./programs/wayland/cardboard.nix
+ ./programs/wayland/hyprlock.nix
+ ./programs/wayland/hyprland.nix
+diff --git a/nixos/modules/programs/vtune.nix b/nixos/modules/programs/vtune.nix
+new file mode 100644
+index 00000000000000..9ace5cbc338fbc
+--- /dev/null
++++ b/nixos/modules/programs/vtune.nix
+@@ -0,0 +1,74 @@
++{
++ config,
++ lib,
++ pkgs,
++ ...
++}:
++
++let
++ inherit (lib)
++ mkEnableOption
++ mkIf
++ mkMerge
++ mkOption
++ mkPackageOption
++ types
++ ;
++
++ cfg = config.programs.vtune;
++in
++{
++ options.programs.vtune = {
++ enable = mkEnableOption "VTune Profiler";
++
++ package = mkPackageOption pkgs "intel-oneapi-vtune" {
++ nullable = true;
++ extraDescription = ''
++ Set to `null` to install only the kernel module.
++ '';
++ };
++
++ modulePackage = mkOption {
++ type = types.nullOr types.package;
++ default = config.boot.kernelPackages.intel-vtune-sepdk.override {
++ intel-oneapi-vtune = config.programs.package or pkgs.intel-oneapi-vtune;
++ };
++ defaultText = ''
++ config.boot.kernelPackages.intel-vtune-sepdk.override {
++ intel-oneapi-vtune = config.programs.vtune.package or pkgs.intel-oneapi-vtune;
++ }
++ '';
++ example = "config.boot.kernelPackages.intel-vtune-sepdk";
++ description = ''
++ The package to use for the VTune Profiler kernel module.
++ Set to `null` to disable the kernel module.
++ An user should be in the `vtune` group to use the module.
++ '';
++ };
++ };
++
++ config = mkIf cfg.enable (mkMerge [
++ (mkIf (cfg.package != null) { environment.systemPackages = [ cfg.package ]; })
++
++ (mkIf (cfg.modulePackage != null) {
++ boot.extraModulePackages = [ cfg.modulePackage ];
++
++ environment.systemPackages = [ cfg.modulePackage ];
++
++ users.groups.vtune = { };
++
++ systemd.services.vtune-sep5 = {
++ description = "Load VTune SEP5 driver";
++ wantedBy = [ "multi-user.target" ];
++ serviceConfig = {
++ Type = "oneshot";
++ ExecStart = "${cfg.modulePackage}/bin/insmod-sep --load-in-tree-driver";
++ ExecStop = "${cfg.modulePackage}/bin/rmmod-sep";
++ RemainAfterExit = true;
++ };
++ };
++ })
++ ]);
++
++ meta.maintainers = [ lib.maintainers.xzfc ];
++}
+
diff --git a/packages/unciv/default.nix b/packages/unciv/default.nix
new file mode 100644
index 0000000..7980c59
--- /dev/null
+++ b/packages/unciv/default.nix
@@ -0,0 +1,76 @@
+{
+ stdenv,
+ lib,
+ fetchurl,
+ copyDesktopItems,
+ makeDesktopItem,
+ makeWrapper,
+ jre,
+ libGL,
+ libpulseaudio,
+ libXxf86vm,
+}:
+stdenv.mkDerivation rec {
+ pname = "unciv";
+ version = "4.17.2";
+
+ desktopIcon = fetchurl {
+ url = "https://github.com/yairm210/Unciv/blob/${version}/extraImages/Icons/Unciv%20icon%20v6.png?raw=true";
+ hash = "sha256-Zuz+HGfxjGviGBKTiHdIFXF8UMRLEIfM8f+LIB/xonk=";
+ };
+
+ src = fetchurl {
+ url = "https://github.com/yairm210/Unciv/releases/download/${version}/Unciv.jar";
+ hash = "sha256-zLH7juFlPkvM6xbVrmsAuIrvoGOXMrZswujbU6u7bms=";
+ };
+
+ envLibPath = lib.makeLibraryPath (
+ lib.optionals stdenv.hostPlatform.isLinux [
+ libGL
+ libpulseaudio
+ libXxf86vm
+ ]
+ );
+
+ desktopItem = makeDesktopItem {
+ name = "unciv";
+ exec = "unciv";
+ comment = "An open-source Android/Desktop remake of Civ V";
+ desktopName = "Unciv";
+ icon = "unciv";
+ categories = [ "Game" ];
+ };
+
+ dontUnpack = true;
+
+ nativeBuildInputs = [
+ copyDesktopItems
+ makeWrapper
+ ];
+
+ installPhase = ''
+ runHook preInstall
+
+ makeWrapper ${jre}/bin/java $out/bin/unciv \
+ --prefix LD_LIBRARY_PATH : "${envLibPath}" \
+ --prefix PATH : ${lib.makeBinPath [ jre ]} \
+ --add-flags "-jar ${src}"
+
+ install -Dm444 ${desktopIcon} $out/share/icons/hicolor/512x512/apps/unciv.png
+
+ runHook postInstall
+ '';
+
+ desktopItems = [ desktopItem ];
+
+ meta = with lib; {
+ description = "Open-source Android/Desktop remake of Civ V";
+ mainProgram = "unciv";
+ homepage = "https://github.com/yairm210/Unciv";
+ maintainers = with maintainers; [ tex ];
+ sourceProvenance = with sourceTypes; [ binaryBytecode ];
+ license = licenses.mpl20;
+ platforms = platforms.all;
+ };
+}
+
diff --git a/packages/vintagestory/default.nix b/packages/vintagestory/default.nix
new file mode 100644
index 0000000..364cdc2
--- /dev/null
+++ b/packages/vintagestory/default.nix
@@ -0,0 +1,113 @@
+{
+ lib,
+ stdenv,
+ fetchurl,
+ makeWrapper,
+ makeDesktopItem,
+ copyDesktopItems,
+ xorg,
+ gtk2,
+ sqlite,
+ openal,
+ cairo,
+ libGLU,
+ SDL2,
+ freealut,
+ libglvnd,
+ pipewire,
+ libpulseaudio,
+ dotnet-runtime_7
+}:
+
+stdenv.mkDerivation rec {
+ name = "vintagestory-${version}";
+ version = "1.20.11";
+
+ src = fetchurl {
+ url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${version}.tar.gz";
+ hash = "sha256-IOreg6j/jLhOK8jm2AgSnYQrql5R6QxsshvPs8OUcQA=";
+ };
+
+ nativeBuildInputs = [
+ makeWrapper
+ copyDesktopItems
+ ];
+
+ buildInputs = [ dotnet-runtime_7 ];
+
+ runtimeLibs = lib.makeLibraryPath (
+ [
+ gtk2
+ sqlite
+ openal
+ cairo
+ libGLU
+ SDL2
+ freealut
+ libglvnd
+ pipewire
+ libpulseaudio
+ ]
+ ++ (with xorg; [
+ libX11
+ libXi
+ libXcursor
+ ])
+ );
+
+ desktopItems = [
+ (makeDesktopItem {
+ name = "vintagestory";
+ desktopName = "Vintage Story";
+ exec = "vintagestory";
+ icon = "vintagestory";
+ comment = "Innovate and explore in a sandbox world";
+ categories = [ "Game" ];
+ })
+ (makeDesktopItem {
+ name = "Vintagestory_url_connect";
+ desktopName = "Vintage Story URI Connect";
+ type = "Application";
+ noDisplay = true;
+ mimeTypes = [ "x-scheme-handler/vintagestoryjoin" ];
+ exec = "vintagestory -c %U";
+ categories = [ "Game" ];
+ })
+ (makeDesktopItem {
+ name = "Vintagestory_url_mod";
+ desktopName = "Vintage Story URI mod install";
+ type = "Application";
+ noDisplay = true;
+ mimeTypes = [ "x-scheme-handler/vintagestorymodinstall" ];
+ exec = "vintagestory -i %U";
+ categories = [ "Game" ];
+ })
+ ];
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out/share/vintagestory $out/bin $out/share/pixmaps $out/share/fonts/truetype
+ cp -r * $out/share/vintagestory
+ cp $out/share/vintagestory/assets/gameicon.xpm $out/share/pixmaps/vintagestory.xpm
+ cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype
+
+ runHook postInstall
+ '';
+
+ preFixup =
+ ''
+ makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory \
+ --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
+ --add-flags $out/share/vintagestory/Vintagestory.dll
+ makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory-server \
+ --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
+ --add-flags $out/share/vintagestory/VintagestoryServer.dll
+ ''
+ + ''
+ find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do
+ local filename="$(basename -- "$file")"
+ ln -sf "$filename" "''${file%/*}"/"''${filename,,}"
+ done
+ '';
+}