From 55666be313f4b4808f106cae109768c6176c2e0d Mon Sep 17 00:00:00 2001 From: Whovian9369 Date: Wed, 29 May 2024 16:32:18 -0400 Subject: [PATCH] Add `hactoolnet-bin` to packages, but do not add to environment. --- flake.nix | 1 + home/packages/hactoolnet-bin/package.nix | 45 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 home/packages/hactoolnet-bin/package.nix diff --git a/flake.nix b/flake.nix index 2408a85..98c874e 100644 --- a/flake.nix +++ b/flake.nix @@ -136,6 +136,7 @@ }; packages.x86_64-linux = { + hactoolnet-bin = pkgs.callPackage ./home/packages/hactoolnet-bin/package.nix {}; irdkit = pkgs.callPackage ./home/packages/irdkit/package.nix {}; ird_tools = pkgs.callPackage ./home/packages/ird_tools/package.nix {}; ps3dec = pkgs.callPackage ./home/packages/ps3dec/package.nix {}; diff --git a/home/packages/hactoolnet-bin/package.nix b/home/packages/hactoolnet-bin/package.nix new file mode 100644 index 0000000..cca45fb --- /dev/null +++ b/home/packages/hactoolnet-bin/package.nix @@ -0,0 +1,45 @@ +{ + lib, + autoPatchelfHook, + fetchzip, + gcc, + makeWrapper, + openssl, + stdenv, + zlib +}: + +stdenv.mkDerivation rec { + name = "hactoolnet-bin"; + version = "0.19.0"; + + src = fetchzip { + url = "https://github.com/Thealexbarney/LibHac/releases/download/v0.19.0/hactoolnet-0.19.0-linux.zip"; + sha256 = "njlIFsAjyKErYatbP+3fmjP5dv3DhJ7G1+KvC2ZPdso="; + }; + + buildInputs = [ + autoPatchelfHook + makeWrapper + gcc.cc + zlib + ]; + + installPhase = '' + mkdir -p $out/bin + chmod +x hactoolnet + cp hactoolnet $out/bin/ + wrapProgram $out/bin/hactoolnet \ + --set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT 1 \ + --set LD_LIBRARY_PATH ${lib.makeLibraryPath [ openssl ]} + ''; + + meta = { + description = "An example program that uses LibHac. It is used in a similar manner to hactool."; + homepage = "https://github.com/Thealexbarney/LibHac"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + mainProgram = "hactoolnet"; + platforms = lib.platforms.all; + }; +}