fix: separate dev shell and dev image nix deps (#9189)

* fix: separate dev shell and dev image nix deps

* Add less
This commit is contained in:
Kyle Carberry 2023-08-18 10:58:52 -05:00 committed by GitHub
parent e94ebea5e9
commit 9725ec0713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 15 deletions

View File

@ -19,9 +19,7 @@
bash
cairo
curl
docker
drpc.defaultPackage.${system}
exa
gcc
getopt
git
@ -35,9 +33,9 @@
gotestsum
jq
kubernetes-helm
less
mockgen
nfpm
nix
nodejs
nodePackages.pnpm
nodePackages.prettier
@ -52,7 +50,6 @@
protobuf
protoc-gen-go
ripgrep
screen
shellcheck
shfmt
sqlc
@ -67,6 +64,15 @@
zsh
zstd
];
# We separate these to reduce the size of the dev shell for packages that we only
# want in the image.
devImagePackages = with pkgs; [
docker
exa
nix
nixpkgs-fmt
screen
];
# This is the base image for our Docker container used for development.
# Use `nix-prefetch-docker ubuntu --arch amd64 --image-tag lunar` to get this.
@ -102,7 +108,7 @@
# Environment variables that live in `/etc/environment` in the container.
# These will also be applied to the container config.
devEnvVars = [
"PATH=${pkgs.lib.makeBinPath devShellPackages}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/coder/go/bin"
"PATH=${pkgs.lib.makeBinPath (devShellPackages ++ devImagePackages)}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/coder/go/bin"
# This setting prevents Go from using the public checksum database for
# our module path prefixes. It is required because these are in private
# repositories that require authentication.
@ -153,6 +159,13 @@
experimental-features = nix-command flakes
''
)
# Allow people to change shells!
(
pkgs.writeTextDir "etc/shells" ''
${pkgs.bash}/bin/bash
${pkgs.zsh}/bin/zsh
''
)
# This is the debian script for managing Docker with `sudo service docker ...`.
(
pkgs.writeTextFile {
@ -189,19 +202,19 @@
cp -a ${pkgs.glibcLocales}/lib/locale/locale-archive usr/lib/locale/locale-archive
'';
config = {
Env = devEnvVars;
Entrypoint = [ "/bin/bash" ];
User = "coder";
config = {
Env = devEnvVars;
Entrypoint = [ "/bin/bash" ];
User = "coder";
};
};
};
in
{
in
{
packages = {
devEnvImage = devEnvImage;
};
defaultPackage = formatter; # or replace it with your desired default package.
devShell = pkgs.mkShell { buildInputs = devShellPackages; };
}
);
}
}
);
}