From 04cd26947890f241c05ef946c587b44399bfbede 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 56bb289f..879b3882 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -94,7 +94,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 dc541b48523c9b3ddf3d0d39f437ea69d54c0306 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 879b3882..4f668cfe 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -97,7 +97,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 b1e20134131a922e9a191c0df1c6260ef6d0b7cd 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 4f668cfe..1e07a928 100644 --- a/nixos-modules/host/default.nix +++ b/nixos-modules/host/default.nix @@ -99,9 +99,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}"; };