From 513d93cfc786a1f0d359f6ef109577eb2e713ca9 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 19 Oct 2022 23:16:42 +0100 Subject: [PATCH 1/2] Change the derivation to have parity with nixpkgs - Symlink rather than copying libraries - Update maintainers - Reformat with nixpkgs-fmt Signed-off-by: Skyler Grey --- nix/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index c8b4f7ccb..c7fc75769 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -59,20 +59,20 @@ stdenv.mkDerivation rec { # Copy libnbtplusplus rm -rf source/libraries/libnbtplusplus mkdir source/libraries/libnbtplusplus - cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus - chmod a+r+w source/libraries/libnbtplusplus/* + ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus + chmod -R +r+w source/libraries/libnbtplusplus # Copy tomlplusplus rm -rf source/libraries/tomlplusplus mkdir source/libraries/tomlplusplus - cp -a ${tomlplusplus}/* source/libraries/tomlplusplus - chmod a+r+w source/libraries/tomlplusplus/* + ln -s ${tomlplusplus}/* source/libraries/tomlplusplus + chmod -R +r+w source/libraries/tomlplusplus ''; cmakeFlags = [ "-GNinja" "-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}" ] ++ lib.optionals enableLTO [ "-DENABLE_LTO=on" ] - ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; + ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; # we have to check if the system is NixOS before adding stdenv.cc.cc.lib (#923) postInstall = '' @@ -96,6 +96,6 @@ stdenv.mkDerivation rec { ''; platforms = platforms.unix; license = licenses.gpl3Only; - maintainers = with maintainers; [ starcraft66 kloenk ]; + maintainers = with maintainers; [ minion3665 Scrumplex ]; }; } From dab091a7b776c66541238db6805022fcf4432406 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 19 Oct 2022 23:40:49 +0100 Subject: [PATCH 2/2] Update NIX.md so it has more methods + is clearer - Add proper headings - Change flake codeblocks so that configuration stuff isn't in the same place as flake.nix stuff - Add instructions for not using the overlay with flakes - Add instructions for running ad-hoc with flakes Signed-off-by: Skyler Grey --- nix/NIX.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/nix/NIX.md b/nix/NIX.md index e57d5be7d..980d20e87 100644 --- a/nix/NIX.md +++ b/nix/NIX.md @@ -1,21 +1,59 @@ -# How to import +# Running on Nix -To import with flakes use +## Putting it in your system configuration + +### On flakes-enabled nix + +#### Directly installing + +The `prismlauncher` flake provides a package which you can install along with +the rest of your packages ```nix +# In your flake.nix: { inputs = { prismlauncher.url = "github:PrismLauncher/PrismLauncher"; }; - -... - - nixpkgs.overlays = [ inputs.prismlauncher.overlay ]; ## Within configuration.nix - environment.systemPackages = with pkgs; [ prismlauncher ]; ## } ``` -To import without flakes use channels: +```nix +# And in your system configuration: +environment.systemPackages = [ prismlauncher.packages.${pkgs.system}.prismlauncher ]; + +# Or in your home-manager configuration: +home.packages = [ prismlauncher.packages.${pkgs.system}.prismlauncher ]; +``` + +#### Using the overlay + +Alternatively, you can overlay the prismlauncher version in nixpkgs which will +allow you to install using `pkgs` as you normally would while also using the +latest version + +```nix +# In your flake.nix: +{ + inputs = { + prismlauncher.url = "github:PrismLauncher/PrismLauncher"; + }; +} +``` + +```nix +# And in your system configuration: +nixpkgs.overlays = [ inputs.prismlauncher.overlay ]; +environment.systemPackages = [ pkgs.prismlauncher ]; + +# Or in your home-manager configuration: +config.nixpkgs.overlays = [ inputs.prismlauncher.overlay ]; +home.packages = [ pkgs.prismlauncher ]; +``` + +### Without flakes-enabled nix + +#### Using channels ```sh nix-channel --add https://github.com/PrismLauncher/PrismLauncher/archive/master.tar.gz prismlauncher @@ -23,9 +61,10 @@ nix-channel --update prismlauncher nix-env -iA prismlauncher ``` -or alternatively you can use +#### Using the overlay ```nix +# In your configuration.nix: { nixpkgs.overlays = [ (import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).overlay @@ -34,3 +73,11 @@ or alternatively you can use environment.systemPackages = with pkgs; [ prismlauncher ]; } ``` + +## Running ad-hoc + +If you're on a flakes-enabled nix you can run the launcher in one-line + +```sh +nix run github:PrismLauncher/PrismLauncher +```