Commit 571f390d authored by Audrey Dutcher's avatar Audrey Dutcher Committed by John Ericson
Browse files

freebsd: Only support branch selection via override... for now.

Remove config element for freebsdBranch
parent d5972ed6
Loading
Loading
Loading
Loading
+0 −0

Empty file deleted.

+24 −47
Original line number Diff line number Diff line
{
  lib,
  config,
  makeScopeWithSplicing',
  generateSplicesForMkScope,
  callPackage,
  crossLibcStdenv,
  attributePathToSplice ? [ "freebsd" ],
  branch ? "release/13.1.0",
}:

let
@@ -20,34 +21,9 @@ let
      * `stable/<major>` for stable versions working towards the next minor release
      * `main` for the latest development version

      Set one with the NIXPKGS_FREEBSD_BRANCH environment variable or by setting `nixpkgs.config.freebsdBranch`.
      Branches can be selected by overriding the `branch` attribute on the freebsd package set.
    '';

  attributes =
    let
      supported13 = "release/13.1.0";
      supported14 = "release/14.0.0";
      branch =
        let
          fallbackBranch = supported13;
          envBranch = builtins.getEnv "NIXPKGS_FREEBSD_BRANCH";
          selectedBranch =
            if config.freebsdBranch != null then
              config.freebsdBranch
            else if envBranch != "" then
              envBranch
            else
              null;
          chosenBranch = if selectedBranch != null then selectedBranch else fallbackBranch;
        in
        chosenBranch;
    in
    {
      freebsd = versions.${branch} or (badBranchError branch);
      freebsd13 = versions.${supported13} or (badBranchError supported13);
      freebsd14 = versions.${supported14} or (badBranchError supported14);
    };

  # `./package-set.nix` should never know the name of the package set we
  # are constructing; just this function is allowed to know that. This
  # is why we:
@@ -57,31 +33,32 @@ let
  #  - construct the *anonymized* `buildFreebsd` attribute to be passed
  #    to `./package-set.nix`.
  callFreeBSDWithAttrs =
    extraArgs: attribute: sourceData:
    extraArgs:
    let
      otherSplices = generateSplicesForMkScope [ attribute ];
      # we do not include the branch in the splice here because the branch
      # parameter to this file will only ever take on one value - more values
      # are provided through overrides.
      otherSplices = generateSplicesForMkScope attributePathToSplice;
    in
    makeScopeWithSplicing' {
      inherit otherSplices;
      f = callPackage ./package-set.nix (
      f =
        self:
        {
          inherit branch;
        }
        // callPackage ./package-set.nix (
          {
            sourceData = versions.${self.branch} or (throw (badBranchError self.branch));
            versionData = self.sourceData.version;
            buildFreebsd = otherSplices.selfBuildHost;
          inherit sourceData;
          versionData = sourceData.version;
          patchesRoot = ./patches/${sourceData.version.revision};
            patchesRoot = ./patches/${self.versionData.revision};
          }
          // extraArgs
      );
        ) self;
    };

  exportedAttrSetsNative = lib.mapAttrs (callFreeBSDWithAttrs { }) attributes;

  exportedAttrSetsCross = lib.mapAttrs' (
    name: sourceData:
    lib.nameValuePair (name + "Cross") (
      callFreeBSDWithAttrs { stdenv = crossLibcStdenv; } name sourceData
    )
  ) attributes;
in

exportedAttrSetsNative // exportedAttrSetsCross
{
  freebsd = callFreeBSDWithAttrs { };
  freebsdCross = callFreeBSDWithAttrs { stdenv = crossLibcStdenv; };
}
+2 −4
Original line number Diff line number Diff line
@@ -40911,9 +40911,7 @@ with pkgs;
  } ../os-specific/bsd/setup-hook.sh;
  inherit (callPackage ../os-specific/bsd/freebsd { })
  freebsd freebsdCross
  freebsd13 freebsd13Cross
  freebsd14 freebsd14Cross;
    freebsd freebsdCross;
  netbsd = callPackage ../os-specific/bsd/netbsd { };
  netbsdCross = callPackage ../os-specific/bsd/netbsd {
+0 −8
Original line number Diff line number Diff line
@@ -74,14 +74,6 @@ let
      feature = "set `__contentAddressed` to true by default";
    };

    freebsdBranch = mkMassRebuild {
      type = types.nullOr types.str;
      default = null;
      description = ''
        Default FreeBSD release to use for FreeBSD packages
      '';
    };

    allowAliases = mkOption {
      type = types.bool;
      default = true;