hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
748 stars 40 forks source link

perSystem.packages cannot be used with recursive packages #176

Open hmanhng opened 1 year ago

hmanhng commented 1 year ago

I use perSystem.packages to put the packages in, I try to create a folder firefox-addons like this:

{ fetchurl, lib, stdenv }@args:

let
  buildFirefoxXpiAddon = lib.makeOverridable ({ stdenv ? args.stdenv
    , fetchurl ? args.fetchurl, pname, version, addonId, url, sha256,...
    }:
    stdenv.mkDerivation {
      name = "${pname}-${version}";

      src = fetchurl { inherit url sha256; };

      preferLocalBuild = true;
      allowSubstitutes = true;

      buildCommand = ''
        dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
        mkdir -p "$dst"
        install -v -m644 "$src" "$dst/${addonId}.xpi"
      '';
    });
in
{

  dashlane = buildFirefoxXpiAddon {
    pname = "dashlane";
    version = "6.2321.2";
    addonId = "jetpack-extension@dashlane.com";
    url = "https://prod.extensions.dashlane.com/downloads/firefox/dashlane-latest-fx.xpi";
    sha256 = "sha256-YcwL/MFfMrIuLDngK3fzclEC58jR02fe7zOh5XWOZwg=";
  };
  default-zoom = buildFirefoxXpiAddon {
    pname = "default-zoom";
    version = "1.1.3";
    addonId = "default-zoom@jamielinux.com";
    url = "https://addons.mozilla.org/firefox/downloads/file/3567861/default_zoom-1.1.3.xpi";
    sha256 = "sha256-bbAC380jFU8Q0ewXfM5O1YcbJXrlnF279WqV2dkgGHY=";
  };
  aria2 = buildFirefoxXpiAddon {
    pname = "aria2-integration";
    version = "4.3.0";
    addonId = "baptistecdr@users.noreply.github.com";
    url = "https://addons.mozilla.org/firefox/downloads/file/4099805/aria2_extension-4.3.0.xpi";
    sha256 = "sha256-MXDHbdSYzaEpQcUz/YXQqKQ5t6q4h83O+84KHN2nAqI=";
  };
}

like nur.rycee. I have tried callPackages ./pkgs/firefox-addons { }; as well as pkgs.recurseIntoAttrs (pkgs.callPackage ./pkgs/firefox-addons { }); but it doesn't work at all. I don't know where did I go wrong?

roberth commented 9 months ago

Hi @hmanhng,

I am sorry to be so late to respond to this issue. I try to keep up with flake-parts notifications but this one fell through the cracks somehow.

perSystem.packages does support recursive packages, although the flakes schema does impose a restriction. Support is as follows:

Do you still have this code? If the above doesn't already answer your question, I'd like to help.