hosts/installer builds an image (nix build .#installer-iso) carrying this flake as /etc/moonix, disko and a wrapper. The guest runs `moonix-install <host>`: disko formats per the host file, nixos-install installs, and the repository is cloned into the account own ~/flakes/moonix with /etc/nixos/flake.nix pointing at it. The image is built from the local tree, so a state does not have to be pushed to be installable. disko is patched to re-ask for the LUKS passphrase on a mismatch instead of killing the script: its `exit 1` sits inside a function called from the until loop that was meant to repeat the prompt.
153 lines
4.6 KiB
Nix
153 lines
4.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";
|
|
};
|
|
|
|
# Project sources. These repos are not flakes themselves, they are
|
|
# consumed as plain source trees pinned to a release tag.
|
|
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;
|
|
};
|
|
# Not packaged in nixpkgs.
|
|
stasis = {
|
|
url = "github:saltnpepper97/stasis/v1.4.1";
|
|
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";
|
|
};
|
|
|
|
stasis = pkgs.callPackage ./pkgs/stasis.nix {
|
|
src = inputs.stasis;
|
|
version = "1.4.1";
|
|
};
|
|
|
|
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
|
|
];
|
|
|
|
_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 ];
|
|
};
|
|
};
|
|
}
|