Compare commits
2 Commits
59e10c3eea
...
73893438cb
| Author | SHA1 | Date | |
|---|---|---|---|
| 73893438cb | |||
| 6932f8507a |
@@ -42,6 +42,25 @@ sudo nix --extra-experimental-features "flakes nix-command" run 'github:nix-comm
|
|||||||
# failed with no space left on device.
|
# failed with no space left on device.
|
||||||
# problem is lots of data is written to the local /nix/store which is mounted on tmpfs in ram
|
# problem is lots of data is written to the local /nix/store which is mounted on tmpfs in ram
|
||||||
# it seems that a workaround could be modifying the bootable stick to contain a swap partition to extend tmpfs storage
|
# it seems that a workaround could be modifying the bootable stick to contain a swap partition to extend tmpfs storage
|
||||||
|
```
|
||||||
|
|
||||||
|
# Testing Disko
|
||||||
|
Testing disko partitioning is working quite well. Just run the following and check the datasets in the vm:
|
||||||
|
```bash
|
||||||
|
nix run -L .\#nixosConfigurations.fanny.config.system.build.vmWithDisko
|
||||||
|
```
|
||||||
|
|
||||||
|
Only problem is that encryption is not working, so it needs to be commented out. For testing host fanny the following parts in ```./machines/modules/disko/fanny.nix``` need to be commented out(for both pools!):
|
||||||
|
```nix
|
||||||
|
datasets = {
|
||||||
|
encrypted = {
|
||||||
|
options = {
|
||||||
|
encryption = "aes-256-gcm"; #THIS ONE
|
||||||
|
keyformat = "passphrase"; #THIS ONE
|
||||||
|
keylocation = "file:///tmp/root.key"; #THIS ONE
|
||||||
|
};
|
||||||
|
# use this to read the key during boot
|
||||||
|
postCreateHook = '' #THIS ONE
|
||||||
|
zfs set keylocation="prompt" "zroot/$name"; #THIS ONE
|
||||||
|
''; #THIS ONE
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ in
|
|||||||
modules = defaultModules ++ [
|
modules = defaultModules ++ [
|
||||||
./fanny/configuration.nix
|
./fanny/configuration.nix
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
./modules/disko/btrfs-laptop.nix
|
./modules/disko/fanny.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,11 @@
|
|||||||
services.acpid.enable = true;
|
services.acpid.enable = true;
|
||||||
|
|
||||||
networking.hostName = "fanny";
|
networking.hostName = "fanny";
|
||||||
|
networking.hostId = "1312acab";
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
virtualisation.vmVariant.virtualisation.graphics = false;
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
system.stateVersion = "23.05"; # Do.. Not.. Change..
|
system.stateVersion = "23.05"; # Do.. Not.. Change..
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted";
|
name = "crypted";
|
||||||
passwordFile = "/tmp/secret.key"; # Interactive
|
passwordFile = /tmp/secret.key; # Interactive
|
||||||
content = {
|
content = {
|
||||||
type = "btrfs";
|
type = "btrfs";
|
||||||
extraArgs = [ "-f" ];
|
extraArgs = [ "-f" ];
|
||||||
|
|||||||
141
machines/modules/disko/fanny.nix
Normal file
141
machines/modules/disko/fanny.nix
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
ssd = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sda";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "1024M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "zroot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hdd0 = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sdb";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
zfs = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "storage";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hdd1 = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sdc";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
zfs = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "storage";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
zpool = {
|
||||||
|
zroot = {
|
||||||
|
type = "zpool";
|
||||||
|
mode = "";
|
||||||
|
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||||
|
options.cachefile = "none";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "zstd";
|
||||||
|
"com.sun:auto-snapshot" = "false";
|
||||||
|
};
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
encrypted = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options = {
|
||||||
|
mountpoint = "none";
|
||||||
|
encryption = "aes-256-gcm";
|
||||||
|
keyformat = "passphrase";
|
||||||
|
keylocation = "file:///tmp/root.key";
|
||||||
|
};
|
||||||
|
# use this to read the key during boot
|
||||||
|
postCreateHook = ''
|
||||||
|
zfs set keylocation="prompt" "zroot/$name";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
"encrypted/root" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
"encrypted/var" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/var";
|
||||||
|
};
|
||||||
|
"encrypted/etc" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/etc";
|
||||||
|
};
|
||||||
|
"encrypted/home" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/home";
|
||||||
|
};
|
||||||
|
"encrypted/nix" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
storage = {
|
||||||
|
type = "zpool";
|
||||||
|
mode = "mirror";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
encrypted = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options = {
|
||||||
|
mountpoint = "none";
|
||||||
|
encryption = "aes-256-gcm";
|
||||||
|
keyformat = "passphrase";
|
||||||
|
keylocation = "file:///tmp/storage.key";
|
||||||
|
};
|
||||||
|
|
||||||
|
# use this to read the key during boot
|
||||||
|
postCreateHook = ''
|
||||||
|
zfs set keylocation="prompt" "zroot/$name";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
"encrypted/data" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/data";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user