8000 Dynamism, `--arg` alternative · Issue #166 · nixops4/nixops4 · GitHub
[go: up one dir, main page]

Skip to content

Dynamism, --arg alternative #166

Open

Description

@roberth

I'm not planning --arg options, as dynamism should be handled at the resource composition layer, not in the Nix-language substrate.
This way we avoid state management trouble that results from instantiating your "world" in multiple ways that are not actually managed by nixops4.

--argstr env prod

DTAP can be added explicitly (member for each), and more open ended setups could be supported by generalizing the members concept.
Something pretty dynamic could already be achieved by having a "set" resource, with nix run "methods" to add values.
An expression could then insert the values as members attrnames (with some module inside).

--arg config '{ "payload": ... }'

Taken at face value, this pattern would require identifying the deployment by value. That'd be bad: configuration change -> deploy from scratch (lose data, etc). This would have to be combined with the prior env example.

Combined

So it seems we're looking at more of a key-value map situation. Our new nixops4 command or option(s) could create the key in a manner similar to aforementioned "mutable set resource", and then insert the value into a memo-like resource inside, or if we don't care about separating the state into a separate resource, it could be a "mutable map" resource from the get go. Giving up the separate resource would limit the choice of where the value state is stored, reducing permissions flexibility.

I'm still a little bit fuzzy on how the CLI-level value would reach the value-storing resource. Probably something like a transient attribute on a map resource that can be used as the initial_value of the memo inside the value, or something along those lines.
A module could abstract away this expression-level wiring, setting up the memo resource behind the scenes.

With those things in place, the CLI could expose a nixops4 apply --create resource.path.key value and/or nixops4 create resource.path.key value, as well as a nixops4 destroy resource.path.key.

Interaction with apply command line args

  • if no arguments given, apply everything
  • if arguments are given, auto-add the map resource and the new key path.

Activity

  1. added theissue type on Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0