config/base.nix

72 lines
2.2 KiB
Nix

{ config, pkgs, lib, inputs, ... }:
{
imports = let ifExists = p: if builtins.pathExists p then p else {}; in [
./cachix.nix # update with `cachix use --mode nixos -d . FOOBAR`
./profiles/locale-no.nix
# results of 'nixos-generate-config'
# nice to have if i just dump this flake into /etc/nixos on a clean install
(ifExists ./configuration.nix )
(ifExists ./hardware-configuration.nix )
];
nixpkgs.config.permittedInsecurePackages = [
"pulsar-1.106.0"
"pulsar-1.109.0"
"zotero-6.0.26"
"gitea-1.19.4"
];
environment.systemPackages = with pkgs; [
ddrescue
gptfdisk
ms-sys
nvme-cli
parted
pciutils
smartmontools
testdisk
usbutils
] ++ lib.optionals (builtins.elem config.nixpkgs.system [ "x86_64-linux" "aarch64_linux"]) [
cage
weston
];
# TODO: selectively whitelist
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = (pkg: true);
nixpkgs.config.nonfreeLicensing = true; # used by ffmpeg
hardware.enableRedistributableFirmware = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.settings.allowed-users = [ "*" ]; # default
#nix.settings.allowed-users = [ "@nixbld" "@builders" ]; # TODO: this
nix.settings.trusted-users = [ "root" "@wheel" ];
nix.settings.keep-derivations = true; # great with nix-diff
nix.settings.auto-optimise-store = true; # deduplicate with hardlinks, expensive. Alternative: nix-store --optimise
#nix.optimize.automatic = true; # periodic optimization
nix.gc.automatic = true;
nix.gc.dates = "weekly";
nix.gc.options = "--delete-older-than 30d";
nix.settings.min-free = 1 * 1024 * 1024 * 1024;
nix.settings.max-free = 5 * 1024 * 1024 * 1024;
services.thermald.enable = lib.mkIf (config.nixpkgs.system == "x86_64-linux") true;
# System fonts
# Nice to have when X-forwading on headless machines
fonts.fontDir.enable = true; # creates /run/current-system/sw/share/X11/fonts
fonts.enableDefaultPackages = true; # dejavu, freefont, gyre, liberation, unifont, noto-fonts-emoji
fonts.packages = with pkgs; [
noto-fonts # includes Cousine
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
];
networking.firewall.enable = true; # default
}