!oNSIfazDqEcwhcOjSL:matrix.org

disko

381 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko97 Servers

Load older messages


SenderMessageTime
7 Apr 2024
@perchun:matrix.orgPerchun Pak Btw, I don't know if it is intended, but this command returns exit code 0 when partition exists
https://github.com/nix-community/disko/blob/0a17298c0d96190ef3be729d594ba202b9c53beb/lib/types/gpt.nix#L158
Should I open an issue on GitHub?
10:00:59
@lassulus:lassul.uslassulushmm, what is the problem?10:02:55
@lassulus:lassul.uslassulusah maybe an ! is missing10:04:51
@lassulus:lassul.uslassulusbut not sure how it even gets to that point, since it will skip the whole if statement if a table exists on line 15610:06:21
@perchun:matrix.orgPerchun Pak I am not familiar with the code, but this line has 3 possible states (from my understanding)
- partition table does not exist
- partition does not exist
- partition exists

In bottom two sgdisk exits with 0 code, but in first with some other (don't remember exactly). Though if partition table doesn't exist, it will be created on top of the script
10:06:40
@lassulus:lassul.uslassulusbut not sure there is a scenario where a partition table does not exist but a partition?10:07:33
@lassulus:lassul.uslassuluseither way, the code doesn't do whats intended :)10:07:46
@perchun:matrix.orgPerchun Pak
In reply to @lassulus:lassul.us
but not sure how it even gets to that point, since it will skip the whole if statement if a table exists on line 156
I deleted the part that created the partition table, that's how it did for me

So if the scenario where sgdisk exits with non zero doesn't exist, why is there an if statement?
10:08:26
@perchun:matrix.orgPerchun Pak
In reply to @lassulus:lassul.us
but not sure how it even gets to that point, since it will skip the whole if statement if a table exists on line 156
* I deleted the part that created the partition table, that's how it did for me (not saying you should support this use case)

So if the scenario where sgdisk exits with non zero doesn't exist, why is there an if statement?
10:09:07
@lassulus:lassul.uslassuluswell I wanted to create it in the case where the table exists but the partition does not10:11:55
@lassulus:lassul.uslassulusI will prepare a commit10:12:02
@lassulus:lassul.uslassulusgive me 5min10:12:04
@perchun:matrix.orgPerchun Pak I already did everything with my disk, it is not a blocker for me 10:12:38
@perchun:matrix.orgPerchun Pak * I already did everything with my disk, it is not a problem for me 10:12:47
@perchun:matrix.orgPerchun Pak Just a thing I noticed  10:12:59
@xxxcrow:matrix.orgn3v3r_a9a1nhalo! has anyone achieved disko + nixos-anywhere + impermanence btrfs? (+sops) 10:13:01
@perchun:matrix.orgPerchun Pak
In reply to @xxxcrow:matrix.org
halo!
has anyone achieved disko + nixos-anywhere + impermanence btrfs? (+sops)
Vimjoyer did config for btrfs + impermanence, don't know about other things 
https://youtu.be/YPKwkWtK7l0?feature=shared
10:14:30
@lassulus:lassul.uslassulushmm, indeed weird, that sgdisk exists with 0 on an error10:20:57
@xxxcrow:matrix.orgn3v3r_a9a1n
In reply to @perchun:matrix.org
Vimjoyer did config for btrfs + impermanence, don't know about other things 
https://youtu.be/YPKwkWtK7l0?feature=shared

disko has gone crazy, or me?

                content = {
                  type = "btrfs";
                  extraArgs = ["-f"];
                  subvolumes = {
                    "/root" = {
                      mountpoint = "/";
                      mountOptions = ["compress=zstd" "noatime"];
                    };

mounts / in /root

10:34:06
@perchun:matrix.orgPerchun Pak
In reply to @xxxcrow:matrix.org

disko has gone crazy, or me?

                content = {
                  type = "btrfs";
                  extraArgs = ["-f"];
                  subvolumes = {
                    "/root" = {
                      mountpoint = "/";
                      mountOptions = ["compress=zstd" "noatime"];
                    };

mounts / in /root

It backups all your data on every reboot. I can show you the folder structure when I arrive home
10:35:16
@xxxcrow:matrix.orgn3v3r_a9a1nso, i can find all the stuff in /root directory10:35:16
@xxxcrow:matrix.orgn3v3r_a9a1n
In reply to @perchun:matrix.org
It backups all your data on every reboot. I can show you the folder structure when I arrive home
i mean, it's not even that much of impermanence, but really about disko
10:36:14
@xxxcrow:matrix.orgn3v3r_a9a1n

ok, this is the drive:

            luks = {
              size = "100%";
              content = {
                type = "luks";
                name = "nvme-crypt";
                # 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 = {
                    "/root" = {
                      mountpoint = "/";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/home" = {
                      mountpoint = "/home";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/nix" = {
                      mountpoint = "/nix";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/persist" = {
                      mountpoint = "/persist";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/log" = {
                      mountpoint = "/var/log";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/swap" = {
                      mountpoint = "/.swapvol";
                      swap.swapfile.size = "8G";
                    };
                  };
                };
              };
            };
          };
        };
      };
10:36:46
@perchun:matrix.orgPerchun Pak When you're booted into the system, root is in /. When you mount the disk, structure is something like
```
- nix/store
- old_roots
 - $(date) # older than 30d are automatically deleted
- root
- and some fourth folder name of which I completely forgot
```
10:37:23
@perchun:matrix.orgPerchun Pak Fourth is persist 10:38:10
@perchun:matrix.orgPerchun Pak Btw, here is how you can use it with luks
https://gist.github.com/PerchunPak/0df4fa9117dfb036b0564a9f058f539c
10:39:49
@xxxcrow:matrix.orgn3v3r_a9a1n
In reply to @xxxcrow:matrix.org

ok, this is the drive:

            luks = {
              size = "100%";
              content = {
                type = "luks";
                name = "nvme-crypt";
                # 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 = {
                    "/root" = {
                      mountpoint = "/";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/home" = {
                      mountpoint = "/home";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/nix" = {
                      mountpoint = "/nix";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/persist" = {
                      mountpoint = "/persist";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/log" = {
                      mountpoint = "/var/log";
                      mountOptions = ["compress=zstd" "noatime"];
                    };
                    "/swap" = {
                      mountpoint = "/.swapvol";
                      swap.swapfile.size = "8G";
                    };
                  };
                };
              };
            };
          };
        };
      };
ok, what do you thing the result of this would be?
10:42:22
@xxxcrow:matrix.orgn3v3r_a9a1n

i do:
nix run github:nix-community/nixos-anywhere -- --flake .#immortal root@192.168.1.100 --no-reboot

10:44:32
@xxxcrow:matrix.orgn3v3r_a9a1nthen mount /dev/mapper/nvme-crypt /mnt10:44:50
@xxxcrow:matrix.orgn3v3r_a9a1n
[root@nixos:~]# ls /mnt/
home  log  nix  persist  root  swap

[root@nixos:~]# ls /mnt/root
bin  boot  dev  etc  home  lib  lib64  nix  persist  proc  root  run  srv  sys  tmp  usr  var

[root@nixos:~]# btrfs subvolume list /mnt
ID 256 gen 29 top level 5 path home
ID 257 gen 33 top level 5 path log
ID 258 gen 33 top level 5 path nix
ID 259 gen 29 top level 5 path persist
ID 260 gen 36 top level 5 path root
ID 261 gen 18 top level 5 path swap
ID 262 gen 29 top level 260 path root/srv
ID 263 gen 30 top level 260 path root/var/lib/portables
ID 264 gen 31 top level 260 path root/var/lib/machines
ID 265 gen 33 top level 260 path root/var/tmp

10:47:53

Show newer messages


Back to Room ListRoom Version: 10