Skip to content

Commit

Permalink
🐛 Fix override for C platforms
Browse files Browse the repository at this point in the history
After calling `overrideFactory` on a C platform, the `override` function
was dropped from the resulting set.
  • Loading branch information
abbec committed Sep 13, 2024
1 parent 05b6885 commit c577eae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## Fixed
- Overriding the factory of a C platform caused the 'override' function
to disappear from the resulting set.

## [4.1.4] - 2024-06-03

## Fixed
Expand Down
21 changes: 11 additions & 10 deletions c/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,35 @@ let
sha256 = "sha256:10m80cpdhk1jqvqvkzy8qls7nmsra77fx7rrq4snk0s46z1msafl";
} else mathjax;

inner =
mkPlatform =
{ name
, pkgs
, stdenv ? pkgs.stdenv
, output ? null
, platformOverrides ? _: { }
}:
, factoryOverrides ? { }
}@args:
let
factory = pkgs.callPackage (import ./make-derivation.nix platformOverrides)
{
factory = pkgs.callPackage
(import ./make-derivation.nix platformOverrides)
({
inherit base stdenv components;
targetName = name;
mathjax = mathjax';
};
} // factoryOverrides);

finalPlatform = factory:
{
inherit name pkgs;
__functor = _self: factory;
override = overrides:
mkPlatform (args // overrides);
overrideFactory = overrides:
finalPlatform (
factory.override overrides);
} // lib.optionalAttrs (output != null) { inherit output; };
finalPlatform (factory.override overrides);
} // { inherit output; };
in
finalPlatform factory;

mkPlatform = lib.makeOverridable inner;

platforms' = {
_default = mkPlatform {
inherit pkgs;
Expand Down

0 comments on commit c577eae

Please sign in to comment.