From a3885311170447497e6efdc05071ed944d4869e9 Mon Sep 17 00:00:00 2001 From: oluceps Date: Wed, 20 Mar 2024 18:30:35 +0800 Subject: [PATCH] ~ try fix azure img --- flake.lock | 6 +-- hosts/bootstrap/configuration.nix | 23 +++++++++ hosts/bootstrap/default.nix | 7 +-- hosts/bootstrap/disk-config.nix | 83 ++++++++++++------------------- 4 files changed, 59 insertions(+), 60 deletions(-) diff --git a/flake.lock b/flake.lock index ed7c0e21a..d251fef10 100644 --- a/flake.lock +++ b/flake.lock @@ -21662,11 +21662,11 @@ }, "nixpkgs_29": { "locked": { - "lastModified": 1710451336, - "narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", + "lastModified": 1710806803, + "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d691274a972b3165335d261cc4671335f5c67de9", + "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3", "type": "github" }, "original": { diff --git a/hosts/bootstrap/configuration.nix b/hosts/bootstrap/configuration.nix index e75b50b1b..a37d211ec 100644 --- a/hosts/bootstrap/configuration.nix +++ b/hosts/bootstrap/configuration.nix @@ -52,6 +52,7 @@ "audit=0" "net.ifnames=0" + # "systemd.gpt_auto=0" "console=ttyS0" "earlyprintk=ttyS0" "rootdelay=300" @@ -78,4 +79,26 @@ }; }; + services.udev.extraRules = '' + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:0", ATTR{removable}=="0", SYMLINK+="disk/by-lun/0", + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:1", ATTR{removable}=="0", SYMLINK+="disk/by-lun/1", + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:2", ATTR{removable}=="0", SYMLINK+="disk/by-lun/2" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:3", ATTR{removable}=="0", SYMLINK+="disk/by-lun/3" + + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:4", ATTR{removable}=="0", SYMLINK+="disk/by-lun/4" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:5", ATTR{removable}=="0", SYMLINK+="disk/by-lun/5" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:6", ATTR{removable}=="0", SYMLINK+="disk/by-lun/6" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:7", ATTR{removable}=="0", SYMLINK+="disk/by-lun/7" + + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:8", ATTR{removable}=="0", SYMLINK+="disk/by-lun/8" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:9", ATTR{removable}=="0", SYMLINK+="disk/by-lun/9" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:10", ATTR{removable}=="0", SYMLINK+="disk/by-lun/10" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:11", ATTR{removable}=="0", SYMLINK+="disk/by-lun/11" + + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:12", ATTR{removable}=="0", SYMLINK+="disk/by-lun/12" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:13", ATTR{removable}=="0", SYMLINK+="disk/by-lun/13" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:14", ATTR{removable}=="0", SYMLINK+="disk/by-lun/14" + ENV{DEVTYPE}=="disk", KERNEL!="sda" SUBSYSTEM=="block", SUBSYSTEMS=="scsi", KERNELS=="?:0:0:15", ATTR{removable}=="0", SYMLINK+="disk/by-lun/15" + + ''; } diff --git a/hosts/bootstrap/default.nix b/hosts/bootstrap/default.nix index d0284830f..f1841d376 100644 --- a/hosts/bootstrap/default.nix +++ b/hosts/bootstrap/default.nix @@ -12,14 +12,11 @@ ./configuration.nix ./disk-config.nix inputs.disko.nixosModules.disko + inputs.impermanence.nixosModules.impermanence + { nixpkgs = { hostPlatform = lib.mkDefault system; - overlays = with inputs;[ - agenix-rekey.overlays.default - fenix.overlays.default - self.overlays.default - ]; }; } ]; diff --git a/hosts/bootstrap/disk-config.nix b/hosts/bootstrap/disk-config.nix index 892e25d40..582190153 100644 --- a/hosts/bootstrap/disk-config.nix +++ b/hosts/bootstrap/disk-config.nix @@ -1,9 +1,7 @@ -{ lib, ... }: -{ - +{ ... +}: { disko = { enableConfig = false; - devices = { disk.main = { imageSize = "2G"; @@ -12,17 +10,15 @@ content = { type = "gpt"; partitions = { - boot = { - size = "1M"; - type = "EF02"; # for grub MBR - priority = 0; - }; - + # boot = { + # size = "1M"; + # type = "EF02"; # for grub MBR + # priority = 0; + # }; ESP = { - name = "ESP"; size = "512M"; type = "EF00"; - priority = 1; + # priority = 0; content = { type = "filesystem"; format = "vfat"; @@ -30,58 +26,41 @@ mountOptions = [ "fmask=0077" "dmask=0077" ]; }; }; - - root = { + nix = { size = "100%"; content = { - type = "btrfs"; - extraArgs = [ "-f" "--csum xxhash64" ]; - subvolumes = { - "root" = { - mountpoint = "/"; - mountOptions = [ "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" "nosuid" "nodev" ]; - }; - "home" = { - mountOptions = [ "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" "nosuid" "nodev" ]; - mountpoint = "/home"; - }; - "nix" = { - mountOptions = [ "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" "nosuid" "nodev" ]; - mountpoint = "/nix"; - }; - "var" = { - mountOptions = [ "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" "nosuid" "nodev" ]; - mountpoint = "/var"; - }; - }; + type = "filesystem"; + format = "btrfs"; + mountpoint = "/nix"; + mountOptions = [ "compress-force=zstd" "nosuid" "nodev" ]; }; }; }; }; }; + nodev."/" = { + fsType = "tmpfs"; + mountOptions = [ "relatime" "mode=755" "nosuid" "nodev" ]; + }; }; }; + fileSystems."/" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ "relatime" "mode=755" "nosuid" "nodev" ]; + }; - - - fileSystems = { - "/efi" = { - device = "/dev/sda2"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - "/" = { - device = "/dev/sda3"; - fsType = "btrfs"; - options = [ "subvol=/root" "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" ]; - }; - } // lib.genAttrs [ "/home" "/nix" "/var" ] (name: { + fileSystems."/nix" = { device = "/dev/sda3"; fsType = "btrfs"; - options = [ "subvol=${name}" "compress-force=zstd:1" "noatime" "discard=async" "space_cache=v2" "nosuid" "nodev" ]; - }); + options = [ "compress-force=zstd" "nosuid" "nodev" ]; + }; + fileSystems."/efi" = { + device = "/dev/sda2"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; } - +