This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/nixos/profiles/global/nix.nix

60 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, config, pkgs, nixpkgs, self, ... }:
2024-03-25 09:23:35 +11:00
{
2024-03-25 16:47:43 +11:00
## Below is to align shell/system to flake's nixpkgs
## ref: https://nixos-and-flakes.thiscute.world/best-practices/nix-path-and-flake-registry
# Make `nix repl '<nixpkgs>'` use the same nixpkgs as the one used by this flake.
environment.etc."nix/inputs/nixpkgs".source = "${nixpkgs}";
2024-03-26 21:11:59 +11:00
nix = {
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
registry.nixpkgs.flake = nixpkgs;
channel.enable = false; # remove nix-channel related tools & configs, we use flakes instead.
# but NIX_PATH is still used by many useful tools, so we set it to the same value as the one used by this flake.
# https://github.com/NixOS/nix/issues/9574
settings.nix-path = lib.mkForce "nixpkgs=/etc/nix/inputs/nixpkgs";
2024-03-25 16:47:43 +11:00
2024-03-26 21:11:59 +11:00
###
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
settings = {
2024-03-25 16:47:43 +11:00
2024-03-26 21:11:59 +11:00
# Enable flakes
experimental-features = [
"nix-command"
"flakes"
];
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
# Substitutions
substituters = [
2024-03-26 21:11:59 +11:00
"https://cache.garnix.io"
"https://nix-community.cachix.org"
"https://numtide.cachix.org"
"https://deploy-rs.cachix.org"
2024-03-26 21:11:59 +11:00
];
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"deploy-rs.cachix.org-1:xfNobmiwF/vzvK1gpfediPwpdIP0rpDV2rYqx40zdSI="
2024-03-26 21:11:59 +11:00
];
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
# Fallback quickly if substituters are not available.
connect-timeout = 25;
2024-03-26 21:11:59 +11:00
# Avoid copying unnecessary stuff over SSH
builders-use-substitutes = true;
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
trusted-users = [ "root" "@wheel" ];
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
warn-dirty = false;
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
# The default at 10 is rarely enough.
log-lines = lib.mkDefault 25;
2024-03-25 09:23:35 +11:00
2024-03-26 21:11:59 +11:00
};
2024-03-25 12:01:03 +11:00
};
2024-03-25 09:23:35 +11:00
}