mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 08:04:20 +01:00
34 lines
958 B
Nix
34 lines
958 B
Nix
{ nixpkgs, pkgs, system, inputs }:
|
|
with pkgs.lib; {
|
|
substitute = runCommand: name: inFile: vars:
|
|
runCommand name {}
|
|
(let
|
|
varsStr = pkgs.lib.mapAttrsToList
|
|
(name: value: ''--subst-var-by "${name}" "${value}"'')
|
|
vars;
|
|
in
|
|
''
|
|
substitute ${inFile} $out \
|
|
${builtins.concatStringsSep " " varsStr}
|
|
'');
|
|
flakes = path: modules: genAttrs modules (module:
|
|
let
|
|
self = (import (path + "/${module}/flake.nix")).outputs (inputs // { inherit self; });
|
|
in
|
|
self
|
|
);
|
|
dockerImages = pkgs: path: modules: genAttrs modules (module:
|
|
import (path + "/${module}") ({ inherit pkgs system; } // inputs)
|
|
);
|
|
pkgsWithFlakes = flakes: import nixpkgs
|
|
{
|
|
inherit system;
|
|
overlays = builtins.concatLists (mapAttrsToList (_: flake:
|
|
if builtins.hasAttr "overlay" flake then
|
|
[ flake.overlay ]
|
|
else
|
|
[]
|
|
) flakes);
|
|
};
|
|
}
|