From 228365cdf0470318d6e1ee8e52b9123e739eae75 Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Mon, 21 Jul 2025 22:11:17 +0200 Subject: [PATCH] [HACK] swap out nixops4 deployments for raw nixos modules rm deployment rm imports --- default.nix | 2 -- deployment/data-model-test.nix | 58 +++++++++------------------------- deployment/data-model.nix | 15 +++------ deployment/deployment.nix | 12 ------- 4 files changed, 19 insertions(+), 68 deletions(-) delete mode 100644 deployment/deployment.nix diff --git a/default.nix b/default.nix index 27b868b9..24b73cd2 100644 --- a/default.nix +++ b/default.nix @@ -11,7 +11,6 @@ let ; inherit (pkgs) lib; inherit (import sources.flake-inputs) import-flake; - inputs = (import-flake { src = ./.; }).inputs; inherit ((import-flake { src = ./.; }).inputs) nixops4; panel = import ./panel { inherit sources system; }; pre-commit-check = @@ -79,7 +78,6 @@ in # re-export inputs so they can be overridden granularly # (they can't be accessed from the outside any other way) inherit - inputs sources system pkgs diff --git a/deployment/data-model-test.nix b/deployment/data-model-test.nix index 61b1e4cf..c151f4a6 100644 --- a/deployment/data-model-test.nix +++ b/deployment/data-model-test.nix @@ -7,15 +7,12 @@ let (lib.evalModules { specialArgs = { inherit inputs; - # to be passed to nixops4Deployment - resourceProviderSystem = builtins.currentSystem; }; modules = [ module ./data-model.nix ]; }).config; - nixops4Deployment = import ./deployment.nix { inherit inputs; }; in { _class = "nix-unit"; @@ -133,42 +130,20 @@ in { _class = "fediversity-environment"; resources.shell.login-shell.username = "operator"; - implementation = - requests: - { providers, ... }: - { - _class = "nixops4Deployment"; - providers = { - inherit (inputs.nixops4.modules.nixops4Provider) local; - }; - # this seems checked according to {providers,resources,resource}.nix, - # values will not eagerly get checked, matching `providers.nix`'s `lazyAttrsOf`, - # 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 - ) - ); - }; - }; - }; + implementation = requests: { + _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 = { @@ -182,10 +157,7 @@ in }; }; example-deployment = mkOption { - type = types.submoduleWith { - class = "nixops4Deployment"; - modules = [ nixops4Deployment ]; - }; + type = types.raw; readOnly = true; default = config.environments.single-nixos-vm.deployment config.example-configuration; }; diff --git a/deployment/data-model.nix b/deployment/data-model.nix index 2c1a9c80..09a6ea1b 100644 --- a/deployment/data-model.nix +++ b/deployment/data-model.nix @@ -1,7 +1,6 @@ { lib, config, - inputs, ... }: let @@ -13,10 +12,10 @@ let submoduleWith optionType functionTo + raw ; functionType = import ./function.nix; - nixops4Deployment = import ./deployment.nix { inherit lib inputs; }; configuration = mkOption { description = "Configuration type declaring options to be set by operators"; @@ -150,10 +149,7 @@ in }; implementation = mkOption { description = "Mapping of resources required by applications to available resources; the result can be deployed"; - type = functionTo (submoduleWith { - class = "nixops4Deployment"; - modules = [ environment.config.resource-mapping.output-type ]; - }); + type = functionTo environment.config.resource-mapping.output-type; }; resource-mapping = mkOption { description = "Function type for the mapping from resources to a (NixOps4) deployment"; @@ -164,15 +160,12 @@ in readOnly = true; default = { input-type = configuration; - output-type = nixops4Deployment; + output-type = raw; }; }; deployment = mkOption { description = "Generate a deployment from a configuration"; - type = functionTo (submoduleWith { - class = "nixops4Deployment"; - modules = [ environment.config.resource-mapping.output-type ]; - }); + type = functionTo (submodule environment.config.resource-mapping.output-type); readOnly = true; default = cfg: diff --git a/deployment/deployment.nix b/deployment/deployment.nix deleted file mode 100644 index 2e7c73dd..00000000 --- a/deployment/deployment.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - inputs, - ... -}: - -inputs.nixops4.modules.nixops4Deployment.default - -# inherit lib config resources; -# # config = { -# # type providers provider inputs outputsSkeleton resourceType -# # }; -# }