- Add installer/fresh-install.sh for installing from live ISO - Handles disk partitioning, LUKS encryption, filesystem setup - Generates minimal NixOS config for first boot - Enable flakes in ISO environment - Pass installer script content to ISO build via specialArgs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
186 lines
4.6 KiB
Nix
186 lines
4.6 KiB
Nix
{
|
|
description = "Nomarchy - An opinionated NixOS configuration with Hyprland";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
hyprland.url = "github:hyprwm/Hyprland";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# Secrets management
|
|
agenix = {
|
|
url = "github:ryantm/agenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# Hardware quirks database
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
|
};
|
|
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
nixpkgs-stable,
|
|
hyprland,
|
|
home-manager,
|
|
agenix,
|
|
nixos-hardware,
|
|
...
|
|
} @ inputs: let
|
|
lib = nixpkgs.lib;
|
|
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
# Import helper functions
|
|
mkHost = import ./lib/mkHost.nix {inherit inputs lib;};
|
|
|
|
# Default configuration options
|
|
defaultConfig = {
|
|
username = "user";
|
|
hostname = "nomarchy";
|
|
timezone = "UTC";
|
|
locale = "en_US.UTF-8";
|
|
keyboardLayouts = ["us"];
|
|
keyboardVariants = [""];
|
|
|
|
# Features (opinionated defaults, user can disable)
|
|
enableSyncthing = true;
|
|
enableMullvad = false;
|
|
enablePrinting = true;
|
|
enableBluetooth = true;
|
|
|
|
# Performance (security-conscious defaults)
|
|
enableMitigationsOff = false; # Opt-in only
|
|
|
|
# Boot
|
|
bootloader = "systemd-boot"; # or "limine"
|
|
enablePlymouth = false; # Boot splash
|
|
|
|
# Theme
|
|
theme = "classical";
|
|
};
|
|
in {
|
|
# NixOS configurations
|
|
nixosConfigurations = {
|
|
# Example configuration with systemd-boot (default)
|
|
example = mkHost {
|
|
system = "x86_64-linux";
|
|
config = defaultConfig // {
|
|
hostname = "nomarchy";
|
|
};
|
|
extraModules = [
|
|
# Minimal test hardware config
|
|
({...}: {
|
|
fileSystems."/" = {
|
|
device = "/dev/disk/by-label/nixos";
|
|
fsType = "ext4";
|
|
};
|
|
})
|
|
];
|
|
};
|
|
|
|
# Example configuration with Limine bootloader
|
|
example-limine = mkHost {
|
|
system = "x86_64-linux";
|
|
config = defaultConfig // {
|
|
hostname = "nomarchy-limine";
|
|
bootloader = "limine";
|
|
enablePlymouth = true;
|
|
};
|
|
extraModules = [
|
|
({...}: {
|
|
fileSystems."/" = {
|
|
device = "/dev/disk/by-label/nixos";
|
|
fsType = "ext4";
|
|
};
|
|
})
|
|
];
|
|
};
|
|
|
|
# ISO installer configuration
|
|
installer = nixpkgs.lib.nixosSystem {
|
|
system = "x86_64-linux";
|
|
specialArgs = {
|
|
inherit inputs;
|
|
installerScriptContent = builtins.readFile ./installer/fresh-install.sh;
|
|
};
|
|
modules = [
|
|
./iso/default.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
# Flake apps
|
|
apps = forAllSystems (system: {
|
|
# Main installer app: nix run github:blu/nomarchy
|
|
default = {
|
|
type = "app";
|
|
program = "${self.packages.${system}.nomarchy-install}/bin/nomarchy-install";
|
|
};
|
|
|
|
# Interactive installer
|
|
install = {
|
|
type = "app";
|
|
program = "${self.packages.${system}.nomarchy-install}/bin/nomarchy-install";
|
|
};
|
|
});
|
|
|
|
# Packages
|
|
packages = forAllSystems (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in {
|
|
# Installer script
|
|
nomarchy-install = pkgs.writeShellScriptBin "nomarchy-install" (builtins.readFile ./installer/install.sh);
|
|
|
|
# ISO image
|
|
iso = self.nixosConfigurations.installer.config.system.build.isoImage;
|
|
|
|
default = self.packages.${system}.nomarchy-install;
|
|
});
|
|
|
|
# NixOS modules for users who want to import individual pieces
|
|
nixosModules = {
|
|
default = import ./modules;
|
|
hyprland = import ./modules/desktop/hyprland.nix;
|
|
theme = import ./themes/theme.nix;
|
|
performance = import ./modules/performance;
|
|
};
|
|
|
|
# Home-manager modules
|
|
homeManagerModules = {
|
|
default = import ./modules/home;
|
|
};
|
|
|
|
# Templates for users to bootstrap their own config
|
|
templates = {
|
|
default = {
|
|
path = ./templates/default;
|
|
description = "Basic nomarchy configuration";
|
|
};
|
|
};
|
|
|
|
# Export lib functions for users
|
|
lib = {
|
|
inherit mkHost;
|
|
};
|
|
|
|
# Development shell
|
|
devShells = forAllSystems (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in {
|
|
default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
nil # Nix LSP
|
|
alejandra # Nix formatter
|
|
nixpkgs-fmt
|
|
];
|
|
};
|
|
});
|
|
};
|
|
}
|