diff --git a/pkgs/by-name/ne/neohtop/package.nix b/pkgs/by-name/ne/neohtop/package.nix new file mode 100644 index 00000000000000..5386e554237590 --- /dev/null +++ b/pkgs/by-name/ne/neohtop/package.nix @@ -0,0 +1,51 @@ +{ + rustPlatform, + cargo-tauri, + nodejs, + jq, + stdenv, + importNpmLock, + zsh, + fetchFromGitHub, +}: + +let + tauri = cargo-tauri; +in + +rustPlatform.buildRustPackage rec { + name = "neohtop"; + pname = name; + version = "1.1.1"; + + src = fetchFromGitHub { + owner = "abdenasser"; + repo = "neohtop"; + rev = "v${version}"; + hash = "sha256-TM1QxYuJHhx7tgXqg3+sD1nXnEv1Oghk7fwwAHFFoZ4"; + }; + nativeBuildInputs = [ tauri.hook npmConfigHook nodejs ]; + cargoRoot = "src-tauri"; + sourceRoot = "source/${cargoRoot}"; + cargoHash = ""; + npmDeps = importNpmLock { + npmRoot = src; + }; + # remove macOS signing + postConfigure = '' + ${jq}/bin/jq 'del(.bundle.macOS.signingIdentity, .bundle.macOS.hardenedRuntime)' src-tauri/tauri.conf.json > tmp.json + mv tmp.json src-tauri/tauri.conf.json + ''; + npmConfigHook = importNpmLock.npmConfigHook; + checkPhase = "true"; # idk why checks fail, todo + installPhase = let path = "${cargoRoot}/target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/bundle"; in + if stdenv.isDarwin then '' + mkdir -p $out/bin + mv ${path}/macos $out/Applications + echo "#!${zsh}/bin/zsh" >> $out/bin/${name} + echo "open -a $out/Applications/${name}.app" >> $out/bin/${name} + chmod +x $out/bin/${name} + '' else '' + mv ${path}/deb/*/data/usr $out + ''; +} \ No newline at end of file