Switch to the dendritic flake-parts layout, with stubs for phase 2
flake.nix now only declares inputs and calls flake-parts with import-tree
over ./modules: every .nix file under modules/ is a flake-parts module.
Features are aspects (flake.modules.nixos.<name> and
flake.modules.homeManager.<name>); importing an aspect enables it, so the
my.* option modules and their enable flags are gone.
- Add the flake-parts glue: modules/flake/ (systems, shared meta data,
host construction through configurations.nixos, overlays, packages,
apps, dev shell, formatter, checks), modules/users/faumaray.nix
(meta.owner) and modules/core/{nixpkgs,home-manager,install-facts}.nix.
config.my is kept as one read-only derived option so install-system
keeps working unchanged.
- Add the aspects that are already final: secrets, ssh, hyprland,
wezterm, git, stylix, proxy-suite, gitea-runner and claude-code, and
the desktop host (modules/hosts/desktop/{host,hardware,disks}.nix).
- Port the always-on basics to the `core` aspect (nix, boot, locale,
networking, users), lanzaboote and plain systemd-boot to the
`secure-boot` and `systemd-boot` aspects, and the installer ISO to
modules/installer/iso.nix. Behaviour is unchanged; the time zone,
default locale, XKB layouts and the firewall setting now live in
modules/hosts/desktop/host.nix.
- Move the Lua files (Hyprland settings, binds, rules; Neovim init.lua)
with git mv, byte-identical.
- Add bare stubs, marked STUB, for the aspects that the next phase
ports: amd, rocm, gaming, vpn, docker, noctalia, audio, fonts, xdg,
apps, shell and neovim. The host evaluates with them, but those
features are not configured until they are ported.
- Remove lib/, overlays/, apps/, modules/nixos/, modules/home/,
modules/installer/default.nix and hosts/desktop/{default,disks,home}.nix.
- flake.lock: add flake-parts, import-tree, stylix and serena with their
transitive inputs (22 new nodes); every existing pin is unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
This commit is contained in:
84 files changed
+2121
-1928
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# Boot basics every host shares: EFI variable access, systemd in the initrd and
|
||||
# the latest kernel. The boot loader itself is an aspect of its own: the host
|
||||
# imports `secure-boot` (lanzaboote) or `systemd-boot`.
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
initrd.systemd.enable = true;
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# home-manager as a NixOS module. Aspects add their home-manager half to the
|
||||
# owner (`home-manager.users.<owner>.imports`), so every home-manager module
|
||||
# also receives `osConfig` (the NixOS configuration) and `inputs`.
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.core = {
|
||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
backupFileExtension = "hm-backup";
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Read-only facts for pkgs/install-system/install-system.sh, which evaluates
|
||||
# `nixosConfigurations.<host>.config.my` and reads user.name, user.uid,
|
||||
# boot.secureBoot.enable and secrets.enable. Everything here is derived from
|
||||
# the real configuration; no aspect may read `config.my`.
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{ config, ... }:
|
||||
{
|
||||
options.my = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
readOnly = true;
|
||||
internal = true;
|
||||
description = "Facts for install-system (derived; do not set, do not read in aspects).";
|
||||
};
|
||||
|
||||
config.my = {
|
||||
user = {
|
||||
inherit (owner) name;
|
||||
inherit (config.users.users.${owner.name}) uid;
|
||||
};
|
||||
# Only the secure-boot aspect imports lanzaboote.
|
||||
boot.secureBoot.enable = config.boot.lanzaboote.enable or false;
|
||||
secrets.enable = config.age.secrets != { };
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# The parts of the locale setup that do not depend on the machine. The host
|
||||
# sets the time zone, the default locale and the XKB layouts
|
||||
# (modules/hosts/<name>/host.nix); the console follows those layouts, and so
|
||||
# does Hyprland (modules/desktop/hyprland, through osConfig).
|
||||
{
|
||||
flake.modules.nixos.core = {
|
||||
# Russian stays available for apps and games even with an English UI.
|
||||
i18n.extraLocales = [ "ru_RU.UTF-8/UTF-8" ];
|
||||
|
||||
# TTY and initrd keymap follow the XKB layout set by the host.
|
||||
console.useXkbConfig = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# NetworkManager with the OpenVPN plugin. The owner joins the `networkmanager`
|
||||
# group in users.nix. Whether a firewall runs is the host's decision
|
||||
# (modules/hosts/<name>/host.nix).
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
plugins = [ pkgs.networkmanager-openvpn ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
# Nix daemon settings, binary caches, garbage collection and flake registry.
|
||||
{ config, inputs, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.core = {
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
auto-optimise-store = true;
|
||||
# root is already trusted by default; this adds the admin group.
|
||||
trusted-users = [ "@wheel" ];
|
||||
warn-dirty = false;
|
||||
# Same caches as flake.nixConfig, so the system keeps using them after
|
||||
# install without the "untrusted flake settings" prompt.
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://noctalia.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
|
||||
];
|
||||
};
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
|
||||
# `nix shell nixpkgs#foo` and <nixpkgs> use the exact nixpkgs of this flake
|
||||
# instead of fetching a different revision.
|
||||
channel.enable = false;
|
||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||
};
|
||||
|
||||
programs = {
|
||||
# Nicer `nixos-rebuild` front-end that knows where the flake lives.
|
||||
nh = {
|
||||
enable = true;
|
||||
flake = "/home/${owner.name}/nixos-config";
|
||||
};
|
||||
|
||||
# Lets prebuilt binaries (editors' language servers, game launchers) run.
|
||||
nix-ld.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Every host uses this flake's overlay and allows unfree packages (Steam,
|
||||
# TeamSpeak, Claude Code). home-manager shares this package set
|
||||
# (useGlobalPkgs, modules/core/home-manager.nix).
|
||||
{ config, ... }:
|
||||
let
|
||||
overlay = config.flake.overlays.default;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.core = {
|
||||
nixpkgs = {
|
||||
overlays = [ overlay ];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
# The owner's account (meta.owner, modules/users/faumaray.nix): the only
|
||||
# interactive user. The `docker` and `gamemode` groups are added by the docker
|
||||
# and gaming aspects.
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
|
||||
passwordSecret = "${owner.name}-password";
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hasPasswordSecret = config.age.secrets ? ${passwordSecret};
|
||||
in
|
||||
{
|
||||
users.mutableUsers = true;
|
||||
|
||||
users.users.${owner.name} = {
|
||||
isNormalUser = true;
|
||||
inherit (owner) uid;
|
||||
description = owner.fullName;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"video"
|
||||
"audio"
|
||||
"input"
|
||||
"render"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keys = owner.sshAuthorizedKeys;
|
||||
|
||||
# Real password comes from agenix; otherwise a throwaway one so the first
|
||||
# boot can never lock the user out.
|
||||
hashedPasswordFile = lib.mkIf hasPasswordSecret config.age.secrets.${passwordSecret}.path;
|
||||
initialPassword = lib.mkIf (!hasPasswordSecret) "changeme";
|
||||
};
|
||||
|
||||
# Required by `shell = pkgs.zsh` (puts zsh into /etc/shells).
|
||||
programs.zsh.enable = true;
|
||||
|
||||
security.sudo.wheelNeedsPassword = true;
|
||||
|
||||
warnings = lib.optional (!hasPasswordSecret) ''
|
||||
User "${owner.name}" has the temporary password "changeme". Run `passwd` after
|
||||
the first login, or add secrets/${passwordSecret}.age (hashed with
|
||||
`mkpasswd -m yescrypt`, encrypted with agenix) and `git add` it.
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user