Propagate the user and group names of the calling user

This commit is contained in:
Sander van der Burg 2021-04-04 14:51:03 +02:00 committed by Sander van der Burg
parent 5cea3900eb
commit b796c4336d
12 changed files with 44 additions and 3 deletions

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, exprFile ? null
, extraParams ? {}
}@args:

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, clientInterface ? (if builtins.getEnv "DISNIX_CLIENT_INTERFACE" == "" then "disnix-run-activity" else builtins.getEnv "DISNIX_CLIENT_INTERFACE")
, disnixDataDir ? (if builtins.getEnv "DISNIX_DATA_DIR" == "" then throw "Set DISNIX_DATA_DIR to the data directory of Disnix" else builtins.getEnv "DISNIX_DATA_DIR")
, extraParams ? {}

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -9,6 +9,8 @@
, lockDir ? "${stateDir}/lock"
, libDir ? "${stateDir}/lib"
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
, defaultBundleName ? "default"

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -9,6 +9,8 @@
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:

View File

@ -19,9 +19,14 @@ let
inherit profileSettings exprFile extraParams pkgs system tools;
};
processes = import exprFile ({
processesFun = import exprFile;
processesFormalArgs = builtins.functionArgs processesFun;
processesArgs = builtins.intersectAttrs processesFormalArgs ({
inherit pkgs system processManager;
} // extraParams // profileSettings.params);
} // profileSettings.params // extraParams);
processes = processesFun processesArgs;
in
with import "${nixpkgs}/nixos/lib/testing-python.nix" { inherit system; };

View File

@ -3,6 +3,8 @@
stateDir = "/home/unprivileged/var";
runtimeDir = "${stateDir}/run";
forceDisableUserChange = true;
callingUser = "unprivileged";
callingGroup = "users";
};
deployArgs = [ "--state-dir" "/home/unprivileged/var" "--force-disable-user-change" ];

View File

@ -197,4 +197,20 @@ fi
NIXPROC=${NIXPROC:-@NIXPROC@}
# Build the profile
nix-build $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $spoolDirArg $lockDirArg $libDirArg $forceDisableUserChangeArg $noOutLinkArg $showTraceArg $processManagerArg "${extraParamsArg[@]}" $exprFileArg $NIXPROC/backends/$processManager/build-$processManager-env.nix
nix-build $stateDirArg \
$runtimeDirArg \
$logDirArg \
$tmpDirArg \
$cacheDirArg \
$spoolDirArg \
$lockDirArg \
$libDirArg \
$forceDisableUserChangeArg \
--argstr callingUser "$(id -un)" \
--argstr callingGroup "$(id -gn)" \
$noOutLinkArg \
$showTraceArg \
$processManagerArg \
"${extraParamsArg[@]}" \
$exprFileArg \
$NIXPROC/backends/$processManager/build-$processManager-env.nix