feat: initial m3ta-home structure
- flake.nix with nixpkgs, home-manager, nix-colors, m3ta-nixpkgs, agenix, NUR inputs
- lib/mkHome.nix: compose HM config from user + identity + context + sets
- profiles/base: shell, cli-tools, secrets (always loaded)
- profiles/contexts/desktop: WM, apps, theme, ghostty
- profiles/contexts/server: minimal headless
- profiles/sets/coding: core (git, direnv, jq, rg), editor, lsp, languages, agents
- profiles/sets/gaming: steam, gamescope, gpu
- profiles/sets/media: obs, ffmpeg, kdenlive, handbrake, yt-dlp
- users/m3tam3re/identities: private.nix, work.nix (git, jj, ssh per identity)
- users/m3tam3re/preferences: cliphist, difftastic, base packages
2026-05-02 09:08:40 +02:00
|
|
|
# lib/mkHome.nix — Compose a complete home-manager configuration.
|
|
|
|
|
#
|
|
|
|
|
# This is the central function that replaces the old mkHomeConfig from nixos-config.
|
|
|
|
|
# It assembles imports based on three dimensions:
|
|
|
|
|
#
|
|
|
|
|
# WHO you are → user + identity (preferences + git/ssh/jj config)
|
|
|
|
|
# WHAT you do → context (desktop|server) + sets (coding, gaming, media)
|
|
|
|
|
# WHERE you are → host (handled by nixos-config, only overrides here)
|
|
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
|
# imports = [ (m3ta-lib.mkHome {
|
|
|
|
|
# user = "m3tam3re";
|
|
|
|
|
# identity = "private"; # or "work"
|
|
|
|
|
# context = "desktop"; # or "server"
|
|
|
|
|
# sets = [ "coding" "gaming" "media" ];
|
|
|
|
|
# }) ];
|
|
|
|
|
#
|
|
|
|
|
# Then override host-specific settings in the consuming module:
|
|
|
|
|
# m3ta.home.sets.coding.languages.python.extra = true;
|
|
|
|
|
# wayland.windowManager.hyprland.settings.monitor = [ ... ];
|
|
|
|
|
#
|
2026-05-02 09:56:45 +02:00
|
|
|
{inputs}: let
|
|
|
|
|
lib = inputs.nixpkgs.lib;
|
feat: initial m3ta-home structure
- flake.nix with nixpkgs, home-manager, nix-colors, m3ta-nixpkgs, agenix, NUR inputs
- lib/mkHome.nix: compose HM config from user + identity + context + sets
- profiles/base: shell, cli-tools, secrets (always loaded)
- profiles/contexts/desktop: WM, apps, theme, ghostty
- profiles/contexts/server: minimal headless
- profiles/sets/coding: core (git, direnv, jq, rg), editor, lsp, languages, agents
- profiles/sets/gaming: steam, gamescope, gpu
- profiles/sets/media: obs, ffmpeg, kdenlive, handbrake, yt-dlp
- users/m3tam3re/identities: private.nix, work.nix (git, jj, ssh per identity)
- users/m3tam3re/preferences: cliphist, difftastic, base packages
2026-05-02 09:08:40 +02:00
|
|
|
in {
|
|
|
|
|
mkHome = {
|
|
|
|
|
user ? "m3tam3re",
|
|
|
|
|
identity ? "private",
|
|
|
|
|
context ? null,
|
|
|
|
|
sets ? [],
|
|
|
|
|
}: let
|
2026-05-02 09:56:45 +02:00
|
|
|
# --- Module path helpers ---
|
|
|
|
|
profilePath = ../profiles;
|
|
|
|
|
userPath = ../users;
|
|
|
|
|
|
|
|
|
|
# Always loaded — CLI tools, shell, secrets, overlays
|
|
|
|
|
baseModule = "${profilePath}/base";
|
|
|
|
|
|
|
|
|
|
# Context modules — mutually exclusive (desktop or server)
|
|
|
|
|
contextModuleMap = {
|
|
|
|
|
desktop = "${profilePath}/contexts/desktop";
|
|
|
|
|
server = "${profilePath}/contexts/server";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Feature sets — freely combinable, some have context guards
|
|
|
|
|
setModuleMap = {
|
|
|
|
|
coding = "${profilePath}/sets/coding";
|
|
|
|
|
gaming = "${profilePath}/sets/gaming";
|
|
|
|
|
media = "${profilePath}/sets/media";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Sets that require desktop context
|
|
|
|
|
desktopOnlySets = ["gaming" "media"];
|
|
|
|
|
|
feat: initial m3ta-home structure
- flake.nix with nixpkgs, home-manager, nix-colors, m3ta-nixpkgs, agenix, NUR inputs
- lib/mkHome.nix: compose HM config from user + identity + context + sets
- profiles/base: shell, cli-tools, secrets (always loaded)
- profiles/contexts/desktop: WM, apps, theme, ghostty
- profiles/contexts/server: minimal headless
- profiles/sets/coding: core (git, direnv, jq, rg), editor, lsp, languages, agents
- profiles/sets/gaming: steam, gamescope, gpu
- profiles/sets/media: obs, ffmpeg, kdenlive, handbrake, yt-dlp
- users/m3tam3re/identities: private.nix, work.nix (git, jj, ssh per identity)
- users/m3tam3re/preferences: cliphist, difftastic, base packages
2026-05-02 09:08:40 +02:00
|
|
|
# User preferences — always loaded (shell style, editor config, etc.)
|
|
|
|
|
preferencesPath = "${userPath}/${user}/preferences";
|
|
|
|
|
|
|
|
|
|
# Identity — git name/email, SSH match blocks, jj config
|
|
|
|
|
identityPath = "${userPath}/${user}/identities/${identity}.nix";
|
|
|
|
|
|
|
|
|
|
# Resolve context module
|
|
|
|
|
contextImport =
|
|
|
|
|
if context == null
|
|
|
|
|
then []
|
|
|
|
|
else if builtins.hasAttr context contextModuleMap
|
|
|
|
|
then [contextModuleMap.${context}]
|
|
|
|
|
else throw "m3ta-home: unknown context '${context}'. Valid: desktop, server";
|
|
|
|
|
|
|
|
|
|
# Resolve set modules
|
|
|
|
|
setImports =
|
|
|
|
|
map
|
|
|
|
|
(s:
|
|
|
|
|
if builtins.hasAttr s setModuleMap
|
|
|
|
|
then setModuleMap.${s}
|
|
|
|
|
else throw "m3ta-home: unknown set '${s}'. Valid: ${lib.concatStringsSep ", " (builtins.attrNames setModuleMap)}")
|
|
|
|
|
sets;
|
|
|
|
|
|
|
|
|
|
# Validation: desktop-only sets
|
|
|
|
|
usedDesktopOnlySets =
|
|
|
|
|
builtins.filter (s: builtins.elem s desktopOnlySets) sets;
|
|
|
|
|
in {
|
|
|
|
|
imports =
|
|
|
|
|
[
|
|
|
|
|
baseModule
|
|
|
|
|
preferencesPath
|
|
|
|
|
identityPath
|
|
|
|
|
]
|
|
|
|
|
++ contextImport
|
|
|
|
|
++ setImports;
|
|
|
|
|
|
|
|
|
|
assertions =
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
assertion = builtins.elem context ["desktop" "server" null];
|
|
|
|
|
message = "m3ta-home: context must be 'desktop', 'server', or null (got: '${toString context}')";
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
++ map (s: {
|
|
|
|
|
assertion = context == "desktop";
|
|
|
|
|
message = "m3ta-home: set '${s}' requires context = 'desktop'";
|
|
|
|
|
})
|
|
|
|
|
usedDesktopOnlySets;
|
|
|
|
|
};
|
|
|
|
|
}
|