Files
self 1483d30d7e dev: add en_GB locale archive to devenv
Provide a Nix glibc locale archive with en_GB.UTF-8 so tools inside the devenv shell inherit a valid UTF-8 locale.
2026-06-08 21:52:55 +02:00

111 lines
2.4 KiB
Nix

{
pkgs,
lib,
inputs,
...
}: let
system = pkgs.stdenv.system;
pkgs-unstable = inputs.nixpkgs-unstable.legacyPackages.${system};
hasGlibcLocales = pkgs.stdenv.hostPlatform.isLinux && pkgs.stdenv.hostPlatform.isGnu;
devLocales =
if hasGlibcLocales
then
pkgs.glibcLocales.override {
allLocales = false;
locales = [
"en_GB.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
];
}
else null;
in {
# https://devenv.sh/basics/
env =
{
LANG = "en_GB.UTF-8";
# Parallel deps compilation
MIX_OS_DEPS_COMPILE_PARTITION_COUNT = 8;
# Enable JS/LV debugging (required?)
NODE_ENV = "development";
# Delay npm dependency resolution to reduce rushed supply-chain updates.
NPM_CONFIG_MIN_RELEASE_AGE = "7";
}
// lib.optionalAttrs hasGlibcLocales {
LOCALE_ARCHIVE = "${devLocales}/lib/locale/locale-archive";
};
# https://devenv.sh/packages/
packages = with pkgs;
[
git
# linter and formatter for JavaScript, TypeScript, JSX, CSS and GraphQL
prettier
# Nix code formatter
alejandra
# Nostr tooling
pkgs-unstable.nak
pkgs-unstable.algia
(pkgs-unstable.callPackage ./nix/nosdump.nix {})
]
++
# Linux only
lib.optionals pkgs.stdenv.isLinux [
# for ExUnit notifier
libnotify
# for package - file_system
inotify-tools
];
# https://devenv.sh/tests/
# enterTest = ''
# echo "Running tests"
# git --version | grep "2.42.0"
# '';
# https://devenv.sh/languages/
languages = {
elixir = {
enable = true;
package = pkgs.elixir_1_19;
};
javascript = {
enable = true;
package = pkgs.nodejs_24;
npm.enable = true;
};
};
# dotenv.enable = true;
devenv.warnOnNewVersion = false;
# https://devenv.sh/pre-commit-hooks/
git-hooks.hooks = {
alejandra.enable = true;
prettier.enable = true;
prettier.files = "\\.(js|ts|tsx|css)$";
check-added-large-files = {
enable = true;
args = ["--maxkb=131072"];
};
mix-format.enable = true;
mix-format.files = "\\.(ex|exs|heex)$";
};
# https://devenv.sh/scripts/
enterShell = ''
echo
elixir --version
echo -n "Node.js "
node --version
echo
'';
scripts = {
plugin.exec = ''bash "$DEVENV_ROOT/scripts/plugin" "$@"'';
};
# See full reference at https://devenv.sh/reference/options/
}