Compare commits

...

2 Commits

Author SHA1 Message Date
33f5a3db37
Rework overlays
There are now two separate overlays:
- backports
- mitigations
2024-03-30 01:51:45 -04:00
9e15b68b79
rename, update overlays/README.md 2024-03-30 01:06:13 -04:00
5 changed files with 83 additions and 31 deletions

View File

@ -87,7 +87,10 @@
})
# various temporary fixes that automatically revert
(import ./overlays self)
self.overlays.mitigations
# auto backports from nixpkgs unstable
self.overlays.backports
inputs.hyprwm-contrib.overlays.default
inputs.rust-overlay.overlays.default
@ -284,6 +287,8 @@
apps = eachSystem (system: import ./pkgs/apps.nix
{ inherit (self.outputs) packages; inherit system; });
overlays = import ./overlays self;
nixosConfigurations = {
slab = mkSystem {
system = "x86_64-linux";

View File

@ -1,9 +1,20 @@
# backports
This is a nixpkgs overlay that contains temporary fixes for build failures or
other issues, usually backported from the nixpkgs master branch. Each package
defined in this overlay shall automatically disable itself once a certain
condition is met, such as the upstream package being updated or the nixpkgs
modification date passing a certain time.
# Overlays
This directory contains nixpkgs overlays which each serve some specific purpose.
## backports
This overlay defines programs that should be unconditionally backported from
nixpkgs-unstable. Packages backported in this overlay will be built using
inputs from the current system when possible, as to not unnecessarily increase
the closure size. This may result in unexpected breakages, as packages in
nixpkgs-unstable are built and tested against other such packages.
## mitigations
This overlay contains temporary fixes for build failures or other issues,
usually backported from the nixpkgs master branch. Each package defined in this
overlay shall automatically disable itself once a certain condition is met,
such as the upstream package being updated or the nixpkgs modification date
passing a certain time.
This is in place because I am extremely forgetful; I will almost certainly
forget to undo a temporary fix later, so this takes care of it for me.

20
overlays/backports.nix Normal file
View File

@ -0,0 +1,20 @@
nixfiles: final: prev:
let
pkgs-unstable = import nixfiles.inputs.nixpkgs-unstable { config.allowUnfree = true; inherit (final) system; };
inherit (final) callPackage lib electron_28;
backport = pkg: let
inherit (lib) getAttrFromPath;
inherit (builtins) getAttr isString;
getAttr' = name: attrs: if isString pkg then getAttr name attrs else getAttrFromPath name attrs;
oldPkg = getAttr' pkg prev;
newPkg = getAttr' pkg pkgs-unstable;
in if oldPkg.version == newPkg.version
then oldPkg
else (callPackage newPkg.override);
in {
vesktop = backport "vesktop" { };
obsidian = backport "obsidian" { electron = final.electron_28; };
}

View File

@ -1,25 +1,16 @@
nixfiles: final: prev:
nixfiles:
let
inherit (prev) callPackage fetchFromGitHub;
inherit (prev.lib) recurseIntoAttrs optionalAttrs;
isNewer = ref: ver: (builtins.compareVersions ver ref) == 1;
# if you can't do version based just make it time based and deal with it in a
# month if it's not fixed
# 2024-04-10T08:11:11
gap-hold = (nixfiles.inputs.nixpkgs-unstable.lastModified <= 1712751071);
gimpPlugins-gap = let
src = fetchFromGitHub {
owner = "Scrumplex";
repo = "nixpkgs";
rev = "cca25fd345f2c48de66ff0a950f4ec3f63e0420f";
hash="sha256-oat4TwOorFevUMZdBFgaQHx/UKqGW7CGMoOHVgQxVdM=";
};
in recurseIntoAttrs (callPackage "${src}/pkgs/applications/graphics/gimp/plugins" {});
in (optionalAttrs gap-hold { gimpPlugins = gimpPlugins-gap; }) //
# can't optionalAttrs for version checks because it breaks lazy eval and causes infinite recursion
{
obsidian = let
pkg = final.callPackage "${nixfiles.inputs.nixpkgs-unstable}/pkgs/applications/misc/obsidian" { electron = final.electron_28; };
in if isNewer "1.4.16" prev.obsidian.version then prev.obsidian else pkg;
}
inherit (nixfiles.inputs.nixpkgs) lib;
# this name is awful. maybe i don't know anything about functional
# programming or something, but the naming isn't very self explanatory
# - why is it "compose" instead of "combine"
# - why is it "extensions" instead of "overlays"
inherit (lib) composeManyExtensions;
in rec {
backports = import ./backports.nix nixfiles;
mitigations = import ./mitigations.nix nixfiles;
default = composeManyExtensions [
backports
mitigations
];
}

25
overlays/mitigations.nix Normal file
View File

@ -0,0 +1,25 @@
nixfiles: final: prev:
let
inherit (prev) callPackage fetchFromGitHub;
inherit (prev.lib) recurseIntoAttrs optionalAttrs;
isNewer = ref: ver: (builtins.compareVersions ver ref) == 1;
# if you can't do version based just make it time based and deal with it in a
# month if it's not fixed
# 2024-04-10T08:11:11
gap-hold = (nixfiles.inputs.nixpkgs-unstable.lastModified <= 1712751071);
gimpPlugins-gap = let
src = fetchFromGitHub {
owner = "Scrumplex";
repo = "nixpkgs";
rev = "cca25fd345f2c48de66ff0a950f4ec3f63e0420f";
hash="sha256-oat4TwOorFevUMZdBFgaQHx/UKqGW7CGMoOHVgQxVdM=";
};
in recurseIntoAttrs (callPackage "${src}/pkgs/applications/graphics/gimp/plugins" {});
in (optionalAttrs gap-hold { gimpPlugins = gimpPlugins-gap; })
# # can't optionalAttrs for version checks because it breaks lazy eval and causes infinite recursion
# // {
# obsidian = let
# pkg = final.callPackage "${nixfiles.inputs.nixpkgs-unstable}/pkgs/applications/misc/obsidian" { electron = final.electron_28; };
# in if isNewer "1.4.16" prev.obsidian.version then prev.obsidian else pkg;
# }