Skip to content

Commit e6ec959

Browse files
committed
Fix coping files in
1 parent 467918a commit e6ec959

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

flake.nix

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,39 @@
8181
--shell=/bin/bash \
8282
--uid=1000 \
8383
--user-group
84-
cat > /etc/pam.d/other <<EOF
84+
cp ${pkgs.sudo}/bin/sudo /usr/bin/sudo
85+
chmod 4755 /usr/bin/sudo
86+
'';
87+
};
88+
customFiles = pkgs.stdenv.mkDerivation {
89+
name = "custom-env";
90+
phases = [ "installPhase" ];
91+
installPhase = ''
92+
mkdir -p $out/etc
93+
echo ${devEnvPath} > $out/etc/environment
94+
95+
mkdir -p $out/etc/systemd/system
96+
cp ${pkgs.docker}/etc/systemd/system/docker.service $out/etc/systemd/system/
97+
echo "coder ALL=(ALL) NOPASSWD:ALL" > $out/etc/sudoers
98+
mkdir -p $out/etc/pam.d
99+
cat > $out/etc/pam.d/other <<EOF
85100
account sufficient pam_unix.so
86101
auth sufficient pam_rootok.so
87102
password requisite pam_unix.so nullok yescrypt
88103
session required pam_unix.so
89104
EOF
90-
echo "coder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers
91-
mkdir -p /etc/ssl/certs
92-
cp -r ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
93-
cp ${pkgs.sudo}/bin/sudo /usr/bin/sudo
94-
chmod 4755 /usr/bin/sudo
105+
mkdir -p $out/etc/ssl/certs
106+
cp -r ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs/ca-certificates.crt
95107
'';
96108
};
109+
97110
devEnvPath = "PATH=${pkgs.lib.makeBinPath devShellPackages}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/coder/go/bin";
98111
devEnvImage = pkgs.dockerTools.streamLayeredImage {
99112
name = "codercom/oss-dogfood";
100113
tag = "testing";
101114
fromImage = intermediateDevEnvImage;
102115
contents = [
103-
(
104-
pkgs.writeTextDir
105-
"etc/environment"
106-
''
107-
${devEnvPath}
108-
''
109-
)
116+
customFiles
110117
];
111118

112119
config = {

0 commit comments

Comments
 (0)