Commit Graph

450 Commits

Author SHA1 Message Date
Johannes Kirschbauer
802ef94798 Vars/helper: remove unneeded wrapper arount collectFiles 2025-07-13 21:00:30 +02:00
Jörg Thalheim
57f9cd9eee 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
4f13049ee2 put flake input overrides into a helper function 2025-07-07 15:59:09 +00:00
lassulus
ca69864a20 rename lingering clan.vars -> clan.core.vars 2025-07-07 00:59:52 +02:00
lassulus
8302f3ffde 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
pinpox
a0a9cef2a6 Add state-version nixos option
This reverts commit 695574988e.
2025-07-04 11:54:12 +02:00
DavHau
969b7606a6 reverting 4c2bb0791d 2025-07-04 10:35:30 +07:00
Jörg Thalheim
ba5b81abf0 actually import state-version 2025-07-03 20:19:19 +02:00
lassulus
a6409f921b 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
40065c7a00 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
Johannes Kirschbauer
4c2bb0791d clan.deployment: unify deprecated option 2025-07-02 18:37:29 +02:00
Johannes Kirschbauer
695574988e Revert "Merge pull request 'Make state-version generation an clan option' (#4056) from state-version-option into main"
This reverts commit a101ff1f11, reversing
changes made to f12b62d8b4.
2025-07-01 18:15:11 +02:00
a-kenji
0093836272 docs(clan): Improve state-version documentation 2025-07-01 17:32:20 +02:00
DavHau
1ab9eb733c checks: fix some tests not named correctly 2025-06-30 19:50:16 +07:00
DavHau
ee5fa8fe74 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
pinpox
9e7e0378a8 Remove state-version module from tests 2025-06-30 12:58:05 +02:00
pinpox
47d4dfad1b Add state-version option 2025-06-30 12:54:29 +02:00
DavHau
e0b2d15361 tests: explicitly specify services to be sourced from self
See previous commit
2025-06-30 10:13:46 +00:00
Jörg Thalheim
6ab5171b5b add restricted network nixos modules
See README.md for explanation
2025-06-27 18:44:17 +02:00
pinpox
264b010a89 Fix machine-id on macos 2025-06-26 15:35:34 +02:00
pinpox
cb69eea68f Make machine ID a option 2025-06-24 10:42:03 +02:00
Qubasa
344259aa56 genmoon.py: Fix type error 2025-06-17 13:53:43 +02:00
Michael Hoang
213f12ce01 vars: don't expose restartUnits on macOS 2025-06-10 13:48:06 +07:00
Michael Hoang
49bec8536b vars: don't use sops.secrets.*.restartUnits on macOS 2025-06-10 13:27:15 +07:00
lassulus
2460ac970f Revert "clan-cli: Use Remote class in DeployInfo, add tests for qrcode parser and json parser"
This reverts commit 2ca3b5d698.
2025-06-09 11:28:15 +02:00
Qubasa
2ca3b5d698 clan-cli: Use Remote class in DeployInfo, add tests for qrcode parser and json parser 2025-06-07 00:51:24 +02:00
a-kenji
dd330f10c1 facts: Add deprecation warning 2025-06-04 13:21:09 +02:00
lassulus
e89fb92f52 zerotier: fix targetHost 2025-06-04 08:46:01 +02:00
lassulus
d108262b47 zerotier: set targetHost if var is generated 2025-06-03 12:16:09 +02:00
DavHau
d27834b565 tests: actually execute vars checks in CI 2025-05-31 16:16:09 +07:00
Jörg Thalheim
7314f6b2ff 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
d397c8ad39 add multiline-hidden prompt for both ui and cli 2025-05-14 19:53:36 +02:00
Mic92
ecc327277c 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
10bc9e3e44 vars: improve warnings for non-public secrets 2025-05-12 12:06:05 +02:00
DavHau
aa557f3a96 vars: cleanup sops file module 2025-05-12 15:30:23 +07:00
a-kenji
b877df4c6e vars/interface: Fix typo 2025-05-06 19:48:08 +00:00
Jörg Thalheim
f8bbd91c4a vars: warn if mode/owner/user is used on non-secret var 2025-05-04 14:59:22 +02:00
Jörg Thalheim
51da7ed5e8 vars: fix defaultText 2025-05-04 14:59:22 +02:00
vdbe
d445a353d5 clanCore/vars/sops: add sops & switch to builtins.path 2025-05-04 08:08:58 +02:00
vdbe
b08a2bdb75 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
Johannes Kirschbauer
8495106ec4 feat(services): init feature flags in the module manifest: 'manifest.features.API' 2025-04-27 11:07:45 +02:00
Johannes Kirschbauer
ffa8257763 chore: remove unused option 'clanSchema' from core nixos modules 2025-04-27 11:07:45 +02:00
Raymond Barbiero
222915a9ed clanCore/vars: allow mode to be set
fmt
2025-04-25 11:29:43 +02:00
Jörg Thalheim
fe6fd41a4d zerotier: migrate from facts to vars 2025-04-22 18:20:35 +02:00
Michael Hoang
e6e7f5d5de networking: set targetHost if FQDN is explicitly set 2025-04-23 01:15:13 +10:00
Michael Hoang
20ae80ee49 vars: fix default group on macOS 2025-04-22 23:39:47 +10:00
Michael Hoang
a575894a83 nixosModules/clanCore: support nix-darwin 2025-04-22 23:14:03 +10:00
Michael Hoang
8ae348d686 vars: improve messaging 2025-04-22 02:03:24 +10:00
Johannes Kirschbauer
dbd859bea2 machine/vars: expose result direclty via vars submodule; keep deployment.data alias for now 2025-04-20 13:23:01 +02:00
hsjobeki
c895907b9d revert 83ec5a063a
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