nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 makeScopeWithSplicing',
3 generateSplicesForMkScope,
4 callPackage,
5 attributePathToSplice ? [ "freebsd" ],
6 branch ? "release/14.2.0",
7}:
8
9let
10 versions = builtins.fromJSON (builtins.readFile ./versions.json);
11
12 badBranchError =
13 branch:
14 throw ''
15 Unknown FreeBSD branch ${branch}!
16 FreeBSD branches normally look like one of:
17 * `release/<major>.<minor>.0` for tagged releases without security updates
18 * `releng/<major>.<minor>` for release update branches with security updates
19 * `stable/<major>` for stable versions working towards the next minor release
20 * `main` for the latest development version
21
22 Branches can be selected by overriding the `branch` attribute on the freebsd package set.
23 '';
24
25 # we do not include the branch in the splice here because the branch
26 # parameter to this file will only ever take on one value - more values
27 # are provided through overrides.
28 otherSplices = generateSplicesForMkScope attributePathToSplice;
29in
30# `./package-set.nix` should never know the name of the package set we
31# are constructing; just this function is allowed to know that. This
32# is why we:
33#
34# - do the splicing for cross compilation here
35#
36# - construct the *anonymized* `buildFreebsd` attribute to be passed
37# to `./package-set.nix`.
38makeScopeWithSplicing' {
39 inherit otherSplices;
40 f =
41 self:
42 {
43 inherit branch;
44 }
45 // callPackage ./package-set.nix ({
46 sourceData = versions.${self.branch} or (throw (badBranchError self.branch));
47 versionData = self.sourceData.version;
48 buildFreebsd = otherSplices.selfBuildHost;
49 patchesRoot = ./patches + "/${self.versionData.revision}";
50 }) self;
51}