Skip to content

Instantly share code, notes, and snippets.

@delirehberi
Last active July 12, 2020 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delirehberi/974c7d162c2ed7153984c44ff358057a to your computer and use it in GitHub Desktop.
Save delirehberi/974c7d162c2ed7153984c44ff358057a to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
let
ihpDev = builtins.fetchTarball {
url= "https://beta:beta@ihp.digitallyinduced.com/ihp-new.tar.gz";
sha256 = "0kmrb8w96qpwfjm8h3fa8dpmz94zl096n5xvsdgkk70gw76hjg1m";
};
NB_USER = "ihp";
NB_UID = "1000";
dockerEtc = pkgs.runCommand "docker-etc" {} ''
mkdir -p $out/etc/pam.d
echo "root:x:0:0::/root:/bin/sh" > $out/etc/passwd
echo "${NB_USER}:x:1000:1000::/home/${NB_USER}:" >> $out/etc/passwd
echo "root:!x:::::::" > $out/etc/shadow
echo "${NB_USER}:!:::::::" >> $out/etc/shadow
echo "root:x:0:" > $out/etc/group
echo "${NB_USER}:x:1000:" >> $out/etc/group
echo "root:x::" > $out/etc/gshadow
echo "${NB_USER}:!::" >> $out/etc/gshadow
'';
in
pkgs.dockerTools.buildImageWithNixDb {
name = "ihp";
tag = "latest";
created = "now";
contents = with pkgs; [
dockerEtc
bashInteractive
ihpDev
direnv
cachix
gnumake
git
coreutils
gnugrep
cacert
which
];
config = {
Cmd = ["echo" "$PATH"];
WorkingDir = "/app";
User = NB_USER;
};
runAsRoot = ''
#!${pkgs.runtimeShell}
mkdir -p /app
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment