Commit Graph

116 Commits

Author SHA1 Message Date
pinpox
b27ff67a14 Add type to group and owner vars options 2025-08-19 22:46:30 +02:00
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
Johannes Kirschbauer
c285c737fe Vars/helper: remove unneeded wrapper arount collectFiles 2025-07-11 16:14:02 +02:00
Jörg Thalheim
453691d0bf checks/eval-module-clan-vars: optimize to use filtered source
- Replace self.filter with lib.fileset for more precise filtering
- Remove unnecessary clan-core dependency from the test
- Test only needs lib and pkgs, not the full flake context
- Prevents unnecessary rebuilds when unrelated files change
2025-07-07 20:55:04 +02:00
Jörg Thalheim
b692f6fcfe put flake input overrides into a helper function 2025-07-07 15:59:09 +00:00
lassulus
bbb7773567 rename lingering clan.vars -> clan.core.vars 2025-07-07 00:59:52 +02:00
lassulus
2f0f9a9fba vars/password-store: replace passBackend option with passPackage
The `clan.core.vars.settings.passBackend` option has been replaced with
`clan.vars.password-store.passPackage` to provide better type safety and
clearer configuration.

Changes:
- Remove problematic mkRemovedOptionModule that caused circular dependency
- Add proper option definition with assertion-based migration
- Users setting the old option get clear migration instructions
- Normal evaluation continues to work for users not using the old option

Migration: Replace `clan.core.vars.settings.passBackend = "passage"`
with `clan.vars.password-store.passPackage = pkgs.passage`
2025-07-06 12:46:39 +02: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
lassulus
a055b4d1eb refactor: remove deployment.json and use direct selectors
- Remove deployment.json file generation from outputs.nix
- Add throw for deprecated deployment.file usage with upgrade instructions
- Remove vars data from deployment.data
- Update Machine class to use direct select() calls instead of deployment property
- Update all deployment property accesses to use direct selectors
- Add precaching for frequently accessed values in update.py:
  - Module paths for facts and vars
  - Deployment settings (requireExplicitUpdate, nixosMobileWorkaround)
  - Services and generators data
  - Secret upload locations
- This removes unnecessary JSON serialization and makes the code more composable
2025-07-02 20:56:23 +02:00
DavHau
73b298d0b2 checks: rename attributes for better discoverability
- all eval checks prefixed with `eval-`
- all service checks prefixed with `service-`
2025-06-30 19:04:21 +07:00
Michael Hoang
ad963a75c5 vars: don't expose restartUnits on macOS 2025-06-10 13:48:06 +07:00
Michael Hoang
e8ebd887d0 vars: don't use sops.secrets.*.restartUnits on macOS 2025-06-10 13:27:15 +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
Mic92
5cd8c3729a Merge pull request 'Data-mesher: don't set owner for public vars' (#3571) from misc-fixes-2 into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3571
2025-05-12 10:27:05 +00:00
Jörg Thalheim
bdc0265ccd vars: improve warnings for non-public secrets 2025-05-12 12:06:05 +02:00
DavHau
fa011934f8 vars: cleanup sops file module 2025-05-12 15:30:23 +07:00
a-kenji
812b81f38e vars/interface: Fix typo 2025-05-06 19:48:08 +00:00
Jörg Thalheim
6f70a9ec01 vars: warn if mode/owner/user is used on non-secret var 2025-05-04 14:59:22 +02: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
5e61a6e41d nixosModules/clanCore: support nix-darwin 2025-04-22 23:14:03 +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
hsjobeki
b48b30de0e revert db50ffc4b7
revert vars: use writeShellApplication to shellcheck generators

Cannot re-generate the vars for data-mesher or any of our tests anymore

cc @DavHau @Qubasa Can we work together to fix this.
I like shellchecking but if we loose the ability to add tests thats unfortunate
This is blocking: the new 'restic' and 'zerotier' migrations because we need to write integration tests from the beginning.
2025-04-16 07:14:25 +00:00
RTUnreal
db50ffc4b7 vars: use writeShellApplication to shellcheck generators 2025-04-09 19:44:00 +02:00
Michael Hoang
ce85aebc17 tests: add --show-trace to nix-unit tests 2025-04-08 08:53:29 +02:00
Johannes Kirschbauer
dd10497d96 fix(test/vars): include lib into test closure 2025-04-02 10:31:16 +02:00
Pablo Ovelleiro Corral
8ed186ce55 data-mesher: init module
Co-authored-by: Brian McGee <brian@bmcgee.ie>
2025-03-29 13:49:41 +00:00
lassulus
90bd9217e3 vars fs: fix 2025-02-22 03:39:42 +00:00
Pablo Ovelleiro Corral
f28a38bbb3 Make store-backend configurable 2025-02-18 06:34:50 +01:00
Michael Hoang
4e2ae0f9f6 cli: add morph command 2025-02-16 21:31:28 +07: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
Jörg Thalheim
293d67d485 remove eval warning for createFile 2025-01-21 15:20:38 +01:00
Michael Hoang
7ee0e2afbf vars: support secrets for partitioning the disk 2025-01-21 11:13:51 +00:00
DavHau
5ce72dd261 tests: reduce unnecessary rebuilds of several tests
Some test were referring to the whole source code via ${self} which amde them rebuild on every single commit.

This is not mitigated by introduceing `self.filter { include = [...]; }` allowin to a content addressed subset of the source code in tests.
2025-01-17 17:00:18 +07:00
clan-bot
4c284bb86b Merge pull request 'Migrate borgbackup module to vars' (#2741) from pinpox/clan-core:migrate-borgbackup-vars into main 2025-01-16 12:16:37 +00:00
Pablo Ovelleiro Corral
038083bece Migrate borgbackup module to vars 2025-01-16 13:14:24 +01:00
Jörg Thalheim
fb217cc4b2 remove flip functions from sops code 2025-01-15 13:59:49 +00:00