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 # Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# This repo's overlay plus any other overlays you use overlays = import ./overlays {inherit inputs;};
# 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;
};
overlaysModule = { overlaysModule = {
nixpkgs.overlays = builtins.attrValues self.overlays; nixpkgs.overlays = builtins.attrValues self.overlays;

View File

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