Skip to content

Conversation

tomeon
Copy link
Contributor

@tomeon tomeon commented Jun 17, 2022

Cherry-picked from #155.

Don't use lib.mkForce on the system.build.kexec_tarball definition when building on a nixpkgs version from before the commit that changed config.system.build's type from a lazy attribute set to a submodule.

Prior to this type change, there is no system.build.kexec_tarball option declared, so the NixOS module system does not resolve priorities/overrides in the config.build.kexec_tarball definition.

That is, with lib.mkForce, the config.build.kexec_tarball definition ends up being something like:

{
  _type = "override";
  content = <...>;
  priority = 50;
}

Removing lib.mkForce permits sensibly interpolating system.build.kexec_tarball in system.build.kexec_bundle's builder script.

Likewise, no lib.mkOverride for system.build.raw.

This PR introduces two shim functions defined in ./lib.nix, maybe.mkForce and maybe.mkOverride, that try to detect whether config.system.build is a submodule and:

  1. if so, pass through to lib.mkForce or lib.mkOverride, and
  2. If not, just return the supplied argument as-is.

on nixpkgs versions prior to the commit that changed
config.system.build's type from a lazy attribute set to a submodule.

Prior to this type change, there is no system.build.kexec_tarball option
declared, so the NixOS module system does not resolve
priorities/overrides in the config.build.kexec_tarball definition.

That is, with lib.mkForce, the config.build.kexec_tarball definition
ends up being something like:

    {
      _type = "override";
      content = <...>;
      priority = 50;
    }

Removing lib.mkForce allows us to successfully and sensibly interpolate
the value (== outPath) of system.build.kexec_tarball in
system.build.kexec_bundle's builder script.

Likewise, no lib.mkOverride for system.build.raw.
@Lassulus Lassulus merged commit 898edde into nix-community:master Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants