From e8bfac9e30f6982c2b0129e35d9e5dc3aa021725 Mon Sep 17 00:00:00 2001 From: lordkekz Date: Mon, 9 Dec 2024 12:19:58 +0100 Subject: [PATCH 1/3] nixos-modules/host/default: Create and chown sources of shares --- nixos-modules/host/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos-modules/host/default.nix b/nixos-modules/host/default.nix index fea96b23..f5456b90 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -92,7 +92,14 @@ in then updateFlake else flake}' > flake chown -h ${user}:${group} flake - ''; + '' + # Make sure that the sources of the shares can be accessed. + # Also ignore failures of each command for now + + builtins.foldl' (acc: share: acc + '' + # Initialize permissions for share with mountPoint ${share.mountPoint} + mkdir -p '${share.source}' || : + chown -hR ${user}:${group} '${share.source}' || : + '') "" guestConfig.microvm.shares; serviceConfig.SyslogIdentifier = "install-microvm-${name}"; }; "microvm@${name}" = { From 756dbd7c8c28cb2f2ec1d0da15935161f17db21a Mon Sep 17 00:00:00 2001 From: lordkekz Date: Mon, 9 Dec 2024 14:46:42 +0100 Subject: [PATCH 2/3] nixos-modules/host/default: Don't chown nix store --- nixos-modules/host/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos-modules/host/default.nix b/nixos-modules/host/default.nix index f5456b90..acc50756 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -95,7 +95,8 @@ in '' # Make sure that the sources of the shares can be accessed. # Also ignore failures of each command for now - + builtins.foldl' (acc: share: acc + '' + + builtins.foldl' (acc: share: + acc + lib.optionalString (share.source != "/nix/store") '' # Initialize permissions for share with mountPoint ${share.mountPoint} mkdir -p '${share.source}' || : chown -hR ${user}:${group} '${share.source}' || : From 79d5ddb6697681322869dbd40b5e24087d159af5 Mon Sep 17 00:00:00 2001 From: lordkekz Date: Sun, 29 Dec 2024 22:33:41 +0100 Subject: [PATCH 3/3] nixos-modules/host/default: Fix indentation --- nixos-modules/host/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos-modules/host/default.nix b/nixos-modules/host/default.nix index acc50756..3a7049a3 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -97,9 +97,9 @@ in # Also ignore failures of each command for now + builtins.foldl' (acc: share: acc + lib.optionalString (share.source != "/nix/store") '' - # Initialize permissions for share with mountPoint ${share.mountPoint} - mkdir -p '${share.source}' || : - chown -hR ${user}:${group} '${share.source}' || : + # Initialize permissions for share with mountPoint ${share.mountPoint} + mkdir -p '${share.source}' || : + chown -hR ${user}:${group} '${share.source}' || : '') "" guestConfig.microvm.shares; serviceConfig.SyslogIdentifier = "install-microvm-${name}"; };