Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions dev-shells/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ mapAttrs (system: pkgs: {

];

shellHook =
''
export NIXOSLOGO_SRC=$(git rev-parse --show-toplevel)/package-sets/python-packages/nixoslogo
export NIXOS_ANNOTATIONS_FONT_FILE="${jura}/share/fonts/truetype/jura/Jura-Regular.ttf"
export NIXOS_COLOR_PALETTE_FILE="${nixos-branding.nixos-color-palette}/colors.toml";
export NIXOS_LOGOTYPE_FONT_FILE="${route159}/share/fonts/opentype/route159/Route159-Regular.otf"
''
+ checks.${system}.pre-commit-check.shellHook;
shellHook = ''
export NIXOSLOGO_SRC=$(git rev-parse --show-toplevel)/package-sets/python-packages/nixoslogo
export NIXOS_ANNOTATIONS_FONT_FILE="${jura}/share/fonts/truetype/jura/Jura-Regular.ttf"
export NIXOS_COLOR_PALETTE_FILE="${nixos-branding.nixos-color-palette}/colors.toml";
export NIXOS_LOGOTYPE_FONT_FILE="${route159}/share/fonts/opentype/route159/Route159-Regular.otf"
''
+ checks.${system}.pre-commit-check.shellHook;

}
) { };
Expand Down
36 changes: 18 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 0 additions & 112 deletions overlays/add-typix-library/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ let
composeManyExtensions
;

inherit (lib.strings)
versionOlder
;

inherit (lib.trivial)
warnIf
;

in

composeManyExtensions [
Expand All @@ -27,108 +19,4 @@ composeManyExtensions [
typix-lib = inputs.typix.lib.${final.stdenv.hostPlatform.system};
})

(
final: prev:

{
typix-lib =
let
versionThreshold = "0.13.1";
currentTypstVersion = final.typst.version;
in
prev.typix-lib.overrideScope (
finalScope: prevScope:
warnIf (versionOlder versionThreshold currentTypstVersion)
''
The current version of typst is ${currentTypstVersion} which is older than version ${versionThreshold}.
This overlay was created because typst version ${versionThreshold} did not deterministically create PDF files.
Specifically, certain color data in SVG files were not being embedded in the SVG file deterministically.
Try removing this overlay and see if the NixOS Branding Guide can be built and then re-built deterministically.
If it can, remove this overlay. If not, bump the version threshold.
''
{

qpdf = warnIf (versionOlder "12" prev.qpdf.version) ''
Upstream qpdf has reached version 12. This override and the associated derivation definition can be removed.
'' final.qpdf;

buildDeterministicTypstProject = finalScope.callPackage (
{
lib,
mkTypstDerivation,
ocamlPackages,
qpdf,
typstOptsFromArgs,
}:
args@{
typstCompileCommand ? "typst compile",
typstSource ? "main.typ",
...
}:
let

inherit (lib.attrsets)
removeAttrs
;

inherit (lib.strings)
escapeShellArg
removeSuffix
;

typstOptsString = args.typstOptsString or (typstOptsFromArgs args);

cleanedArgs = removeAttrs args [
"typstCompileCommand"
"typstOpts"
"typstOptsString"
"typstOutput"
"typstSource"
];

outfileName = "${removeSuffix ".typ" typstSource}";

nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
ocamlPackages.cpdf
qpdf
];

in
mkTypstDerivation (
cleanedArgs
// {
inherit
nativeBuildInputs
;

buildPhaseTypstCommand =
args.buildPhaseTypstCommand or ''
${typstCompileCommand} \
${typstOptsString} \
${escapeShellArg typstSource} \
${outfileName}-compile.pdf

# need to remove the trailer ID so it can be recreated deterministically
cpdf \
-i ${outfileName}-compile.pdf \
-remove-id \
-o ${outfileName}-no-meta.pdf

qpdf \
${outfileName}-no-meta.pdf \
--remove-metadata \
--deterministic-id \
${outfileName}.pdf

mkdir $out
cp ${outfileName}.pdf $out/
'';
}
)
) { };

}
);
})

]
24 changes: 18 additions & 6 deletions package-sets/python-packages/coloraide/package.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
hatchling,
lib,
pytestCheckHook,
typing-extensions,
}:

buildPythonPackage rec {
let
version = "6.1";
in
buildPythonPackage {
pname = "coloraide";
version = "4.5.1";
inherit version;
pyproject = true;

src = fetchFromGitHub {
owner = "facelessuser";
repo = "coloraide";
tag = version;
hash = "sha256-/jhVYJE3zxnSTPTFWB4CWw3TPq1qyte+hN7hcgzbbkE=";
hash = "sha256-hsuFouesw4B9rr17NCQVB6LyYUdNRm9Cj2Cqj+MdLkc=";
};

build-system = [
hatchling
];

dependencies = [
typing-extensions
];

pythonImportsCheck = [
"coloraide"
];

nativeCheckInputs = [
pytestCheckHook
];

meta = {
description = "A library to aid in using colors";
homepage = "https://github.com/facelessuser/coloraide";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ djacu ];
maintainers = [ ];
};
}
Loading