From e8f02cfd7448fa9289f4281726ed2485f91cd446 Mon Sep 17 00:00:00 2001 From: technofab Date: Fri, 4 Oct 2024 21:01:11 +0200 Subject: [PATCH] fix(image): fix default profile link + stop linking it to user profile --- image.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/image.nix b/image.nix index 839bb2b..1950ce4 100644 --- a/image.nix +++ b/image.nix @@ -96,8 +96,10 @@ echo "coder:100000:65536" > $out/etc/subgid ln -s ${profile} $out/nix/var/nix/profiles/default-1-link - ln -s $out/nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default - ln -s /nix/var/nix/profiles/default $out/home/coder/.nix-profile + ln -s /nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default + + # prevents the profiles from being cleaned up by the GC + ln -s /nix/var/nix/profiles $out/nix/var/nix/gcroots/profiles ln -s ${pkgs.coreutils}/bin/env $out/usr/bin/env ln -s ${pkgs.bashInteractive}/bin/bash $out/bin/sh @@ -113,9 +115,6 @@ in uid = 1000; gid = 1000; - extraCommands = '' - ln -s /nix/var/nix/profiles nix/var/nix/gcroots/profiles - ''; fakeRootCommands = '' chown -R 1000:1000 ./ chmod 1777 tmp @@ -123,7 +122,7 @@ in ''; config = { - Cmd = ["/home/coder/.nix-profile/bin/bash"]; + Cmd = ["/bin/bash"]; User = "1000:1000"; Env = [ "USER=coder" @@ -132,6 +131,8 @@ in "XDG_RUNTIME_DIR=/tmp" "PATH=${lib.concatStringsSep ":" [ "/home/coder/.nix-profile/bin" + # this makes all the packages defined at the top available + # in the workspace "/nix/var/nix/profiles/default/bin" "/nix/var/nix/profiles/default/sbin" ]}"