summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--home.nix5
-rw-r--r--home/packages.nix1
-rw-r--r--shell-scripts/nixup20
3 files changed, 19 insertions, 7 deletions
diff --git a/home.nix b/home.nix
index a0f14ee..8428853 100644
--- a/home.nix
+++ b/home.nix
@@ -18,8 +18,6 @@
home.sessionPath = [
"${config.home.homeDirectory}/.krew/bin"
- # this shouldn't be here but meh
- "${config.home.homeDirectory}/.nix-profile/bin"
];
programs.starship.enable = true;
@@ -49,6 +47,9 @@
programs.bash = {
enable = true;
profileExtra = ''
+ if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
+ . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
+ fi
# include nix.sh if it exists
[[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh
# source some workspace specific stuff
diff --git a/home/packages.nix b/home/packages.nix
index a918265..15f09e2 100644
--- a/home/packages.nix
+++ b/home/packages.nix
@@ -28,6 +28,7 @@
github-cli
fd
argocd
+ docker-client
]
++ (import ../shell-scripts.nix {inherit pkgs config;});
mike-extra-packages = with pkgs; [
diff --git a/shell-scripts/nixup b/shell-scripts/nixup
index 2817f59..ed3981a 100644
--- a/shell-scripts/nixup
+++ b/shell-scripts/nixup
@@ -17,11 +17,6 @@ case "${@}" in
cat > /tmp/docker-build-${USER} <<EOF
FROM alpine
-# Add your user the alpine way
-RUN apk add --no-cache --update shadow \
- && groupadd -g $(id -g) ${USER} \
- && useradd -g $(id -g) --groups wheel -u $(id -u) ${USER}
-
# Enable HTTPS support in wget and set nsswitch.conf to make resolution work within containers
RUN apk add --no-cache --update openssl \
&& echo hosts: files dns > /etc/nsswitch.conf
@@ -41,6 +36,9 @@ RUN wget https://nixos.org/releases/nix/nix-\${NIX_VERSION}/nix-\${NIX_VERSION}-
&& /nix/var/nix/profiles/default/bin/nix-store --optimise \
&& /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents
+# Somehow this file is missing?
+RUN mkdir -p /etc/bash && touch /etc/bash/bashrc
+
ONBUILD ENV \
ENV=/etc/profile \
USER=root \
@@ -55,17 +53,29 @@ ENV \
GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
NIX_PATH=/nix/var/nix/profiles/per-user/root/channels
+
+# Add your user the alpine way
+RUN apk add --no-cache --update shadow \
+ && groupadd -g $(getent group docker | cut -d: -f3) docker \
+ && groupadd -g $(id -g) ${USER} \
+ && useradd -g $(id -g) --groups wheel,docker -u $(id -u) ${USER} \
+ && rm -rf /var/cache/apk/*
EOF
docker build . -t nixos-${USER} -f /tmp/docker-build-${USER}
fi
docker run --volumes-from=nix-data-${USER} --rm -it \
+ -v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-certificates.crt \
-e GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \
-e NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
-e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
+ -e http_proxy=$http_proxy \
+ -e https_proxy=$http_proxy \
+ -e SHELL=bash \
-e USER=${USER} \
-u $(id -u):$(id -g) \
--group-add wheel \
+ --group-add docker \
-v ${HOME}:${HOME} \
-w ${HOME} \
--name nixos-${USER} \