2024-12-20 22:37:44 -05:00
{
config ,
lib ,
2026-04-19 13:26:02 -04:00
pkgs ,
2024-12-20 22:37:44 -05:00
. . .
} :
2024-12-17 15:26:10 -05:00
2026-04-19 13:26:02 -04:00
let
alias_nix_pin_revision = pkgs . writeShellScriptBin " n i x - p i n - r e v i s i o n " ''
# Usage: nix-pin-revision nixpkgs 'github:NixOS/nixpkgs/00c21e4c93d963c50d4c0c89bfa84ed6e0694df2'
exec nix flake lock - - override-input " ' ' ${ @ } "
'' ;
in
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
2025-08-17 09:37:06 -04:00
./roles/amd_s2idle
2026-02-03 11:14:05 -05:00
./roles/android
2025-04-11 17:41:55 -04:00
./roles/ansible
./roles/ares
2025-10-11 00:08:02 -04:00
./roles/base
2025-04-11 17:41:55 -04:00
./roles/bluetooth
./roles/boot
2025-10-26 15:05:49 -04:00
./roles/build_in_ram
2025-04-11 17:41:55 -04:00
./roles/chromecast
2024-12-22 00:48:57 -05:00
./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
2025-05-04 16:20:00 -04:00
./roles/distributed_build
2025-10-11 00:08:02 -04:00
./roles/doas
2025-04-11 17:41:55 -04:00
./roles/docker
2025-10-27 14:56:27 -04:00
./roles/dont_use_substituters
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
2026-03-01 12:39:11 -05:00
./roles/esim
2025-04-11 17:41:55 -04:00
./roles/firefox
./roles/firewall
./roles/flux
2024-12-20 22:37:44 -05:00
./roles/fonts
2025-04-11 17:41:55 -04:00
./roles/gcloud
./roles/git
./roles/global_options
2025-11-24 23:01:40 -05:00
./roles/gnome_keyring
2025-04-11 17:41:55 -04:00
./roles/gnuplot
2024-12-20 22:37:44 -05:00
./roles/gpg
2025-04-11 17:41:55 -04:00
./roles/graphics
2026-01-02 10:11:30 -05:00
./roles/graphviz
2025-04-11 17:41:55 -04:00
./roles/hydra
2025-11-24 23:01:40 -05:00
./roles/image_based_appliance
2025-04-11 17:41:55 -04:00
./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
2026-05-31 02:03:49 -04:00
./roles/kernel
2025-04-11 17:41:55 -04:00
./roles/kodi
2025-01-01 14:14:55 -05:00
./roles/kubernetes
2025-01-14 18:04:04 -05:00
./roles/latex
2025-01-14 20:16:06 -05:00
./roles/launch_keyboard
2025-01-14 21:54:21 -05:00
./roles/lvfs
2025-04-11 17:41:55 -04:00
./roles/media
2025-01-19 21:29:24 -05:00
./roles/memtest86
2025-10-26 17:16:15 -04:00
./roles/minimal_base
2025-04-11 17:41:55 -04:00
./roles/network
2025-01-25 20:18:10 -05:00
./roles/nix_index
2026-01-01 10:52:00 -05:00
./roles/nix_repl
2025-05-04 15:31:13 -04:00
./roles/nix_worker
2025-12-08 23:20:33 -05:00
./roles/nixdev
2025-04-11 17:41:55 -04:00
./roles/nvme
2025-09-23 21:45:29 -04:00
./roles/openpgp_card_tools
2025-05-12 19:06:04 -04:00
./roles/optimized_build
2025-03-20 20:18:40 -04:00
./roles/pcsx2
2025-09-07 22:38:13 -04:00
./roles/podman
2025-12-03 16:12:36 -05:00
./roles/postgresql_client
2025-04-11 17:41:55 -04:00
./roles/python
./roles/qemu
2025-10-25 15:00:14 -04:00
./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
2025-03-31 22:22:01 -04:00
./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
2025-10-11 00:08:02 -04:00
./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
2025-10-11 00:08:02 -04:00
./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
2026-02-06 11:24:05 -05:00
./roles/webcam
2025-11-17 04:54:15 -05:00
./roles/wine
2025-04-11 17:41:55 -04:00
./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
2025-04-11 17:45:47 -04:00
./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
2025-10-11 00:08:02 -04:00
config = {
nix . settings . experimental-features = [
" n i x - c o m m a n d "
" f l a k e s "
2025-11-29 23:08:03 -05:00
" c a - d e r i v a t i o n s "
# "blake3-hashes"
# "git-hashing"
2024-12-17 15:26:10 -05:00
] ;
2025-10-11 00:08:02 -04:00
nix . settings . trusted-users = [ " @ w h e e l " ] ;
2026-02-05 21:38:45 -05:00
nix . settings . connect-timeout = 5 ;
nix . settings . min-free = 128000000 ;
nix . settings . max-free = 1000000000 ;
nix . settings . fallback = true ;
nix . settings . warn-dirty = false ;
2026-04-05 12:20:17 -04:00
nix . settings . fsync-metadata = true ;
# Ensure store paths are durably written to disk before registering the paths so a crash mid-build does not leave us in a corrupted state.
nix . settings . fsync-store-paths = true ;
2025-10-11 00:08:02 -04:00
hardware . enableRedistributableFirmware = true ;
# Keep outputs so we can build offline.
2025-11-29 20:53:41 -05:00
nix . settings . keep-outputs = true ;
nix . settings . keep-derivations = true ;
2025-10-11 00:08:02 -04:00
# Automatic garbage collection
nix . gc = lib . mkIf ( ! config . me . buildingPortable ) {
# Runs nix-collect-garbage --delete-older-than 5d
2026-05-31 02:03:49 -04:00
# automatic = true;
automatic = false ;
2025-10-11 00:08:02 -04:00
persistent = true ;
dates = " m o n t h l y " ;
# randomizedDelaySec = "14m";
options = " - - d e l e t e - o l d e r - t h a n 3 0 d " ;
2024-12-17 15:26:10 -05:00
} ;
2025-10-11 00:08:02 -04:00
nix . settings . auto-optimise-store = ! config . me . buildingPortable ;
2024-12-17 15:26:10 -05:00
2026-04-19 13:26:02 -04:00
environment . systemPackages = [
alias_nix_pin_revision
] ;
2025-10-11 00:08:02 -04:00
environment . persistence . " / p e r s i s t " = lib . mkIf ( config . me . mountPersistence ) {
hideMounts = true ;
2025-01-24 20:36:37 -05:00
directories = [
2025-10-11 00:08:02 -04:00
" / v a r / l i b / n i x o s " # Contains user information (uids/gids)
" / v a r / l i b / s y s t e m d " # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
" / v a r / l o g / j o u r n a l " # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
] ;
files = [
" / e t c / m a c h i n e - i d " # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"
2025-01-24 20:36:37 -05:00
] ;
} ;
2024-12-17 15:26:10 -05:00
2025-10-11 00:08:02 -04:00
# Write a list of the currently installed packages to /etc/current-system-packages
2025-11-15 20:00:59 -05:00
# 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;
2025-10-11 00:08:02 -04:00
# nixpkgs.overlays = [
# (final: prev: {
# foot = throw "foo";
# })
# ];
2025-10-25 15:00:14 -04:00
nixpkgs . overlays =
let
disableTests = (
2026-01-15 18:10:05 -05:00
# Example: (disableTests "coreutils")
2025-10-25 15:00:14 -04:00
package_name :
( final : prev : {
" ${ package_name } " = prev . " ${ package_name } " . overrideAttrs ( old : {
doCheck = false ;
doInstallCheck = false ;
} ) ;
} )
) ;
2026-01-15 18:10:05 -05:00
disableTestsPython = (
# Example: (disableTestsPython "scipy")
package_name :
( final : prev : {
pythonPackagesExtensions = prev . pythonPackagesExtensions ++ [
( python-final : python-prev : {
" ${ package_name } " = python-prev . " ${ package_name } " . overridePythonAttrs ( oldAttrs : {
doCheck = false ;
} ) ;
} )
] ;
} )
) ;
disableOptimizations = (
# Example: (disableOptimizations "coreutils")
package_name :
( final : prev : {
" ${ package_name } " = final . unoptimized . " ${ package_name } " ;
} )
) ;
disableOptimizationsScope = (
# Example: (disableOptimizationsScope "kdePackages" "qtbase")
scope : package_name :
( final : prev : {
" ${ scope } " = prev . " ${ scope } " . overrideScope (
scopeFinal : scopePrev : {
" ${ package_name } " = final . unoptimized . " ${ scope } " . " ${ package_name } " ;
}
) ;
} )
) ;
disableOptimizationsPython3 = (
# Example: (disableOptimizationsPython3 "scipy")
package_name :
( final : prev : {
python3Packages = prev . python3Packages . override {
overrides = python-final : python-prev : {
" ${ package_name } " = final . unoptimized . python3 . pkgs . " ${ package_name } " ;
} ;
} ;
} )
) ;
2025-10-25 15:00:14 -04:00
in
[
2026-05-01 20:16:45 -04:00
( disableTests " d e n o " ) # Tests use too much disk space
2026-05-31 02:03:49 -04:00
( disableOptimizations " l i b t p m s " )
2026-01-15 18:10:05 -05:00
( disableOptimizationsPython3 " s c i p y " )
2026-05-31 02:03:49 -04:00
( disableOptimizations " a s s i m p " )
( disableOptimizations " g s l " )
2026-06-12 12:09:33 -04:00
( final : prev : {
rpcs3 = prev . rpcs3 . override {
glew = ( final . glew . override { enableEGL = false ; } ) ;
} ;
} )
( final : prev : {
fwupd = prev . fwupd . overrideAttrs (
finalAttrs : prevAttrs : {
version = " 2 . 1 . 5 " ;
src = final . fetchFromGitHub {
owner = " f w u p d " ;
repo = " f w u p d " ;
tag = finalAttrs . version ;
hash = " s h a 2 5 6 - D z Q + N 9 9 Z m F R q Z c 2 r N 6 P S q m o I M X U y r E 8 K k n + K n T / A W P c = " ;
} ;
}
) ;
} )
2026-06-21 22:14:14 -04:00
( disableTests " o n e t b b " ) # oneTBB tests hang forever on machines with a single core (like my build virtual machine) https://github.com/uxlfoundation/oneTBB/issues/1557
2026-07-05 16:15:33 -04:00
( disableTests " a w s - c - c o m m o n " ) # aws-c-common tests time out on my build virtual machine but run fine on my laptop.
2026-05-21 20:33:04 -04:00
2026-01-15 18:10:05 -05:00
# Works but probably sets python2's scipy to be python3:
#
2025-11-29 23:08:03 -05:00
# (final: prev: {
2026-01-15 18:10:05 -05:00
# pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
# (python-final: python-prev: {
# scipy = final.unoptimized.python3Packages.scipy;
# })
# ];
2025-11-29 23:08:03 -05:00
# })
2025-10-25 15:00:14 -04:00
] ;
2025-10-16 22:06:28 -04:00
2025-10-11 00:08:02 -04:00
# 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 = " 2 4 . 1 1 " ; # Did you read the comment?
} ;
2024-12-17 15:26:10 -05:00
}