2023-08-25 19:26:30 +00:00
|
|
|
{
|
2023-09-15 10:31:18 +00:00
|
|
|
# this placeholder is replaced by the path to nixpkgs
|
|
|
|
inputs.nixpkgs.url = "__NIXPKGS__";
|
2023-08-25 19:26:30 +00:00
|
|
|
|
2024-03-17 18:48:49 +00:00
|
|
|
outputs =
|
|
|
|
inputs':
|
2023-10-25 15:36:01 +00:00
|
|
|
let
|
|
|
|
# fake clan-core input
|
|
|
|
fake-clan-core = {
|
|
|
|
clanModules.fake-module = ./fake-module.nix;
|
|
|
|
};
|
2024-03-17 18:48:49 +00:00
|
|
|
inputs = inputs' // {
|
|
|
|
clan-core = fake-clan-core;
|
|
|
|
};
|
2023-10-25 15:36:01 +00:00
|
|
|
machineSettings = (
|
2024-03-17 18:48:49 +00:00
|
|
|
if builtins.getEnv "CLAN_MACHINE_SETTINGS_FILE" != "" then
|
|
|
|
builtins.fromJSON (builtins.readFile (builtins.getEnv "CLAN_MACHINE_SETTINGS_FILE"))
|
|
|
|
else if builtins.pathExists ./machines/machine1/settings.json then
|
|
|
|
builtins.fromJSON (builtins.readFile ./machines/machine1/settings.json)
|
|
|
|
else
|
|
|
|
{ }
|
|
|
|
);
|
|
|
|
machineImports = map (module: fake-clan-core.clanModules.${module}) (
|
|
|
|
machineSettings.clanImports or [ ]
|
2023-10-25 15:36:01 +00:00
|
|
|
);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosConfigurations.machine1 = inputs.nixpkgs.lib.nixosSystem {
|
2024-03-17 18:48:49 +00:00
|
|
|
modules = machineImports ++ [
|
|
|
|
./nixosModules/machine1.nix
|
|
|
|
machineSettings
|
|
|
|
(
|
|
|
|
{
|
|
|
|
lib,
|
|
|
|
options,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2023-10-25 15:36:01 +00:00
|
|
|
config = {
|
|
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
# speed up by not instantiating nixpkgs twice and disable documentation
|
|
|
|
nixpkgs.pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
|
|
|
documentation.enable = false;
|
|
|
|
};
|
2024-06-17 10:42:28 +00:00
|
|
|
options.clan.core.optionsNix = lib.mkOption {
|
2023-10-25 15:36:01 +00:00
|
|
|
type = lib.types.raw;
|
|
|
|
internal = true;
|
|
|
|
readOnly = true;
|
|
|
|
default = (pkgs.nixosOptionsDoc { inherit options; }).optionsNix;
|
|
|
|
defaultText = "optionsNix";
|
|
|
|
description = ''
|
|
|
|
This is to export nixos options used for `clan config`
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
options.clanImports = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
description = ''
|
|
|
|
A list of imported module names imported from clan-core.clanModules.<name>
|
|
|
|
The buildClan function will automatically import these modules for the current machine.
|
|
|
|
'';
|
|
|
|
};
|
2024-03-17 18:48:49 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
2023-10-25 15:36:01 +00:00
|
|
|
};
|
2023-08-26 08:32:04 +00:00
|
|
|
};
|
2023-08-25 19:26:30 +00:00
|
|
|
}
|