[HACK] swap out nixops4 deployments for raw nixos modules

rm deployment

rm imports
This commit is contained in:
Kiara Grouwstra 2025-07-21 22:11:17 +02:00
parent c8882e32f6
commit 228365cdf0
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
4 changed files with 19 additions and 68 deletions

View file

@ -11,7 +11,6 @@ let
; ;
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (import sources.flake-inputs) import-flake; inherit (import sources.flake-inputs) import-flake;
inputs = (import-flake { src = ./.; }).inputs;
inherit ((import-flake { src = ./.; }).inputs) nixops4; inherit ((import-flake { src = ./.; }).inputs) nixops4;
panel = import ./panel { inherit sources system; }; panel = import ./panel { inherit sources system; };
pre-commit-check = pre-commit-check =
@ -79,7 +78,6 @@ in
# re-export inputs so they can be overridden granularly # re-export inputs so they can be overridden granularly
# (they can't be accessed from the outside any other way) # (they can't be accessed from the outside any other way)
inherit inherit
inputs
sources sources
system system
pkgs pkgs

View file

@ -7,15 +7,12 @@ let
(lib.evalModules { (lib.evalModules {
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
# to be passed to nixops4Deployment
resourceProviderSystem = builtins.currentSystem;
}; };
modules = [ modules = [
module module
./data-model.nix ./data-model.nix
]; ];
}).config; }).config;
nixops4Deployment = import ./deployment.nix { inherit inputs; };
in in
{ {
_class = "nix-unit"; _class = "nix-unit";
@ -133,42 +130,20 @@ in
{ {
_class = "fediversity-environment"; _class = "fediversity-environment";
resources.shell.login-shell.username = "operator"; resources.shell.login-shell.username = "operator";
implementation = implementation = requests: {
requests: _class = "nixos";
{ providers, ... }: users.users = (
{ config.resources.login-shell.policy.apply (
_class = "nixops4Deployment"; lib.concatMapAttrs (
providers = { _application: resources:
inherit (inputs.nixops4.modules.nixops4Provider) local; lib.mapAttrs (_k: lib.getAttr "login-shell") (
}; lib.filterAttrs (_name: value: value ? login-shell) resources
# this seems checked according to {providers,resources,resource}.nix, )
# values will not eagerly get checked, matching `providers.nix`'s `lazyAttrsOf`, ) requests
# whereas allowed keys seem to match those defined in `resource.nix`. )
# the content of `resources.the-machine` however, follows `nixops4-nixos`, );
# which is not allowed through our `type` yet.
resources.the-machine = { };
_class = "nixops4Resource";
type = providers.local.exec;
imports = [
inputs.nixops4-nixos.modules.nixops4Resource.nixos
];
nixos.module =
{ ... }:
{
_class = "nixos";
users.users = (
config.resources.login-shell.policy.apply (
lib.concatMapAttrs (
_application: resources:
lib.mapAttrs (_k: lib.getAttr "login-shell") (
lib.filterAttrs (_name: value: value ? login-shell) resources
)
) requests
)
);
};
};
};
}; };
}; };
options = { options = {
@ -182,10 +157,7 @@ in
}; };
}; };
example-deployment = mkOption { example-deployment = mkOption {
type = types.submoduleWith { type = types.raw;
class = "nixops4Deployment";
modules = [ nixops4Deployment ];
};
readOnly = true; readOnly = true;
default = config.environments.single-nixos-vm.deployment config.example-configuration; default = config.environments.single-nixos-vm.deployment config.example-configuration;
}; };

View file

@ -1,7 +1,6 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
@ -13,10 +12,10 @@ let
submoduleWith submoduleWith
optionType optionType
functionTo functionTo
raw
; ;
functionType = import ./function.nix; functionType = import ./function.nix;
nixops4Deployment = import ./deployment.nix { inherit lib inputs; };
configuration = mkOption { configuration = mkOption {
description = "Configuration type declaring options to be set by operators"; description = "Configuration type declaring options to be set by operators";
@ -150,10 +149,7 @@ in
}; };
implementation = mkOption { implementation = mkOption {
description = "Mapping of resources required by applications to available resources; the result can be deployed"; description = "Mapping of resources required by applications to available resources; the result can be deployed";
type = functionTo (submoduleWith { type = functionTo environment.config.resource-mapping.output-type;
class = "nixops4Deployment";
modules = [ environment.config.resource-mapping.output-type ];
});
}; };
resource-mapping = mkOption { resource-mapping = mkOption {
description = "Function type for the mapping from resources to a (NixOps4) deployment"; description = "Function type for the mapping from resources to a (NixOps4) deployment";
@ -164,15 +160,12 @@ in
readOnly = true; readOnly = true;
default = { default = {
input-type = configuration; input-type = configuration;
output-type = nixops4Deployment; output-type = raw;
}; };
}; };
deployment = mkOption { deployment = mkOption {
description = "Generate a deployment from a configuration"; description = "Generate a deployment from a configuration";
type = functionTo (submoduleWith { type = functionTo (submodule environment.config.resource-mapping.output-type);
class = "nixops4Deployment";
modules = [ environment.config.resource-mapping.output-type ];
});
readOnly = true; readOnly = true;
default = default =
cfg: cfg:

View file

@ -1,12 +0,0 @@
{
inputs,
...
}:
inputs.nixops4.modules.nixops4Deployment.default
# inherit lib config resources;
# # config = {
# # type providers provider inputs outputsSkeleton resourceType
# # };
# }