Two changes that cannot be separated in the result: the Firefox preconfiguration is what made desktop.nix untenable, and the split is what it now lives in. Firefox replaces LibreWolf, with Betterfox as its preference base and the settings that Betterfox does not cover expressed as policies: uBlock Origin, the Catppuccin theme, no Pocket, no Sync, autoscroll, DuckDuckGo, no translation offer, no password prompts, no bookmarks toolbar, about:blank as home and new tab. Both add-ons are normal_installed and the preferences keep status "default", so none of it is locked away — undoing settings by hand was the reason to leave LibreWolf. desktop.nix carried thirteen topics over 637 lines, and the existing split followed the NixOS option namespace rather than the topic: services.pipewire here, its configPackages there; services.gvfs and services.udisks2 apart from their packages; Bluetooth likewise. Nine modules now each hold one topic with its options, packages, configs and services together. desktop.nix keeps the compositor, the /etc deployment, portals and what belongs to no topic. The refactor changes nothing about the built system, and that was checked after each of the eight steps rather than assumed. The plain store path does not serve as the criterion: moving a package to another module reorders environment.systemPackages, which changes the system-path hash and propagates into every file naming it. What was compared instead is the package set through diff-closures and every differing file with store hashes normalised away. Two steps reordered the user tmpfiles list, which is neutral only because no two rules name the same path — checked, not presumed.
81 lines
2.9 KiB
Nix
81 lines
2.9 KiB
Nix
# ABOUTME: zsh as the interactive shell, sourcing moonarch's shared zshrc.
|
|
# ABOUTME: Carries the command line tools that zshrc and the helper scripts call.
|
|
|
|
{ pkgs, moonarchSrc, ... }:
|
|
|
|
let
|
|
xdg = "${moonarchSrc}/defaults/xdg";
|
|
|
|
# zsh/newuser runs its setup wizard on every interactive login for as long as
|
|
# the user has none of .zshenv, .zprofile, .zshrc or .zlogin — the whole
|
|
# configuration living in /etc/zshrc does not count. Seeded below to stop
|
|
# that, and deliberately without configuration: moonarch's own copy of this
|
|
# file sources the shared zshrc, which here would run it a second time, on
|
|
# top of the one /etc/zshrc already did.
|
|
userZshrc = pkgs.writeText "zshrc" ''
|
|
# The moonarch zsh configuration is system-wide, in /etc/zshrc.
|
|
#
|
|
# This file keeps zsh from running zsh-newuser-install and is the place for
|
|
# your own additions: zsh reads it after /etc/zshrc, so it wins over it.
|
|
'';
|
|
in
|
|
{
|
|
environment.etc."xdg/fastfetch/config.jsonc".source = "${xdg}/fastfetch/config.jsonc";
|
|
|
|
programs.zsh.enable = true;
|
|
|
|
# moonarch's shared zshrc, which it installs as /etc/zsh/zshrc.moonarch. zsh reads
|
|
# /etc/zshrc before ~/.zshrc, so a user file still wins over it.
|
|
programs.zsh.interactiveShellInit = ''
|
|
source ${moonarchSrc}/defaults/shell/zshrc
|
|
'';
|
|
|
|
# /etc/zshrc places promptInit after interactiveShellInit, and its default
|
|
# ends in `prompt suse`, which assigns PS1 — the same parameter as PROMPT.
|
|
# Left at the default it overwrites the prompt the sourced zshrc just set.
|
|
# The zshrc owns the prompt, so nothing else has to run here.
|
|
programs.zsh.promptInit = "";
|
|
|
|
# The zshrc sources both plugins from /usr/share/zsh/plugins; the lookups are
|
|
# guarded and silently find nothing here. These modules source the same
|
|
# plugins from the store instead, with the strategy the zshrc sets.
|
|
programs.zsh.syntaxHighlighting.enable = true;
|
|
programs.zsh.autosuggestions = {
|
|
enable = true;
|
|
strategy = [ "history" "completion" ];
|
|
};
|
|
|
|
# environment.shellAliases carries ls, ll and l as defaults, and /etc/zshrc
|
|
# renders them after interactiveShellInit, so they shadow the eza aliases of
|
|
# the sourced zshrc. null drops an alias. Scoped to zsh: bash keeps the
|
|
# coreutils ls, which is the only thing it has.
|
|
programs.zsh.shellAliases = {
|
|
ls = null;
|
|
ll = null;
|
|
l = null;
|
|
};
|
|
|
|
# CLI tools referenced by zshrc and the helper scripts
|
|
environment.systemPackages = with pkgs; [
|
|
bat
|
|
btop
|
|
eza
|
|
fastfetch
|
|
fd
|
|
fzf
|
|
jq
|
|
lazygit
|
|
ripgrep
|
|
neovim
|
|
git
|
|
];
|
|
|
|
# zsh/newuser runs its setup wizard on every interactive login for as long as
|
|
# the user has none of .zshenv, .zprofile, .zshrc or .zlogin, so the seed
|
|
# above has to reach the home directory. 'C' copies once and never
|
|
# overwrites, so user edits survive.
|
|
systemd.user.tmpfiles.rules = [
|
|
"C %h/.zshrc 0644 - - - ${userZshrc}"
|
|
];
|
|
}
|