From 41fb6f1f0d988249d0e0c046781d4fc49b6cd13c Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 21 Aug 2024 03:18:00 +0100 Subject: [PATCH 1/2] nexusmods-app: use `finalAttrs` for recursive fixpoint --- pkgs/by-name/ne/nexusmods-app/package.nix | 27 +++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/ne/nexusmods-app/package.nix b/pkgs/by-name/ne/nexusmods-app/package.nix index 875f17e876bb6..7c6cda0b56a90 100644 --- a/pkgs/by-name/ne/nexusmods-app/package.nix +++ b/pkgs/by-name/ne/nexusmods-app/package.nix @@ -10,18 +10,17 @@ libICE, libSM, libX11, - nexusmods-app, runCommand, pname ? "nexusmods-app", }: -buildDotnetModule rec { +buildDotnetModule (finalAttrs: { inherit pname; version = "0.4.1"; src = fetchFromGitHub { owner = "Nexus-Mods"; repo = "NexusMods.App"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-FzQphMhiC1g+6qmk/R1v4rq2ldy35NcaWm0RR1UlwLA="; }; @@ -55,7 +54,8 @@ buildDotnetModule rec { makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ desktop-file-utils ]}" - "--set APPIMAGE ${placeholder "out"}/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux + # Make associating with nxm links work on Linux + "--set APPIMAGE ${placeholder "out"}/bin/NexusMods.App" ]; runtimeDeps = [ @@ -65,7 +65,7 @@ buildDotnetModule rec { libX11 ]; - executables = [ meta.mainProgram ]; + executables = [ "NexusMods.App" ]; doCheck = true; @@ -93,15 +93,10 @@ buildDotnetModule rec { let runTest = name: script: - runCommand "${pname}-test-${name}" - { - # TODO: use finalAttrs when buildDotnetModule has support - nativeBuildInputs = [ nexusmods-app ]; - } - '' - ${script} - touch $out - ''; + runCommand "${pname}-test-${name}" { nativeBuildInputs = [ finalAttrs.finalPackage ]; } '' + ${script} + touch $out + ''; in { serve = runTest "serve" '' @@ -123,7 +118,7 @@ buildDotnetModule rec { meta = { mainProgram = "NexusMods.App"; homepage = "https://github.com/Nexus-Mods/NexusMods.App"; - changelog = "https://github.com/Nexus-Mods/NexusMods.App/releases/tag/${src.rev}"; + changelog = "https://github.com/Nexus-Mods/NexusMods.App/releases/tag/${finalAttrs.src.rev}"; license = [ lib.licenses.gpl3Plus ]; maintainers = with lib.maintainers; [ l0b0 @@ -158,4 +153,4 @@ buildDotnetModule rec { } ''; }; -} +}) From c8c753d66d916412ebf06645dc198c10666a4044 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 21 Aug 2024 03:29:55 +0100 Subject: [PATCH 2/2] nexusmods-app: define `runtimeInputs` Allow overriding what is added to the PATH in the wrapper. --- pkgs/by-name/ne/nexusmods-app/package.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ne/nexusmods-app/package.nix b/pkgs/by-name/ne/nexusmods-app/package.nix index 7c6cda0b56a90..9d4c3947d97a7 100644 --- a/pkgs/by-name/ne/nexusmods-app/package.nix +++ b/pkgs/by-name/ne/nexusmods-app/package.nix @@ -53,11 +53,13 @@ buildDotnetModule (finalAttrs: { ''; makeWrapperArgs = [ - "--prefix PATH : ${lib.makeBinPath [ desktop-file-utils ]}" + "--prefix PATH : ${lib.makeBinPath finalAttrs.runtimeInputs}" # Make associating with nxm links work on Linux "--set APPIMAGE ${placeholder "out"}/bin/NexusMods.App" ]; + runtimeInputs = [ desktop-file-utils ]; + runtimeDeps = [ fontconfig libICE