machine_setup/nix/configuration/configuration.nix

205 lines
5.7 KiB
Nix
Raw Normal View History

2024-12-20 22:37:44 -05:00
{
config,
lib,
...
}:
2024-12-17 15:26:10 -05:00
{
2024-12-20 22:37:44 -05:00
imports = [
2025-04-11 17:41:55 -04:00
./roles/2ship2harkinian
2024-12-20 22:37:44 -05:00
./roles/alacritty
./roles/amd_s2idle
2025-04-11 17:41:55 -04:00
./roles/ansible
./roles/ares
./roles/base
2025-04-11 17:41:55 -04:00
./roles/bluetooth
./roles/boot
./roles/build_in_ram
2025-04-11 17:41:55 -04:00
./roles/chromecast
./roles/chromium
2025-09-02 21:57:35 -04:00
./roles/d2
2025-07-13 16:07:25 -04:00
./roles/direnv
2025-10-26 17:36:25 -04:00
./roles/disko
./roles/distributed_build
./roles/doas
2025-04-11 17:41:55 -04:00
./roles/docker
2025-04-16 20:36:08 -04:00
./roles/ecc
2024-12-20 22:37:44 -05:00
./roles/emacs
2025-10-05 20:14:01 -04:00
./roles/emulate_isa
2025-04-11 17:41:55 -04:00
./roles/firefox
./roles/firewall
./roles/flux
2024-12-20 22:37:44 -05:00
./roles/fonts
./roles/image_based_appliance
2025-04-11 17:41:55 -04:00
./roles/gcloud
./roles/git
./roles/global_options
./roles/gnuplot
2024-12-20 22:37:44 -05:00
./roles/gpg
2025-04-11 17:41:55 -04:00
./roles/graphics
./roles/hydra
./roles/iso
2025-05-26 14:12:49 -04:00
./roles/iso_mount
2025-10-25 20:09:07 -04:00
./roles/jujutsu
2025-04-11 17:41:55 -04:00
./roles/kanshi
./roles/kodi
2025-01-01 14:14:55 -05:00
./roles/kubernetes
2025-01-14 18:04:04 -05:00
./roles/latex
./roles/launch_keyboard
./roles/lvfs
2025-04-11 17:41:55 -04:00
./roles/media
./roles/memtest86
./roles/minimal_base
2025-04-11 17:41:55 -04:00
./roles/network
2025-01-25 20:18:10 -05:00
./roles/nix_index
./roles/nix_worker
2025-04-11 17:41:55 -04:00
./roles/nvme
2025-09-23 21:45:29 -04:00
./roles/openpgp_card_tools
./roles/optimized_build
2025-03-20 20:18:40 -04:00
./roles/pcsx2
2025-09-07 22:38:13 -04:00
./roles/podman
2025-04-11 17:41:55 -04:00
./roles/python
./roles/qemu
./roles/recovery
2025-04-11 17:41:55 -04:00
./roles/reset
2025-05-25 11:00:31 -04:00
./roles/rpcs3
2025-04-11 17:41:55 -04:00
./roles/rust
2025-09-23 21:45:29 -04:00
./roles/sequoia
2025-06-28 20:49:59 -04:00
./roles/shadps4
./roles/shikane
2025-04-11 17:41:55 -04:00
./roles/shipwright
./roles/sm64ex
./roles/sops
./roles/sound
2025-09-09 22:53:15 -04:00
./roles/spaghettikart
2025-04-11 17:41:55 -04:00
./roles/ssh
./roles/sshd
2025-04-11 17:41:55 -04:00
./roles/steam
./roles/steam_run_free
./roles/sway
./roles/tekton
./roles/terraform
2025-04-16 20:36:08 -04:00
./roles/thunderbolt
./roles/user
2025-10-05 16:28:31 -04:00
./roles/uutils
2025-04-11 17:41:55 -04:00
./roles/vnc_client
./roles/vscode
./roles/wasm
./roles/waybar
./roles/wireguard
2025-09-23 21:45:29 -04:00
./roles/yubikey
2025-04-11 17:41:55 -04:00
./roles/zfs
./roles/zrepl
./roles/zsh
./util/install_files
2025-04-11 17:41:55 -04:00
./util/unfree_polyfill
2024-12-20 22:37:44 -05:00
];
2024-12-17 15:26:10 -05:00
config = {
nix.settings.experimental-features = [
"nix-command"
"flakes"
2024-12-17 15:26:10 -05:00
];
nix.settings.trusted-users = [ "@wheel" ];
hardware.enableRedistributableFirmware = true;
# Keep outputs so we can build offline.
# Disable substituters to avoid risk of cache poisoning.
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
substitute = false
'';
nix.settings.substituters = lib.mkForce [ ];
# Automatic garbage collection
nix.gc = lib.mkIf (!config.me.buildingPortable) {
# Runs nix-collect-garbage --delete-older-than 5d
automatic = true;
persistent = true;
dates = "monthly";
# randomizedDelaySec = "14m";
options = "--delete-older-than 30d";
2024-12-17 15:26:10 -05:00
};
nix.settings.auto-optimise-store = !config.me.buildingPortable;
2024-12-17 15:26:10 -05:00
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
hideMounts = true;
directories = [
"/var/lib/nixos" # Contains user information (uids/gids)
"/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
"/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
];
files = [
"/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"
];
};
2024-12-17 15:26:10 -05:00
# Write a list of the currently installed packages to /etc/current-system-packages
environment.etc."current-system-packages".text =
let
packages = builtins.map (p: "${p.name}") config.environment.systemPackages;
sortedUnique = builtins.sort builtins.lessThan (lib.unique packages);
formatted = builtins.concatStringsSep "\n" sortedUnique;
in
formatted;
# nixpkgs.overlays = [
# (final: prev: {
# foot = throw "foo";
# })
# ];
nixpkgs.overlays =
let
disableTests = (
package_name:
(final: prev: {
"${package_name}" = prev."${package_name}".overrideAttrs (old: {
doCheck = false;
doInstallCheck = false;
});
})
);
in
[
(final: prev: {
imagemagick = prev.imagemagick.overrideAttrs (old: rec {
# 7.1.2-6 seems to no longer exist, so use 7.1.2-7
version = "7.1.2-7";
src = final.fetchFromGitHub {
owner = "ImageMagick";
repo = "ImageMagick";
tag = version;
hash = "sha256-9ARCYftoXiilpJoj+Y+aLCEqLmhHFYSrHfgA5DQHbGo=";
};
});
})
(final: prev: {
grub2 = (final.callPackage ./package/grub { });
})
];
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.11"; # Did you read the comment?
};
2024-12-17 15:26:10 -05:00
}