depot/nix/docker/heptapod/default.nix

38 lines
1.2 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
let
origImageArgs = {
imageName = "octobus/heptapod";
2021-11-25 18:29:40 +00:00
imageDigest = "sha256:17783755180e2ac685550b7039c416b6fab72a6106bb57d58ad26f73cd6dcf91";
sha256 = "sha256:15g4dpxdkwxd7v3sydlh4mwa6x9r6ipdrravxv6x9vbl51y8kvzn";
finalImageName = "octobus/heptapod";
2021-11-25 18:29:40 +00:00
finalImageTag = "0.27.0";
};
origImage = pkgs.dockerTools.pullImage origImageArgs;
name = origImageArgs.imageName;
tag = "${origImageArgs.finalImageTag}-lukegb";
in pkgs.dockerTools.buildImage rec {
inherit name tag;
fromImage = origImage;
fromImageName = origImageArgs.finalImageName;
fromImageTag = origImageArgs.finalImageTag;
diskSize = 8192;
runAsRoot = ''
#!{pkgs.runtimeShell}
cat <<"EOF" >/assets/wrapper_wrapper
#!/bin/bash
/usr/bin/id hg || /usr/sbin/useradd -g $(id -u git) -u $(id -g git) -o -d /var/opt/gitlab -p "*" hg
/usr/bin/grep "AllowUsers git hg" /assets/sshd_config || /bin/sed -i "s/AllowUsers git/AllowUsers git hg/" /assets/sshd_config
exec /assets/wrapper "$@"
EOF
chmod ugo=rx /assets/wrapper_wrapper
'';
config.Cmd = ["/assets/wrapper_wrapper"];
} // {
meta = { inherit name tag; };
}