Commit Graph

55 Commits

Author SHA1 Message Date
Michael Hoang
a71a5880c1 treewide: reformat 2025-08-08 15:28:37 +10:00
Johannes Kirschbauer
fc2e619046 vars: add display attribute submodule for customizable ux 2025-07-31 16:35:15 +02:00
DavHau
b91158f454 vars/interface: make type of dependencies configurable
One vars get lifted to the global scope, dependencies need to be structured differently, eg. categorized by instances
2025-07-15 13:41:05 +07:00
DavHau
66a6758db4 vars/interface: cleanup + don't use specialArgs for pkgs 2025-07-15 13:07:18 +07:00
DavHau
61df393c2d vars: reduce dependency on pkgs
pass pkgs only to generators submodule which is the only place where it is needed because of finalScript
2025-07-15 12:15:12 +07:00
DavHau
1c2b72c6f0 vars: cleanup nix interface 2025-07-14 18:20:04 +07:00
lassulus
c760561dbd refactor: remove _serialized field and implement efficient vars selection
- Remove _serialized field from vars interface to prevent serialization
  errors with throwing passBackend field
- Implement direct selection of generator fields using multi-select syntax
- Refactor vars_generators() to use new Generator.from_flake() method that
  selects only safe fields (avoiding non-serializable values)
- Remove unused legacy methods: Generator.from_json(), Var.from_json(),
  Prompt.from_json()
- Update precaching to match new selection approach

This fixes the serialization errors that were preventing vars from working
with the new password-store implementation by avoiding the problematic
_serialized field entirely.
2025-07-03 18:53:36 +02:00
Michael Hoang
ad963a75c5 vars: don't expose restartUnits on macOS 2025-06-10 13:48:06 +07:00
DavHau
60f07c3472 tests: actually execute vars checks in CI 2025-05-31 16:16:09 +07:00
Jörg Thalheim
8860a58deb vars: add restartUnits option
For secrets not part of the nix store there is no other way in NixOS to
restart a service after the secret is updated. One example is changing
password in userborn, which doesn't run as a activation script but as a
systemd service.
2025-05-28 16:44:19 +02:00
Jörg Thalheim
75fa7ac609 add multiline-hidden prompt for both ui and cli 2025-05-14 19:53:36 +02:00
a-kenji
812b81f38e vars/interface: Fix typo 2025-05-06 19:48:08 +00:00
Jörg Thalheim
f06296aa94 vars: fix defaultText 2025-05-04 14:59:22 +02:00
vdbe
26f336cf69 clanCore/vars/sops: add sops & switch to builtins.path 2025-05-04 08:08:58 +02:00
vdbe
f3e32ce827 clanCore/vars/sops: only copy required secrets to store
Create a store path per in repo secret/var to be copied, this prevents
unused secrets from being leaked.

For example the `root-password` generator contains both the hashed and
unhashed password but only the hash is used.
2025-05-04 08:08:58 +02:00
Raymond Barbiero
4117eb2f37 clanCore/vars: allow mode to be set
fmt
2025-04-25 11:29:43 +02:00
Michael Hoang
f4b8f2e858 vars: fix default group on macOS 2025-04-22 23:39:47 +10:00
Michael Hoang
2c9b25624a vars: improve messaging 2025-04-22 02:03:24 +10:00
Johannes Kirschbauer
9c3474f55f machine/vars: expose result direclty via vars submodule; keep deployment.data alias for now 2025-04-20 13:23:01 +02:00
a-kenji
da0f792d9e vars/interface: Change prompt.persist default to false
Change `prompt.persist` default to false.
We want a consistent default that is not conditionally dependent on
other values.
This makes communication on how the functionality is used more
consistent and easier understood.
2025-02-04 07:47:22 +00:00
Jörg Thalheim
50e30a750d remove createFile legacy alias from vars/interface
it's hard to filter this out in nix. So instead we just drop this
option.
2025-01-31 10:29:35 +00:00
lassulus
e4826b5c53 vars: set persist to true if the script is empty 2025-01-22 19:36:19 +00:00
Michael Hoang
7ee0e2afbf vars: support secrets for partitioning the disk 2025-01-21 11:13:51 +00:00
Johannes Kirschbauer
31a1fe887e Vars: interface improve docs formatting 2025-01-14 17:40:57 +01:00
DavHau
4a9ae3a45f vars: rename createFile -> persist 2025-01-11 04:19:46 +00:00
Jörg Thalheim
21ecbfc673 vars: simplify validationHash type for better error messages 2024-12-25 19:21:51 +00:00
Michael Hoang
1d7e0c1c02 install: upload vars needed for activation for installation 2024-12-22 05:53:26 +00:00
lassulus
70ff7fcc2f vars: allow setting files as needed for activation 2024-12-19 13:05:05 +01:00
lassulus
9cc3bdbc9f vars: eval finalScript lazy 2024-12-14 13:38:51 +01:00
lassulus
e9efe2f0d1 vars: export also file owner & group to deployment.json 2024-12-05 10:29:19 +01:00
lassulus
82fb1edc37 vars: add file mode 2024-12-04 23:30:39 +01:00
lassulus
e6eaa3cc03 vars password-store: add neededForUsers option 2024-12-03 22:28:39 +01:00
DavHau
5c5a87d416 vars: rename: invalidation -> validation 2024-11-29 17:23:31 +07:00
DavHau
fbbfcc0aa5 vars: generate docs for cli and module 2024-11-29 17:23:31 +07:00
Jörg Thalheim
cd2ea0d735 vars: add name to generators 2024-11-26 15:26:16 +01:00
DavHau
d4c8b2e4ed vars: implement invalidation mechanism
This adds options `invalidationData` to generators.

`invalidationData` can be used by an author of a generator to signal if a re-generation is required after updating the logic.

Whenever a generator with invalidation data is executed, a hash of that data is stored by the respective public and/or secret backends.

The stored hashes will be checked on future deployments, and a re-generation is triggered whenever a hash doesn't match what's defined in nix.
2024-11-20 16:27:22 +07:00
lassulus
8f0c575425 password-store owner & group support 2024-11-16 01:18:59 +01:00
Jörg Thalheim
0a844097db vars: use explicit lib.mkOption function
the error messages where hard to read, when I tried to add a nested
option. Let's make the code easier to understand instead of saving some
characters to type.
2024-10-31 12:10:57 +01:00
Jörg Thalheim
0842b05687 vars: move owner/group to a sops namespace
we want to allow users to use this feature but do not want to use this
option in our own module because it's not supported by password store.
2024-10-31 12:10:57 +01:00
Louis Opter
4effc0c50e vars: add the user and group options on files
This changeset forwards the ownership control options from sops-nix.
2024-10-23 09:05:53 +00:00
DavHau
0a8b7f38a8 vars: implement migration
Migrating generated files from the facts subsystem to the vars subsystem is now possible.

HowTo:
1. declare `clan.core.vars.generators.<generator>.migrateFact = my_service` where `my_service` refers to a service from `clan.core.facts.services`
2. run `clan vers generate your_machine` or `clan machines update your_machine`

Vars will only be migrated for a generator if:
1. The facts service specified via `migrateFact` does exist
2. None of the vars to generate exist yet
3. All public var names exist in the public facts store
4. All secret var names exist in the secret fact store

If the migration is deemed possible, the generator script will not be executed. Instead the files from the public or secret facts store are read and stored into the corresponding vars store
2024-09-19 17:57:03 +02:00
a-kenji
6dd1a7395f vars: use correct paths for value accesses
Use correct paths for value accesses of vars under:

- `per-machine`
- `shared`
2024-09-11 19:02:43 +02:00
DavHau
dc4fcb7329 vars: new option prompts.<name>.createFile 2024-09-04 15:48:10 +02:00
DavHau
62ccd0ed4b vars: introduce deploy=true/false for generated files 2024-09-01 14:32:46 +02:00
DavHau
d1c2f0b622 vars: introduce share flag 2024-08-03 15:26:53 +07:00
DavHau
395c5cbace vars/sops: fix loading of vars from directory structure 2024-07-29 18:01:26 +07:00
DavHau
0acf9178c8 vars: implement prompts 2024-07-22 20:40:12 +07:00
DavHau
566c1403c0 vars: implement dependencies 2024-07-17 16:42:16 +07:00
DavHau
7dbed61079 vars: implement secret generation 2024-07-11 11:37:17 +07:00
DavHau
941cf9fb9d vars: implement generating public variables via in_repo 2024-07-09 14:26:56 +07:00