Help with disko #35
-
|
Hi Vic!! Appreciate you providing Normally, in a flake modules kind of way, I would normally have this as a flake module I tried converting it in various ways, first as a non-dedritic module with the exact same file contents, but couldn't figure out how to have disko automatically set the filesystems It doesn't help that my understanding of the Nix language is at a beginner level. Definitely running before I can walk but I just really like the simplicity that If this is not the proper forum, or I did not provide enough information, let me know! I'll continue experimenting as well :) As an aside -- am I missing examples in the repo somewhere on converting external flakes like nvf, disko, etc. into the dendritic pattern? I looked at https://github.com/vic/den/tree/main/templates/default/modules/_example but couldn't find a good example of converting some of these flakes. Appreciate it!! :) |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 39 replies
-
|
Hey, @mariolopjr I know nothing about disko, but I will try to be of help anyways. First of all, lets assume that Now, I might be wrong, so please don't trust me, since I have zero experience with disko. But this is what I imagine from reading the documentation (at flake-parts, I'm following this since I see you are importing their disko flakeModule). # modules/disko.nix -- this is a flake-parts module, like those used in `den` and any dendritic.
{
imports = [ inputs.disko.flakeModules.default ];
flake.diskoConfigurations.my-pc = {
disko.devices = ...; # all your large disko config.
};
}according to the documentation, this is all you need for using with their CLI tools like Digging a bit more in the disko repo I see there's also the option of configuring disko inside a nixos configuration, and that might be an actual usable example in den. I don't know if that is what you need, since your code looks like solved by my previous snippet. The following is den configuration, assuming you already defined # modules/my-pc/partitioning.nix -- lets configure disk inside my-pc nixos.
{ inputs, ... }:
{
den.aspects.my-pc.nixos = {
# anything inside here is a normal NixOS configuration module.
# so you can follow any example that mentions NixOS configurations.
# NOTE: we are importing a `nixos` module not the flake one like on our previous example
# since this block is a nixos configuration.
# This is the module being loaded: https://github.com/nix-community/disko/blob/master/module.nix
imports = [ inputs.disko.nixosModules.default ];
# the module defines options.disko, so I assume after importing the nixos module you can do:
disko.devices = {
# everything you already had here.
};
};
}I dont know which of the two examples is more useful, it depends if you want to use the disko CLI tools use the first option that expose Anyways, hope this can be of any help. Feel free to ask if you have more questions. Also if you are willing to send a PR that adds a very minimal disko setup to one of your example hosts, fell free to sen the PR it will be more than welcome! |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much!! That worked and the CLI still works since the disks can be exposed via flake.diskoConfigurations or via flake.nixosConfigurations. And what this module does is it allows to declare disks in a manner that a blank, unformatted system can have its disk formatted with the same disk configuration it will use to boot with. No more manual partitioning!
This is a great idea! I will refine (and simplify) the disko configuration to include an example den aspect in the repo! Thank you again, the walk thru steps really helped me understand the process of den-ifying other modules lol |
Beta Was this translation helpful? Give feedback.
-
|
Follow-up question @vic (sorry!). I'd like to make the configuration more modular and less brittle (esp once I open a pull request to add the example here). Right now, I have to duplicate the exact same configuration with minor changes between two systems (the VM and non-VM, but in the future, most systems will use a similar configuration but with some options tweaked if needed). So now I have a In this case, I need to change the I tried all sorts of ways to de-duplicate this effort with The other complication is this type of filesystem management should be opt-in for the systems that provide it in the aspect. Really appreciate any advice you can give, thank you!! :) |
Beta Was this translation helpful? Give feedback.
-
|
The module system will merge whatever config tree you need: { den, ...}:
den.aspects.winterfell.includes = [
den.aspects.disko._.common
den.aspects.disko._.machine
];
den.aspects.winterfell.includes = [
den.aspects.disko._.common
den.aspects.disko._.vm
];
den.aspects.disko._.common = {
nixos.disko.devices = { ... } # everything except parts that change
};
den.aspects.disko._.vm = {
nixos.disko.devices = {
disk.main.content.partitons.swap = { ... } # specific to VM
};
};
# same for hardware machine.
} |
Beta Was this translation helpful? Give feedback.
-
|
Hi @vic I'm back! (hope you're not sick of my questions!!) Been re-working my small repo to den 0.3 and it looks like I got it mostly sorted, however, Here's the actual error (and the PR I gave in progress: mariolopjr/infra#1). This is the new disko file that's been parameterized, and using it in the host includes: https://github.com/mariolopjr/infra/blob/d71305478c9d455e7e84af042c5039435e32f58c/modules/hosts/winterfell/winterfell.nix#L20 I've tried digging in with Sorry to constantly bug you, was just curious if you have any thoughts knowing the inner workings of the new Previously, I set the Appreciate any help in advance! |
Beta Was this translation helpful? Give feedback.
-
|
The last couple of days I have closely followed the rapid development on your amazing set of libraries, @vic and I am utterly amazed! However, I still struggle to include disko and individual disk partitions as aspects... Particularly with the latest developments (which I absolutely think are the way to go!) I'm still a little confused and just can't get it to work (yet)... The documentation is very dense for me and the concepts behind it very high-level... Did someone already use the latest developments and can provide a minimal example of how to include disko, sops-nix or other flake modules? Or maybe even has an infrastructure config to share? Any help or examples are much appreciated! |
Beta Was this translation helpful? Give feedback.
-
|
Hey @vic thanks for your super responsive and quick reply – I see you are wholeheartedly invested and that's a very valueable thing :) I have read by and far through all the other issues, discussions, repos, and I'll give it another shot tomorrow and see what I can come up with. Maybe I can prepare a little repo and we can go from there. I would just like to say I really appreciate your work as it is exactly how I imagine this ecosystem to be and where I would like to see it go – if I can say this, since I am still very early in my nix expertise. Keep up the good work! |
Beta Was this translation helpful? Give feedback.
Hey, @mariolopjr
I know nothing about disko, but I will try to be of help anyways.
First of all, lets assume that
disko.devices = ...is the whole configuration tree you shared, no need to repeat your particular disko configuration.Now, I might be wrong, so please don't trust me, since I have zero experience with disko. But this is what I imagine from reading the documentation (at flake-parts, I'm following this since I see you are importing their disko flakeModule).