2019-01-17 17:18:00 +03:00
|
|
|
{ nixpkgs ? <nixpkgs>
|
2019-02-01 01:06:29 +03:00
|
|
|
, configuration ? <nixos-config>
|
2019-01-17 17:18:00 +03:00
|
|
|
, system ? builtins.currentSystem
|
2020-10-23 18:54:01 +03:00
|
|
|
|
|
|
|
, formatConfig
|
|
|
|
|
|
|
|
, flakeUri ? null
|
|
|
|
, flakeAttr ? null
|
2019-01-17 17:18:00 +03:00
|
|
|
}:
|
|
|
|
let
|
2021-06-07 03:20:11 +03:00
|
|
|
module = import ./format-module.nix;
|
2020-10-23 18:54:01 +03:00
|
|
|
|
|
|
|
# Will only get evaluated when used, so no worries
|
|
|
|
flake = builtins.getFlake flakeUri;
|
|
|
|
flakeSystem = flake.outputs.packages."${system}".nixosConfigurations."${flakeAttr}" or flake.outputs.nixosConfigurations."${flakeAttr}";
|
2019-01-17 17:18:00 +03:00
|
|
|
in
|
2020-10-23 18:54:01 +03:00
|
|
|
if flakeUri != null then
|
2022-02-27 01:12:37 +03:00
|
|
|
flakeSystem.extendModules {
|
|
|
|
modules = [ module formatConfig ];
|
|
|
|
}
|
2020-10-23 18:54:01 +03:00
|
|
|
else
|
|
|
|
import "${toString nixpkgs}/nixos/lib/eval-config.nix" {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
module
|
|
|
|
formatConfig
|
|
|
|
configuration
|
|
|
|
];
|
|
|
|
}
|