mirror of
https://github.com/gytis-ivaskevicius/flake-utils-plus.git
synced 2024-10-26 17:16:28 +03:00
62 lines
2.0 KiB
Nix
62 lines
2.0 KiB
Nix
{
|
|
description = "Pure Nix flake utility functions";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
outputs = { self, flake-utils }:
|
|
let
|
|
inherit (builtins) isList isAttrs mapAttrs;
|
|
inherit (flake-utils.lib) defaultSystems eachSystemMap;
|
|
fupArgs = { flake-utils-plus = self; };
|
|
|
|
mkFlake = import ./lib/mkFlake.nix fupArgs;
|
|
exportModules = import ./lib/exportModules.nix fupArgs;
|
|
exportOverlays = import ./lib/exportOverlays.nix fupArgs;
|
|
exportPackages = import ./lib/exportPackages.nix fupArgs;
|
|
genPkgOverlay = import ./lib/genPkgOverlay.nix;
|
|
internal-functions = import ./lib/internal-functions.nix;
|
|
overlay = final: prev: {
|
|
__dontExport = true;
|
|
fup-repl = final.callPackage ./lib/fup-repl.nix { };
|
|
};
|
|
|
|
in
|
|
rec {
|
|
inherit overlay;
|
|
|
|
blueprints.fup-repl = ./lib/fup-repl.nix;
|
|
nixosModules.autoGenFromInputs = import ./lib/options.nix;
|
|
darwinModules.autoGenFromInputs = import ./lib/options.nix;
|
|
|
|
devShell = eachSystemMap defaultSystems (system: import ./devShell.nix { inherit system; });
|
|
|
|
lib = flake-utils.lib // {
|
|
inherit mkFlake exportModules exportOverlays exportPackages genPkgOverlay;
|
|
|
|
# DO NOT USE - subject to change without notice
|
|
internal = internal-functions;
|
|
|
|
# merge nested attribute sets and lists
|
|
mergeAny = lhs: rhs:
|
|
lhs // mapAttrs
|
|
(name: value:
|
|
if isAttrs value then lhs.${name} or { } // value
|
|
else if isList value then lhs.${name} or [ ] ++ value
|
|
else value
|
|
)
|
|
rhs;
|
|
|
|
patchChannel = system: channel: patches:
|
|
if patches == [ ] then channel else
|
|
(import channel { inherit system; }).pkgs.applyPatches {
|
|
name = if channel ? shortRev then "nixpkgs-patched-${channel.shortRev}" else "nixpkgs-patched";
|
|
src = channel;
|
|
patches = patches;
|
|
};
|
|
|
|
};
|
|
};
|
|
}
|
|
|
|
|