From 0c8b4ccfa998ec9e4999985fdce846d5a7b0cfae Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:37:51 +0100 Subject: [PATCH] Fix sops-nix failure after reboot /home partition of lvm wasn't mounted and sops-nix couldn't find the key in that unmounted partition --- hosts/franz/default.nix | 32 ++++++++++++++++---------------- hosts/franz/sops.nix | 22 ++++++++++------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/hosts/franz/default.nix b/hosts/franz/default.nix index 525dab3..dabea1a 100644 --- a/hosts/franz/default.nix +++ b/hosts/franz/default.nix @@ -1,19 +1,17 @@ -{ - inputs, - outputs, - lib, - config, - pkgs, - ... -}: let +{ inputs +, outputs +, ... +}: +let vars = import ../../vars.nix; -in { +in +{ imports = [ inputs.hardware.nixosModules.common-pc-ssd inputs.disko.nixosModules.default ./hardware-configuration.nix - (import ../../disko/btrfs-swap.nix {device = "/dev/nvme0n1";}) + (import ../../disko/btrfs-swap.nix { device = "/dev/nvme0n1"; }) ./disko/zfs.nix ../common/global @@ -29,7 +27,7 @@ in { ]; # Enable ZFS - boot.supportedFilesystems = ["zfs"]; + boot.supportedFilesystems = [ "zfs" ]; networking.hostId = "f014fc43"; services.zfs.autoScrub.enable = true; @@ -40,12 +38,14 @@ in { systemd.services.NetworkManager-wait-online.enable = false; # Prevent zfs from being automounted by fstab auto discovery & zfs - fileSystems."/storage/dataset".options = ["noauto"]; - fileSystems."/storage".options = ["noauto"]; + fileSystems = { + "/storage/dataset".options = [ "noauto" ]; + "/storage".options = [ "noauto" ]; - fileSystems."/home/ghoscht/.zfs" = { - device = "/dev/disk/by-label/SECRET_KEYS"; - fsType = "vfat"; + "/home/ghoscht/.zfs" = { + device = "/dev/disk/by-label/SECRET_KEYS"; + fsType = "vfat"; + }; }; users.mutableUsers = true; diff --git a/hosts/franz/sops.nix b/hosts/franz/sops.nix index eeba82d..4c52d17 100644 --- a/hosts/franz/sops.nix +++ b/hosts/franz/sops.nix @@ -1,18 +1,16 @@ -{ - pkgs, - inputs, - config, - ... -}: let - vars = import ../../vars.nix; -in { +{ pkgs +, inputs +, ... +}: { imports = [ inputs.sops-nix.nixosModules.sops ]; - environment.systemPackages = with pkgs; [sops]; + environment.systemPackages = with pkgs; [ sops ]; - sops.defaultSopsFile = ../../secrets/franz.yaml; - sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = "/home/${vars.user}/.config/sops/age/keys.txt"; + sops = { + defaultSopsFile = ../../secrets/franz.yaml; + defaultSopsFormat = "yaml"; + age.keyFile = "/sops-nix/sops.txt"; + }; }