Skip to content

Commit

Permalink
don't push a folder in; just write bashrc directly
Browse files Browse the repository at this point in the history
  • Loading branch information
silky committed May 11, 2021
1 parent 1370dc9 commit 0666d82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
File renamed without changes.
15 changes: 7 additions & 8 deletions nix/devcontainer/devcontainer.nix
Expand Up @@ -34,18 +34,13 @@
, which
}:
let
bashrc = ./bashrc;
# I think we should be able to use buildLayeredImage, but for some reason it
# produces a nonfunctional image
image = dockerTools.buildImage {
inherit name tag;

contents = [
# See: https://github.com/NixOS/nixpkgs/issues/118722
(stdenv.mkDerivation {
name = "wrapped";
src = ./root;
installPhase = "ln -s $src $out";
})
coreutils
procps
gnugrep
Expand Down Expand Up @@ -98,15 +93,19 @@ let
runAsRoot = ''
${dockerTools.shadowSetup}
groupadd --gid ${nonRootUserId} ${nonRootUser}
useradd --uid ${nonRootUserId} --gid ${nonRootUserId} -m ${nonRootUser}
useradd --uid ${nonRootUserId} --gid ${nonRootUserId} ${nonRootUser}
mkdir -p /home/${nonRootUser}
cat ${bashrc} > /home/${nonRootUser}/.bashrc
# Because we map in the `./.cabal` folder from the users home directory,
# (see: https://github.com/input-output-hk/plutus-starter/blob/main/.devcontainer/devcontainer.json)
# and because docker won't let us map a volume not as root
# (see: https://github.com/moby/moby/issues/2259 link), we have to make the
# folder first and chown it ...
mkdir /home/${nonRootUser}/.cabal
chown ${nonRootUser}:${nonRootUser} /home/${nonRootUser}/.cabal
chown -R ${nonRootUser}:${nonRootUser} /home/${nonRootUser}
'';

config = {
Expand Down

0 comments on commit 0666d82

Please sign in to comment.