Fix including the overlay twice exploding nixos-option by making it idempotent
This commit is contained in:
parent
b4b38e6b5f
commit
4e25f1ab68
32
overlay.nix
32
overlay.nix
|
@ -54,9 +54,26 @@ let
|
||||||
inherit (prev) lib;
|
inherit (prev) lib;
|
||||||
|
|
||||||
prefetch-npm-deps-args = lib.functionArgs prev.prefetch-npm-deps.override;
|
prefetch-npm-deps-args = lib.functionArgs prev.prefetch-npm-deps.override;
|
||||||
in
|
|
||||||
override_2_18 //
|
warning = ''
|
||||||
{
|
warning: You have the lix overlay included into a nixpkgs import twice,
|
||||||
|
perhaps due to the NixOS module being included twice, or because of using
|
||||||
|
pkgs.nixos and also including it in imports, or perhaps some unknown
|
||||||
|
machinations of a complicated flake library.
|
||||||
|
This is completely harmless since we have no-op'd the second one if you are
|
||||||
|
seeing this message, but it would be a small style improvement to fix
|
||||||
|
it :)
|
||||||
|
P.S. If you had some hack to fix nixos-option build failures in your
|
||||||
|
configuration, that was caused by including an older version of the lix
|
||||||
|
overlay twice, which is now mitigated if you see this message, so you can
|
||||||
|
delete that.
|
||||||
|
P.P.S. This Lix has super catgirl powers.
|
||||||
|
'';
|
||||||
|
|
||||||
|
maybeWarnDuplicate = x: if final.lix-overlay-present > 1 then builtins.trace warning x else x;
|
||||||
|
|
||||||
|
overlay = override_2_18 // {
|
||||||
|
lix-overlay-present = 1;
|
||||||
# used for things that one wouldn't necessarily want to update, but we
|
# used for things that one wouldn't necessarily want to update, but we
|
||||||
# nevertheless shove it in the overlay and fixed-point it in case one *does*
|
# nevertheless shove it in the overlay and fixed-point it in case one *does*
|
||||||
# want to do that.
|
# want to do that.
|
||||||
|
@ -64,7 +81,7 @@ override_2_18 //
|
||||||
|
|
||||||
nixVersions = prev.nixVersions // rec {
|
nixVersions = prev.nixVersions // rec {
|
||||||
# FIXME: do something less scuffed
|
# FIXME: do something less scuffed
|
||||||
nix_2_18 = lixPkg;
|
nix_2_18 = maybeWarnDuplicate lixPkg;
|
||||||
stable = nix_2_18;
|
stable = nix_2_18;
|
||||||
nix_2_18_upstream = prev.nixVersions.nix_2_18;
|
nix_2_18_upstream = prev.nixVersions.nix_2_18;
|
||||||
};
|
};
|
||||||
|
@ -95,4 +112,9 @@ override_2_18 //
|
||||||
else prev.prefetch-npm-deps;
|
else prev.prefetch-npm-deps;
|
||||||
|
|
||||||
nix-doc = prev.callPackage ./nix-doc/package.nix { withPlugin = false; };
|
nix-doc = prev.callPackage ./nix-doc/package.nix { withPlugin = false; };
|
||||||
}
|
};
|
||||||
|
in
|
||||||
|
# Make the overlay idempotent, since flakes passing nixos modules around by
|
||||||
|
# value and many other things make it way too easy to include the overlay
|
||||||
|
# twice
|
||||||
|
if (prev ? lix-overlay-present) then { lix-overlay-present = 2; } else overlay
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
let
|
let
|
||||||
configs = {
|
configs = {
|
||||||
it-builds = nixos ({ ... }: {
|
it-builds = nixos ({ ... }: {
|
||||||
|
imports = [ lix-module ];
|
||||||
documentation.enable = false;
|
documentation.enable = false;
|
||||||
fileSystems."/".device = "ignore-root-device";
|
fileSystems."/".device = "ignore-root-device";
|
||||||
boot.loader.grub.enable = false;
|
boot.loader.grub.enable = false;
|
||||||
|
|
Loading…
Reference in a new issue