Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac(back): #1357 deprecate makes non root #1368

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions makes/container-image/main.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ __nixpkgs__.dockerTools.buildImage {
'';
})

# Configure doas
(__nixpkgs__.writeTextDir "etc/doas.conf" ''
permit nopass keepenv root as makes
'')

# Add 3 groups
(__nixpkgs__.writeTextDir "etc/group" ''
root:x:0:
Expand Down Expand Up @@ -128,29 +123,8 @@ __nixpkgs__.dockerTools.buildImage {
session required pam_unix.so
'')

# Add Makes:
# - By default, it runs as root (uid 0).
# - If `MAKES_NON_ROOT` is in the environment and non-empty,
# makes will run as the makes user (uid > 0).
(__nixpkgs__.writeShellScriptBin "m" ''
if test -z "''${MAKES_NON_ROOT:-}"; then
${outputs."/"}/bin/m "$@"
else
echo Using feature flag: MAKES_NON_ROOT

set -x
mkdir -p /nix/var/nix
chmod u+w /nix/store
chown makes:makes --recursive /nix
chown root:root $(realpath /etc/doas.conf)

chmod u+w /home/makes /tmp /working-dir
chown makes:makes /home/makes /tmp /working-dir
chown makes:makes --recursive "$PWD"

${__nixpkgs__.doas}/bin/doas -u makes ${outputs."/"}/bin/m "$@"
fi
'')
# Add Makes
outputs."/"
];
};
}
Loading