Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nav: init at 1.2.1 #356071

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5015,6 +5015,12 @@
githubId = 118536343;
name = "David Hamelin";
};
David-Kopczynski = {
name = "David Elias Chris Kopczynski";
email = "mail@davidkopczynski.com";
github = "David-Kopczynski";
githubId = 53194670;
};
david-r-cox = {
email = "david@integrated-reasoning.com";
github = "david-r-cox";
Expand Down Expand Up @@ -10702,6 +10708,11 @@
name = "Joonas Rautiola";
keys = [ { fingerprint = "87EC DD30 6614 E510 5299 F0D4 090E B48A 4669 AA54"; } ];
};
Jojo4GH = {
name = "Jonas Broeckmann";
github = "Jojo4GH";
githubId = 36777568;
};
jojosch = {
name = "Johannes Schleifenbaum";
email = "johannes@js-webcoding.de";
Expand Down
62 changes: 62 additions & 0 deletions pkgs/by-name/na/nav/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
stdenv,
lib,
fetchzip,
nix-update-script,
autoPatchelfHook,
libxcrypt-legacy,
}:

let
system = stdenv.hostPlatform.parsed.cpu.name;
platform = "${system}-unknown-linux-gnu";
in
stdenv.mkDerivation rec {
pname = "nav";
version = "1.2.1";

src = fetchzip {
url = "https://github.com/Jojo4GH/nav/releases/download/v${version}/nav-${platform}.tar.gz";
sha256 =
{
x86_64-linux = "sha256-ihn5wlagmujHlSfJpgojQNqa4NjLF1wk2pt8wHi60DY=";
aarch64-linux = "sha256-l3rKu3OU/TUUjmx3p06k9V5eN3ZDNcxbxObLqVQ2B7U=";
}
.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this not be built from source, using, e.g. gradle2nix rather than downloading the release binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking for gradle2nix, I could not find any documentation in this repository at first and thus tried to get it running with gradle. However, we could not get the build running (our latest config is shown below).

This is the reason, I looked into gradle2nix again. The repository is currently migrating to V2 with functionality that is not (yet?) available for nixpkgs. We are currently wondering how to achieve the build and would like to know whether to stick to the binaries or if we should use:

let
  gradle2nix = import (fetchTarball "https://github.com/tadfisher/gradle2nix/archive/v2.tar.gz")  {};
in
gradle2nix.buildGradlePackage { ... }

(as described in the documentation for gradle2nix)

Would love to know how to proceed or where to get further information.

Nix Config for gradle.fetchDeps

We tried many variations of this file with gradleUpdateTask, gradleUpdateScript, and gradleFlags, but all of them failed at the dependency download or building step. @Jojo4GH's theory was that the dependency resolution does not work for common architectures, failing at downloading kotlin-stdlib:2.0.0 for arm64.

{
  stdenv,
  lib,
  fetchFromGitHub,
  gradle,
  makeWrapper,
  jre,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: rec {
  pname = "nav";
  version = "1.2.1";

  src = fetchFromGitHub {
    owner = "Jojo4GH";
    repo = "nav";
    rev = "v${version}";
    hash = "sha256-rS64lvS8lBpOsNq+abqqLrX5HJsPTdVx6Akjg9S/pyQ=";
  };

  nativeBuildInputs = [
    gradle
  ];

  mitmCache = gradle.fetchDeps {
    inherit (finalAttrs) pname;
    data = ./deps.json;
  };

  __darwinAllowLocalNetworking = true;

  installPhase = ''
    runHook preInstall

    # this was never reached...

    runHook postInstall
  '';

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "The Interactive and Stylish Replacement for ls & cd";
    longDescription = ''
      To make use of nav, add the following lines to your configuration:
      `programs.bash.shellInit = "eval \"$(nav --init bash)\"";` and
      `programs.zsh.shellInit = "eval \"$(nav --init zsh)\"";`
    '';
    homepage = "https://github.com/Jojo4GH/nav";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      David-Kopczynski
      Jojo4GH
    ];
    platforms = lib.platforms.linux;
    sourceProvenance = with lib.sourceTypes; [
      fromSource
      binaryBytecode # for gradle dependencies
    ];
    mainProgram = "nav";
  };
})

Copy link
Contributor

@steeleduncan steeleduncan Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left an approving review as I don't see any real problem with packaging it as you have, and I wouldn't want to do anything to discourage someone with the commit bit merging it

I'm curious about the new gradle2nix though, so I'll have a try packaging with the v2 version, and if successful that can go as a separate PR once this is merged


nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
stdenv.cc.cc.lib
libxcrypt-legacy
];

installPhase = ''
runHook preInstall

mkdir -p $out/bin
cp nav $out/bin

runHook postInstall
'';

passthru.updateScript = nix-update-script { };

meta = {
description = "Interactive and stylish replacement for ls & cd";
longDescription = ''
To make use of nav, add the following lines to your configuration:
`programs.bash.shellInit = "eval \"$(nav --init bash)\"";` and
`programs.zsh.shellInit = "eval \"$(nav --init zsh)\"";`
'';
homepage = "https://github.com/Jojo4GH/nav";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
David-Kopczynski
Jojo4GH
];
platforms = lib.platforms.linux;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
mainProgram = "nav";
};
}
Loading