@@ -20,33 +20,31 @@ RUN mkdir -m 0755 /nix \
2020# Set environment so Nix is on PATH
2121ENV USER=root
2222ENV HOME=/root
23- ENV PATH=/root/.nix-profile/bin:/root/.nix-profile/sbin:$PATH
24-
25- # Install Nix
26- RUN curl -L https://nixos.org/nix/install | sh -s -- --daemon
2723
2824# Configure Nix to run in unprivileged mode (no nixbld group needed)
2925RUN mkdir -p /etc/nix && echo "build-users-group =" >> /etc/nix/nix.conf
3026
27+ # Install Nix
28+ RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon --no-modify-profile --no-channel-add --yes
29+
30+ # Set PATH after Nix installation to include Nix binaries explicitly
31+ ENV PATH="/root/.nix-profile/bin:/root/.nix-profile/sbin:${PATH}"
32+
3133# Add Nix channels for Nixpkgs and Home Manager
3234# Source the Nix profile before running nix-channel commands
33- RUN . /root/.nix-profile/etc/profile.d/nix.sh && \
34- nix-channel --add https://nixos.org/channels/nixos-25.05 nixpkgs && \
35- nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz home-manager && \
36- nix-channel --update
35+ RUN . /root/.nix-profile/etc/profile.d/nix.sh
36+ RUN nix-channel --add https://nixos.org/channels/nixos-25.05 nixpkgs
37+ RUN nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz home-manager
38+ RUN nix-channel --update
3739
38- # Install home-manager for the root user
39- RUN . /root/.nix-profile/etc/profile.d/nix.sh && \
40- nix-shell '<home-manager>' -A install
40+ # Install home-manager
41+ RUN nix-env -iA home-manager -f '<home-manager>'
4142
42- # Nix bin path for any shells
43- RUN echo 'export PATH=" /root/.nix-profile/bin:$PATH"' \
44- > /etc/profile.d/hm-path.sh
43+ # Copy into the container
44+ WORKDIR /root/.config/home-manager
45+ COPY . .
4546
46- # Entrypoint
47- COPY nix_test_env/docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
48- RUN chmod +x /usr/local/bin/docker_entrypoint.sh
47+ RUN chmod +x ./nix_test_env/docker_entrypoint.sh
48+ ENTRYPOINT ["./nix_test_env/docker_entrypoint.sh" ]
4949
50- WORKDIR /root
51- ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh" ]
5250CMD ["tail" , "-f" , "/dev/null" ]
0 commit comments