chore: initial commit

This commit is contained in:
Jake Hamilton 2022-09-07 17:06:33 -07:00
commit 7e8aabfaff
No known key found for this signature in database
GPG key ID: 9762169A1B35EA68
19 changed files with 2505 additions and 0 deletions

43
lib/overlay/default.nix Normal file
View file

@ -0,0 +1,43 @@
{ core-inputs
, user-inputs
, snowfall-lib
}:
let
inherit (core-inputs.nixpkgs.lib) assertMsg;
user-overlays-root = snowfall-lib.fs.get-file "overlays";
in
{
overlay = {
# Create a flake-utils-plus overlays builder.
# Type: Attrs -> Attrs -> [(a -> b -> c)]
# Usage: create-overlays { src = ./my-overlays; overlay-package-namespace = "my-packages"; }
# result: (channels: [ ... ])
create-overlays =
{ src ? user-overlays-root
, overlay-package-namespace ? null
, extra-overlays ? [ ]
}: channels:
let
user-overlays = snowfall-lib.fs.get-default-nix-files-recursive src;
create-overlay = overlay: import overlay (user-inputs // { inherit channels; });
user-packages-overlay = final: prev:
let
user-packages = snowfall-lib.package.create-packages {
channels = channels;
};
user-packages-without-default = builtins.removeAttrs
(user-packages) [ "default" ];
in
if overlay-package-namespace == null then
user-packages-without-default
else
{
${overlay-package-namespace} = user-packages-without-default;
};
overlays = [ user-packages-overlay ] ++ extra-overlays ++ (builtins.map create-overlay user-overlays);
in
overlays;
};
}