Personal Nix setup

Merge branch 'sodacream'

+11 -27
flake.lock
···
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
-
],
-
"rust-overlay": "rust-overlay"
+
]
},
"locked": {
-
"lastModified": 1738646237,
-
"narHash": "sha256-++0dXoZO9l5oceiGQsJmtUI5WXlPMw6QKjpg7vGPl3w=",
-
"owner": "tpwrules",
+
"lastModified": 1740250957,
+
"narHash": "sha256-FTmaWVUuJY4ibBcAyTKGEv8EGqiUquSUg9kV+DAYZIo=",
+
"owner": "kitten",
"repo": "nixos-apple-silicon",
-
"rev": "3d1c6c27b14c4b8fcbdaec779e715f30cb72ed15",
+
"rev": "b27e311a81eba2cf149d36fabe550bab7994d355",
"type": "github"
},
"original": {
-
"owner": "tpwrules",
+
"owner": "kitten",
+
"ref": "next",
"repo": "nixos-apple-silicon",
"type": "github"
}
···
"nixpkgs"
],
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
-
"rust-overlay": "rust-overlay_2"
+
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1737639419,
···
},
"nixpkgs": {
"locked": {
-
"lastModified": 1739482815,
-
"narHash": "sha256-/5Lwtmp/8j+ro32gXzitucSdyjJ6QehfJCL58WNA7N0=",
+
"lastModified": 1740019556,
+
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "ba0939c506a03c60a765cd7f7c43794816540eec",
+
"rev": "dad564433178067be1fbdfcce23b546254b6d641",
"type": "github"
},
"original": {
···
}
},
"rust-overlay": {
-
"flake": false,
-
"locked": {
-
"lastModified": 1686795910,
-
"narHash": "sha256-jDa40qRZ0GRQtP9EMZdf+uCbvzuLnJglTUI2JoHfWDc=",
-
"owner": "oxalica",
-
"repo": "rust-overlay",
-
"rev": "5c2b97c0a9bc5217fc3dfb1555aae0fb756d99f9",
-
"type": "github"
-
},
-
"original": {
-
"owner": "oxalica",
-
"repo": "rust-overlay",
-
"type": "github"
-
}
-
},
-
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"lanzaboote",
+7 -1
flake.nix
···
};
apple-silicon = {
-
url = "github:tpwrules/nixos-apple-silicon";
+
url = "github:kitten/nixos-apple-silicon/next";
inputs.nixpkgs.follows = "nixpkgs";
};
···
inherit overlays;
system = "aarch64-linux";
hostname = "ramune";
+
};
+
+
nixosConfigurations."sodacream" = mkSystem {
+
inherit overlays;
+
system = "aarch64-linux";
+
hostname = "sodacream";
};
packages = eachSystem (system: {
+3 -2
home/apps/firefox.nix
···
-
{ lib, config, helpers, ... }:
+
{ lib, config, pkgs, helpers, ... }:
with lib;
let
···
config = mkIf (cfg.enable && cfg.firefox.enable) {
programs.firefox = {
enable = true;
+
package = with pkgs; (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) {});
profiles.default = {
settings = {
"browser.aboutConfig.showWarning" = false;
···
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"font.default.x-western" = "sans-serif";
"font.name.sans-serif.x-western" = "Inter";
-
"dom.ipc.processCount" = 4;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
+
"gfx.webrender.all" = true;
};
};
};
+2 -1
home/apps/ghostty.nix
···
window-theme = ghostty
window-colorspace = display-p3
window-save-state = always
-
window-decoration = server
+
window-decoration = client
+
window-inherit-working-directory = true
unfocused-split-opacity = 0.9
adjust-underline-thickness = -1
+53 -8
home/base/git.nix
···
cfg = config.modules.git;
home = config.home.homeDirectory;
+
excludesFile = pkgs.writeTextFile {
+
name = ".gitignore";
+
text = ''
+
# macOS: General
+
.DS_Store
+
.AppleDouble
+
.LSOverride
+
._*
+
+
# macOS: Files that might appear in the root of a volume
+
.DocumentRevisions-V100
+
.fseventsd
+
.Spotlight-V100
+
.TemporaryItems
+
.Trashes
+
.VolumeIcon.icns
+
.com.apple.timemachine.donotpresent
+
+
# Xcode
+
xcuserdata/
+
+
# Linux: hidden files
+
*~
+
.fuse_hidden*
+
.directory
+
.Trash-*
+
.nfs*
+
'';
+
};
+
userType = types.submodule {
options = {
name = mkOption {
···
tag.gpgSign = true;
push.gpgSign = "if-asked";
+
column.ui = "auto";
color.ui = "auto";
init.defaultBranch = "main";
+
help.autocorrect = "prompt";
branch.sort = "-committerdate";
-
tag.sort = "-taggerdate";
+
tag.sort = "-version:refname";
+
commit.verbose = true;
status = {
showUntrackedFiles = "all";
···
tool = "vimdiff";
submodule = "log";
algorithm = "histogram";
+
colorMoved = "plain";
colorMovedWS = "allow-indentation-change";
+
mnemonicPrefix = true;
compactionHeuristic = true;
-
context = 10;
+
rename = true;
};
push = {
default = "simple";
autoSetupRemote = true;
-
followtags = true;
+
followTags = true;
+
atomic = true;
};
rebase = {
-
autosquash = true;
-
autostash = true;
+
autoSquash = true;
+
autoStash = true;
updateRefs = true;
missingCommitsCheck = "error";
};
···
fetch = {
prune = true;
-
prunetags = true;
+
pruneTags = true;
+
all = true;
};
gitget = {
···
skip-host = true;
};
-
core.autocrlf = false;
+
rerere = {
+
enabled = true;
+
autoupdate = true;
+
};
+
+
core = {
+
autocrlf = false;
+
excludesfile = toString excludesFile;
+
};
+
pull.rebase = true;
-
rerere.enabled = true;
difftool.prompt = false;
mergetool.prompt = true;
transfer.fsckobjects = true;
-1
home/default.nix
···
imports = [
./base
./development
-
./desktop
./apps
];
}
-20
home/desktop/default.nix
···
-
{ lib, helpers, ... }:
-
-
with lib; {
-
options.modules.desktop = {
-
enable = mkOption {
-
default = false;
-
example = true;
-
description = "Whether to enable Desktop options.";
-
type = types.bool;
-
};
-
};
-
-
config.modules.desktop = {
-
enable = if helpers.isLinux then (mkDefault false) else (mkForce false);
-
};
-
} // helpers.linuxAttrs {
-
imports = [
-
./theme.nix
-
];
-
}
-39
home/desktop/theme.nix
···
-
{ lib, config, pkgs, ... }:
-
-
with lib;
-
let
-
cfg = config.modules.desktop;
-
in {
-
options.modules.desktop.theme = {
-
enable = mkOption {
-
default = cfg.enable;
-
example = true;
-
description = "Whether to enable default theme.";
-
type = types.bool;
-
};
-
};
-
-
config = mkIf cfg.theme.enable {
-
fonts.fontconfig.enable = true;
-
-
services.xsettingsd = {
-
enable = true;
-
settings = {
-
"Gtk/CursorThemeName" = "Bibata-Modern-Classic";
-
"Xft/Antialias" = true;
-
"Xft/Hinting" = true;
-
"Xft/HintStyle" = "hintslight";
-
"Xft/RGBA" = "rgb";
-
"Xft/dpi" = 163;
-
};
-
};
-
-
home.pointerCursor = {
-
name = "Bibata-Modern-Classic";
-
package = pkgs.bibata-cursors;
-
size = 24;
-
gtk.enable = true;
-
x11.enable = true;
-
};
-
};
-
}
+2 -1
home/development/js.nix
···
NODE_REPL_HISTORY = "${config.xdg.stateHome}/node_repl_history";
NPM_CONFIG_USERCONFIG = "${NPMRC_PATH}";
NPM_CONFIG_CACHE = "${config.xdg.cacheHome}/npm";
-
NPM_CONFIG_TMP = "${config.xdg.runtimeDir}/npm";
+
NPM_CONFIG_TMP = "$XDG_RUNTIME_DIR/npm";
VOLTA_HOME = "${config.xdg.dataHome}/volta";
COREPACK_ENABLE_AUTO_PIN = "0"; # disable corepack creating packageManager entries
+
COREPACK_INTEGRITY_KEYS = "0";
};
home.file.".yarnrc".text = ''
-1
machines/pepper/home.nix
···
{
modules = {
development.enable = false;
-
desktop.enable = true;
apps = {
enable = true;
discord.enable = true;
+30
machines/sodacream/configuration.nix
···
+
{ user, ... }:
+
+
{
+
imports = [
+
./hardware.nix
+
];
+
+
users.users."${user}" = {
+
isNormalUser = true;
+
extraGroups = [ "wheel" ];
+
hashedPassword = "$6$DEmCOeiSFe6ymGox$WMWddbT9PkkfDT6JS4WuJsM3mQHI0e9kg0t42UowO79dWAcSU0K//KKlcebSosoMRz5mUEw5TFvbrv1aRHqYa/";
+
};
+
+
modules = {
+
desktop = {
+
enable = true;
+
rawaccel.enable = false;
+
affinity.performanceCores = [ 4 5 6 7 ];
+
};
+
fonts.enable = true;
+
server = {
+
enable = true;
+
sshd.enable = true;
+
tailscale.enable = true;
+
};
+
};
+
+
system.stateVersion = "25.05";
+
}
+
+90
machines/sodacream/hardware.nix
···
+
{ lib, inputs, modulesPath, ... }:
+
+
with lib;
+
{
+
imports = with inputs; [
+
apple-silicon.nixosModules.apple-silicon-support
+
(modulesPath + "/installer/scan/not-detected.nix")
+
];
+
+
networking.hostId = "1a99cdb0";
+
+
boot = {
+
supportedFilesystems = [ "btrfs" ];
+
loader = {
+
systemd-boot.enable = true;
+
efi.canTouchEfiVariables = false;
+
};
+
kernelParams = [
+
"zswap.enabled=1"
+
"zswap.compressor=zstd"
+
"zswap.zpool=zsmalloc"
+
"zswap.max_pool_percent=20"
+
"apple_dcp.show_notch=1"
+
"nvme_apple.flush_interval=1000"
+
];
+
initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/NIXOS_LUKS";
+
};
+
+
fileSystems."/" = {
+
device = "/dev/disk/by-label/NIXROOT";
+
fsType = "btrfs";
+
options = [ "subvol=@root" "compress=zstd" "noatime" ];
+
};
+
+
fileSystems."/nix" = {
+
device = "/dev/disk/by-label/NIXROOT";
+
fsType = "btrfs";
+
options = [ "subvol=@nix" "compress=zstd" "noatime" ];
+
};
+
+
fileSystems."/home" = {
+
device = "/dev/disk/by-label/NIXROOT";
+
fsType = "btrfs";
+
options = [ "subvol=@home" "noatime" ];
+
};
+
+
fileSystems."/var/log" = {
+
device = "/dev/disk/by-label/NIXROOT";
+
fsType = "btrfs";
+
options = [ "subvol=@log" "noatime" ];
+
};
+
+
fileSystems."/swap" = {
+
device = "/dev/disk/by-label/NIXROOT";
+
fsType = "btrfs";
+
options = [ "subvol=@swap" "noatime" ];
+
};
+
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/9B6C-1522";
+
fsType = "vfat";
+
options = [ "fmask=0022" "dmask=0022" ];
+
};
+
+
swapDevices = [
+
{
+
device = "/swap/swapfile";
+
size = 16 * 1024;
+
}
+
];
+
+
nixpkgs.overlays = [ inputs.apple-silicon.overlays.apple-silicon-overlay ];
+
+
hardware = {
+
enableAllFirmware = true;
+
graphics.enable = true;
+
bluetooth.enable = true;
+
wirelessRegulatoryDatabase = true;
+
asahi.useExperimentalGPUDriver = true;
+
};
+
+
services.udev.extraRules = ''
+
ACTION=="add|change", KERNEL=="nvme[0-9]*n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
+
'';
+
+
systemd.services = {
+
mount-pstore.enable = mkDefault false;
+
ModemManager.enable = mkDefault false;
+
};
+
}
+16
machines/sodacream/home.nix
···
+
{ ... }: {
+
modules = {
+
development = {
+
enable = true;
+
js.enable = true;
+
zig.enable = true;
+
terraform.enable = false;
+
react-native.enable = false;
+
};
+
apps = {
+
enable = true;
+
firefox.enable = true;
+
ghostty.enable = true;
+
};
+
};
+
}
-1
modules/apps/games.nix
···
hardware.steam-hardware.enable = true;
users.users."${user}".extraGroups = [ "gamemode" ];
-
services.system76-scheduler.enable = true;
environment.systemPackages = [
(pkgs.lutris.override {
+2 -1
modules/base/linux.nix
···
"quiet"
"splash"
"boot.shell_on_fail"
-
"rd.systemd.show_status=false"
+
"rd.systemd.show_status=auto"
"rd.udev.log_level=3"
+
"udev.log_priority=3"
"nmi_watchdog=0"
"mitigations=off"
];
+99
modules/desktop/affinity.nix
···
+
{ lib, config, pkgs, ... }:
+
+
with lib;
+
let
+
cfg = config.modules.desktop;
+
+
concat = concatMapStringsSep "," toString;
+
performance = concat cfg.affinity.performanceCores;
+
efficiency = concat cfg.affinity.efficiencyCores;
+
in {
+
options.modules.desktop.affinity = {
+
enable = mkOption {
+
default = cfg.enable;
+
example = true;
+
description = "Tweak CPU affinity into performance and efficiency core slices";
+
type = types.bool;
+
};
+
+
performanceCores = mkOption {
+
type = with types; listOf ints.unsigned;
+
default = [ ];
+
description = "List of performance CPUs";
+
};
+
+
efficiencyCores = mkOption {
+
type = with types; listOf ints.unsigned;
+
default = [ 0 1 2 3 ];
+
description = "List of efficiency CPUs";
+
};
+
+
isolateNixDaemon = mkOption {
+
default = cfg.affinity.enable;
+
type = types.bool;
+
};
+
};
+
+
config = mkIf cfg.affinity.enable {
+
boot.kernelParams = [ "rcu_nocbs=all" ]
+
++ optionals (efficiency != "") [ "irqaffinity=${efficiency}" ]
+
++ optionals (performance != "") [ "nohz_full=${performance}" ];
+
+
systemd = {
+
user.slices = {
+
background.sliceConfig = {
+
AllowedCPUs = efficiency;
+
Delegate = "cpuset";
+
CPUWeight = 80;
+
Nice = 6;
+
IOSchedulingClass = "idle";
+
};
+
session.sliceConfig = {
+
StartupAllowedCPUs = mkIf (performance != "") "${efficiency},${performance}";
+
AllowedCPUs = efficiency;
+
Delegate = "cpuset";
+
Nice = 9;
+
IOSchedulingClass = "idle";
+
};
+
app.sliceConfig = {
+
Nice = 0;
+
IOSchedulingClass = "best-effort";
+
IOSchedulingPriority = 0;
+
};
+
};
+
slices = {
+
system.sliceConfig = {
+
AllowedCPUs = efficiency;
+
Nice = 12;
+
IOSchedulingClass = "idle";
+
};
+
nix.sliceConfig = mkIf cfg.affinity.isolateNixDaemon {
+
CPUQuota = "80%";
+
ManagedOOMMemoryPressure = "kill";
+
ManagedOOMMemoryPressureLimit = "80%";
+
Nice = 9;
+
};
+
};
+
services = {
+
nix-daemon.serviceConfig = mkIf cfg.affinity.isolateNixDaemon {
+
Slice = "nix.slice";
+
OOMScoreAdjust = 950;
+
};
+
"user@" = {
+
overrideStrategy = "asDropin";
+
serviceConfig.Delegate = "cpuset";
+
};
+
};
+
};
+
+
powerManagement = {
+
powerDownCommands = "systemctl stop system76-scheduler";
+
resumeCommands = "systemctl start system76-scheduler";
+
};
+
+
assertions = singleton {
+
assertion = mutuallyExclusive cfg.affinity.performanceCores cfg.affinity.efficiencyCores;
+
message = "Performance and efficiency CPU cores must not overlap";
+
};
+
};
+
}
+1
modules/desktop/default.nix
···
imports = [
./services.nix
./session.nix
+
./affinity.nix
./fonts.nix
./rawaccel.nix
];
-1
modules/desktop/services.nix
···
services = {
hardware.bolt.enable = true;
printing.enable = true;
-
flatpak.enable = true;
colord.enable = true;
fwupd.enable = true;
+13 -1
modules/desktop/session.nix
···
};
config = mkIf cfg.session.enable {
-
boot.plymouth.enable = true;
+
boot = {
+
plymouth.enable = true;
+
initrd.verbose = mkDefault false;
+
consoleLogLevel = 0;
+
loader.timeout = 0;
+
kernelParams = [ "console=tty1" "vt.global_cursor_default=0" ];
+
};
services = {
desktopManager.plasma6.enable = true;
···
systemPackages = with pkgs.kdePackages; [
sddm-kcm
qtmultimedia
+
pkgs.apple-cursor
];
plasma6 = {
excludePackages = with pkgs.kdePackages; [
+
discover
ffmpegthumbs
plasma-browser-integration
kate
···
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
+
extraPortals = with pkgs; [
+
kdePackages.xdg-desktop-portal-kde
+
xdg-desktop-portal-gtk
+
];
};
};
}