2021-03-13 16:39:03 +03:00
|
|
|
{
|
|
|
|
description = "Pure Nix flake utility functions";
|
2021-03-14 15:26:29 +03:00
|
|
|
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
2021-03-27 13:28:27 +03:00
|
|
|
outputs = { self, flake-utils }:
|
2021-04-18 08:58:47 +03:00
|
|
|
let
|
2021-04-27 09:45:51 +03:00
|
|
|
inherit (builtins) isList isAttrs mapAttrs;
|
2022-05-13 19:41:04 +03:00
|
|
|
inherit (flake-utils.lib) defaultSystems eachSystemMap;
|
2021-04-18 08:58:47 +03:00
|
|
|
fupArgs = { flake-utils-plus = self; };
|
2021-05-15 16:47:15 +03:00
|
|
|
|
2021-07-17 15:09:49 +03:00
|
|
|
mkFlake = import ./lib/mkFlake.nix fupArgs;
|
|
|
|
exportModules = import ./lib/exportModules.nix fupArgs;
|
|
|
|
exportOverlays = import ./lib/exportOverlays.nix fupArgs;
|
|
|
|
exportPackages = import ./lib/exportPackages.nix fupArgs;
|
2022-01-14 04:10:39 +03:00
|
|
|
genPkgOverlay = import ./lib/genPkgOverlay.nix;
|
2021-07-17 15:09:49 +03:00
|
|
|
internal-functions = import ./lib/internal-functions.nix;
|
2021-06-20 15:17:25 +03:00
|
|
|
overlay = import ./lib/overlay.nix;
|
2021-04-18 08:58:47 +03:00
|
|
|
in
|
2021-03-27 13:28:27 +03:00
|
|
|
rec {
|
2021-06-20 15:17:25 +03:00
|
|
|
inherit overlay;
|
2021-03-27 13:28:27 +03:00
|
|
|
|
2021-09-05 17:40:36 +03:00
|
|
|
nixosModules.autoGenFromInputs = import ./lib/options.nix;
|
2022-01-31 05:09:36 +03:00
|
|
|
darwinModules.autoGenFromInputs = import ./lib/options.nix;
|
2021-03-27 13:28:27 +03:00
|
|
|
|
2022-05-13 19:41:04 +03:00
|
|
|
devShell = eachSystemMap defaultSystems (system: import ./devShell.nix { inherit system; });
|
2021-04-16 20:55:01 +03:00
|
|
|
|
2021-07-19 15:09:49 +03:00
|
|
|
lib = flake-utils.lib // {
|
2022-01-14 04:10:39 +03:00
|
|
|
inherit mkFlake exportModules exportOverlays exportPackages genPkgOverlay;
|
2021-03-13 16:39:03 +03:00
|
|
|
|
2021-07-19 15:09:49 +03:00
|
|
|
# DO NOT USE - subject to change without notice
|
|
|
|
internal = internal-functions;
|
|
|
|
|
2021-04-27 09:45:51 +03:00
|
|
|
# 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;
|
|
|
|
|
2021-04-14 20:48:02 +03:00
|
|
|
patchChannel = system: channel: patches:
|
|
|
|
if patches == [ ] then channel else
|
|
|
|
(import channel { inherit system; }).pkgs.applyPatches {
|
2021-09-05 18:26:53 +03:00
|
|
|
name = if channel ? shortRev then "nixpkgs-patched-${channel.shortRev}" else "nixpkgs-patched";
|
2021-04-14 20:48:02 +03:00
|
|
|
src = channel;
|
|
|
|
patches = patches;
|
|
|
|
};
|
|
|
|
|
2021-03-13 16:39:03 +03:00
|
|
|
};
|
2021-03-27 13:28:27 +03:00
|
|
|
};
|
2021-03-13 16:39:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|