From 9075130cc8001e4cc61c79204cf00a9bf7a4544c Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 17 Jul 2023 18:54:31 +0200 Subject: [PATCH] Import disko as module --- flake.nix | 4 ++++ hosts/nixos/common/global/default.nix | 1 + hosts/nixos/lapetus/default.nix | 5 +++++ hosts/nixos/lapetus/partitions.nix | 8 +++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 72e8949..7af1950 100644 --- a/flake.nix +++ b/flake.nix @@ -76,6 +76,10 @@ # Spotify client spicetify-nix.url = "github:the-argus/spicetify-nix"; spicetify-nix.inputs.nixpkgs.follows = "nixpkgs-unstable"; + + # Disko + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs-unstable"; }; # }}} diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index af163e6..6d42698 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -3,6 +3,7 @@ let imports = [ inputs.hyprland.nixosModules.default + inputs.disko.nixosModules.default inputs.agenix.nixosModules.default inputs.stylix.nixosModules.stylix inputs.nur.nixosModules.nur diff --git a/hosts/nixos/lapetus/default.nix b/hosts/nixos/lapetus/default.nix index da48c73..4d9541a 100644 --- a/hosts/nixos/lapetus/default.nix +++ b/hosts/nixos/lapetus/default.nix @@ -28,9 +28,14 @@ # zfs rollback -r zroot@blank # ''; + disko.devices = import ./partitions.nix { + devices = [ "/dev/sda" ]; + }; + # Boot boot.loader.grub = { enable = true; + version = 2; device = "/dev/sda"; }; } diff --git a/hosts/nixos/lapetus/partitions.nix b/hosts/nixos/lapetus/partitions.nix index 6967b76..8143a65 100644 --- a/hosts/nixos/lapetus/partitions.nix +++ b/hosts/nixos/lapetus/partitions.nix @@ -56,15 +56,21 @@ # {{{ Datasets datasets = { "root/persist/data" = { + type = "zfs_fs"; mountpoint = "/persist/data"; options."com.sun:auto-snapshot" = "true"; }; "root/persist/state" = { + type = "zfs_fs"; mountpoint = "/persist/state"; options."com.sun:auto-snapshot" = "true"; }; - "root/local/nix" = { mountpoint = "/nix"; }; + "root/local/nix" = { + type = "zfs_fs"; + mountpoint = "/nix"; + }; "root/local/cache" = { + type = "zfs_fs"; mountpoint = "/persist/local/cache"; }; };