diff --git a/flake.lock b/flake.lock index a4bb6b3..1a411cf 100644 --- a/flake.lock +++ b/flake.lock @@ -60,6 +60,26 @@ "type": "gitlab" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747742835, + "narHash": "sha256-kYL4GCwwznsypvsnA20oyvW8zB/Dvn6K5G/tgMjVMT4=", + "owner": "nix-community", + "repo": "disko", + "rev": "df522e787fdffc4f32ed3e1fca9ed0968a384d62", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -131,26 +151,79 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "mailserver", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "mailserver", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747372754, + "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "mailserver", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "mailserver": { "inputs": { "blobs": "blobs", "flake-compat": "flake-compat_2", - "nixpkgs": "nixpkgs_2", - "nixpkgs-24_11": "nixpkgs-24_11" + "git-hooks": "git-hooks", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-24_11": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1734884447, - "narHash": "sha256-HA9fAmGNGf0cOYrhgoa+B6BxNVqGAYXfLyx8zIS0ZBY=", - "owner": "simple-nixos-mailserver", - "repo": "nixos-mailserver", - "rev": "63209b1def2c9fc891ad271f474a3464a5833294", - "type": "gitlab" + "lastModified": 1747508277, + "narHash": "sha256-r6QVhsBlPxvkYjG6rYWARnmMbv1WRVQhFP1vtawXgmw=", + "ref": "backports-25.05", + "rev": "4a3924fc236273cb44305bb4d516bd6d66c70ebe", + "revCount": 688, + "type": "git", + "url": "https://gitlab.com/SuperSandro2000/nixos-mailserver.git" }, "original": { - "owner": "simple-nixos-mailserver", - "ref": "nixos-24.11", - "repo": "nixos-mailserver", - "type": "gitlab" + "ref": "backports-25.05", + "type": "git", + "url": "https://gitlab.com/SuperSandro2000/nixos-mailserver.git" } }, "napalm": { @@ -195,21 +268,6 @@ "type": "github" } }, - "nixpkgs-24_11": { - "locked": { - "lastModified": 1734083684, - "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-24.11", - "type": "indirect" - } - }, "nixpkgs-lib": { "locked": { "lastModified": 1743296961, @@ -227,31 +285,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1732014248, - "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1743703532, - "narHash": "sha256-s1KLDALEeqy+ttrvqV3jx9mBZEvmthQErTVOAzbjHZs=", + "lastModified": 1747825515, + "narHash": "sha256-BWpMQymVI73QoKZdcVCxUCCK3GNvr/xa2Dc4DM1o2BE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bdb91860de2f719b57eef819b5617762f7120c70", + "rev": "cd2812de55cf87df88a9e09bf3be1ce63d50c1a6", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.11", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } @@ -309,8 +352,9 @@ "root": { "inputs": { "authentik": "authentik", + "disko": "disko", "mailserver": "mailserver", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" } }, "systems": { diff --git a/flake.nix b/flake.nix index 3e546dd..e9babb8 100644 --- a/flake.nix +++ b/flake.nix @@ -10,14 +10,25 @@ }; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; authentik = { url = "github:MarcelCoding/authentik-nix"; }; - mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.11"; + mailserver = { + url = "git+https://gitlab.com/SuperSandro2000/nixos-mailserver.git?ref=backports-25.05"; +inputs = { + nixpkgs.follows = "nixpkgs"; + nixpkgs-24_11.follows = "nixpkgs"; + }; + }; + # mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.11"; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, authentik, mailserver }: { + outputs = { self, nixpkgs, authentik, mailserver, disko }: { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; nixosConfigurations = { @@ -25,6 +36,8 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + ./hetzner-disk.nix + disko.nixosModules.disko authentik.nixosModules.default mailserver.nixosModules.mailserver ]; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index ebaac35..499ea00 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -14,13 +14,13 @@ boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { - device = "/dev/sda1"; - fsType = "ext4"; - }; + # fileSystems."/" = + # { + # device = "/dev/sda1"; + # fsType = "ext4"; + # }; - swapDevices = [ ]; + # swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/hetzner-disk.nix b/hetzner-disk.nix new file mode 100644 index 0000000..a679e7c --- /dev/null +++ b/hetzner-disk.nix @@ -0,0 +1,56 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for grub MBR + }; + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + subvolumes = { + "/rootfs" = { + mountpoint = "/"; + }; + "/home" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/home"; + }; + # Sub(sub)volume doesn't need a mountpoint as its parent is mounted + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + ]; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +}