!oNSIfazDqEcwhcOjSL:matrix.org

disko

351 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko88 Servers

Load older messages


SenderMessageTime
1 Dec 2025
@chickeniq:matrix.orgChickenIQ *

proper hack, works without disko too

{
  config,
  pkgs,
  lib,
  ...
}:

let
  installBootLoader =
    (import (pkgs.path + "/nixos/modules/system/boot/loader/generic-extlinux-compatible") {
      inherit config lib pkgs;
    }).config.content.system.build.installBootLoader;

  populateFirmware =
    (import (pkgs.path + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix") {
      inherit config lib pkgs;
    }).sdImage.populateFirmwareCommands;

  installCmd = pkgs.writeShellScript "populate-boot.sh" ''
    set -e && export PATH=${pkgs.coreutils}/bin:$PATH
    ${installBootLoader} "$@"

    ln -s "/boot" "$NIX_BUILD_TOP/firmware" 
    cd "$NIX_BUILD_TOP" && ${populateFirmware} 
    echo "include usercfg.txt" >> /boot/config.txt
  '';
in
{
  system.build.installBootLoader = lib.mkForce installCmd;
}
03:27:14
@stooj:matrix.orgstooj joined the room.16:54:37
@stooj:matrix.orgstoojRedacted or Malformed Event17:32:21
@stooj:matrix.orgstooj

Possibly a general flake question: what is the syntax for applying a flake from a non-github repo and using a specific branch?

So far I'm trying:

nix run --extra-experimental-features 'nix-command flakes' 'github:nix-community/disko/latest#disko-install' -- --write-efi-boot-entries --flake 'https://codeberg.org/higara/legacy-nix-configuration.git?ref=add-klaes#klaes' --disk nvme0 /dev/nvme0n1

And getting:

error: Failed to open archive (Unrecognizde archive format)
.disko-install-wrapped: line 234: artifacts[1]: unbound variable
17:39:25
@stooj:matrix.orgstooj *

Possibly a general flake question: what is the syntax for applying a flake from a non-github repo and using a specific branch?

So far I'm trying:

nix run --extra-experimental-features 'nix-command flakes' \
    'github:nix-community/disko/latest#disko-install' -- \
    --write-efi-boot-entries \
    --flake 'https://codeberg.org/higara/legacy-nix-configuration.git?ref=add-klaes#klaes' \
    --disk nvme0 /dev/nvme0n1

And getting:

error: Failed to open archive (Unrecognizde archive format)
.disko-install-wrapped: line 234: artifacts[1]: unbound variable
17:40:32
@berrij:fairydust.spaceBerriJI guess you need 'git+https://...' instead of just starting directly with 'https://'17:44:09
@stooj:matrix.orgstoojThanks, I will try that.17:45:08
@brisingr05:matrix.orgBrisingr changed their display name from Brisingr05 to Brisingr.18:39:52
@stooj:matrix.orgstooj Thanks @berrij:fairydust.space 19:08:31
@berrij:fairydust.spaceBerriJQuick question: I want to streamline my deployment process for new machines a bit using disko, flakes and nixos-anywhere. Currently I only use disko without flakes and I crafted this disko config (https://codeberg.org/BerriJ/nixos-config/src/branch/main/hosts/common/disks/disko-luks-lvm-swap-btrfs.nix#L1-L9) which uses some variables for swap-size, etc. Ideally, I would add this config to my flake, and be able to define things like swapsize etc. per host (maybe inside the nixosConfigurations outputs of my flake?) Maybe someone of you has something like that, you would help me a lot 😇🙏20:49:57
@berrij:fairydust.spaceBerriJNevermind, I found this: https://github.com/nix-community/nixos-anywhere-examples/blob/main/flake.nix#L28, which should be exactly what I was looking for. Now I need to wrap my head around provisioning luks encryption passwords 🙃21:13:51
2 Dec 2025
@chickeniq:matrix.orgChickenIQ *

proper hack, works without disko too

{
  config,
  pkgs,
  lib,
  ...
}:

let
  installBootLoader =
    (import (pkgs.path + "/nixos/modules/system/boot/loader/generic-extlinux-compatible") {
      inherit config lib pkgs;
    }).config.content.system.build.installBootLoader;

  populateFirmware =
    (import (pkgs.path + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix") {
      inherit config lib pkgs;
    }).sdImage.populateFirmwareCommands;

  installCommand = pkgs.writeShellScript "populate-boot.sh" ''
    set -e && export PATH=${pkgs.coreutils}/bin:$PATH
    ${builtins.replaceStrings [ "firmware/" ] [ "boot/" ] populateFirmware}
    echo "include usercfg.txt" >> boot/config.txt
    ${installBootLoader} "$@"
  '';
in
{
  system.build.installBootLoader = lib.mkForce installCommand;
}
00:56:06
@sinan:sinanmohd.comsinan

How do you guys handle diffrent /dev/* paths,

i use nixos anywhere to add nodes to my cluster but some nodes will have /dev/nvme0n1 as root and some /dev/sda1 and so on

Is there way to automatically select which ever is avaialable ?

12:47:49
@sinan:sinanmohd.comsinanif not maybe we can use some sort of lib.mkOverride where we assign priority on each path - disk pair, and select the first available one ?12:50:21
@berrij:fairydust.spaceBerriJ I usually pass it as a variable. So my config looks like this: https://codeberg.org/BerriJ/nixos-config/src/branch/main/hosts/common/disks/disko-luks-lvm-swap-btrfs.nix#L16 And then I do: nix --experimental-features "nix-command flakes" <br /> run github:nix-community/disko/c5140c6 -- <br /> --mode destroy,format,mount $SCRIPT_DIR/disko-luks-lvm-swap-btrfs.nix <br /> --yes-wipe-all-disks <br /> --argstr disk "${DISK}" <br /> --arg sizes "${SIZES}" <br /> --arg luks_passwordFile "${LUKS_PWF}" 13:21:53
3 Dec 2025
@blitz:chat.x86.lolblitz joined the room.09:48:57
@blitz:chat.x86.lolblitzHey! Quick question: Is it possible to perserve certain partitions when using disko to deploy a system? I'd like to preserve the ESP and another recovery partition (can be identified by UUID for example)09:49:52
@lassulus:lassul.uslassulusnot easily, you would have to run just the formatScript and have enough space available, you can create some partitons with content = null; which would get ignored by disko, but the offsets for the partition you want to create need to be correct09:51:59
@blitz:chat.x86.lolblitzmmh ok. maybe I'll write my own script that handles this for now, let's see :)09:53:17
@blitz:chat.x86.lolblitzbut thanks!09:53:23
@lassulus:lassul.uslassulusthat is probably easier for now09:53:41
4 Dec 2025
@i-am-logger:matrix.orgIdo Samuelson joined the room.01:47:19
@tanja:catgirl.cloudTanja (she/her) - ☎️ 4201 changed their display name from Tanja (she/her) to Tanja (she/her) - ☎️ 4201.18:09:01
7 Dec 2025
@mou_bugtracker:matrix.orgmouHi, disko community. I have a question. Couple years ago i installed nixos with disko integrated into installation. So disko was used to perform formatting of the disks. Since then configuration preserved in nixos configuration for this host. Overall config consist of nested elements: LUKS -> LVM -> Ext4 on partitions. Overtime i realized that 100Gb is too small for my nix-store volume. And planing to shrink home partition and LV and enlarge nix-store LV and corresponding partition. But what i do not understand, what should i do with current disko cofiguration and how discrepancy of actual LV and Partition sizes with disko definition will affect NixOs boot process? And what action should i take after making changes to LVM? 16:32:09
@cf11:0x2c.orgchaoflow mou: I'd say the boot process does not care about the size of actual partitions, but rather about their existence and order. You could probably also use nixos-generate-config to get the filesSystems attribute set for configuration.nix - usually living in hardware-configuration.nix - and drop disko from the setup. 16:50:54
@cf11:0x2c.orgchaoflowNote: with btrfs subvolumes or zfs datasets you wouldn't have the resizing problem, as those share the available space of one filesystem/partition while providing logical separation, e.g. for snapshots. In that case no LVM would be used but LUKS -> btrfs/zfs or using ZFS encryption, maybe not even LUKS - but I don't have experience with ZFS.16:53:16
@mou_bugtracker:matrix.orgmou Thank you for your answer. I thought about this trick as a precaution. fileSystems dictionary is much more undestandable and manageable when it comes to disaster recovery ))) 16:54:01
@jappie:jappie.devjappie also, you can verify your config using nix repl, e.g. :bl nixosConfigurations.yourHost.config.environment.etc.fstab.source to check fstab (which uses some information from disko - mainly what to mount where) 16:59:32
@mou_bugtracker:matrix.orgmouThank you. This is invaluable. I actually always been interested how to check what disko configuration expands into.17:01:01
@jappie:jappie.devjappiethere's also some systemd services that decrypt luks volumes I think, but I couldn't tell you which ones from the top of my head 😅17:02:54

There are no newer messages yet.


Back to Room ListRoom Version: 10