extract & rework backports overlay

main
Felix Stupp 2 months ago
parent b718f36bb0
commit 0dfac33429
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -100,6 +100,8 @@
nixosModules = importFlakeMod ./nix/nixos-modules; nixosModules = importFlakeMod ./nix/nixos-modules;
overlays = importFlakeMod ./nix/overlays;
packages = importFlakeModWithSystem ./nix/packages; packages = importFlakeModWithSystem ./nix/packages;
}; };

@ -49,14 +49,7 @@
outputs.nixosModules.banananetwork outputs.nixosModules.banananetwork
]; ];
config = { config = {
nixpkgs.overlays = [ nixpkgs.overlays = lib.singleton outputs.overlays.backports;
# TODO until 24.11
(lib.mkIf (!lib.versionAtLeast lib.version "24.11") (
final: prev: {
inherit ((lib.systemSpecificVars pkgs.system).pkgs_unstable) nixfmt-rfc-style wcurl;
}
))
];
}; };
}; };

@ -0,0 +1,20 @@
{ lib, ... }@flakeArg:
{ pkgs_unstable, ... }@systemArg:
final: prev:
let
list = [
# TODO until 24.11
"nixfmt-rfc-style"
"wcurl"
];
backport =
pkgAttrName:
let
alreadyStable = builtins.hasAttr pkgAttrName prev;
stableSource = lib.warn "consider removing ${pkgAttrName} from backports list as it is now available on stable" prev;
source = if alreadyStable then stableSource else pkgs_unstable;
pkg = builtins.getAttr pkgAttrName source;
in
pkg;
in
lib.genAttrs list backport

@ -0,0 +1,14 @@
{ lib, ... }@flakeArg:
let
inherit (lib) systemSpecificVars;
rawImport = path: import path flakeArg;
wrapOverlay =
overlay: final: prev:
overlay (systemSpecificVars prev.system) final prev;
importOverlay = path: wrapOverlay (rawImport path);
in
{
backports = importOverlay ./backports.nix;
}
Loading…
Cancel
Save