From e7f108145ac1c0470a5afb999d79353e3c893fd3 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Wed, 15 Jan 2025 17:14:55 +0100 Subject: [PATCH] fix(flake.nix): install locales on linux host devShells (#16120) Change-Id: I22dba63d317b41749c807a55e15278006cdcecad Signed-off-by: Thomas Kosiewski - Adds neovim and fzf to development tools, removes sapling, and fixes locale issues on Linux systems. - Updates Dockerfile.nix syntax to use uppercase `AS` to remove warnings. - Refactored conditional logic for strace inclusion using `lib.optional`. --- dogfood/contents/Dockerfile.nix | 4 ++-- flake.nix | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dogfood/contents/Dockerfile.nix b/dogfood/contents/Dockerfile.nix index 40729eb9c5..b17325b625 100644 --- a/dogfood/contents/Dockerfile.nix +++ b/dogfood/contents/Dockerfile.nix @@ -1,5 +1,5 @@ # Build stage -FROM nixos/nix:2.19.2 as nix +FROM nixos/nix:2.19.2 AS nix # enable --experimental-features 'nix-command flakes' globally # nix does not enable these features by default these are required to run commands like @@ -14,7 +14,7 @@ RUN nix profile install "/app#all" --priority 4 && \ nix-collect-garbage -d # Final image -FROM codercom/enterprise-base:latest as final +FROM codercom/enterprise-base:latest AS final # Set the non-root user USER root diff --git a/flake.nix b/flake.nix index 1473db147c..de604bfb48 100644 --- a/flake.nix +++ b/flake.nix @@ -58,20 +58,22 @@ # The minimal set of packages to build Coder. devShellPackages = with pkgs; [ - # google-chrome is not available on OSX and aarch64 linux - (if pkgs.stdenv.hostPlatform.isDarwin || pkgs.stdenv.hostPlatform.isAarch64 then null else google-chrome) + # google-chrome is not available on aarch64 linux + (lib.optionalDrvAttr ( !stdenv.isLinux || !stdenv.isAarch64 ) google-chrome) # strace is not available on OSX - (if pkgs.stdenv.hostPlatform.isDarwin then null else strace) + (lib.optionalDrvAttr ( !pkgs.stdenv.isDarwin ) strace) bat cairo curl delve drpc.defaultPackage.${system} + fzf gcc gdk getopt gh git + (lib.optionalDrvAttr stdenv.isLinux glibcLocales) gnumake gnused go_1_22 @@ -85,8 +87,10 @@ kubernetes-helm less mockgen + moreutils nfpm nodejs + neovim pnpm openssh openssl @@ -98,8 +102,6 @@ protobuf proto_gen_go_1_30 ripgrep - # This doesn't build on latest nixpkgs (July 10 2024) - (pinnedPkgs.sapling) shellcheck (pinnedPkgs.shfmt) sqlc @@ -165,6 +167,8 @@ export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers} export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true ''; + + LOCALE_ARCHIVE = with pkgs; lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; }; packages = { proto_gen_go = proto_gen_go_1_30;