Initial commit: Nomarchy NixOS configuration
An opinionated NixOS configuration with Hyprland, featuring: - Modular flake-based architecture - Parameterized user configuration (username, timezone, locale, etc.) - Classical/antiquity theme with Thomas Cole wallpapers - Full Hyprland setup with waybar, rofi, swaync - Custom utility scripts (screenshots, screen recording, WiFi QR) - Neovim with LSP support - Interactive installer for existing NixOS systems - ISO builder for fresh installations Flake outputs: - nixosConfigurations.example - Test configuration - nixosConfigurations.installer - ISO installer - packages.iso - Bootable ISO image - apps.default - Interactive installer - lib.mkHost - Host builder function - templates.default - Starter template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
162
flake.nix
Normal file
162
flake.nix
Normal file
@@ -0,0 +1,162 @@
|
||||
{
|
||||
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
|
||||
|
||||
# Theme
|
||||
theme = "classical";
|
||||
};
|
||||
in {
|
||||
# NixOS configurations
|
||||
nixosConfigurations = {
|
||||
# Example configuration (requires hardware-configuration.nix)
|
||||
# Users create their own configuration via the installer
|
||||
example = mkHost {
|
||||
system = "x86_64-linux";
|
||||
config = defaultConfig // {
|
||||
hostname = "nomarchy";
|
||||
};
|
||||
extraModules = [
|
||||
# Minimal test hardware config
|
||||
({...}: {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
# ISO installer configuration
|
||||
installer = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {inherit inputs;};
|
||||
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
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user