From b68cb8781740270641bc1c19d9b1106e8a873957 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 17:20:56 +0200 Subject: [PATCH 01/10] btrfs maybe plsplspls --- devices/ellaca/disko.nix | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 devices/ellaca/disko.nix diff --git a/devices/ellaca/disko.nix b/devices/ellaca/disko.nix new file mode 100644 index 0000000..482ed8d --- /dev/null +++ b/devices/ellaca/disko.nix @@ -0,0 +1,64 @@ +{ + disko.devices = { + disk = { + vdb = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "128M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + end = "-16G"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + "/rootfs" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/"; + }; + "/home" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/home"; + }; + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + # Subvolume for the swapfile + "/swap" = { + mountpoint = "/.swapvol"; + swap = { + swapfile.size = "20M"; + swapfile2.size = "20M"; + swapfile2.path = "rel-path"; + }; + }; + }; + swap = { + swapfile = { + size = "16G"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} From d21880f08c67aa3c721e978a247ccec533a3fc4e Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 21:45:42 +0200 Subject: [PATCH 02/10] added second disk --- devices/ellaca/disko.nix | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/devices/ellaca/disko.nix b/devices/ellaca/disko.nix index 482ed8d..b1b6a39 100644 --- a/devices/ellaca/disko.nix +++ b/devices/ellaca/disko.nix @@ -1,7 +1,7 @@ { disko.devices = { disk = { - vdb = { + vda = { type = "disk"; device = "/dev/nvme0n1"; content = { @@ -39,15 +39,6 @@ mountOptions = [ "compress=zstd" "noatime" ]; mountpoint = "/nix"; }; - # Subvolume for the swapfile - "/swap" = { - mountpoint = "/.swapvol"; - swap = { - swapfile.size = "20M"; - swapfile2.size = "20M"; - swapfile2.path = "rel-path"; - }; - }; }; swap = { swapfile = { @@ -59,6 +50,29 @@ }; }; }; + vdb = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + "/ext" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/ext"; + }; + }; + }; + }; + }; + }; }; }; } From 824e82ec45edfbcb969f8715b7e5a192f0654355 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 21:50:46 +0200 Subject: [PATCH 03/10] added disko module --- devices/ellaca/default.nix | 1 + devices/ellaca/hardware-config.nix | 23 +---------------------- flake.nix | 5 +++++ outputs.nix | 3 ++- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/devices/ellaca/default.nix b/devices/ellaca/default.nix index e8a2e4b..8203bf7 100644 --- a/devices/ellaca/default.nix +++ b/devices/ellaca/default.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { imports = [ ./hardware-config.nix + ./disko.nix ./nvidia.nix ./options.nix ]; diff --git a/devices/ellaca/hardware-config.nix b/devices/ellaca/hardware-config.nix index c805605..c0cbc1f 100644 --- a/devices/ellaca/hardware-config.nix +++ b/devices/ellaca/hardware-config.nix @@ -1,30 +1,9 @@ -{ config, lib, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - +{ config, lib, ... }: { boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/95b15244-c97c-42a5-9be1-ed5df6872dcb"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/BF87-B3DE"; - fsType = "vfat"; - }; - - fileSystems."/ext" = { - device = "/dev/disk/by-uuid/31608388-1043-47a0-a5da-e92250e821f8"; - fsType = "ext4"; - }; - - swapDevices =[ { device = "/dev/disk/by-uuid/b6445ced-1cc2-461f-a81f-6e8409c10f48"; } ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction diff --git a/flake.nix b/flake.nix index cbc14ef..37d6ff8 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,11 @@ url = "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs: import ./outputs.nix inputs; diff --git a/outputs.nix b/outputs.nix index 3aa3f1e..661379e 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,10 +1,11 @@ -{ nixpkgs, home-manager, nixos-hardware, nur, niri, ... }@inputs: { +{ nixpkgs, home-manager, nixos-hardware, nur, niri, disko, ... }@inputs: { nixosConfigurations = let clientModules = [ ./modules/system ./options.nix niri.nixosModules.niri + disko.nixosModules.disko home-manager.nixosModules.home-manager { nixpkgs.overlays = [ nur.overlay From 8fe0b2f9dded870ed481d8d3a13447284d4208ad Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 21:54:08 +0200 Subject: [PATCH 04/10] missing closing braces --- devices/ellaca/disko.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/devices/ellaca/disko.nix b/devices/ellaca/disko.nix index b1b6a39..408370b 100644 --- a/devices/ellaca/disko.nix +++ b/devices/ellaca/disko.nix @@ -68,6 +68,7 @@ mountOptions = [ "compress=zstd" "noatime" ]; mountpoint = "/ext"; }; + }; }; }; }; From 12af9ae0fe42d0d1654126d73998186bdb4f8397 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 22:04:09 +0200 Subject: [PATCH 05/10] added overall mountpoint --- devices/ellaca/disko.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devices/ellaca/disko.nix b/devices/ellaca/disko.nix index 408370b..5859015 100644 --- a/devices/ellaca/disko.nix +++ b/devices/ellaca/disko.nix @@ -40,6 +40,8 @@ mountpoint = "/nix"; }; }; + + mountpoint = "/pratition-root"; swap = { swapfile = { size = "16G"; From e7ac0a8f6db0ad5abe30fd3590b9b5548e7183d3 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 22:40:07 +0200 Subject: [PATCH 06/10] update --- flake.lock | 57 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 076add5..0c49378 100644 --- a/flake.lock +++ b/flake.lock @@ -98,6 +98,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715070411, + "narHash": "sha256-5CNvkH0Nf7yMwgKhjUNg/lUK40C7DXB4zKOuA2jVO90=", + "owner": "nix-community", + "repo": "disko", + "rev": "4677f6c53482a8b01ee93957e3bdd569d51261d6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-compat": { "locked": { "lastModified": 1696426674, @@ -236,11 +256,11 @@ ] }, "locked": { - "lastModified": 1714981474, - "narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=", + "lastModified": 1715077503, + "narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=", "owner": "nix-community", "repo": "home-manager", - "rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f", + "rev": "6e277d9566de9976f47228dd8c580b97488734d4", "type": "github" }, "original": { @@ -261,11 +281,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1714951328, - "narHash": "sha256-qCKsQcM9uOxZ+ATJ1iYOuQNLP5AwXiTs0hraM3+jj3Q=", + "lastModified": 1715110424, + "narHash": "sha256-rPFWgi2ngVwf5hhQR/5WbHioEEd2qNQGf2h0F9G/ft4=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "520b2c1c1a1d30a579fa275bc85e3af58dbccde4", + "rev": "cea8f80a5b8171e7c2b90b89c67ef4b28faa2bf9", "type": "github" }, "original": { @@ -294,11 +314,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1714900109, - "narHash": "sha256-+VJWriIMcBv6p+Ri6e/6OWHrItWlunitXPzhfCvj82w=", + "lastModified": 1715105951, + "narHash": "sha256-DWhwI5hTqVCjNuboPDAwKLsdamSlgE/FtJJN/+hdglA=", "owner": "YaLTeR", "repo": "niri", - "rev": "9847a652af864109b3543e42d48087a38c0729ad", + "rev": "5248e534995dc21279cfd14651c994cd02353452", "type": "github" }, "original": { @@ -325,11 +345,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1714984131, - "narHash": "sha256-kjIvFbbKb6RGIJyOgcF+BBWHNzhNSNqRTxX/SkrkRno=", + "lastModified": 1715010655, + "narHash": "sha256-FmdhvR/hgBkPDvIv/HOEIQsSMaVXh8wvTrnep8dF3Jc=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "e148ccbecbd2fe4dc4768fba67f6db828466ad06", + "rev": "d1659c9eb8af718118fb4bbe2c86797c8b8623eb", "type": "github" }, "original": { @@ -368,11 +388,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1714782413, - "narHash": "sha256-tbg0MEuKaPcUrnmGCu4xiY5F+7LW2+ECPKVAJd2HLwM=", + "lastModified": 1714971268, + "narHash": "sha256-IKwMSwHj9+ec660l+I4tki/1NRoeGpyA2GdtdYpAgEw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "651b4702e27a388f0f18e1b970534162dec09aff", + "rev": "27c13997bf450a01219899f5a83bd6ffbfc70d3c", "type": "github" }, "original": { @@ -414,11 +434,11 @@ }, "nur": { "locked": { - "lastModified": 1715006743, - "narHash": "sha256-ILUhdMg6UYaWB7Tl+Npw96bhIjOQXyxgPIGiJb/KKvg=", + "lastModified": 1715113425, + "narHash": "sha256-eUP1YApWNiTxwGvOwpwomiTMO3pYo0mKHj8jF+lSRyk=", "owner": "nix-community", "repo": "nur", - "rev": "92319ea1c3659134da57f4ab53c415f2994527a4", + "rev": "f2400f2299b96a4083dbf94c7d1ef8709790666a", "type": "github" }, "original": { @@ -463,6 +483,7 @@ }, "root": { "inputs": { + "disko": "disko", "home-manager": "home-manager", "niri": "niri", "nixos-hardware": "nixos-hardware", From 8731c41b5b649bcfc5982994163d2aae2fd2728a Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 23:03:52 +0200 Subject: [PATCH 07/10] different grub options --- devices/ellaca/default.nix | 2 +- devices/ellaca/disko.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devices/ellaca/default.nix b/devices/ellaca/default.nix index 8203bf7..32060fd 100644 --- a/devices/ellaca/default.nix +++ b/devices/ellaca/default.nix @@ -16,7 +16,7 @@ grub = { enable = true; efiSupport = true; - device = "nodev"; + efiInstallAsRemovable = true; useOSProber = true; font = null; splashImage = null; diff --git a/devices/ellaca/disko.nix b/devices/ellaca/disko.nix index 5859015..1349545 100644 --- a/devices/ellaca/disko.nix +++ b/devices/ellaca/disko.nix @@ -20,7 +20,7 @@ }; }; root = { - end = "-16G"; + size = "100%"; content = { type = "btrfs"; extraArgs = [ "-f" ]; # Override existing partition From 75db472d2b4e413292ff3dd11ac0bea21c76588f Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 23:44:32 +0200 Subject: [PATCH 08/10] manual hardware config if that's the issue --- devices/ellaca/default.nix | 1 - devices/ellaca/hardware-config.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/devices/ellaca/default.nix b/devices/ellaca/default.nix index 32060fd..04e5318 100644 --- a/devices/ellaca/default.nix +++ b/devices/ellaca/default.nix @@ -1,7 +1,6 @@ { pkgs, ... }: { imports = [ ./hardware-config.nix - ./disko.nix ./nvidia.nix ./options.nix ]; diff --git a/devices/ellaca/hardware-config.nix b/devices/ellaca/hardware-config.nix index c0cbc1f..08d9ed7 100644 --- a/devices/ellaca/hardware-config.nix +++ b/devices/ellaca/hardware-config.nix @@ -4,6 +4,33 @@ boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/7d29fef5-9fdf-43b4-ad17-a94774f802b5"; + fsType = "btrfs"; + options = [ "subvol=rootfs" "compress=zstd" "noatime" ]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/DCD8-29D7"; + fsType = "vfat"; + }; + "/nix" = { + device = "/dev/disk/by-uuid/7d29fef5-9fdf-43b4-ad17-a94774f802b5"; + fsType = "btrfs"; + options = [ "subvol=nix" "compress=zstd" "noatime" ]; + }; + "/home" = { + device = "/dev/disk/by-uuid/7d29fef5-9fdf-43b4-ad17-a94774f802b5"; + fsType = "btrfs"; + options = [ "subvol=home" "compress=zstd" "noatime" ]; + }; + "/ext" = { + device = "/dev/disk/by-uuid/90aa2cba-41dc-4efb-b509-822d1e2bc525"; + fsType = "btrfs"; + options = [ "subvol=ext" "compress=zstd" "noatime" ]; + }; + }; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction From 7fd7e0964a2c785b3abd3e7447de933ea42b1534 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 23:46:02 +0200 Subject: [PATCH 09/10] added grub device again --- devices/ellaca/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/devices/ellaca/default.nix b/devices/ellaca/default.nix index 04e5318..f3f1fa7 100644 --- a/devices/ellaca/default.nix +++ b/devices/ellaca/default.nix @@ -16,6 +16,7 @@ enable = true; efiSupport = true; efiInstallAsRemovable = true; + device = "nodev"; useOSProber = true; font = null; splashImage = null; From 5defe3103b5a4fb41b33e80fc5ad2fa23a0d6204 Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 7 May 2024 23:46:50 +0200 Subject: [PATCH 10/10] removed disko for now --- flake.lock | 27 +++------------------------ flake.nix | 5 ----- outputs.nix | 3 +-- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index 0c49378..b228582 100644 --- a/flake.lock +++ b/flake.lock @@ -98,26 +98,6 @@ "type": "github" } }, - "disko": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715070411, - "narHash": "sha256-5CNvkH0Nf7yMwgKhjUNg/lUK40C7DXB4zKOuA2jVO90=", - "owner": "nix-community", - "repo": "disko", - "rev": "4677f6c53482a8b01ee93957e3bdd569d51261d6", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "disko", - "type": "github" - } - }, "flake-compat": { "locked": { "lastModified": 1696426674, @@ -434,11 +414,11 @@ }, "nur": { "locked": { - "lastModified": 1715113425, - "narHash": "sha256-eUP1YApWNiTxwGvOwpwomiTMO3pYo0mKHj8jF+lSRyk=", + "lastModified": 1715118353, + "narHash": "sha256-3TqhtMk0arxsDHagrK4TbnqJnHvnPlgt9PXaioP8+84=", "owner": "nix-community", "repo": "nur", - "rev": "f2400f2299b96a4083dbf94c7d1ef8709790666a", + "rev": "dbfe43f42385384352f1d6f7fe2ace2208e88517", "type": "github" }, "original": { @@ -483,7 +463,6 @@ }, "root": { "inputs": { - "disko": "disko", "home-manager": "home-manager", "niri": "niri", "nixos-hardware": "nixos-hardware", diff --git a/flake.nix b/flake.nix index 37d6ff8..cbc14ef 100644 --- a/flake.nix +++ b/flake.nix @@ -21,11 +21,6 @@ url = "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; - - disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = inputs: import ./outputs.nix inputs; diff --git a/outputs.nix b/outputs.nix index 661379e..3aa3f1e 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,11 +1,10 @@ -{ nixpkgs, home-manager, nixos-hardware, nur, niri, disko, ... }@inputs: { +{ nixpkgs, home-manager, nixos-hardware, nur, niri, ... }@inputs: { nixosConfigurations = let clientModules = [ ./modules/system ./options.nix niri.nixosModules.niri - disko.nixosModules.disko home-manager.nixosModules.home-manager { nixpkgs.overlays = [ nur.overlay