diff --git a/README.md b/README.md index 5b7bd0e3..7c9c9df5 100755 --- a/README.md +++ b/README.md @@ -110,6 +110,26 @@ You will need to add `$HOME/.local/bin` in your `$PATH` to be able to run umu th export PATH="$HOME/.local/bin:$PATH" ``` +# Packages: +## NixOS +if you want to add umu-launcher as a flake add this to your inputs in flake.nix +```nix + inputs = { + umu= { + url = "git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging\/nix&submodules=1"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + } +``` +and in your configuration.nix +```nix +{inputs, pkgs, ... }: +{ + 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 # Usage notes: diff --git a/packaging/nix/combine.nix b/packaging/nix/combine.nix new file mode 100644 index 00000000..aa898b9e --- /dev/null +++ b/packaging/nix/combine.nix @@ -0,0 +1,11 @@ +{ env, package, symlinkJoin }: +symlinkJoin { + name = "umu-combine"; + paths = [ + env + package + ]; + postBuild = '' + rm $out/bin/umu-run + ''; +} diff --git a/packaging/nix/flake.lock b/packaging/nix/flake.lock new file mode 100644 index 00000000..6aa4ab22 --- /dev/null +++ b/packaging/nix/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1711333969, + "narHash": "sha256-5PiWGn10DQjMZee5NXzeA6ccsv60iLu+Xtw+mfvkUAs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "57e6b3a9e4ebec5aa121188301f04a6b8c354c9b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/packaging/nix/flake.nix b/packaging/nix/flake.nix new file mode 100644 index 00000000..4ccc3844 --- /dev/null +++ b/packaging/nix/flake.nix @@ -0,0 +1,13 @@ +{ + description = "umu universal game launcher"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-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; }; + in{ + packages.x86_64-linux.umu = nixpkgs.legacyPackages.x86_64-linux.callPackage ./combine.nix { env=umu-run; package=umu-package; }; + }; +} diff --git a/packaging/nix/umu-launcher.nix b/packaging/nix/umu-launcher.nix new file mode 100644 index 00000000..23f3ebc5 --- /dev/null +++ b/packaging/nix/umu-launcher.nix @@ -0,0 +1,16 @@ +{stdenv , umu-launcher, pkgs, ...}: +stdenv.mkDerivation { + pname = "umu-launcher"; + version = "0.1"; + src = umu-launcher; + depsBuildBuild = [ + pkgs.meson + pkgs.ninja + pkgs.scdoc + ]; + dontUseMesonConfigure = true; + dontUseNinjaBuild = true; + dontUseNinjaInstall = true; + dontUseNinjaCheck = true; + configureScript = "./configure.sh"; +} diff --git a/packaging/nix/umu-run.nix b/packaging/nix/umu-run.nix new file mode 100644 index 00000000..bfbbd6c3 --- /dev/null +++ b/packaging/nix/umu-run.nix @@ -0,0 +1,14 @@ +{ 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 +buildFHSEnv { + name = "umu"; + runScript = writeShellScript "umu-env" '' + ${exportLDPath} + ${package}/bin/umu-run "$@" + ''; +}