docs: move 'migrate-flake' to 'convert existing nixos'

This commit is contained in:
Johannes Kirschbauer
2025-08-25 13:04:55 +02:00
parent 1b12882e29
commit 4470bb886e
3 changed files with 24 additions and 22 deletions

View File

@@ -59,6 +59,7 @@ nav:
- Configure Disk Config: guides/getting-started/choose-disk.md - Configure Disk Config: guides/getting-started/choose-disk.md
- Update Machine: guides/getting-started/update.md - Update Machine: guides/getting-started/update.md
- Continuous Integration: guides/getting-started/flake-check.md - Continuous Integration: guides/getting-started/flake-check.md
- Convert Existing NixOS Config: guides/getting-started/convert-flake.md
- ClanServices: guides/clanServices.md - ClanServices: guides/clanServices.md
- Backup & Restore: guides/backups.md - Backup & Restore: guides/backups.md
- Disk Encryption: guides/disk-encryption.md - Disk Encryption: guides/disk-encryption.md
@@ -77,7 +78,6 @@ nav:
- Writing a Service Module: guides/services/community.md - Writing a Service Module: guides/services/community.md
- Writing a Disko Template: guides/disko-templates/community.md - Writing a Disko Template: guides/disko-templates/community.md
- Migrations: - Migrations:
- Migrate existing Flakes: guides/migrations/migration-guide.md
- Migrate from clan modules to services: guides/migrations/migrate-inventory-services.md - Migrate from clan modules to services: guides/migrations/migrate-inventory-services.md
- Facts Vars Migration: guides/migrations/migration-facts-vars.md - Facts Vars Migration: guides/migrations/migration-facts-vars.md
- Disk id: guides/migrations/disk-id.md - Disk id: guides/migrations/disk-id.md

View File

@@ -1,18 +1,20 @@
# Migrate existing NixOS configurations # Convert existing NixOS configurations
This guide will help you migrate your existing NixOS configurations into Clan. This guide will help you convert your existing NixOS configurations into a Clan.
!!! Warning !!! Warning
Migrating instead of starting new can be trickier and might lead to bugs or Migrating instead of starting new can be trickier and might lead to bugs or
unexpected issues. We recommend following the [Getting Started](../getting-started/index.md) guide first. Once you have a working setup, you can easily transfer your NixOS configurations over. unexpected issues. We recommend reading the [Getting Started](./index.md) guide first.
Once you have a working setup and understand the concepts transfering your NixOS configurations over is easy.
## Back up your existing configuration
## Back up your existing configuration!
Before you start, it is strongly recommended to back up your existing Before you start, it is strongly recommended to back up your existing
configuration in any form you see fit. If you use version control to manage configuration in any form you see fit. If you use version control to manage
your configuration changes, it is also a good idea to follow the migration your configuration changes, it is also a good idea to follow the migration
guide in a separte branch until everything works as expected. guide in a separte branch until everything works as expected.
## Starting Point ## Starting Point
We assume you are already using NixOS flakes to manage your configuration. If We assume you are already using NixOS flakes to manage your configuration. If
@@ -43,10 +45,9 @@ have have two hosts: **berlin** and **cologne**.
} }
``` ```
## Add clan-core Input ## 1. Add `clan-core` to `inputs`
Add `clan-core` to your flake as input. It will provide everything we need to Add `clan-core` to your flake as input.
manage your configurations with clan.
```nix ```nix
inputs.clan-core = { inputs.clan-core = {
@@ -56,7 +57,7 @@ inputs.clan-core = {
} }
``` ```
## Update Outputs ## 2. Update Outputs
To be able to access our newly added dependency, it has to be added to the To be able to access our newly added dependency, it has to be added to the
output parameters. output parameters.
@@ -105,24 +106,23 @@ For the provide flake example, your flake should now look like this:
{ {
nixosConfigurations = clan.nixosConfigurations; nixosConfigurations = clan.nixosConfigurations;
inherit (clan) clanInternals; inherit (clan.config) nixosConfigurations nixosModules clanInternals;
clan = clan.config;
clan = {
inherit (clan) templates;
};
}; };
} }
``` ```
Et voilà! Your existing hosts are now part of a clan. Existing Nix tooling Et voilà! Your existing hosts are now part of a clan.
Existing Nix tooling
should still work as normal. To check that you didn't make any errors, run `nix should still work as normal. To check that you didn't make any errors, run `nix
flake show` and verify both hosts are still recognized as if nothing had flake show` and verify both hosts are still recognized as if nothing had
changed. You should also see the new `clanInternals` output. changed. You should also see the new `clan` output.
``` ```
nix flake show nix flake show
git+file:///my-nixos-config git+file:///my-nixos-config
├───clanInternals: unknown ├───clan: unknown
└───nixosConfigurations └───nixosConfigurations
├───berlin: NixOS configuration ├───berlin: NixOS configuration
└───cologne: NixOS configuration └───cologne: NixOS configuration
@@ -131,7 +131,7 @@ git+file:///my-nixos-config
Of course you can also rebuild your configuration using `nixos-rebuild` and Of course you can also rebuild your configuration using `nixos-rebuild` and
veryify everything still works. veryify everything still works.
## Add Clan CLI devShell ## 3. Add `clan-cli` to your `devShells`
At this point Clan is set up, but you can't use the CLI yet. To do so, it is At this point Clan is set up, but you can't use the CLI yet. To do so, it is
recommended to expose it via a `devShell` in your flake. It is also possible to recommended to expose it via a `devShell` in your flake. It is also possible to
@@ -163,8 +163,8 @@ cologne
## Specify Targets ## Specify Targets
Clan needs to know where it can reach your hosts. For each of your hosts, set Clan needs to know where it can reach your hosts. For testing purpose set
`clan.core.networking.targetHost` to its adress or hostname. `clan.core.networking.targetHost` to the machines adress or hostname.
```nix ```nix
# machines/berlin/configuration.nix # machines/berlin/configuration.nix
@@ -173,6 +173,8 @@ Clan needs to know where it can reach your hosts. For each of your hosts, set
} }
``` ```
See our guide on for properly [configuring machines networking](../networking.md)
## Next Steps ## Next Steps
You are now fully set up. Use the CLI to manage your hosts or proceed to You are now fully set up. Use the CLI to manage your hosts or proceed to

View File

@@ -639,7 +639,7 @@ in
Exports are used to share and expose information between instances. Exports are used to share and expose information between instances.
Define exports in the [`perInstance`](#perInstance) or [`perMachine`](#perMachine) scope. Define exports in the [`perInstance`](#roles.perInstance) or [`perMachine`](#perMachine) scope.
Accessing the exports: Accessing the exports: