-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacbuild.sh
More file actions
executable file
·23 lines (20 loc) · 1 KB
/
macbuild.sh
File metadata and controls
executable file
·23 lines (20 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
set -euo pipefail
if ! command -v docker &> /dev/null
then
echo "Please install docker first."
exit 1
fi
if ! docker container inspect nix-docker > /dev/null 2>&1; then
docker create --platform linux/amd64 --privileged --name nix-docker -it -w /work -v $(git rev-parse --show-toplevel):/work nixos/nix
docker start nix-docker > /dev/null
docker exec nix-docker bash -c "git config --global --add safe.directory /work"
docker exec nix-docker bash -c "echo 'sandbox = true' >> /etc/nix/nix.conf"
docker exec nix-docker bash -c "echo 'filter-syscalls = false' >> /etc/nix/nix.conf"
docker exec nix-docker bash -c "echo 'max-jobs = auto' >> /etc/nix/nix.conf"
docker exec nix-docker bash -c "echo 'experimental-features = nix-command flakes' >> /etc/nix/nix.conf"
docker exec nix-docker bash -c "nix-env -iA nixpkgs.docker nixpkgs.jq"
docker exec nix-docker bash -c "nix profile install github:serokell/deploy-rs"
fi
docker start nix-docker > /dev/null
docker exec -it nix-docker "$@"