2024-09-02 18:31:19 +05:30
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
2024-09-22 14:56:53 +05:30
|
|
|
}: {
|
2024-09-02 18:31:19 +05:30
|
|
|
options.snowflake.core.nix = {
|
|
|
|
enable = lib.mkEnableOption "Enable core nix configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf config.snowflake.core.nix.enable {
|
|
|
|
nix = {
|
|
|
|
# Run garbage collector daily, and remove anything
|
|
|
|
# older than 7 days.
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
|
|
|
dates = "daily";
|
|
|
|
options = "--delete-older-than 7d";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Add each flake input as a registry to make nix3 commands
|
|
|
|
# consistent with nix flakes.
|
2024-09-22 14:56:53 +05:30
|
|
|
registry = lib.mapAttrs (_: value: {flake = value;}) inputs;
|
2024-09-02 18:31:19 +05:30
|
|
|
|
|
|
|
# Add inputs to system's legacy channels.
|
|
|
|
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
|
|
|
|
|
|
|
|
# Use the latest, unstable version of nix.
|
2024-09-22 14:56:53 +05:30
|
|
|
package = pkgs.nixVersions.nix_2_23;
|
|
|
|
# TODO: switch back to nix git. Current version has a security issue that allows
|
|
|
|
# remote code execution.
|
|
|
|
# package = pkgs.nixVersions.git;
|
2024-09-02 18:31:19 +05:30
|
|
|
|
|
|
|
settings = {
|
|
|
|
# Accept flake configuration without prompting.
|
|
|
|
accept-flake-config = true;
|
|
|
|
# Replace identical nix store files with hard links.
|
|
|
|
auto-optimise-store = true;
|
|
|
|
# Use cache from remote build machines if available.
|
|
|
|
builders-use-substitutes = true;
|
|
|
|
experimental-features = [
|
|
|
|
"auto-allocate-uids"
|
|
|
|
"ca-derivations"
|
|
|
|
"cgroups"
|
|
|
|
"flakes"
|
|
|
|
"nix-command"
|
|
|
|
"recursive-nix"
|
|
|
|
];
|
|
|
|
# Set local flake registry.
|
|
|
|
flake-registry = "/etc/nix/registry.json";
|
|
|
|
# Increase http connections (from 25 to 50) for binary cache.
|
|
|
|
http-connections = 50;
|
|
|
|
# Avoid unwanted garbage collection while using nix-direnv.
|
|
|
|
keep-outputs = true;
|
|
|
|
keep-derivations = true;
|
|
|
|
max-jobs = "auto";
|
|
|
|
# Use sandboxed build environments for builds on all systems.
|
|
|
|
# Defaults to true on linux.
|
|
|
|
sandbox = true;
|
|
|
|
# Add `wheel` group to trusted users.
|
|
|
|
trusted-users = [
|
|
|
|
"root"
|
|
|
|
"@wheel"
|
|
|
|
];
|
|
|
|
# Disable warning for dirty git tree.
|
|
|
|
warn-dirty = false;
|
|
|
|
|
|
|
|
# Add cache substituters to allow fetching cached builds.
|
2024-09-23 11:42:22 +05:30
|
|
|
trusted-substituters = [
|
|
|
|
"https://nix-community.cachix.org"
|
|
|
|
"https://hyprland.cachix.org"
|
|
|
|
];
|
|
|
|
trusted-public-keys = [
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
|
|
|
];
|
2024-09-02 18:31:19 +05:30
|
|
|
};
|
|
|
|
};
|
2024-10-05 20:51:00 +05:30
|
|
|
|
|
|
|
system.switch = {
|
|
|
|
enable = false;
|
|
|
|
enableNg = true;
|
|
|
|
};
|
2024-09-02 18:31:19 +05:30
|
|
|
};
|
|
|
|
}
|