Unverified Commit baa76d3a authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

apx: bugfix and add official vanilla-apx-configs #445912 (#461436)

parents 20dacac6 d05b2f14
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
buildGoModule rec {
  pname = "apx";
  version = "2.4.5";
  versionConfig = "1.0.0";

  src = fetchFromGitHub {
    owner = "Vanilla-OS";
@@ -19,6 +20,14 @@ buildGoModule rec {
    hash = "sha256-0Rfj7hrH26R9GHOPPVdCaeb1bfAw9KnPpJYXyiei90U=";
  };

  # Official Vanilla APX configs (stacks + package-managers)
  configsSrc = fetchFromGitHub {
    owner = "Vanilla-OS";
    repo = "vanilla-apx-configs";
    tag = "v${versionConfig}";
    hash = "sha256-cCXmHkRjcWcpMtgPVtQF5Q76jr1Qt2RHSLtWLQdq+aE=";
  };

  vendorHash = "sha256-RoZ6sXbvIHfQcup9Ba/PpzS0eytKdX4WjDUlgB3UjfE=";

  # podman needed for apx to not error when building shell completions
@@ -40,13 +49,21 @@ buildGoModule rec {
  postPatch = ''
    substituteInPlace config/apx.json \
      --replace-fail "/usr/share/apx/distrobox/distrobox" "${distrobox}/bin/distrobox" \
      --replace-fail "/usr/share/apx" "$out/bin/apx"
      --replace-fail "/usr/share/apx" "$out/share/apx"
    substituteInPlace settings/config.go \
      --replace-fail "/usr/share/apx/" "$out/share/apx/"
  '';

  postInstall = ''
    # Base configuration of apx
    install -Dm444 config/apx.json -t $out/share/apx/

    # Install official Vanilla configs (same as install script)
    install -d $out/share/apx
    cp -r ${configsSrc}/stacks $out/share/apx/
    cp -r ${configsSrc}/package-managers $out/share/apx/

    # Man pages, documentation, license
    installManPage man/man1/*
    install -Dm444 README.md -t $out/share/docs/apx
    install -Dm444 COPYING.md $out/share/licenses/apx/LICENSE
@@ -61,6 +78,16 @@ buildGoModule rec {

  meta = {
    description = "Vanilla OS package manager";
    longDescription = ''
      Apx is the Vanilla OS package manager that allows you to install packages
      from multiple sources inside managed containers without altering the host system.

      Note: This package requires Podman to be enabled in your NixOS configuration.
      Add the following to your configuration.nix:

        virtualisation.podman.enable = true;
        environment.systemPackages = with pkgs; [ apx ];
    '';
    homepage = "https://github.com/Vanilla-OS/apx";
    changelog = "https://github.com/Vanilla-OS/apx/releases/tag/v${version}";
    license = lib.licenses.gpl3Only;