From d77d56a51a9ef83c2b9eb4d5e1a1de1fbec1003f Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 3 Mar 2023 18:49:00 -0600 Subject: [PATCH] Fix mounts --- flake.nix | 20 +++++++++++--------- modules/subvolumes/default.nix | 6 ++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 5316827..3b514e0 100644 --- a/flake.nix +++ b/flake.nix @@ -118,7 +118,7 @@ (subvolumesModule { inherit device subvolumes; }) else { }) - ({ config, pkgs, ... }: + ({ config, lib, pkgs, ... }: let keyFilePath = config.sops.secrets.k3sKeyFile.path; prepareNvme = '' @@ -242,7 +242,7 @@ }; in if unlockMounts && mountVolumes then - fileSystemConfig + lib.mkForce fileSystemConfig else { }; @@ -291,13 +291,13 @@ (subvolumesModule { inherit device subvolumes; }) - { - fileSystems."${mountDir}" = { + ({ lib, ... }: { + fileSystems."${mountDir}" = lib.mkForce { inherit device; fsType = "btrfs"; options = [ "defaults" "compress=zstd" "rw" "loop" ]; }; - } + }) ]; }; @@ -338,7 +338,7 @@ device = "/dev/disk/by-label/DATA"; subvolumes = [ "@garage-cluster-data" ]; }) else { }) - ({ config, pkgs, ... }: + ({ config, pkgs, lib, ... }: let keyFile = "nextcloudKeyFile"; keyFilePath = config.sops.secrets."${keyFile}".path; @@ -418,7 +418,7 @@ }; }; in - if unlockMounts && mountVolumes then fileSystemConfig else { }; + if unlockMounts && mountVolumes then lib.mkForce fileSystemConfig else { }; networking.firewall.enable = false; }) @@ -449,7 +449,7 @@ (subvolumesModule { inherit device subvolumes; }) else { }) - ({ config, ... }: + ({ config, lib, ... }: let keyFilePath = config.sops.secrets."${keyFile}".path; in @@ -466,7 +466,7 @@ ''; }; - fileSystems."${mountDir}" = { + fileSystems."${mountDir}" = lib.mkForce { inherit device; fsType = "btrfs"; options = [ "defaults" "compress=zstd" "rw" ]; @@ -480,6 +480,8 @@ garage1 = makeGarageConfig { hostname = "garage1"; selfIp = "192.168.20.40"; + unlockMounts = true; + mountVolumes = true; }; garage2 = makeGarageConfig { diff --git a/modules/subvolumes/default.nix b/modules/subvolumes/default.nix index cced284..1b3d889 100644 --- a/modules/subvolumes/default.nix +++ b/modules/subvolumes/default.nix @@ -1,7 +1,9 @@ { device, subvolumes ? [ ] }: +{ lib, ... }: + { - fileSystems = builtins.foldl' + fileSystems = lib.mkForce (builtins.foldl' (acc: subvol: let length = builtins.stringLength subvol; @@ -15,5 +17,5 @@ }; }) { } - subvolumes; + subvolumes); }