svanderburg / composer2nix

Generate Nix expressions to build PHP composer packages
MIT License
88 stars 25 forks source link

name of resulting package always "composer-${name}" #16

Closed ymarkus closed 1 year ago

ymarkus commented 3 years ago

Right now, I'm trying to create a package for BookStack and I've been successful doing so with composer2nix. The issue for upstreaming the package is the name, as it is stored in the nix store as composer-${name} and I can't seem to change it to ${name}-${version}.

default.nix:

{ pkgs, system, lib, fetchFromGitHub, dataDir ? "/var/lib/bookstack" }:

let
  package = (import ./composition.nix {
    inherit pkgs system;
    noDev = true; # Disable development dependencies
  }).overrideAttrs (attrs : {
    installPhase = attrs.installPhase + ''
      rm -R $out/storage $out/public/uploads
      ln -s ${dataDir}/storage $out/storage
      ln -s ${dataDir}/public/uploads $out/public/uploads
    '';
  });

in package.override rec {
  name = "bookstack";
  version = "0.31.3";
  removeComposerArtifacts = true; # Remove composer configuration files

  src = fetchFromGitHub {
    owner = "bookstackapp";
    repo = "${name}";
    rev = "v${version}";
    sha256 = "1w4lfy543h1fv3dsl3j0vyjw72n0sbpvipfnai8x1p01fqpnxpgm";
  };

  meta = with lib; {
    description = "A platform to create documentation/wiki content built with PHP & Laravel";
    longDescription = ''
      A platform for storing and organising information and documentation.
      Details for BookStack can be found on the official website at https://www.bookstackapp.com/.
    '';
    homepage = "https://www.bookstackapp.com/";
    license = licenses.mit;
    maintainers = with maintainers; [ ymarkus ];
    platforms = platforms.linux;
  };
}

composition.nix (this and all other files unchanged from the "default.nix" created by composer2nix):

{pkgs ? import <nixpkgs> {
    inherit system;
  }, system ? builtins.currentSystem, noDev ? false}:

let
  composerEnv = import ./composer-env.nix {
    inherit (pkgs) stdenv writeTextFile fetchurl php unzip phpPackages;
  };
in
import ./php-packages.nix {
  inherit composerEnv noDev;
  inherit (pkgs) fetchurl fetchgit fetchhg fetchsvn;
}

Is there a way to fix the package name? I've tried setting pname, but that doesn't work either...

samuelludwig commented 3 years ago

I can confirm that this has created issues for me as well when I was trying to turn the repo into a flake this morning.

svanderburg commented 2 years ago

I've just removed the prefix in c1f98cdac1bb0f5cd84fa2ce6800e613269e0cce. It also seems to give issues when querying packages.

It should now be possible to override the name parameter.