2024-09-09 00:22:14 +00:00
|
|
|
{
|
2024-09-13 01:50:53 +00:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.custom.settings.environment;
|
|
|
|
in {
|
2024-09-09 00:22:14 +00:00
|
|
|
options.custom.settings.environment = {
|
2024-09-13 01:50:53 +00:00
|
|
|
enable = mkOption {default = false;};
|
|
|
|
builder = mkOption {default = config.custom.full;};
|
|
|
|
wayland = mkOption {default = config.custom.minimal;};
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
# https://wiki.nixos.org/wiki/Cross_Compiling
|
2024-09-13 01:50:53 +00:00
|
|
|
boot.binfmt.emulatedSystems = mkIf cfg.builder ["aarch64-linux"]; # Emulate architecture
|
2024-09-09 00:22:14 +00:00
|
|
|
#// nixpkgs.buildPlatform = "x86_64-linux"; # Binary caches often not available
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
localBinInPath = true;
|
|
|
|
|
|
|
|
# HACK: Nix does not currently handle locale properly, so force default
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/183960 et al.
|
|
|
|
#// i18n.defaultLocale = "C.UTF-8";
|
|
|
|
|
|
|
|
sessionVariables = {
|
|
|
|
GDK_SCALE = toString config.custom.scale; # Steam HiDPI
|
|
|
|
|
|
|
|
# https://wiki.nixos.org/wiki/Wayland#Electron_and_Chromium
|
|
|
|
NIXOS_OZONE_WL = mkIf cfg.wayland "1";
|
|
|
|
};
|
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
# https://github.com/aksiksi/compose2nix?tab=readme-ov-file#usage
|
|
|
|
# https://github.com/aksiksi/compose2nix?tab=readme-ov-file#agenix
|
|
|
|
compose2nix = concatStringsSep " " [
|
|
|
|
"compose2nix"
|
|
|
|
"--inputs compose.yaml"
|
|
|
|
"--output compose.nix"
|
|
|
|
"--root_path /containers"
|
|
|
|
"--auto_format"
|
|
|
|
"--check_systemd_mounts"
|
|
|
|
"--env_files_only"
|
|
|
|
"--ignore_missing_env_files"
|
|
|
|
"--include_env_files"
|
|
|
|
#?? --env_files /run/agenix/containers/*/.env
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|