2024-11-19 10:31:29 +01:00
|
|
|
{
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
2024-03-21 15:00:36 +01:00
|
|
|
}:
|
|
|
|
with lib;
|
2024-11-19 10:31:29 +01:00
|
|
|
with lib.metacfg;
|
|
|
|
let
|
2024-03-21 15:00:36 +01:00
|
|
|
cfg = config.metacfg.nix;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.metacfg.nix = with types; {
|
|
|
|
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
|
2024-07-19 12:19:28 +02:00
|
|
|
package = mkOpt package pkgs.nix "Which nix package to use.";
|
2024-03-21 15:00:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
deploy-rs
|
|
|
|
nixfmt
|
|
|
|
nix-index
|
|
|
|
nix-prefetch-git
|
|
|
|
];
|
|
|
|
|
|
|
|
nix =
|
|
|
|
let
|
2024-11-19 10:31:29 +01:00
|
|
|
users = [
|
|
|
|
"root"
|
|
|
|
config.metacfg.user.name
|
|
|
|
];
|
2024-03-21 15:00:36 +01:00
|
|
|
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;
|
2024-11-19 10:31:29 +01:00
|
|
|
interval = {
|
|
|
|
Day = 7;
|
|
|
|
};
|
2024-03-21 15:00:36 +01:00
|
|
|
options = "--delete-older-than 30d";
|
|
|
|
user = config.metacfg.user.name;
|
|
|
|
};
|
|
|
|
|
|
|
|
# flake-utils-plus
|
|
|
|
generateRegistryFromInputs = true;
|
|
|
|
generateNixPathFromInputs = true;
|
|
|
|
linkInputs = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|