Comments (13)
Did you try it and ran into an error? Hooks shouldn't be constrained to zfs, if they are it's probably a bug
from disko.
Did you try it and ran into an error? Hooks shouldn't be constrained to zfs, if they are it's probably a bug
I tried it and it got an error
from disko.
Could you post the error?
from disko.
i tried it yesterday and the error was option not found
i also tried looking at the source code and it seems only zfs has this option
from disko.
I found my mistake.
I feel so stupid, I'm so sorry everyone!
from disko.
@hmanhng Apologies for posting in a closed issue, but can you actually post what your mistake/solution was? I am running into the same issue but don't understand the disko
source as well as you 😃
from disko.
We might be able to improve the docs if one of you could post us the actual error message :D
from disko.
Sorry, you're right, with my disk config being
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/disk/by-id/nvme-WD_BLACK_SN850X_4000GB_23270P802370";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "500M";
priority = 1;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
OS = {
size = "100%";
content = {
type = "btrfs";
subvolumes = {
"SYSTEM" = {};
"SYSTEM/rootfs" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" "nodiratime" ];
postCreateHook = ''
btrfs subvolume snapshot create -r ...
'';
};
"SYSTEM/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" "nodiratime" ];
};
"SYSTEM/swap" = {
mountpoint = "/swap";
swap = {
swapfile.size = "48G";
};
};
"DATA" = {};
"DATA/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" "noatime" "nodiratime" ];
};
"DATA/persistence" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" "nodiratime" ];
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
}
I get the error
error: The option `disko.devices.disk.main.content.partitions.OS.content.subvolumes."SYSTEM/rootfs".postCreateHook' does not exist.
(possible copy-paste errors in the above as I'm re-writing it from the terminal of one machine to another)
from disko.
We might be able to improve the docs if one of you could post us the actual error message :D
I was confused about it but after reading the source code I got it fixed.
I no longer have it so thank you for your help
from disko.
@TimJones
This is my configuration and it works fine.
{disk ? "nvme0n1", ...}: {
disko.devices = {
disk = {
${disk} = {
device = "/dev/${disk}";
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "esp";
start = "1MiB";
end = "512MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
extraArgs = ["-F 32"];
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
}
{
name = "root";
start = "512MiB";
end = "70%";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = ["--allow-discards"];
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "pool";
};
};
}
];
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];
mountOptions = [
"defaults"
"lazytime"
];
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount "/dev/mapper/pool-root" "$MNTPOINT" -o subvol=/
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/rootfs $MNTPOINT/rootfs-blank
'';
subvolumes = {
"rootfs" = {
mountpoint = "/";
};
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
};
"/home" = {
mountpoint = "/home";
mountOptions = ["compress=zstd"];
};
};
};
};
};
};
};
};
}
from disko.
@TimJones You need to set postCreateHook
to the same level as subvolumes
I also made the same mistake.
The process of creating a btrfs
volume is different from zfs
so it may require a bit of hacking.
from disko.
@hmanhng Thanks for the info. I am very new to nix so reading the source still wasn't clear to me. Your example helps a lot!
from disko.
You're welcome.
from disko.
Related Issues (20)
- Add docs for upgrade from legacy table to gpt HOT 4
- QUESTION: neededForBoot option HOT 2
- Random Boot failures due to failing to mount /usr/bin HOT 4
- Size range HOT 1
- encrypted swap and hibernation HOT 2
- Generate an .iso unattended install image HOT 17
- typo in the docs?
- how to to pass flake `self` using `specialArgs`? HOT 2
- disko-install: error: infinite recursion encountered HOT 13
- How can I migrate my setup to Disko (without losing data)? HOT 2
- Mounting the encrypted disko config takes to long - Disko config wrong or Mount config wrong? HOT 1
- confusing disk label applied when using ZFS HOT 2
- diskoImagesScript creates host's user home dir with some garbage leftovers HOT 7
- "Pool zpool_ssd in state MISSING, waiting" then system crashes
- Can disko-install support functions similar to nixos-rebuild --build-host? HOT 2
- setting user password after disko-install does not work anymore ... HOT 1
- How to use `sops-nix` when first partitioning disk with `disko`? HOT 12
- Refuse to evaluate if zpool is set to mirror if only one device is given
- Bind mounts in make-disk-image HOT 1
- resumeDevice for swap on btrfs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disko.