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.
172 lines
5.6 KiB
Nix
172 lines
5.6 KiB
Nix
# ABOUTME: Flake for running the Moonarch desktop on NixOS.
|
|
# ABOUTME: Pulls the Moonarch project repos as sources and builds them with Nix.
|
|
|
|
{
|
|
description = "NixOS configuration for a niri and Quickshell Wayland desktop";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
|
|
|
# Declarative partitioning. Consumed by modules/disk.nix.
|
|
disko = {
|
|
url = "github:nix-community/disko/latest";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# Firefox preference set, consumed by pkgs/betterfox.nix. Not in nixpkgs;
|
|
# carried as an input so `nix flake update` moves it and neither version
|
|
# nor hash have to be kept by hand.
|
|
betterfox = {
|
|
url = "github:yokoffing/Betterfox";
|
|
flake = false;
|
|
};
|
|
|
|
# Project sources. These repos are not flakes themselves, they are
|
|
# consumed as plain source trees following their default branch.
|
|
moonarch = {
|
|
url = "git+https://gitea.moonarch.de/nevaforget/moonarch.git";
|
|
flake = false;
|
|
};
|
|
sweet-cursors = {
|
|
url = "git+https://gitea.moonarch.de/nevaforget/Sweet-cursors.git";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, ... }@inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
moonarchPackages = {
|
|
betterfox = pkgs.callPackage ./pkgs/betterfox.nix {
|
|
src = inputs.betterfox;
|
|
version = "154.0-unstable";
|
|
};
|
|
|
|
sweet-cursors = pkgs.callPackage ./pkgs/sweet-cursors.nix {
|
|
src = inputs.sweet-cursors;
|
|
version = "0-unstable";
|
|
};
|
|
|
|
moonarch-scripts = pkgs.callPackage ./pkgs/moonarch-scripts.nix {
|
|
src = inputs.moonarch;
|
|
};
|
|
};
|
|
|
|
# disko kills the whole format script when the two passphrase entries
|
|
# differ: `exit 1` sits inside a function called from the `until` loop
|
|
# that was meant to repeat the prompt
|
|
# (share/disko/lib/types/luks.nix:151). A typo therefore means starting
|
|
# the install over. One word changes that.
|
|
diskoRetryingPassphrase = inputs.disko.packages.${system}.disko.overrideAttrs (old: {
|
|
postFixup = (old.postFixup or "") + ''
|
|
substituteInPlace $out/share/disko/lib/types/luks.nix \
|
|
--replace-fail 'exit 1' 'return 1'
|
|
'';
|
|
});
|
|
|
|
# Theme overrides, used by the desktop session and by the greeter.
|
|
# Defined once so the two cannot drift apart.
|
|
themePackages = {
|
|
# catppuccin/gtk is Colloid: it pulls vinceliuice's theme in as a git
|
|
# submodule and only recolors it, so the widget shapes are the same
|
|
# either way. Colloid's own `catppuccin` tweak produces Frappe with a
|
|
# grey accent (base #292c3c, selection #ccd0da) — which left GTK as the
|
|
# one layer not on Mocha, while Kvantum and Zed both are. This build is
|
|
# Mocha with the lavender accent, so #b4befe, #f38ba8 and #f9e2af match
|
|
# catppuccin-mocha-lavender in Kvantum exactly — and gtklock, being
|
|
# GTK3, takes its whole palette from here.
|
|
gtk = pkgs.catppuccin-gtk.override {
|
|
variant = "mocha";
|
|
accents = [ "lavender" ];
|
|
};
|
|
|
|
icons = pkgs.colloid-icon-theme.override {
|
|
schemeVariants = [ "catppuccin" ];
|
|
colorVariants = [ "grey" ];
|
|
};
|
|
};
|
|
in
|
|
{
|
|
packages.${system} = moonarchPackages // {
|
|
# Installer image: `nix build .#installer-iso`.
|
|
installer-iso = self.nixosConfigurations.installer.config.system.build.isoImage;
|
|
};
|
|
|
|
# Makes the packages and the moonarch source tree available to every
|
|
# module without threading arguments through by hand.
|
|
nixosModules.moonarch = { ... }: {
|
|
imports = [
|
|
inputs.disko.nixosModules.disko
|
|
./modules/user.nix
|
|
./modules/disk.nix
|
|
./modules/desktop.nix
|
|
./modules/browsers.nix
|
|
./modules/printing.nix
|
|
./modules/lock.nix
|
|
./modules/shell.nix
|
|
./modules/theme.nix
|
|
./modules/audio.nix
|
|
./modules/files.nix
|
|
./modules/network.nix
|
|
./modules/greetd.nix
|
|
./modules/services.nix
|
|
./modules/zed.nix
|
|
];
|
|
|
|
_module.args = {
|
|
moonarchSrc = inputs.moonarch;
|
|
moonarchPkgs = moonarchPackages;
|
|
moonarchThemes = themePackages;
|
|
};
|
|
};
|
|
|
|
nixosConfigurations = {
|
|
# Installer image. Carries this flake and disko, so installing needs
|
|
# neither a clone nor the Gitea reference.
|
|
installer = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [ ./hosts/installer ];
|
|
specialArgs = {
|
|
moonixSrc = self;
|
|
disko = diskoRetryingPassphrase;
|
|
};
|
|
};
|
|
|
|
# QEMU/KVM test VM.
|
|
testvm = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
./hosts/testvm
|
|
self.nixosModules.moonarch
|
|
];
|
|
};
|
|
|
|
# Desktop: 512G system disk, 1T disk for /home.
|
|
desktop = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
./hosts/desktop
|
|
self.nixosModules.moonarch
|
|
];
|
|
};
|
|
|
|
# ThinkPad T14 Gen 3 (AMD Ryzen 7 PRO 6850U).
|
|
thinkpad = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen3
|
|
./hosts/thinkpad
|
|
self.nixosModules.moonarch
|
|
];
|
|
};
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
packages = with pkgs; [ nixpkgs-fmt ];
|
|
};
|
|
};
|
|
}
|