-
Notifications
You must be signed in to change notification settings - Fork 2
/
ckb-shell.nix
66 lines (58 loc) · 1.9 KB
/
ckb-shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ pkgs ? import <nixpkgs> {}
}:
let
nix-thunk = import ./deps/nix-thunk {};
sources = nix-thunk.mapSubdirectories nix-thunk.thunkSource ./deps;
ckb = import sources.ckb {};
ckb-cli = import sources.ckb-cli {};
capsule = import sources.capsule {};
# Provides a script that copies required files to ~/
podmanSetupScript = let
registriesConf = pkgs.writeText "registries.conf" ''
[registries.search]
registries = ['docker.io']
[registries.block]
registries = []
'';
in pkgs.writeScript "podman-setup" ''
#!${pkgs.runtimeShell}
# Dont overwrite customised configuration
if ! test -f ~/.config/containers/policy.json; then
install -Dm555 ${pkgs.skopeo.src}/default-policy.json ~/.config/containers/policy.json
fi
if ! test -f ~/.config/containers/registries.conf; then
install -Dm555 ${registriesConf} ~/.config/containers/registries.conf
fi
'';
# Provides a fake "docker" binary mapping to podman
dockerCompat = pkgs.runCommandNoCC "docker-podman-compat" {} ''
mkdir -p $out/bin
ln -s ${pkgs.podman}/bin/podman $out/bin/docker
ln -s ${pkgs.podman-compose}/bin/podman-compose $out/bin/docker-compose
'';
in pkgs.mkShell {
buildInputs = [
dockerCompat
ckb
capsule
ckb-cli
pkgs.rustc
pkgs.cargo
pkgs.bash
pkgs.podman # Docker compat
pkgs.podman-compose # Docker compose compat
pkgs.runc # Container runtime
pkgs.conmon # Container runtime monitor
pkgs.skopeo # Interact with container registry
pkgs.slirp4netns # User-mode networking for unprivileged namespaces
pkgs.fuse-overlayfs # CoW for images, much faster than default vfs
pkgs.nodejs
pkgs.yarn
];
shellHook = ''
# Install required configuration
${podmanSetupScript}
# ln -s /bin/bash ${pkgs.bash}/bin/bash # What else can we do instead?
'';
DOCKER_HOST="unix:///run/podman/podman.sock";
}