Files
Nomarchy/flake.nix
Bernardo Magri 04512eabcd fix: include modifications missed by 528447c
Previous commit only picked up the new files (branding.nix, hardware-db.sh).
This adds the matching wires:

- core/system/default.nix: import branding.nix
- flake.nix: expose overlays.default = nomarchyOverlay for downstream flakes
- installer/disko-golden.nix: 1 GiB /boot, @snapshots subvolume, LUKS key
  via /dev/shm
- installer/install.sh: hardware auto-detect, hostname prompt, pinned
  nomarchy commit, shared pkgs in generated flake, flake.lock generation,
  post-install home-manager switch via nixos-enter

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-25 10:07:17 +01:00

205 lines
6.7 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 = {
url = "github:misterio77/nix-colors";
inputs.nixpkgs.follows = "nixpkgs";
};
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)
installerIso = 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/installer-iso.nix
{
system.stateVersion = "25.11";
networking.hostName = "nomarchy-installer";
}
];
};
# Graphical installer ISO (legacy, for users who prefer GUI)
installerIsoGraphical = 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/live-iso.nix
./core
{
system.stateVersion = "25.11";
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";
};
}
];
};
# 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;
};
};
}