From 26d677cea761a3c644032e499d274319865c74c7 Mon Sep 17 00:00:00 2001 From: notohh Date: Mon, 22 Apr 2024 18:02:29 -0400 Subject: [PATCH 1/5] hosts: enable disko --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 4 ++++ hosts/ame/disko-config.nix | 33 +++++++++++++++++++++++++++++++++ hosts/default.nix | 2 ++ hosts/tsuki/disko-config.nix | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 hosts/ame/disko-config.nix create mode 100644 hosts/tsuki/disko-config.nix diff --git a/flake.lock b/flake.lock index 8f264c3..38c4312 100644 --- a/flake.lock +++ b/flake.lock @@ -148,6 +148,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713749408, + "narHash": "sha256-9hFaSpgx+rZgGVLsjWdT+QUGyZplUyGdK45IoWEx1GM=", + "owner": "nix-community", + "repo": "disko", + "rev": "b8785a1c37f6176b6bc3d2939df329ab3a8f226c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -1339,6 +1359,7 @@ "attic": "attic", "atuin": "atuin", "deploy-rs": "deploy-rs", + "disko": "disko", "flake-parts": "flake-parts_2", "helix": "helix", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index d24de87..3a76b7e 100755 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,10 @@ url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/ame/disko-config.nix b/hosts/ame/disko-config.nix new file mode 100644 index 0000000..e69131f --- /dev/null +++ b/hosts/ame/disko-config.nix @@ -0,0 +1,33 @@ +{ + disko.devices = { + disk = { + vdb = { + device = "/dev/vda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + end = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + end = "-0"; + content = { + type = "filesystem"; + format = "bcachefs"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix index 5919ec8..d6f5769 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -11,6 +11,7 @@ atticModule = inputs.attic.nixosModules.atticd; nurModule = inputs.nur.nixosModules.nur; t480Module = inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t480; + diskoModule = inputs.disko.nixosModules.default; in { tsuki = nixosSystem { inherit specialArgs; @@ -20,6 +21,7 @@ hmModule atticModule nurModule + diskoModule { home-manager = { useGlobalPkgs = true; diff --git a/hosts/tsuki/disko-config.nix b/hosts/tsuki/disko-config.nix new file mode 100644 index 0000000..903ed01 --- /dev/null +++ b/hosts/tsuki/disko-config.nix @@ -0,0 +1,33 @@ +{ + disko.devices = { + disk = { + vdb = { + device = "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + end = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + end = "-0"; + content = { + type = "filesystem"; + format = "bcachefs"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} From e9fdef46043244e0bc8174bc0918c51bfc506ec7 Mon Sep 17 00:00:00 2001 From: notohh Date: Mon, 22 Apr 2024 18:48:07 -0400 Subject: [PATCH 2/5] ame: update disko --- hosts/ame/disko-config.nix | 4 ++-- hosts/ame/hardware.nix | 21 +++++---------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/hosts/ame/disko-config.nix b/hosts/ame/disko-config.nix index e69131f..6895ac3 100644 --- a/hosts/ame/disko-config.nix +++ b/hosts/ame/disko-config.nix @@ -1,8 +1,8 @@ { disko.devices = { disk = { - vdb = { - device = "/dev/vda"; + sda = { + device = "/dev/sda"; type = "disk"; content = { type = "gpt"; diff --git a/hosts/ame/hardware.nix b/hosts/ame/hardware.nix index fdde3e6..3fd0b57 100644 --- a/hosts/ame/hardware.nix +++ b/hosts/ame/hardware.nix @@ -27,24 +27,13 @@ }; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/57411820-f154-497e-9c7e-dfcb1f21c5cf"; - fsType = "ext4"; - }; - "/boot/efi" = { - device = "/dev/disk/by-uuid/4D09-1D57"; - fsType = "vfat"; - }; - "/nas/restic" = { - device = "192.168.1.199:/mnt/Sutoreji/nix-restic-data/ame"; - fsType = "nfs"; - }; + zramSwap = { + enable = true; + swapDevices = 1; + memoryPercent = 50; + algorithm = "zstd"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/4f69ab31-f6a9-4799-92f1-5abbe0dc9180";} - ]; networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; From 30f5b57fabd3eb6e2ae81c3b82dbe1fd0c2d6ba0 Mon Sep 17 00:00:00 2001 From: notohh Date: Mon, 22 Apr 2024 21:55:21 -0400 Subject: [PATCH 3/5] hosts: update disko --- hosts/ame/hardware.nix | 3 +-- hosts/tsuki/disko-config.nix | 2 +- hosts/tsuki/hardware.nix | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hosts/ame/hardware.nix b/hosts/ame/hardware.nix index 3fd0b57..de17c43 100644 --- a/hosts/ame/hardware.nix +++ b/hosts/ame/hardware.nix @@ -5,6 +5,7 @@ ... }: { imports = [ + ./disko-config.nix (modulesPath + "/installer/scan/not-detected.nix") ]; @@ -18,7 +19,6 @@ }; efi = { canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; }; }; initrd = { @@ -30,7 +30,6 @@ zramSwap = { enable = true; swapDevices = 1; - memoryPercent = 50; algorithm = "zstd"; }; diff --git a/hosts/tsuki/disko-config.nix b/hosts/tsuki/disko-config.nix index 903ed01..8dc6ba1 100644 --- a/hosts/tsuki/disko-config.nix +++ b/hosts/tsuki/disko-config.nix @@ -1,7 +1,7 @@ { disko.devices = { disk = { - vdb = { + nvme0n1 = { device = "/dev/nvme0n1"; type = "disk"; content = { diff --git a/hosts/tsuki/hardware.nix b/hosts/tsuki/hardware.nix index 32ed5a9..1937c62 100755 --- a/hosts/tsuki/hardware.nix +++ b/hosts/tsuki/hardware.nix @@ -5,6 +5,7 @@ ... }: { imports = [ + # ./disko-config.nix (modulesPath + "/installer/scan/not-detected.nix") ]; From 1b656f3467c6b55b7fa4e95ec07e28210c9438a7 Mon Sep 17 00:00:00 2001 From: notohh Date: Tue, 23 Apr 2024 10:55:50 -0400 Subject: [PATCH 4/5] hosts: update inputs --- hosts/ame/hardware.nix | 4 +++- hosts/default.nix | 2 -- hosts/tsuki/hardware.nix | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hosts/ame/hardware.nix b/hosts/ame/hardware.nix index de17c43..abe875b 100644 --- a/hosts/ame/hardware.nix +++ b/hosts/ame/hardware.nix @@ -1,12 +1,14 @@ { + inputs, config, lib, modulesPath, ... }: { imports = [ - ./disko-config.nix + inputs.disko.nixosModules.default (modulesPath + "/installer/scan/not-detected.nix") + ./disko-config.nix ]; boot = { diff --git a/hosts/default.nix b/hosts/default.nix index d6f5769..5919ec8 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -11,7 +11,6 @@ atticModule = inputs.attic.nixosModules.atticd; nurModule = inputs.nur.nixosModules.nur; t480Module = inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t480; - diskoModule = inputs.disko.nixosModules.default; in { tsuki = nixosSystem { inherit specialArgs; @@ -21,7 +20,6 @@ hmModule atticModule nurModule - diskoModule { home-manager = { useGlobalPkgs = true; diff --git a/hosts/tsuki/hardware.nix b/hosts/tsuki/hardware.nix index 1937c62..7fa3987 100755 --- a/hosts/tsuki/hardware.nix +++ b/hosts/tsuki/hardware.nix @@ -1,12 +1,14 @@ { + inputs, config, lib, modulesPath, ... }: { imports = [ - # ./disko-config.nix + inputs.disko.nixosModules.default (modulesPath + "/installer/scan/not-detected.nix") + # ./disko-config.nix ]; boot = { From 24c8bcff4c37d0a8a337f1fba0ea2d1391ed5d8f Mon Sep 17 00:00:00 2001 From: notohh Date: Mon, 22 Apr 2024 21:55:21 -0400 Subject: [PATCH 5/5] hosts: update disko --- hosts/ame/hardware.nix | 2 +- hosts/tsuki/hardware.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/ame/hardware.nix b/hosts/ame/hardware.nix index abe875b..780b88a 100644 --- a/hosts/ame/hardware.nix +++ b/hosts/ame/hardware.nix @@ -6,7 +6,7 @@ ... }: { imports = [ - inputs.disko.nixosModules.default + ./disko-config.nix (modulesPath + "/installer/scan/not-detected.nix") ./disko-config.nix ]; diff --git a/hosts/tsuki/hardware.nix b/hosts/tsuki/hardware.nix index 7fa3987..8758f3e 100755 --- a/hosts/tsuki/hardware.nix +++ b/hosts/tsuki/hardware.nix @@ -6,7 +6,7 @@ ... }: { imports = [ - inputs.disko.nixosModules.default + # ./disko-config.nix (modulesPath + "/installer/scan/not-detected.nix") # ./disko-config.nix ];