Files
Nomarchy/flake.nix
Bernardo Magri 39b1a9c1b3 style(hyprland): set default monitor to 'preferred' resolution
Updated the default Hyprland monitor configuration to 'monitor=,preferred,auto,1'. This ensures the best resolution is selected automatically while maintaining a 1x scale by default.
2026-05-01 17:00:57 +01:00

247 lines
8.8 KiB
Nix

{
description = "Nomarchy - A NixOS-based distribution with Omarchy flavour";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nixos-hardware.url = "github:NixOS/nixos-hardware";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence = {
url = "github:nix-community/impermanence";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# nix-colors is a pure data flake (base16 schemes) — it has no inputs,
# so any `inputs.X.follows` declaration here triggers a "non-existent
# input" warning. Just URL it.
nix-colors.url = "github:misterio77/nix-colors";
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
walker = {
url = "github:abenz1267/walker";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-hardware, disko, impermanence, home-manager, nix-colors, stylix, walker, ... } @ inputs: let
system = "x86_64-linux";
lib = nixpkgs.lib;
# Overlays — the function form lives here so both Nomarchy itself and
# any downstream flake (see `overlays.default` in the outputs) can layer
# the same Nomarchy packages onto their nixpkgs.
nomarchyOverlay = final: prev: {
makima-bin = prev.makima;
nomarchy-system-scripts = final.callPackage ./core/system/scripts-derivation.nix { };
};
overlays = [ nomarchyOverlay ];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
# Helper to create standalone home configurations
mkHome = { username, modules ? [] }: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
./features
{
home.username = username;
home.homeDirectory = "/home/${username}";
home.stateVersion = "25.11";
}
] ++ modules;
};
homeConfigs = {
"nixos" = mkHome { username = "nixos"; };
"nomarchy" = mkHome { username = "nomarchy"; };
};
# Realise the full HM generation for every palette so theme switches hit
# the Nix cache instead of rebuilding Stylix outputs per swap. Each entry
# pins `nomarchy.theme` (and clears the wallpaper override so the theme's
# own default background is used) and exposes the generation's activation
# package under its theme name.
palettes = import ./themes/palettes;
themeNames = builtins.attrNames palettes;
themeVariantFor = themeName: (mkHome {
username = "nomarchy";
modules = [{
nomarchy.theme = lib.mkForce themeName;
nomarchy.wallpaper = lib.mkForce "";
}];
}).activationPackage;
allThemeVariants = pkgs.linkFarm "nomarchy-all-theme-variants"
(map (name: { inherit name; path = themeVariantFor name; }) themeNames);
in {
# Expose inputs for downstream use
inherit inputs;
# Downstream flakes consume this to layer Nomarchy's packages onto their
# own nixpkgs. Used by the installer-generated flake so both the
# nixosSystem and the standalone homeManagerConfiguration share one
# `pkgs` with the overlay applied.
overlays.default = nomarchyOverlay;
nixosModules = {
system = import ./core;
home = import ./features;
};
nixosConfigurations = {
# Minimal TTY installer ISO (new golden path)
nomarchy-installer = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = overlays;
}
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
./hosts/nomarchy-installer.nix
{
system.stateVersion = "25.11";
networking.hostName = "nomarchy-installer";
}
];
};
# Installer VM for testing
installerVm = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = overlays;
}
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
./hosts/nomarchy-installer.nix
{
system.stateVersion = "25.11";
networking.hostName = "nomarchy-installer-vm";
virtualisation.vmVariant.virtualisation.memorySize = 4096;
virtualisation.vmVariant.virtualisation.cores = 2;
}
];
};
# Graphical installer ISO (legacy, for users who prefer GUI)
nomarchy-live = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = overlays;
}
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix"
home-manager.nixosModules.home-manager
./hosts/nomarchy-live.nix
./core
{
system.stateVersion = "25.11";
networking.hostName = "nomarchy-live";
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "nixos";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "hm-bak";
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.nixos = {
imports = [ ./features ];
home.stateVersion = "25.11";
# Live-ISO-only welcome. Pops a notification a few seconds
# after the graphical session is up and opens a terminal
# parked at the installer command, so the user never has to
# hunt for it. Force preferred monitor detection as some
# hardware defaults to 1024x768.
wayland.windowManager.hyprland.extraConfig = nixpkgs.lib.mkAfter ''
monitor = , preferred, auto, 1
exec-once = sh -c 'sleep 3; notify-send -u critical -t 0 "Welcome to Nomarchy" "Run \`sudo /etc/install.sh\` in the open terminal or \`--dry-run\` to preview."'
exec-once = sh -c 'sleep 4; alacritty --title "Nomarchy Installer" -e bash -lc "echo; echo \"Welcome to the Nomarchy live ISO.\"; echo; echo \" sudo /etc/install.sh # install\"; echo \" sudo /etc/install.sh --dry-run # preview only\"; echo \" sudo /etc/install.sh --resume # resume after an interrupt\"; echo; exec bash"'
'';
};
}
];
};
# Default configuration (VM and testing)
default = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
{
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = overlays;
}
home-manager.nixosModules.home-manager
./core/default.nix
./core/system/vm-guest.nix
{
system.stateVersion = "25.11";
networking.hostName = "nomarchy";
virtualisation.vmVariant.virtualisation.memorySize = 4096;
virtualisation.vmVariant.virtualisation.cores = 2;
# Setup default user for testing
users.users.nomarchy = {
isNormalUser = true;
extraGroups = [ "wheel" "video" "render" "networkmanager" ];
initialPassword = "nixos";
};
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "nomarchy";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "hm-bak";
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.nomarchy = {
imports = [ ./features ];
home.stateVersion = "25.11";
};
}
];
};
};
homeConfigurations = homeConfigs;
packages.${system} = {
# Pre-cache every theme's Home Manager generation so subsequent
# `nomarchy-theme-set` swaps are cache hits (no Stylix rebuild, no
# downloads). Run once after install:
# nix build /etc/nomarchy#allThemeVariants --no-link
inherit allThemeVariants;
default = allThemeVariants;
# Expose installer VM as a package
installerVm = self.nixosConfigurations.installerVm.config.system.build.vm;
};
apps.${system} = {
installerVm = {
type = "app";
program = "${self.packages.${system} .installerVm}/bin/run-nomarchy-installer-vm";
};
};
};
}