Hey guys! I’ve been working on something pretty cool that could inspire some other interesting setups.
A second set of eyes would be greatly appreciated.
I am trying to install fedora and nixos on the same machine, but keep them separated.
The goal is to limit the amount of partitions since I want to size change dynamically.
Swap, preferably encrypted for hibernation is preferred.
In order to keep NixOS and Fedora separate I decided to use unique mounts for each.
I chose LUKS to encrypt the whole btrfs partition.
This was the layout and setup I ended up going with.
Partition | Size | OS | Type |
---|---|---|---|
/boot | 1 Gb | Shared | fat32 |
/swap | 32 Gb | Shared | subvolume |
/ | ~ | Shared | btrfs |
/nix/store | ~ | NixOS | subvolume |
/ (Fedora Root) | ~ | Fedora | subvolume |
/ (NixOS Root) | ~ | NixOS | subvolume |
/home/Shared | ~ | Shared | subvolume |
The plan here is for the NixOS install to not mount the fedora root, and for the Fedora install to not mount the NixOS root or the nix store.
I wrote a disko config below but I feel like I am missing something.
In the swap example, there was a presence of an unencrypted swap but I am uninterested in that, is it alright to setup up the encrypted swap without the other as I have done below?
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
encryptedSwap = {
size = "32G";
content = {
type = "swap";
randomEncryption = true;
priority = 100; # prefer to encrypt as long as we have space for it
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
# disable settings.keyFile if you want to use interactive password entry
#passwordFile = "/tmp/secret.key"; # Interactive
settings = {
allowDiscards = true;
keyFile = "/tmp/secret.key";
};
additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
# this should only be mounted if on fedora
# how do i not mount this automatically
"root_fedora" = {
mountpoint = "/";
mountOptions = [
"compress=zstd"
"noatime"
];
};
# this should only be mounted if on nixos
"root_nixos" = {
mountpoint = "/";
mountOptions = [
"compress=zstd"
"noatime"
];
};
# shared contents between fedora and nixos
"shared" = {
mountpoint = "/home/Shared";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [
"compress=zstd"
"noatime"
];
};
};
};
};
};
};
};
};
};
};
}