diff options
| author | Mike Vink <mike.vink@stater.nl> | 2023-05-16 23:17:52 +0000 |
|---|---|---|
| committer | Mike Vink <mike.vink@stater.nl> | 2023-05-17 07:03:54 +0000 |
| commit | 9a1ce8dd56e9f99ab3268aa71b397cb70ae90088 (patch) | |
| tree | ccfb057a40b3f647af9fda6857de7389d3f4fae6 | |
| parent | af401bc667731d518be48e60969f6f5a7dd44513 (diff) | |
nixup script
| -rw-r--r-- | home.nix | 5 | ||||
| -rw-r--r-- | home/packages.nix | 1 | ||||
| -rw-r--r-- | shell-scripts/nixup | 20 |
3 files changed, 19 insertions, 7 deletions
@@ -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} \ |
