How to migrate slowly from a regular flake to den? #151
Replies: 3 comments 10 replies
-
|
Hey, @alanscodelog, yes it is possible to make a gradual migration, I'd love to have the time to create a "Migrating guide" for people moving from flakes or flake-parts. Having a migration-path has been in my mind from the start, some of the very first den batteries are exactly for using non-dendritic files in den. However, as you mention, time is the most precious and scarce resource we have, I also find it hard to have time for all Den stuff I'd like to do. So I really hope people do read the existing code and documentation because I've already invested a lot of my time on trying to answer things with them. From your code I see you don't have flake-parts, but do use flakes, so I guess the best starting point for you would be to read You can preserve your current flake.nix and merge your outputs with the expression at minimal flake.nix. # flake.nix
{
inputs = {
# you need these three, they are pure libs and have no extra dependencies.
import-tree.url = "github:vic/import-tree";
flake-aspects.url = "github:vic/flake-aspects";
den.url = "github:vic/den";
};
outputs = inputs:
let
den = (inputs.nixpkgs.lib.evalModules {
modules = [ (inputs.import-tree ./modules) ]; # copy ./modules from minimal template
specialArgs = { inherit inputs; };
}).config.flake;
in {
# all your current flake outputs merged with den.nixosConfigurations / den.homeConfigurations
}Those are the inputs needed by Den, both import-tree and flake-aspects are separate libs because I want to empower people without forcing anyone to use a framework (Den). At nix files in ./modules you can access I see you already have an {
den.aspects.my-laptop = {
nixos = { pkgs, ... }: {
imports = [ ./your-overlays-module.nix ];
};
};
}I'd recommend starting with a single host, even if it is a fake one used only to integrate Den in your existing flake. Once you feel comfortable with Den concepts, start moving your nix logic away from flake.nix, creating more modules, try moving your flake from monolithic to modularization as you feel right. Maybe you can later help improving a migration guide for helping others and your past self. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much for taking the time 🙏. That helps a lot. I will see if I can get the minimal setup working and write a small guide at least for my situation. I did not use flake parts because I didn't really need it but I understand the idea of it's perSystem. |
Beta Was this translation helpful? Give feedback.
-
|
Okay so I've given it a try. I got it working alone but not merged with my config. I tried merging with I could tell something was weird because it was erroring on build about missing properties that were set. When I loaded this simplified version in the repl it complained about system.stateVersion not being set. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking to change my config to use a dentritic setup and I quite liked den, but my config is pretty big. I don't have time to migrate it all at once. Is it possible to migrate a little bit at a time and initially keep the main structure of the modules? Here's a dumbed down version of my flake (the iteration magic for the users/hosts can be removed). Is it possible to just point to the listed modules initially? Also where are overlays supposed to go?
Beta Was this translation helpful? Give feedback.
All reactions