pseudofile: allow setting uid and gid of files

Necessary for Dropbear to accept non-root authorized_keys files.
This commit is contained in:
Brian McKenna 2023-04-14 09:18:27 +10:00 committed by Daniel Barlow
parent 9f3c80e774
commit fb796e61e0
2 changed files with 4 additions and 1 deletions

View file

@ -69,6 +69,7 @@ in {
(name: val: dir {
".ssh" = dir {
authorized_keys = {
inherit (val) uid gid;
type = "f";
mode = "0400";
file = lib.concatStringsSep

View file

@ -20,12 +20,14 @@ let
, file ? null
, major ? null
, minor ? null
, uid ? 0
, gid ? 0
}:
let
mode' = if mode != null then mode else
(if type == "d" then "0755" else "0644");
pathname = "${prefix}/${filename}";
line = "${pathname} ${type} ${mode'} 0 0";
line = "${pathname} ${type} ${mode'} ${toString uid} ${toString gid}";
in
if type == "f" then
"${line} echo -n \"${qprint file}\" |qprint -d"