dotfiles/machines/common/shared/nix.nix
winston ab0d3a9974
All checks were successful
/ check (push) Successful in 5m2s
chore: update for macOS Sequoia
2024-09-18 14:54:01 +02:00

49 lines
1.2 KiB
Nix

{
lib,
inputs,
pkgs,
...
}:
let
inherit (builtins) attrValues mapAttrs;
inherit (lib) filterAttrs;
inherit (pkgs.stdenv) isDarwin isLinux;
flakeInputs = filterAttrs (name: value: (value ? outputs) && (name != "self")) inputs;
in
{
nixpkgs = {
config.allowUnfree = true;
# prefer my own registry & path pinning for *all* inputs
flake.setNixPath = false;
flake.setFlakeRegistry = false;
};
nix = {
gc.automatic = true;
settings = {
# breaks the Nix Store on macOS
# https://github.com/NixOS/nix/issues/7273
auto-optimise-store = isLinux;
experimental-features = [
"auto-allocate-uids"
"flakes"
"nix-command"
];
trusted-users = [
"@sudo"
"@wheel"
"winston"
];
use-xdg-base-directories = true;
warn-dirty = false;
} // (import ../../../flake.nix).nixConfig;
registry = mapAttrs (name: v: { flake = v; }) flakeInputs;
nixPath =
if isDarwin then
lib.mkForce (mapAttrs (k: v: v.outPath) flakeInputs)
else if isLinux then
attrValues (mapAttrs (k: v: "${k}=${v.outPath}") flakeInputs)
else
throw "Unsupported platform";
};
}