From 09262e8bac0743db5187b92838f454ab08110bb8 Mon Sep 17 00:00:00 2001 From: Yadunand Prem Date: Wed, 29 Oct 2025 13:20:51 +0800 Subject: [PATCH] nut-gc2: add disko --- flake.lock | 151 +++++++++++++++--- flake.nix | 1 + systems/x86_64-linux/nut-gc2/disko-config.nix | 80 +++------- 3 files changed, 152 insertions(+), 80 deletions(-) diff --git a/flake.lock b/flake.lock index f20c379..8991588 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1760836749, - "narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=", + "lastModified": 1761656077, + "narHash": "sha256-lsNWuj4Z+pE7s0bd2OKicOFq9bK86JE0ZGeKJbNqb94=", "owner": "ryantm", "repo": "agenix", - "rev": "2f0f812f69f3eb4140157fe15e12739adf82e32a", + "rev": "9ba0d85de3eaa7afeab493fed622008b6e4924f5", "type": "github" }, "original": { @@ -21,6 +21,28 @@ "type": "github" } }, + "colmena": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs_2", + "stable": "stable" + }, + "locked": { + "lastModified": 1755272288, + "narHash": "sha256-ypTPb2eKcOBbOoyvPV0j4ZOXs4kayo73/2KI456QnE0=", + "owner": "zhaofengli", + "repo": "colmena", + "rev": "5bf4ce6a24adba74a5184f4a9bef01d545a09473", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "colmena", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -79,6 +101,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -101,15 +139,12 @@ } }, "flake-utils": { - "inputs": { - "systems": "systems_2" - }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -120,7 +155,7 @@ }, "flake-utils-plus": { "inputs": { - "flake-utils": "flake-utils_2" + "flake-utils": "flake-utils_3" }, "locked": { "lastModified": 1715533576, @@ -138,6 +173,24 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { "inputs": { "systems": "systems_4" }, @@ -183,11 +236,11 @@ ] }, "locked": { - "lastModified": 1761584077, - "narHash": "sha256-dISPEZahlfs5K6d58zR4akRRyogfE9P4WSyPPNT7HiE=", + "lastModified": 1761750844, + "narHash": "sha256-ab6kNHAEP/oWz8qdblnDw7TIwetr4GnmnDyvya0aw/k=", "owner": "nix-community", "repo": "home-manager", - "rev": "e82585308aef3d4cc2c36c7b6946051c8cdf24ef", + "rev": "b8082c6803353456d45e6a8c0d4b36ad33fb7d6a", "type": "github" }, "original": { @@ -224,6 +277,27 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "colmena", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729742964, + "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1754028485, @@ -241,6 +315,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1750134718, + "narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1761373498, "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", @@ -266,11 +356,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1761601333, - "narHash": "sha256-ZCHa784eMt2RCJBPlbvc40wDBh8uMLuda97OeSpl6Yo=", + "lastModified": 1761744315, + "narHash": "sha256-OknzyEoI+VEYgk/FWMyx3tvjb/MPPyqS+G/aemDz51w=", "owner": "nix-community", "repo": "nixvim", - "rev": "416de183067b939899813ca1a612ba26a28c9ab6", + "rev": "6233fc6b2c3f203d8a5970f4a2c1df5777902717", "type": "github" }, "original": { @@ -281,7 +371,7 @@ }, "nuschtosSearch": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "ixx": "ixx", "nixpkgs": [ "nixvim", @@ -289,11 +379,11 @@ ] }, "locked": { - "lastModified": 1760652422, - "narHash": "sha256-C88Pgz38QIl9JxQceexqL2G7sw9vodHWx1Uaq+NRJrw=", + "lastModified": 1761730856, + "narHash": "sha256-t1i5p/vSWwueZSC0Z2BImxx3BjoUDNKyC2mk24krcMY=", "owner": "NuschtOS", "repo": "search", - "rev": "3ebeebe8b6a49dfb11f771f761e0310f7c48d726", + "rev": "e29de6db0cb3182e9aee75a3b1fd1919d995d85b", "type": "github" }, "original": { @@ -305,16 +395,17 @@ "root": { "inputs": { "agenix": "agenix", + "colmena": "colmena", "disko": "disko", "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixvim": "nixvim", "snowfall-lib": "snowfall-lib" } }, "snowfall-lib": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-utils-plus": "flake-utils-plus", "nixpkgs": [ "nixpkgs" @@ -334,6 +425,22 @@ "type": "github" } }, + "stable": { + "locked": { + "lastModified": 1750133334, + "narHash": "sha256-urV51uWH7fVnhIvsZIELIYalMYsyr2FCalvlRTzqWRw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "36ab78dab7da2e4e27911007033713bab534187b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 0539e5f..3d16bc3 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { agenix.url = "github:ryantm/agenix"; + colmena.url = "github:zhaofengli/colmena"; disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/systems/x86_64-linux/nut-gc2/disko-config.nix b/systems/x86_64-linux/nut-gc2/disko-config.nix index 7be4e97..136f9fe 100644 --- a/systems/x86_64-linux/nut-gc2/disko-config.nix +++ b/systems/x86_64-linux/nut-gc2/disko-config.nix @@ -1,86 +1,50 @@ { disko.devices = { disk = { - disk1 = { + main = { type = "disk"; device = "/dev/vda"; content = { type = "gpt"; partitions = { - ESP = { - size = "512M"; - type = "EF00"; + boot = { + size = "1M"; + type = "EF02"; + priority = 1; + }; + root = { + end = "-4G"; content = { type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ "noatime" ]; }; }; - crypt_p1 = { + swap = { size = "100%"; content = { - type = "luks"; - name = "crypt_p1"; - passwordFile = "/tmp/disk.key"; - settings = { - allowDiscards = true; - }; + type = "swap"; + discardPolicy = "both"; + resumeDevice = false; # resume from hiberation from this device }; }; }; }; }; - disk2 = { + vdb = { type = "disk"; - device = "/dev/nvme2n1"; + device = "/dev/vdb"; content = { type = "gpt"; partitions = { - crypt_p2 = { + root = { size = "100%"; content = { - type = "luks"; - name = "crypt_p2"; - settings = { - allowDiscards = true; - }; - content = { - type = "btrfs"; - extraArgs = [ - "-d raid1" - "/dev/mapper/crypt_p1" - ]; - subvolumes = { - "@" = { }; - "@/root" = { - mountpoint = "/"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "@/home" = { - mountpoint = "/home"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "@/nix" = { - mountpoint = "/nix"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; - }; - "@/swap" = { - # mountpoint = "/.swapvol"; - # swap.swapfile.size = "64G"; - mountOptions = [ "noatime" ]; - }; - }; - }; + type = "filesystem"; + format = "ext4"; + mountpoint = "/srv"; + mountOptions = [ "noatime" ]; }; }; };