nixcfg/modules/darwin/nix/default.nix
Harald Hoyer b453062c57 refactor: simplify Nix module inputs and update configurations
Simplified input argument structures across multiple Nix modules by removing unnecessary bindings and standardizing formats. Enabled `system.primaryUser` setting and updated PAM configuration for sudo touch ID authentication. Removed deprecated or unused configurations, including user fields in metacfg and outdated options in some modules.
2025-05-27 13:12:18 +02:00

79 lines
1.9 KiB
Nix

{ config
, pkgs
, lib
, ...
}:
with lib;
with lib.metacfg;
let
cfg = config.metacfg.nix;
in
{
options.metacfg.nix = with types; {
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
package = mkOpt package pkgs.nix "Which nix package to use.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
deploy-rs
nixfmt
nix-index
nix-prefetch-git
];
nix =
let
users = [
"root"
config.metacfg.user.name
];
in
{
package = cfg.package;
settings =
{
experimental-features = "nix-command flakes";
http-connections = 50;
warn-dirty = false;
log-lines = 50;
# Large builds apparently fail due to an issue with darwin:
# https://github.com/NixOS/nix/issues/4119
sandbox = false;
# This appears to break on darwin
# https://github.com/NixOS/nix/issues/7273
auto-optimise-store = false;
allow-import-from-derivation = true;
trusted-users = users;
allowed-users = users;
# NOTE: This configuration is generated by nix-installer so I'm adding it here in
# case it becomes important.
extra-nix-path = "nixpkgs=flake:nixpkgs";
build-users-group = "nixbld";
}
// (lib.optionalAttrs config.metacfg.tools.direnv.enable {
keep-outputs = true;
keep-derivations = true;
});
gc = {
automatic = true;
interval = {
Day = 7;
};
options = "--delete-older-than 30d";
};
# flake-utils-plus
generateRegistryFromInputs = true;
generateNixPathFromInputs = true;
linkInputs = true;
};
};
}