From fd59a1df25d8fec4dc58f26ca5cb74791514ff97 Mon Sep 17 00:00:00 2001 From: iFargle Date: Fri, 22 Sep 2023 10:45:07 +0900 Subject: [PATCH] Test disk layout --- README.md | 4 +- flake.nix | 2 +- lib/default.nix | 2 +- nixos/hosts/nixos-vm-02/disks.nix | 86 +++++++++++++++---------------- 4 files changed, 46 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 73076c3f..07bfac9a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ * Installing a system from the ISO: ``` +nixos-install [] + HOSTNAME='YourHostnameHere' curl https://git.sysctl.io/albert/nix/raw/branch/main/nixos/hosts/${HOSTNAME}/disks.nix >> /tmp/disks.nix echo 'LUKSEncryptionKeyHere' >> /tmp/secret.key @@ -32,7 +34,7 @@ nixos-install --flake /etc/nixos/git#${HOSTNAME} -v --show-trace --no-root-passw * [ ] Add bracket auto-completion * [ ] Find a way to have magit save login credentials * [x] Try disko - [Link](https://github.com/nix-community/disko) -* [ ] btrfs snapshots +* [ ] btrfs snapshotsd * [ ] vscodium and user-config.js file? * [ ] rofi - bitwarden-cli / bitwarden-menu ([Link](https://search.nixos.org/packages?channel=23.05&show=bitwarden-menu&from=0&size=50&sort=relevance&type=packages&query=bitwarden)) diff --git a/flake.nix b/flake.nix index 542b0af8..bf112b7c 100644 --- a/flake.nix +++ b/flake.nix @@ -67,4 +67,4 @@ in import ./shell.nix { inherit pkgs sops-nix; } ); }; -} +} \ No newline at end of file diff --git a/lib/default.nix b/lib/default.nix index 84aaf415..3f1cd641 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -59,7 +59,7 @@ ]; }; - # Combines mkHost and mkHome for image building + # Combines mkHost and mkHome for image building - Uses minimal to make a smaller image mkMinImage = { hostname , username ? "albert", diff --git a/nixos/hosts/nixos-vm-02/disks.nix b/nixos/hosts/nixos-vm-02/disks.nix index 0f0957a0..91076ddb 100644 --- a/nixos/hosts/nixos-vm-02/disks.nix +++ b/nixos/hosts/nixos-vm-02/disks.nix @@ -2,58 +2,54 @@ disko.devices = { disk = { sda = { - type = "disk"; device = "/dev/sda"; content = { - type = "gpt"; - partitions = { - ESP = { - label = "EFI"; - name = "ESP"; - size = "512M"; - type = "EF00"; - bootable = true; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - ]; - }; + type = "table"; + format = "gpt"; + partitions = [ + { + name = "BOOT"; + label = "BOOT"; + start = "0%"; + end = "550MiB"; + bootable = true; + flags = [ "esp" ]; + fs-type = "fat32"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; }; - luks = { - size = "100%"; + } + { + name = "ROOT"; + label = "ROOT"; + size = "100%"; + content = { + type = "luks"; + name = "LUKS-ROOT"; + extraOpenArgs = [ "--allow-discards" ]; + settings.keyFile = "/tmp/secret.key"; content = { - type = "luks"; - name = "crypted"; - extraOpenArgs = [ "--allow-discards" ]; - # if you want to use the key for interactive login be sure there is no trailing newline - # for example use `echo -n "password" > /tmp/secret.key` - #passwordFile = "/tmp/secret.key"; # Interactive - settings.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" ]; - }; + 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" ]; }; }; }; - }; - }; + } + ]; }; }; };