Files
moonix/flake.nix
T
nevaforget 8c8f9b3c2e chore: fix what a pass over the tree turned up
- zed asked for Hack Nerd Font, which is not installed; the fonts here are
  UbuntuSans and UbuntuSansMono, so it had been rendering in a fallback.
- /etc/mpv/mpv.conf was deployed for a player that is not installed; vlc is.
- The /etc/stasis/stasis.rune entry is unreachable now that the config is
  seeded into the home directory, which stasis prefers.
- Comments referring to Arch now name moonarch, the repository they actually
  describe.
- The project inputs follow their default branch, not a release tag.
2026-08-31 12:43:10 +02:00

144 lines
4.4 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";
};
# 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 = {
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'
'';
});
# Colloid overrides, used by the desktop session and by the greeter.
# Defined once so the two cannot drift apart.
themePackages = {
gtk = pkgs.colloid-gtk-theme.override {
themeVariants = [ "grey" ];
colorVariants = [ "dark" ];
tweaks = [ "catppuccin" ];
};
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/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 ];
};
};
}