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

perSystem.packages cannot be used with recursive packages #176

Open
hmanhng opened this issue Jun 29, 2023 · 1 comment
Open

perSystem.packages cannot be used with recursive packages #176

hmanhng opened this issue Jun 29, 2023 · 1 comment
Labels
question Further information is requested

Comments

@hmanhng
Copy link

hmanhng commented Jun 29, 2023

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 = "[email protected]";
    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 = "[email protected]";
    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 = "[email protected]";
    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
Copy link
Member

roberth commented Jan 16, 2024

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:

  • Yes: packages that depend on other packages defined in the perSystem.packages option. (This is recursion through the module system fixpoint at perSystem)
  • Yes: packages that have other packages in their package attribute set. With the exception of <pkg>.tests.<name>, these are not well discoverable by tooling, so they're best to avoid.
  • Yes, but strict: packages in nested attribute sets. The flakes schema puts a restriction on this, that such "trees" of packages should be added in the legacyPackages attribute/option instead of in packages.

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

@roberth roberth added the question Further information is requested label Jan 29, 2024
shymega pushed a commit to shymega/flake-parts that referenced this issue Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants