feat: overhaul overlays module

This commit is contained in:
Michael Thomas 2024-05-07 20:52:31 -04:00
parent 5cf5528307
commit a345fb7849
2 changed files with 26 additions and 26 deletions

View File

@ -60,19 +60,7 @@
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# This repo's overlay plus any other overlays you use
# If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.\
overlays = {
default = import ./overlays inputs;
pkg-sets = (
final: prev: {
unstable = import inputs.unstable {system = final.system;};
trunk = import inputs.trunk {system = final.system;};
}
);
rust-overlay = rust-overlay.overlays.default;
vscode-extensions = nix-vscode-extensions.overlays.default;
};
overlays = import ./overlays {inherit inputs;};
overlaysModule = {
nixpkgs.overlays = builtins.attrValues self.overlays;

View File

@ -1,13 +1,25 @@
{
nixpkgs,
unstable,
...
}: let
inherit (nixpkgs.lib) composeManyExtensions;
inherit (builtins) attrNames readDir;
localOverlays =
map
(f: import (./default + "/${f}"))
(attrNames (readDir ./default));
in
composeManyExtensions localOverlays
{inputs, ...}: {
rust-overlay = inputs.rust-overlay.overlays.default;
vscode-extensions = inputs.nix-vscode-extensions.overlays.default;
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs final.pkgs;
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.unstable {
system = final.system;
config.allowUnfree = true;
};
};
}