From 15decf6a8a5448acb2b05afd16bf572b15ecbbdb Mon Sep 17 00:00:00 2001 From: beh_10257 <77834479+beh-10257@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:30:45 +0100 Subject: [PATCH] fixes nix build issue and updates nixpkgs (#144) * Fixes Open-Wine-Components/umu-launcher#142 maintaining nix support and updating nixpkgs * removed unneeded dependencies and added more emphasis on tagging maintainers * Update README.md - Add new line --------- Co-authored-by: beh-10257 Co-authored-by: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> --- README.md | 5 +++-- packaging/nix/combine.nix | 4 ++-- packaging/nix/flake.lock | 8 ++++---- packaging/nix/flake.nix | 15 +++++++++++---- packaging/nix/umu-launcher.nix | 22 ++++++++++++++++++---- packaging/nix/umu-run.nix | 15 ++++----------- 6 files changed, 42 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 86e1dc57c..942504dd2 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,9 @@ dnf install -y umu-launcher*.rpm [![Stable version badge](https://img.shields.io/aur/version/umu-launcher?style=flat&label=umu-launcher)](https://aur.archlinux.org/packages/umu-launcher) ### NixOS +If there is any problem with the flake feel free to open a bug report and tag any of the maintainers +> maintainers: @beh-10257 + If you want to add umu-launcher as a flake add this to your inputs in `flake.nix` ```nix inputs = { @@ -156,8 +159,6 @@ and in your `configuration.nix` environment.systemPackages = [ inputs.umu.packages.${pkgs.system}.umu ]; } ``` -If there is any problem with the flake feel free to open a bug report and tag any of the maintainers -> maintainers: @beh-10257 ## Contributing diff --git a/packaging/nix/combine.nix b/packaging/nix/combine.nix index aa898b9e1..3b3b28871 100644 --- a/packaging/nix/combine.nix +++ b/packaging/nix/combine.nix @@ -1,11 +1,11 @@ { env, package, symlinkJoin }: symlinkJoin { - name = "umu-combine"; + name = "umu-run-bwrap"; paths = [ env package ]; postBuild = '' - rm $out/bin/umu-run + rm $out/bin/umu ''; } diff --git a/packaging/nix/flake.lock b/packaging/nix/flake.lock index 08544662a..eb18d153d 100644 --- a/packaging/nix/flake.lock +++ b/packaging/nix/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1716137900, - "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", + "lastModified": 1720657034, + "narHash": "sha256-nPhbeFdyN8yn+EXmnPcBWisoypndtQbNIhSKmAinv3E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", + "rev": "212defe037698e18fc9521dfe451779a8979844c", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/packaging/nix/flake.nix b/packaging/nix/flake.nix index 4ccc38448..272830270 100644 --- a/packaging/nix/flake.nix +++ b/packaging/nix/flake.nix @@ -1,13 +1,20 @@ { description = "umu universal game launcher"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = { self, nixpkgs }: let - umu-package = nixpkgs.legacyPackages.x86_64-linux.callPackage ./umu-launcher.nix { umu-launcher=( builtins.toPath "${self}/../../"); }; - umu-run = nixpkgs.legacyPackages.x86_64-linux.callPackage ./umu-run.nix { package=umu-package; }; + umu-launcher-src=builtins.toPath "${self}/../../"; + nixpk=nixpkgs.legacyPackages.x86_64-linux; + in + let + pyth = nixpk.pkgs.python3; + in + let + umu-package = nixpk.callPackage ./umu-launcher.nix { umu-launcher=umu-launcher-src; pyth1=pyth; }; + umu-run = nixpk.callPackage ./umu-run.nix { package=umu-package; }; in{ - packages.x86_64-linux.umu = nixpkgs.legacyPackages.x86_64-linux.callPackage ./combine.nix { env=umu-run; package=umu-package; }; + packages.x86_64-linux.umu = nixpk.callPackage ./combine.nix { env=umu-run; package=umu-package; }; }; } diff --git a/packaging/nix/umu-launcher.nix b/packaging/nix/umu-launcher.nix index 5bbd6fa70..396480ffa 100644 --- a/packaging/nix/umu-launcher.nix +++ b/packaging/nix/umu-launcher.nix @@ -1,19 +1,33 @@ -{stdenv , umu-launcher, pkgs, ...}: -stdenv.mkDerivation { - pname = "umu-launcher"; +{pyth1 ,python3Packages , umu-launcher, pkgs, ...}: +python3Packages.buildPythonPackage { + name = "umu-launcher"; version = "0.1"; src = umu-launcher; + pyproject = false; depsBuildBuild = [ pkgs.meson pkgs.ninja pkgs.scdoc + pkgs.git + pkgs.python3Packages.installer + pkgs.hatch + pkgs.python3Packages.build ]; propagatedBuildInputs = [ - pkgs.python3 + pyth1 + pkgs.python3Packages.xlib ]; + makeFlags = [ "PYTHON_INTERPRETER=${pyth1}/bin/python" "SHELL_INTERPRETER=/run/current-system/sw/bin/bash" "DESTDIR=${placeholder "out"}" ]; dontUseMesonConfigure = true; dontUseNinjaBuild = true; dontUseNinjaInstall = true; dontUseNinjaCheck = true; configureScript = "./configure.sh"; + configureFlags = [ "--prefix=${placeholder "out"}" ]; + postInstall='' + mv -fv $out${pyth1}/* $out + mv -fv $out$out/* $out + rm -vrf $out/nix + mv $out/bin/umu-run $out/bin/umu + ''; } diff --git a/packaging/nix/umu-run.nix b/packaging/nix/umu-run.nix index bfbbd6c30..3055cf2a7 100644 --- a/packaging/nix/umu-run.nix +++ b/packaging/nix/umu-run.nix @@ -1,14 +1,7 @@ -{ package, lib,stdenv, buildFHSEnv, writeShellScript, ...}: -let - ldPath = lib.optionals stdenv.is64bit [ "/lib64" ] ++ [ "/lib32" ]; - exportLDPath = '' - export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH - ''; -in +{ package, buildFHSEnv, writeShellScript, ...}: buildFHSEnv { - name = "umu"; - runScript = writeShellScript "umu-env" '' - ${exportLDPath} - ${package}/bin/umu-run "$@" + name = "umu-run"; + runScript = writeShellScript "umu-run-shell" '' + ${package}/bin/umu "$@" ''; }