generated from goodbyekansas/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add support for nixpkgs up to 23.11
Note that for newer versions of nixpkgs, this also requires a new Nedryland version.
- Loading branch information
Showing
45 changed files
with
2,131 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,111 @@ | ||
let self = | ||
args@{ base | ||
, lib | ||
, pkgs | ||
, platforms ? { } | ||
, extraAttrs ? { } | ||
# TODO: remove generateDocs in next major. It is renamed to enableDoxygen to be | ||
# consistent with make-derivation.nix | ||
, generateDocs ? true | ||
, enableDoxygen ? true | ||
, components | ||
, mathjax ? null | ||
}: | ||
let | ||
enableDoxygen' = | ||
if args ? generateDocs then | ||
lib.trivial.warn | ||
'' | ||
generateDocs is deprecated, use enableDoxygen instead. | ||
enableDoxygen can also be used on derivation-level. | ||
'' | ||
generateDocs | ||
else | ||
enableDoxygen; | ||
mathjaxDefaultVersion = "3.2.2"; | ||
mathjax' = | ||
if mathjax == null then | ||
builtins.fetchurl | ||
{ | ||
url = "https://cdn.jsdelivr.net/npm/mathjax@${mathjaxDefaultVersion}/es5/tex-svg.js"; | ||
sha256 = "sha256:10m80cpdhk1jqvqvkzy8qls7nmsra77fx7rrq4snk0s46z1msafl"; | ||
} else mathjax; | ||
let | ||
self = | ||
args@{ base | ||
, lib | ||
, pkgs | ||
, platforms ? { } | ||
, extraAttrs ? { } | ||
# TODO: remove generateDocs in next major. It is renamed to enableDoxygen to be | ||
# consistent with make-derivation.nix | ||
, generateDocs ? true | ||
, enableDoxygen ? true | ||
, components | ||
, mathjax ? null | ||
}: | ||
let | ||
enableDoxygen' = | ||
if args ? generateDocs then | ||
lib.trivial.warn | ||
'' | ||
generateDocs is deprecated, use enableDoxygen instead. | ||
enableDoxygen can also be used on derivation-level. | ||
'' | ||
generateDocs | ||
else | ||
enableDoxygen; | ||
mathjaxDefaultVersion = "3.2.2"; | ||
mathjax' = | ||
if mathjax == null then | ||
builtins.fetchurl | ||
{ | ||
url = "https://cdn.jsdelivr.net/npm/mathjax@${mathjaxDefaultVersion}/es5/tex-svg.js"; | ||
sha256 = "sha256:10m80cpdhk1jqvqvkzy8qls7nmsra77fx7rrq4snk0s46z1msafl"; | ||
} else mathjax; | ||
|
||
inner = | ||
{ name | ||
, pkgs | ||
, stdenv ? pkgs.stdenv | ||
, output ? null | ||
, platformOverrides ? _: { } | ||
}: | ||
let | ||
factory = pkgs.callPackage (import ./make-derivation.nix platformOverrides) | ||
{ | ||
inherit base stdenv components; | ||
targetName = name; | ||
mathjax = mathjax'; | ||
}; | ||
inner = | ||
{ name | ||
, pkgs | ||
, stdenv ? pkgs.stdenv | ||
, output ? null | ||
, platformOverrides ? _: { } | ||
}: | ||
let | ||
factory = pkgs.callPackage (import ./make-derivation.nix platformOverrides) | ||
{ | ||
inherit base stdenv components; | ||
targetName = name; | ||
mathjax = mathjax'; | ||
}; | ||
|
||
finalPlatform = factory: | ||
{ | ||
inherit name pkgs; | ||
__functor = _self: factory; | ||
overrideFactory = overrides: | ||
finalPlatform ( | ||
factory.override overrides); | ||
} // lib.optionalAttrs (output != null) { inherit output; }; | ||
in | ||
(finalPlatform factory); | ||
finalPlatform = factory: | ||
{ | ||
inherit name pkgs; | ||
__functor = _self: factory; | ||
overrideFactory = overrides: | ||
finalPlatform ( | ||
factory.override overrides); | ||
} // lib.optionalAttrs (output != null) { inherit output; }; | ||
in | ||
finalPlatform factory; | ||
|
||
mkPlatform = lib.makeOverridable inner; | ||
mkPlatform = lib.makeOverridable inner; | ||
|
||
platforms' = { | ||
_default = mkPlatform { | ||
inherit pkgs; | ||
name = "_default"; | ||
}; | ||
} // platforms; | ||
platforms' = { | ||
_default = mkPlatform { | ||
inherit pkgs; | ||
name = "_default"; | ||
}; | ||
} // platforms; | ||
|
||
createPlatformTargets = attrsOrFn: | ||
lib.mapAttrs' | ||
(name: platform: { | ||
name = platform.output or name; | ||
value = platform attrsOrFn; | ||
}) | ||
platforms'; | ||
createPlatformTargets = attrsOrFn: | ||
lib.mapAttrs' | ||
(name: platform: { | ||
name = platform.output or name; | ||
value = platform attrsOrFn; | ||
}) | ||
platforms'; | ||
|
||
toComponent = componentFactory: targets: | ||
componentFactory | ||
({ | ||
name = targets._default.name; | ||
version = targets._default.version; | ||
} // targets // lib.optionalAttrs (targets._default.enableDoxygen or enableDoxygen') { | ||
docs.api = targets._default.doc; | ||
}); | ||
in | ||
extraAttrs // rec { | ||
inherit mkPlatform; | ||
platforms = platforms' // { | ||
override = overridePlatforms; | ||
}; | ||
toComponent = componentFactory: targets: | ||
componentFactory | ||
({ | ||
inherit (targets._default) name; | ||
inherit (targets._default) version; | ||
} // targets // lib.optionalAttrs (targets._default.enableDoxygen or enableDoxygen') { | ||
docs.api = targets._default.doc; | ||
}); | ||
in | ||
extraAttrs // rec { | ||
inherit mkPlatform; | ||
platforms = platforms' // { | ||
override = overridePlatforms; | ||
}; | ||
|
||
name = "c/c++"; | ||
emoji = "🦕"; | ||
description = '' | ||
C/C++ | ||
''; | ||
name = "c/c++"; | ||
emoji = "🦕"; | ||
description = '' | ||
C/C++ | ||
''; | ||
|
||
overrideAttrs = f: self (args // { | ||
extraAttrs = (extraAttrs // (f extraAttrs)); | ||
}); | ||
overridePlatforms = f: self (args // { | ||
platforms = (platforms' // (f platforms')); | ||
}); | ||
} // ( | ||
builtins.listToAttrs | ||
(builtins.map | ||
(t: { name = "mk${t}"; value = attrsOrFn: toComponent base."mk${t}" (createPlatformTargets attrsOrFn); }) | ||
[ "Library" "Client" "Service" ])); | ||
in self | ||
overrideAttrs = f: self (args // { | ||
extraAttrs = extraAttrs // (f extraAttrs); | ||
}); | ||
overridePlatforms = f: self (args // { | ||
platforms = platforms' // (f platforms'); | ||
}); | ||
} // ( | ||
builtins.listToAttrs | ||
(builtins.map | ||
(t: { name = "mk${t}"; value = attrsOrFn: toComponent base."mk${t}" (createPlatformTargets attrsOrFn); }) | ||
[ "Library" "Client" "Service" ])); | ||
in | ||
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{}: | ||
_: | ||
{ | ||
languages = import ./languages.nix; | ||
protobuf = import ./protobuf.nix; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.