mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
user: add options to manually set uid and gid
This commit is contained in:
parent
005a4c1bc0
commit
0a97cefe07
1 changed files with 20 additions and 4 deletions
|
|
@ -10,8 +10,8 @@ let
|
|||
idsDerivation = pkgs.runCommandLocal "ids.nix" {} ''
|
||||
cat > $out <<EOF
|
||||
{
|
||||
gid = "$(${pkgs.coreutils}/bin/id -g)";
|
||||
uid = "$(${pkgs.coreutils}/bin/id -u)";
|
||||
gid = $(${pkgs.coreutils}/bin/id -g);
|
||||
uid = $(${pkgs.coreutils}/bin/id -u);
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
|
|
@ -32,6 +32,14 @@ in
|
|||
description = "Group name.";
|
||||
};
|
||||
|
||||
gid = mkOption {
|
||||
type = types.int;
|
||||
default = ids.gid;
|
||||
description = ''
|
||||
Gid. This value should not be set manually except you know what you are doing.
|
||||
'';
|
||||
};
|
||||
|
||||
home = mkOption {
|
||||
type = types.path;
|
||||
readOnly = true;
|
||||
|
|
@ -49,6 +57,14 @@ in
|
|||
readOnly = true;
|
||||
description = "User name.";
|
||||
};
|
||||
|
||||
uid = mkOption {
|
||||
type = types.int;
|
||||
default = ids.uid;
|
||||
description = ''
|
||||
Uid. This value should not be set manually except you know what you are doing.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -61,12 +77,12 @@ in
|
|||
environment.etc = {
|
||||
"group".text = ''
|
||||
root:x:0:
|
||||
${cfg.group}:x:${ids.gid}:${cfg.userName}
|
||||
${cfg.group}:x:${toString cfg.gid}:${cfg.userName}
|
||||
'';
|
||||
|
||||
"passwd".text = ''
|
||||
root:x:0:0:System administrator:${config.build.installationDir}/root:/bin/sh
|
||||
${cfg.userName}:x:${ids.uid}:${ids.gid}:${cfg.userName}:${cfg.home}:${cfg.shell}
|
||||
${cfg.userName}:x:${toString cfg.uid}:${toString cfg.gid}:${cfg.userName}:${cfg.home}:${cfg.shell}
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue