dotfiles/machines/common/shared/nix.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

{
lib,
inputs,
pkgs,
...
2024-05-07 18:20:52 +02:00
}:
let
2023-12-29 09:39:36 +01:00
inherit (builtins) attrValues mapAttrs;
inherit (lib) filterAttrs;
inherit (pkgs.stdenv) isDarwin isLinux;
2023-12-29 09:39:36 +01:00
flakeInputs = filterAttrs (name: value: (value ? outputs) && (name != "self")) inputs;
2024-05-07 18:20:52 +02:00
in
{
2023-03-02 07:30:03 +01:00
nixpkgs.config.allowUnfree = true;
nix = {
gc.automatic = true;
2024-05-07 18:20:52 +02:00
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 =
2024-05-07 18:20:52 +02:00
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";
2023-02-13 23:33:09 +01:00
};
}