rix101/modules/flake/deploy.nix
reo101 2941536b80
refactor(flake)!: export packages using a flake module
Also stop passing `outputs` around, prefer `inputs.self`
Also put all `auto_` in `readOnly` `internal` options
- `autoModules`, `autoConfigurations` and `autoPackages`
Do not export packages as overlay (causes an infinite recursion)
- this is documented on the two places it has effect on
-- in `./overlays/default.nix` and `./modules/flake/configurations.nix`
-- in `autoConfigurations` we manually extend `pkgs` with the flake packages
Allow packages to say what `systems` they are compatible with
- See `./pkgs/swww/systems.nix` - disabled for all systems
- See `./pkgs/pngpaste/systems.nix` - enabled only for `darwin` targets
2024-07-29 01:54:22 +03:00

45 lines
1.3 KiB
Nix

{ lib, config, self, inputs, ... }:
let
inherit (import ../../nix/utils.nix { inherit lib config self; })
accumulateHosts
configuration-type-to-deploy-type;
in
{
flake = {
deploy.nodes =
accumulateHosts
# TODO: nix-on-droid
["nixos" "nix-darwin"]
({ host, system, configuration-type, configuration }:
let
deploy-config-path =
"${config.flake.autoConfigurations.${configuration-type}.dir}/${system}/${host}/deploy.nix";
deploy-config =
import deploy-config-path;
in
lib.optionalAttrs
(builtins.pathExists deploy-config-path)
{
${host} = {
inherit (deploy-config)
hostname;
profiles.system = deploy-config // {
path =
let
deploy-type = configuration-type-to-deploy-type configuration-type;
in
inputs.deploy-rs.lib.${system}.activate.${deploy-type} configuration;
};
};
}
);
checks =
lib.mapAttrs
(system: deployLib:
deployLib.deployChecks
self.deploy)
inputs.deploy-rs.lib;
};
}