Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Last active July 21, 2019 03:41
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 Pitometsu/755bc7312fbed98451c7320957b1f053 to your computer and use it in GitHub Desktop.
Save Pitometsu/755bc7312fbed98451c7320957b1f053 to your computer and use it in GitHub Desktop.
Nix /home to docker installation problem
mypkg = mkDerivation rec {
name = "mypkg";
version = "0.0.1";
src = ./.;
# ...
outputs = [ "out" "custom" ];
installPhase = ''
mkdir -p $out
do-some-install-to $out
mkdir -pv $custom/share
cp -dR --preserve=mode,timestamps from-sources-share \
$custom/share/custom/
mkdir -p "$custom/home/custom"
ln -Tsv $custom/share "$custom/home/custom/share"
'';
}
let
image = with dockerTools.buildLayeredImage {
name = mypkg.name;
tag = mypkg.version;
contents = [ mypkg.all ];
created = "now";
config = {
Entrypoint = [ "myapp" ];
ExposedPorts = {
"4000/tcp" = {};
};
};
}
in image
@Pitometsu
Copy link
Author

Currently $custom have such output:

├── home
│   └── custom
│       └── ...
│           └── share -> /nix/store/fmkqf6zyql85wrirdxasdh9i804a9g98-mypkg-custom/share
└── share
    └── ...

But I see only /share linked to dockers root at result docker image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment