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,107 @@
|
||||
# Claude Code (pkgs.claude-code, unfree) for the owner, through home-manager's
|
||||
# programs.claude-code, with:
|
||||
# codememory MCP server: codebase-memory-mcp (DeusData), code knowledge graph (nixpkgs)
|
||||
# serena MCP server: semantic code retrieval and editing (inputs.serena)
|
||||
# rea MCP server and skill: Reverse Engineer Anything (npm rea-agents)
|
||||
# caveman plugin: skills, commands, agents and hooks (JuliusBrussee/caveman)
|
||||
# Everything is user scope (~/.claude). A repository's own .claude/settings.json
|
||||
# still applies on top of it; nothing here sets a model, effort, permissions or
|
||||
# hooks. MCP servers land in home-manager's generated plugin, so their tools
|
||||
# are named mcp__plugin_hm_<server>__<tool>.
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.homeManager.claude-code =
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
serena = inputs.serena.packages.${pkgs.stdenv.hostPlatform.system}.serena;
|
||||
|
||||
# REA has no Nix package: the MCP server runs from npm through npx
|
||||
# (pinned version, fetched on first start: not hermetic). Its skill comes
|
||||
# from the same npm release. Knobs: reaVersion and the hash below.
|
||||
reaVersion = "6.4.0";
|
||||
reaPackage = pkgs.fetchzip {
|
||||
url = "https://registry.npmjs.org/rea-agents/-/rea-agents-${reaVersion}.tgz";
|
||||
hash = "sha256-aJTYn9CZchdwJLBMn9no4C2EGBO6XemsH3J0GU1DqWM=";
|
||||
};
|
||||
# `rea` on PATH and as the MCP command; npx needs node for the package's
|
||||
# own `#!/usr/bin/env node` scripts.
|
||||
rea = pkgs.writeShellApplication {
|
||||
name = "rea";
|
||||
runtimeInputs = [ pkgs.nodejs ];
|
||||
text = ''exec npx --yes "rea-agents@${reaVersion}" "$@"'';
|
||||
};
|
||||
|
||||
# Knobs: tag and hash.
|
||||
caveman = pkgs.fetchFromGitHub {
|
||||
owner = "JuliusBrussee";
|
||||
repo = "caveman";
|
||||
tag = "v3.2.0";
|
||||
hash = "sha256-GfC8e+EGL7kotZQfZ9kD7ZEWJfhmXujHOHpMxeU3bEo=";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.claude-code = {
|
||||
enable = true;
|
||||
|
||||
# Claude Code also writes ~/.claude/settings.json itself; merge the
|
||||
# declared keys into a writable file on every switch instead of
|
||||
# replacing it with a read-only link.
|
||||
mutableSettings = true;
|
||||
|
||||
# Serena (Python) can take longer than the default MCP start timeout.
|
||||
settings.env.MCP_TIMEOUT = "60000";
|
||||
|
||||
mcpServers = {
|
||||
# To use another code-memory server, replace this one entry.
|
||||
codememory = {
|
||||
command = lib.getExe pkgs.codebase-memory-mcp;
|
||||
args = [ ];
|
||||
};
|
||||
serena = {
|
||||
command = lib.getExe serena;
|
||||
args = [
|
||||
"start-mcp-server"
|
||||
"--context"
|
||||
"claude-code"
|
||||
"--project-from-cwd"
|
||||
"--open-web-dashboard"
|
||||
"false"
|
||||
];
|
||||
};
|
||||
rea = {
|
||||
command = lib.getExe rea;
|
||||
args = [ "mcp" ];
|
||||
};
|
||||
};
|
||||
|
||||
skills.reverse-engineer-anything = "${reaPackage}/skills/reverse-engineer-anything";
|
||||
|
||||
# Loaded as a personal plugin (Claude Code >= 2.1.157).
|
||||
plugins.caveman = caveman;
|
||||
};
|
||||
|
||||
# The CLIs themselves; caveman's hooks need `node` on PATH (they exit
|
||||
# silently without it).
|
||||
home.packages = [
|
||||
pkgs.codebase-memory-mcp
|
||||
serena
|
||||
rea
|
||||
pkgs.nodejs
|
||||
];
|
||||
|
||||
# caveman switches every new session into its terse style unless its
|
||||
# default mode says otherwise. Start with it off (turn it on per session
|
||||
# with /caveman), so agents in repositories like this one keep their
|
||||
# normal reports. Written once; caveman may change it later.
|
||||
home.activation.cavemanDefaultMode = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -e "$HOME/.config/caveman/config.json" ]; then
|
||||
run mkdir -p "$HOME/.config/caveman"
|
||||
run sh -c 'echo "{\"defaultMode\": \"off\"}" > "$HOME/.config/caveman/config.json"'
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Secure Boot through lanzaboote. Keys live in /var/lib/sbctl (create them with
|
||||
# `sbctl create-keys` before the first boot). A host that does not want Secure
|
||||
# Boot imports the `systemd-boot` aspect instead; import only one of the two.
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.secure-boot =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
|
||||
|
||||
boot = {
|
||||
lanzaboote = {
|
||||
enable = true;
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
configurationLimit = 10;
|
||||
};
|
||||
# lanzaboote installs the boot entries itself.
|
||||
loader.systemd-boot.enable = lib.mkForce false;
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.sbctl ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# Plain systemd-boot, the alternative to the `secure-boot` aspect (lanzaboote):
|
||||
# a host imports one of the two.
|
||||
{
|
||||
flake.modules.nixos.systemd-boot = {
|
||||
boot.loader.systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 10;
|
||||
editor = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,27 +1,19 @@
|
||||
# Git identity and defaults. The name and email come from my.user so the
|
||||
# identity is defined once, in the host file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
# Git identity and defaults. The identity is the owner's (meta.owner), defined
|
||||
# once in modules/users/faumaray.nix.
|
||||
{ config, ... }:
|
||||
let
|
||||
cfg = config.my.home.git;
|
||||
inherit (config.meta) owner;
|
||||
in
|
||||
{
|
||||
options.my.home.git.enable = lib.mkEnableOption "Git and GitHub CLI configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
flake.modules.homeManager.git = {
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
user = {
|
||||
name = osConfig.my.user.fullName;
|
||||
inherit (osConfig.my.user) email;
|
||||
name = owner.fullName;
|
||||
inherit (owner) email;
|
||||
};
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T3): replaced in phase 2
|
||||
{
|
||||
flake.modules.homeManager.neovim = { };
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,4 @@
|
||||
# STUB (T3): replaced in phase 2
|
||||
{
|
||||
flake.modules.homeManager.shell = { };
|
||||
}
|
||||
@@ -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.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T1): replaced in phase 2
|
||||
{
|
||||
flake.modules.homeManager.apps = { };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T1): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.audio = { };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T1): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.fonts = { };
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,135 @@
|
||||
# Hyprland desktop, both halves of one feature:
|
||||
# NixOS UWSM-managed compositor, SDDM with autologin of the owner,
|
||||
# portals, keyring and the small services a desktop needs.
|
||||
# home-manager the user configuration. Hyprland reads Lua: the real config
|
||||
# is in the .lua files next to this file; Nix only passes in the
|
||||
# values that come from elsewhere (`require("nixvars")`).
|
||||
# The NixOS half adds the home-manager half to the owner, so a host imports
|
||||
# `nixos.hyprland` once. Noctalia, audio and fonts are separate aspects.
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
hmHyprland = config.flake.modules.homeManager.hyprland;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.hyprland =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${owner.name}.imports = [ hmHyprland ];
|
||||
|
||||
# package/portalPackage stay default: the overlay swaps in the flake builds.
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
settings.Autologin = {
|
||||
Session = "hyprland.desktop";
|
||||
User = owner.name;
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.extraPortals = [
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
pkgs.xdg-desktop-portal-hyprland
|
||||
];
|
||||
|
||||
security.polkit.enable = true;
|
||||
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# Electron/Chromium apps use native Wayland.
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
# Removable drives and trash/mounts in the file manager.
|
||||
services.udisks2.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wl-clipboard
|
||||
cliphist
|
||||
grim
|
||||
slurp
|
||||
brightnessctl
|
||||
playerctl
|
||||
pavucontrol
|
||||
kdePackages.dolphin
|
||||
kdePackages.dolphin-plugins
|
||||
hyprpicker
|
||||
];
|
||||
};
|
||||
|
||||
flake.modules.homeManager.hyprland =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cursor = config.home.pointerCursor;
|
||||
|
||||
# Exposed to the Lua files as `require("nixvars")`. Keyboard layouts come
|
||||
# from the NixOS configuration (services.xserver.xkb, set by the host),
|
||||
# the cursor from home-manager (set by Stylix, theme/stylix.nix).
|
||||
nixVars = {
|
||||
kbLayout = osConfig.services.xserver.xkb.layout;
|
||||
kbOptions = osConfig.services.xserver.xkb.options;
|
||||
terminal = "wezterm";
|
||||
fileManager = "dolphin";
|
||||
cursorSize = if cursor.enable then cursor.size else 24;
|
||||
cursorTheme = if cursor.enable then cursor.name else "";
|
||||
};
|
||||
in
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
configType = "lua";
|
||||
|
||||
# The NixOS half (programs.hyprland) installs the compositor and the
|
||||
# portal, built from the flake overlay. Installing them again here would
|
||||
# put a second copy in the user profile.
|
||||
package = null;
|
||||
portalPackage = null;
|
||||
|
||||
# UWSM owns the session and graphical-session.target; HM's own
|
||||
# hyprland-session.target and dbus import would only duplicate that.
|
||||
systemd.enable = false;
|
||||
xwayland.enable = true;
|
||||
|
||||
# Loaded in name order; `nixvars` is a helper module, not loaded on its
|
||||
# own. Stylix's colours are rendered after these files (hl.config in
|
||||
# hyprland.lua), so they override the colours in settings.lua.
|
||||
extraLuaFiles = {
|
||||
nixvars = {
|
||||
content = "return ${lib.generators.toLua { } nixVars}\n";
|
||||
autoLoad = false;
|
||||
};
|
||||
"10-settings" = ./settings.lua;
|
||||
"20-binds" = ./binds.lua;
|
||||
"30-rules" = ./rules.lua;
|
||||
};
|
||||
};
|
||||
|
||||
# Tools the binds call (screenshots, file manager).
|
||||
home.packages = with pkgs; [
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
kdePackages.dolphin
|
||||
kdePackages.dolphin-plugins
|
||||
];
|
||||
};
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,5 @@
|
||||
# STUB (T1): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.noctalia = { };
|
||||
flake.modules.homeManager.noctalia = { };
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# WezTerm terminal (SUPER+Return in Hyprland). Colours and the font come from
|
||||
# Stylix (theme/stylix.nix: scheme "stylix", Monaspace Krypton + Noto Color
|
||||
# Emoji, size 12); this file holds the rest of the configuration.
|
||||
{
|
||||
flake.modules.homeManager.wezterm =
|
||||
{ lib, ... }:
|
||||
let
|
||||
action = lib.generators.mkLuaInline;
|
||||
in
|
||||
{
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
# Wayland-native, no client-side titlebar (Hyprland draws the borders).
|
||||
enable_wayland = true;
|
||||
window_decorations = "NONE";
|
||||
window_padding = {
|
||||
left = 8;
|
||||
right = 8;
|
||||
top = 8;
|
||||
bottom = 8;
|
||||
};
|
||||
|
||||
# A tab bar only when there is more than one tab.
|
||||
hide_tab_bar_if_only_one_tab = true;
|
||||
use_fancy_tab_bar = false;
|
||||
|
||||
scrollback_lines = 20000;
|
||||
audible_bell = "Disabled";
|
||||
check_for_updates = false;
|
||||
|
||||
# Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
|
||||
# phys: keys are layout independent and work with the ru layout.
|
||||
keys = [
|
||||
{
|
||||
key = "phys:D";
|
||||
mods = "CTRL|SHIFT";
|
||||
action = action "wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }";
|
||||
}
|
||||
{
|
||||
key = "phys:E";
|
||||
mods = "CTRL|SHIFT";
|
||||
action = action "wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T1): replaced in phase 2
|
||||
{
|
||||
flake.modules.homeManager.xdg = { };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T2): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.docker = { };
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
# Gitea Actions runner "performance" for git.faumaray.com, running jobs in
|
||||
# rootful Docker (dev/docker.nix). The registration token is an agenix secret:
|
||||
# secrets/gitea-runner-token.age one line `TOKEN=<registration token>`
|
||||
# (nix run .#secret-from-file -- gitea-runner-token.age <file>)
|
||||
# Without that file the runner is not configured and a warning says so.
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
tokenSecret = config.meta.secretsDir + "/gitea-runner-token.age";
|
||||
hasToken = builtins.pathExists tokenSecret;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.gitea-runner =
|
||||
{ config, ... }:
|
||||
{
|
||||
age.secrets = lib.optionalAttrs hasToken {
|
||||
gitea-runner-token = {
|
||||
file = tokenSecret;
|
||||
mode = "0400";
|
||||
};
|
||||
};
|
||||
|
||||
# An instance without token or tokenFile fails the upstream assertion, so
|
||||
# the instance only exists when the secret does.
|
||||
services.gitea-actions-runner.instances = lib.optionalAttrs hasToken {
|
||||
performance = {
|
||||
enable = true;
|
||||
url = "https://git.faumaray.com";
|
||||
name = "Perfrormance Runner";
|
||||
tokenFile = config.age.secrets.gitea-runner-token.path;
|
||||
labels = [
|
||||
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
"voelin-release:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
|
||||
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
||||
"echoion-release-serial:docker://git.faumaray.ru/void/echoion-release-builder:gcc-16.1.0"
|
||||
];
|
||||
settings = {
|
||||
runner = {
|
||||
capacity = 5;
|
||||
timeout = "3h";
|
||||
fetch_timeout = "5s";
|
||||
fetch_interval = "1s";
|
||||
};
|
||||
cache = {
|
||||
enabled = true;
|
||||
host = "192.168.255.242"; # or "localhost" if not using isolated docker containers
|
||||
port = 8088;
|
||||
dir = "/var/lib/gitea-runner/cache";
|
||||
};
|
||||
container = {
|
||||
# Ensure the job container passes standard bridge mode
|
||||
network_mode = "bridge";
|
||||
|
||||
# Provide the job containers an alias to reach the host system
|
||||
options = "--add-host=host.docker.internal:host-gateway";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
warnings = lib.optional (!hasToken) ''
|
||||
The Gitea Actions runner "performance" is not configured: secrets/gitea-runner-token.age
|
||||
is missing. Put `TOKEN=<new registration token>` in a file, then
|
||||
`nix run .#secret-from-file -- gitea-runner-token.age <file>` and `git add` it.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# `nix run .#<app>`: install and key/secret helpers (../../pkgs).
|
||||
{
|
||||
perSystem =
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
app = pkg: description: {
|
||||
program = lib.getExe pkg;
|
||||
meta.description = description;
|
||||
};
|
||||
in
|
||||
{
|
||||
apps = {
|
||||
install = app pkgs.install-system "Install this flake onto this machine from the NixOS installer (wipes the configured disks)";
|
||||
create-keys = app pkgs.create-keys "Create the SSH host key and Secure Boot keys in keys/<host>/";
|
||||
set-password = app pkgs.set-password "Encrypt the login password into secrets/<user>-password.age";
|
||||
secret-from-file = app pkgs.secret-from-file "Encrypt an existing file (e.g. an SSH key) as secrets/<name>.age";
|
||||
switch = app pkgs.switch-system "Rebuild and switch this machine from the flake";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# Development: `nix develop`, `nix fmt` and the formatting check. Both skip
|
||||
# hardware-configuration.nix, which nixos-generate-config (install-system) writes.
|
||||
{ self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ inputs', pkgs, ... }:
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "nixos-config";
|
||||
packages = [
|
||||
inputs'.agenix.packages.default
|
||||
inputs'.disko.packages.disko
|
||||
pkgs.age
|
||||
pkgs.ssh-to-age
|
||||
pkgs.sbctl
|
||||
pkgs.git
|
||||
pkgs.nixfmt
|
||||
pkgs.nixd
|
||||
pkgs.shellcheck
|
||||
];
|
||||
};
|
||||
|
||||
formatter = pkgs.nixfmt-tree.override {
|
||||
settings.formatter.nixfmt.excludes = [ "hosts/*/hardware-configuration.nix" ];
|
||||
};
|
||||
|
||||
checks.formatting = pkgs.runCommandLocal "nixfmt-check" { nativeBuildInputs = [ pkgs.nixfmt ]; } ''
|
||||
cd ${self}
|
||||
find . -name '*.nix' ! -path './hosts/*/hardware-configuration.nix' -print0 \
|
||||
| xargs -0 nixfmt --check
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
# Shared data for every aspect: who owns this flake and where the secrets are.
|
||||
# Top-level flake-parts options, not a flake output. Read them in any module
|
||||
# through the flake-parts `config`, bound in a `let` before any lower-level
|
||||
# module so the NixOS/home-manager `config` cannot shadow it:
|
||||
#
|
||||
# { config, ... }:
|
||||
# let
|
||||
# inherit (config.meta) owner;
|
||||
# in
|
||||
# {
|
||||
# flake.modules.nixos.foo = { pkgs, ... }: { users.users.${owner.name}.shell = pkgs.zsh; };
|
||||
# flake.modules.homeManager.foo = { programs.git.settings.user.email = owner.email; };
|
||||
# }
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.meta = {
|
||||
owner = mkOption {
|
||||
description = "The single interactive user of every host in this flake.";
|
||||
type = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "Login name.";
|
||||
};
|
||||
fullName = mkOption {
|
||||
type = types.str;
|
||||
description = "Display name (GECOS), also the git author name.";
|
||||
};
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
description = "E-mail address, used for git.";
|
||||
};
|
||||
uid = mkOption {
|
||||
type = types.int;
|
||||
default = 1000;
|
||||
description = "Numeric user id.";
|
||||
};
|
||||
sshAuthorizedKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Public keys allowed to log in over SSH.";
|
||||
};
|
||||
sshKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "id_ed25519" ];
|
||||
description = ''
|
||||
Private SSH key names. Each one is installed as ~/.ssh/<name> when
|
||||
secrets/ssh-<name>.age exists (and ~/.ssh/<name>.pub when
|
||||
secrets/ssh-<name>.pub exists).
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
secretsDir = mkOption {
|
||||
type = types.path;
|
||||
default = ../../secrets;
|
||||
defaultText = lib.literalExpression "./secrets";
|
||||
description = ''
|
||||
Directory with the agenix *.age files. A secret is declared only when its
|
||||
file exists, so a fresh clone still evaluates. Flakes only see files that
|
||||
git tracks: `git add` new secrets before building.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
# Host construction. Every `configurations.nixos.<name>.module` (merged from all
|
||||
# files that set it, see modules/hosts/<name>/) becomes
|
||||
# `nixosConfigurations.<name>`, and its toplevel becomes
|
||||
# `checks.<system>.nixos-<name>`, so `nix flake check --no-build` evaluates
|
||||
# every host completely (plain `nix flake check` builds them).
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hosts = config.configurations.nixos;
|
||||
inherit (config.flake) nixosConfigurations;
|
||||
in
|
||||
{
|
||||
options.configurations.nixos = lib.mkOption {
|
||||
description = "NixOS hosts, one deferred module per host.";
|
||||
default = { };
|
||||
type = lib.types.lazyAttrsOf (
|
||||
lib.types.submodule {
|
||||
options.module = lib.mkOption {
|
||||
type = lib.types.deferredModule;
|
||||
description = "The host's NixOS module: aspects to import plus host-only values.";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
config = {
|
||||
flake.nixosConfigurations = lib.mapAttrs (
|
||||
name: host:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
host.module
|
||||
{ networking.hostName = lib.mkDefault name; }
|
||||
];
|
||||
}
|
||||
) hosts;
|
||||
|
||||
perSystem =
|
||||
{ system, ... }:
|
||||
let
|
||||
hostsOnSystem = lib.filterAttrs (
|
||||
name: _: nixosConfigurations.${name}.pkgs.stdenv.hostPlatform.system == system
|
||||
) hosts;
|
||||
toplevel = name: nixosConfigurations.${name}.config.system.build.toplevel;
|
||||
in
|
||||
{
|
||||
checks = lib.mapAttrs' (name: _: lib.nameValuePair "nixos-${name}" (toplevel name)) hostsOnSystem;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Overlays exposed as `overlays.<name>`; `default` composes all of them and is
|
||||
# applied to every host (modules/core/nixpkgs.nix), to the installer and to the
|
||||
# per-system package set (modules/flake/packages.nix).
|
||||
{ inputs, lib, ... }:
|
||||
{
|
||||
flake.overlays = rec {
|
||||
# Hyprland's own upstream overlays, built from the pinned `hyprland` flake
|
||||
# input against our nixpkgs. Upstream `default` omits the hyprwm libraries
|
||||
# (aquamarine, hyprutils, hyprland-guiutils, ...); `hyprland-packages`
|
||||
# carries them plus Hyprland, `hyprland-extras` adds the matching portal.
|
||||
hyprland = lib.composeManyExtensions [
|
||||
inputs.hyprland.overlays.hyprland-packages
|
||||
inputs.hyprland.overlays.hyprland-extras
|
||||
];
|
||||
|
||||
# Noctalia from its flake. That flake does not follow our nixpkgs, so the
|
||||
# store path matches noctalia.cachix.org and is downloaded, not compiled.
|
||||
noctalia = final: _prev: {
|
||||
noctalia = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
|
||||
};
|
||||
|
||||
# This repository's own packages (../../pkgs): install and key helpers.
|
||||
additions =
|
||||
final: _prev:
|
||||
import ../../pkgs {
|
||||
pkgs = final;
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
# Changes to existing nixpkgs packages. They apply system-wide and to
|
||||
# home-manager (useGlobalPkgs = true).
|
||||
modifications = _final: prev: {
|
||||
# btop with AMD GPU monitoring (ROCm SMI) for the Radeon card.
|
||||
btop = prev.btop.override { rocmSupport = true; };
|
||||
};
|
||||
|
||||
default = lib.composeManyExtensions [
|
||||
hyprland
|
||||
noctalia
|
||||
additions
|
||||
modifications
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# The per-system package set (our overlay, unfree allowed) and the repository's
|
||||
# own tools as flake packages. They are checks too, so plain `nix flake check`
|
||||
# builds them (writeShellApplication runs shellcheck).
|
||||
{ config, inputs, ... }:
|
||||
let
|
||||
overlay = config.flake.overlays.default;
|
||||
in
|
||||
{
|
||||
perSystem =
|
||||
{ system, pkgs, ... }:
|
||||
let
|
||||
tools = {
|
||||
inherit (pkgs)
|
||||
install-system
|
||||
create-keys
|
||||
set-password
|
||||
secret-from-file
|
||||
switch-system
|
||||
;
|
||||
};
|
||||
in
|
||||
{
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ overlay ];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
packages = tools;
|
||||
checks = tools;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# flake-parts glue: the module classes this flake publishes (flake.modules.nixos.*
|
||||
# and flake.modules.homeManager.*, exported as the `modules` output) and the
|
||||
# systems the per-system outputs are built for.
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.flake-parts.flakeModules.modules ];
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T2): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.gaming = { };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T2): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.amd = { };
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T2): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.rocm = { };
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
# Everyday desktop applications.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.apps;
|
||||
in
|
||||
{
|
||||
options.my.home.apps.enable = lib.mkEnableOption "desktop applications";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
firefox.enable = true;
|
||||
mpv.enable = true;
|
||||
imv.enable = true;
|
||||
zathura.enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
vesktop # Discord client with working screen sharing on Wayland
|
||||
telegram-desktop
|
||||
file-roller
|
||||
teamspeak6-client
|
||||
loupe # image viewer
|
||||
zenity
|
||||
procps
|
||||
networkmanager-openvpn
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
# Home-manager modules, all behind `my.home.<name>.enable` (default false).
|
||||
# Loaded for every user through home-manager.sharedModules (see lib/default.nix);
|
||||
# hosts/<name>/home.nix turns the wanted ones on.
|
||||
{
|
||||
imports = [
|
||||
./hyprland
|
||||
./noctalia.nix
|
||||
./wezterm.nix
|
||||
./neovim
|
||||
./shell.nix
|
||||
./git.nix
|
||||
./ssh.nix
|
||||
./xdg.nix
|
||||
./theming.nix
|
||||
./apps.nix
|
||||
];
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
# Hyprland user configuration. Hyprland 0.56 reads Lua, so the real config lives
|
||||
# in the plain .lua files next to this module; Nix only passes in the few
|
||||
# values that come from the system config (keyboard layouts, cursor, apps).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.hyprland;
|
||||
cursor = config.home.pointerCursor;
|
||||
|
||||
# Exposed to the Lua files as `require("nixvars")`.
|
||||
nixVars = {
|
||||
kbLayout = lib.concatStringsSep "," osConfig.my.locale.keyboardLayouts;
|
||||
kbOptions = lib.concatStringsSep "," osConfig.my.locale.keyboardOptions;
|
||||
terminal = "wezterm";
|
||||
fileManager = "dolphin";
|
||||
cursorSize = if cursor.enable then cursor.size else 24;
|
||||
cursorTheme = if cursor.enable then cursor.name else "";
|
||||
};
|
||||
in
|
||||
{
|
||||
options.my.home.hyprland.enable = lib.mkEnableOption "Hyprland user configuration (Lua)";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
configType = "lua";
|
||||
|
||||
# The NixOS module (programs.hyprland) installs the compositor and the
|
||||
# portal, built from the flake overlay. Installing them again here would
|
||||
# put a second copy in the user profile.
|
||||
package = null;
|
||||
portalPackage = null;
|
||||
|
||||
# UWSM owns the session and graphical-session.target; HM's own
|
||||
# hyprland-session.target and dbus import would only duplicate that.
|
||||
systemd.enable = false;
|
||||
xwayland.enable = true;
|
||||
|
||||
# Loaded in name order; `nixvars` is a helper module, not loaded on its own.
|
||||
extraLuaFiles = {
|
||||
nixvars = {
|
||||
content = "return ${lib.generators.toLua { } nixVars}\n";
|
||||
autoLoad = false;
|
||||
};
|
||||
"10-settings" = ./settings.lua;
|
||||
"20-binds" = ./binds.lua;
|
||||
"30-rules" = ./rules.lua;
|
||||
};
|
||||
};
|
||||
|
||||
# Tools the binds call (screenshots, file manager).
|
||||
home.packages = with pkgs; [
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
kdePackages.dolphin
|
||||
kdePackages.dolphin-plugins
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
# Neovim with LSP, completion, fuzzy finding and format-on-save.
|
||||
# The editor config is in init.lua next to this file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.neovim;
|
||||
in
|
||||
{
|
||||
options.my.home.neovim.enable = lib.mkEnableOption "Neovim editor";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-lspconfig
|
||||
blink-cmp
|
||||
telescope-nvim
|
||||
telescope-fzf-native-nvim
|
||||
plenary-nvim
|
||||
lualine-nvim
|
||||
gitsigns-nvim
|
||||
which-key-nvim
|
||||
oil-nvim
|
||||
conform-nvim
|
||||
catppuccin-nvim
|
||||
nvim-web-devicons
|
||||
mini-nvim
|
||||
];
|
||||
|
||||
# Language servers, formatters and search tools, visible to nvim only.
|
||||
extraPackages = with pkgs; [
|
||||
nixd
|
||||
nixfmt
|
||||
lua-language-server
|
||||
stylua
|
||||
bash-language-server
|
||||
shfmt
|
||||
ripgrep
|
||||
fd
|
||||
];
|
||||
|
||||
initLua = builtins.readFile ./init.lua;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
# Noctalia v5 shell (bar, launcher, notifications, lock screen, wallpaper).
|
||||
# The module itself comes from the noctalia flake (home-manager sharedModules).
|
||||
# Settings are validated at build time by `noctalia config validate`, so only
|
||||
# keys from the upstream schema may appear here. Anything changed in the
|
||||
# settings window at runtime is stored separately and overrides this file.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.noctalia;
|
||||
in
|
||||
{
|
||||
options.my.home.noctalia.enable = lib.mkEnableOption "Noctalia shell";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.noctalia = {
|
||||
enable = true;
|
||||
|
||||
# A user service instead of hl.exec_cmd, so it restarts on failure and
|
||||
# follows graphical-session.target (managed by UWSM).
|
||||
systemd.enable = true;
|
||||
|
||||
settings = {
|
||||
theme = {
|
||||
mode = "dark";
|
||||
source = "builtin";
|
||||
builtin = "Catppuccin";
|
||||
};
|
||||
|
||||
shell = {
|
||||
# Installed system-wide (modules/nixos/desktop/fonts.nix).
|
||||
font_family = "Monaspace Krypton";
|
||||
telemetry_enabled = false;
|
||||
|
||||
# No other polkit agent is started in the session.
|
||||
polkit_agent = true;
|
||||
|
||||
# Apps started from the launcher get their own systemd scope, so
|
||||
# restarting the shell service does not kill them.
|
||||
launch_apps_as_systemd_services = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
# Interactive shell: zsh with starship prompt, fzf, zoxide, eza, bat, direnv.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.shell;
|
||||
in
|
||||
{
|
||||
options.my.home.shell.enable = lib.mkEnableOption "zsh shell environment and CLI tools";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autocd = true;
|
||||
|
||||
history = {
|
||||
size = 50000;
|
||||
save = 50000;
|
||||
# Share between open terminals, skip duplicates and space-prefixed lines.
|
||||
share = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
extended = true;
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
".." = "cd ..";
|
||||
g = "git";
|
||||
# nh builds, diffs and activates the flake in one step.
|
||||
rebuild = "nh os switch";
|
||||
rebuild-boot = "nh os boot";
|
||||
rebuild-test = "nh os test";
|
||||
};
|
||||
};
|
||||
|
||||
starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
# Short marker inside `nix shell` / `nix develop`.
|
||||
nix_shell.format = "[$symbol$state]($style) ";
|
||||
};
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
defaultCommand = "fd --type f --hidden --exclude .git";
|
||||
fileWidget.command = "fd --type f --hidden --exclude .git";
|
||||
changeDirWidget.command = "fd --type d --hidden --exclude .git";
|
||||
};
|
||||
|
||||
# `z dir` jumps to frecent directories, `zi` picks with fzf.
|
||||
zoxide.enable = true;
|
||||
|
||||
# ls, ll, la, lt and lla aliases come from the zsh integration.
|
||||
eza = {
|
||||
enable = true;
|
||||
icons = "auto";
|
||||
git = true;
|
||||
};
|
||||
|
||||
bat.enable = true;
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
btop.enable = true;
|
||||
fastfetch.enable = true;
|
||||
};
|
||||
|
||||
# fd backs the fzf commands above.
|
||||
home.packages = [ pkgs.fd ];
|
||||
};
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
# SSH client, agent and the user's keys.
|
||||
# Private keys are agenix secrets (decrypted at boot into /run/agenix); this
|
||||
# module only links them into ~/.ssh so ssh finds them at the usual path.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.ssh;
|
||||
|
||||
secrets = osConfig.my.secrets;
|
||||
|
||||
# Keys that actually have an encrypted secret in the repo. Without a secret
|
||||
# nothing is linked, so a fresh install still boots and ssh falls back to
|
||||
# whatever key the user generates by hand.
|
||||
keys = lib.filter (k: osConfig.age.secrets ? "ssh-${k}") secrets.userSshKeys;
|
||||
|
||||
pubFile = k: secrets.dir + "/ssh-${k}.pub";
|
||||
|
||||
# The decrypted file lives outside the store, so link it by absolute path.
|
||||
keyFiles = lib.listToAttrs (
|
||||
map (
|
||||
k:
|
||||
lib.nameValuePair ".ssh/${k}" {
|
||||
source = config.lib.file.mkOutOfStoreSymlink osConfig.age.secrets."ssh-${k}".path;
|
||||
}
|
||||
) keys
|
||||
);
|
||||
|
||||
# Public keys are not secret, so they are plain files from the repo.
|
||||
pubFiles = lib.listToAttrs (
|
||||
map (k: lib.nameValuePair ".ssh/${k}.pub" { source = pubFile k; }) (
|
||||
lib.filter (k: builtins.pathExists (pubFile k)) keys
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
options.my.home.ssh.enable = lib.mkEnableOption "SSH client, agent and agenix-provided keys";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
# Spell the defaults out below instead of relying on the deprecated ones.
|
||||
enableDefaultConfig = false;
|
||||
|
||||
settings = {
|
||||
"*" = {
|
||||
# Load a key into the agent on first use, so the passphrase (if any)
|
||||
# is typed once per login.
|
||||
AddKeysToAgent = "yes";
|
||||
ServerAliveInterval = 60;
|
||||
ServerAliveCountMax = 3;
|
||||
HashKnownHosts = false;
|
||||
UserKnownHostsFile = "~/.ssh/known_hosts";
|
||||
};
|
||||
|
||||
"github.com" = {
|
||||
User = "git";
|
||||
IdentityFile = "~/.ssh/id_ed25519";
|
||||
# Offer only this key, not everything in the agent.
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
"git.protei.ru" = {
|
||||
User = "git";
|
||||
IdentityFile = "~/.ssh/id_ed25519_work";
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# A plain user service rather than gnome-keyring's agent: no keyring to
|
||||
# unlock, and it sets SSH_AUTH_SOCK for shells, systemd and D-Bus. The
|
||||
# system must not start another agent (programs.ssh.startAgent).
|
||||
services.ssh-agent.enable = true;
|
||||
|
||||
home.file = keyFiles // pubFiles;
|
||||
};
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
# Dark GTK and Qt look, icons and cursor. Noctalia themes the shell itself;
|
||||
# this keeps the apps consistent with it.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.theming;
|
||||
in
|
||||
{
|
||||
options.my.home.theming.enable = lib.mkEnableOption "GTK/Qt theme, icons and cursor";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
gtk = {
|
||||
enable = true;
|
||||
colorScheme = "dark";
|
||||
|
||||
theme = {
|
||||
name = "adw-gtk3-dark";
|
||||
package = pkgs.adw-gtk3;
|
||||
};
|
||||
|
||||
iconTheme = {
|
||||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
# gtk.enable above lets GTK apps pick the cursor up from here.
|
||||
home.pointerCursor = {
|
||||
enable = true;
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Classic";
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
};
|
||||
|
||||
# Qt apps follow the GTK settings, with the Adwaita dark widget style.
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "gtk3";
|
||||
style.name = "adwaita-dark";
|
||||
};
|
||||
|
||||
# libadwaita and GTK 4 apps read the preference from dconf. The system
|
||||
# needs programs.dconf.enable for this to be applied.
|
||||
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
|
||||
};
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
# WezTerm terminal (SUPER+Return in Hyprland). The fonts it asks for
|
||||
# (JetBrainsMono Nerd Font, Noto Color Emoji) come from modules/nixos/desktop/fonts.nix.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.wezterm;
|
||||
in
|
||||
{
|
||||
options.my.home.wezterm.enable = lib.mkEnableOption "WezTerm terminal";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
local act = wezterm.action
|
||||
local config = wezterm.config_builder()
|
||||
|
||||
config.color_scheme = 'Catppuccin Mocha'
|
||||
config.font = wezterm.font_with_fallback { 'Monaspace Krypton', 'Noto Color Emoji' }
|
||||
config.font_size = 12.0
|
||||
|
||||
-- Wayland-native, no client-side titlebar (Hyprland draws the borders).
|
||||
config.enable_wayland = true
|
||||
config.window_decorations = 'NONE'
|
||||
config.window_padding = { left = 8, right = 8, top = 8, bottom = 8 }
|
||||
|
||||
-- A tab bar only when there is more than one tab.
|
||||
config.hide_tab_bar_if_only_one_tab = true
|
||||
config.use_fancy_tab_bar = false
|
||||
|
||||
config.scrollback_lines = 20000
|
||||
config.audible_bell = 'Disabled'
|
||||
config.check_for_updates = false
|
||||
|
||||
-- Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
|
||||
-- phys: keys are layout independent and work with the ru layout.
|
||||
config.keys = {
|
||||
{ key = 'phys:D', mods = 'CTRL|SHIFT', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
|
||||
{ key = 'phys:E', mods = 'CTRL|SHIFT', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
|
||||
}
|
||||
|
||||
return config
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
# XDG base dirs, the user folders and default applications.
|
||||
# Documents, Downloads, Music, Pictures and Videos are separate subvolumes on
|
||||
# the data SSD mounted into $HOME (my.disks); Desktop, Templates and Public
|
||||
# are plain directories on the system disk. Home-manager's default folder
|
||||
# names already match, so only the unwanted ones are changed.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.home.xdg;
|
||||
|
||||
firefox = "firefox.desktop";
|
||||
fileManager = "Dolphin.desktop";
|
||||
imageViewer = "org.gnome.Loupe.desktop";
|
||||
mediaPlayer = "mpv.desktop";
|
||||
pdfViewer = "org.pwmt.zathura.desktop";
|
||||
archiveManager = "org.gnome.FileRoller.desktop";
|
||||
in
|
||||
{
|
||||
options.my.home.xdg.enable = lib.mkEnableOption "XDG directories and default applications";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
xdg = {
|
||||
enable = true;
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
|
||||
# No ~/Projects: code lives wherever the user clones it.
|
||||
projects = null;
|
||||
};
|
||||
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
|
||||
defaultApplications = {
|
||||
"text/html" = firefox;
|
||||
"x-scheme-handler/http" = firefox;
|
||||
"x-scheme-handler/https" = firefox;
|
||||
"x-scheme-handler/about" = firefox;
|
||||
"x-scheme-handler/unknown" = firefox;
|
||||
|
||||
"inode/directory" = fileManager;
|
||||
|
||||
"image/*" = imageViewer;
|
||||
"video/*" = mediaPlayer;
|
||||
"audio/*" = mediaPlayer;
|
||||
"application/pdf" = pdfViewer;
|
||||
|
||||
"application/zip" = archiveManager;
|
||||
"application/x-tar" = archiveManager;
|
||||
"application/x-7z-compressed" = archiveManager;
|
||||
"application/vnd.rar" = archiveManager;
|
||||
};
|
||||
};
|
||||
|
||||
# "Open in terminal" actions (desktop entries with Terminal=true) use WezTerm.
|
||||
terminal-exec = {
|
||||
enable = true;
|
||||
settings.default = [ "org.wezfurlong.wezterm.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
# desktop: disk layout (disko), btrfs, no encryption.
|
||||
# system disk (NVMe): ESP + btrfs "nixos" with @root @home @nix @log @swap
|
||||
# data disk (SATA): btrfs "data", one subvolume per home folder, each
|
||||
# mounted inside the owner's home (~/Games, ~/Music, ...)
|
||||
# The device paths come from hosts/desktop/disk-ids.json, which
|
||||
# `nix run .#install` rewrites after you pick the disks
|
||||
# (list them with `ls -l /dev/disk/by-id`).
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
ids = lib.importJSON ../../../hosts/desktop/disk-ids.json;
|
||||
home = "/home/${owner.name}";
|
||||
|
||||
# Each entry becomes a btrfs subvolume on the data disk, mounted at
|
||||
# ~/<Name>. To add a folder later, add `Name = { };` here, create the
|
||||
# subvolume (`btrfs subvolume create /mnt/data/@name`, with the data disk's
|
||||
# top level mounted), then rebuild. Storage is a free-form folder to organise
|
||||
# yourself; Steam's library goes in ~/Games/SteamLibrary.
|
||||
homeFolders = {
|
||||
Games = { };
|
||||
Downloads = { };
|
||||
Documents = { };
|
||||
Music = { };
|
||||
Pictures = { };
|
||||
Videos = { };
|
||||
Storage = { };
|
||||
};
|
||||
subvolumeOf = name: folder: folder.subvolume or ("@" + lib.toLower name);
|
||||
|
||||
# Compression keeps the NVMe small-write friendly; noatime avoids metadata writes.
|
||||
btrfsOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
|
||||
dataMountOptions = btrfsOptions ++ [
|
||||
# The machine still boots (to the system disk) if the SSD is missing.
|
||||
"nofail"
|
||||
"x-systemd.device-timeout=10s"
|
||||
];
|
||||
|
||||
placeholders = lib.filter (lib.hasInfix "CHANGE-ME") [
|
||||
ids.system
|
||||
ids.data
|
||||
];
|
||||
in
|
||||
{
|
||||
configurations.nixos.desktop.module = {
|
||||
imports = [ inputs.disko.nixosModules.disko ];
|
||||
|
||||
disko.devices.disk = {
|
||||
system = {
|
||||
type = "disk";
|
||||
device = ids.system;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "2G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
# Only root may read the ESP (random seed, lanzaboote images).
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [
|
||||
"-f"
|
||||
"-L"
|
||||
"nixos"
|
||||
];
|
||||
subvolumes = {
|
||||
"@root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@log" = {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
# No compression on the swapfile's subvolume.
|
||||
"@swap" = {
|
||||
mountpoint = "/swap";
|
||||
mountOptions = [ "noatime" ];
|
||||
swap.swapfile.size = "16G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
data = {
|
||||
type = "disk";
|
||||
device = ids.data;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions.data = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [
|
||||
"-f"
|
||||
"-L"
|
||||
"data"
|
||||
];
|
||||
subvolumes = lib.mapAttrs' (
|
||||
name: folder:
|
||||
lib.nameValuePair (subvolumeOf name folder) {
|
||||
mountpoint = "${home}/${name}";
|
||||
mountOptions = dataMountOptions;
|
||||
}
|
||||
) homeFolders;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Logs must be mounted before journald starts in stage 2.
|
||||
fileSystems."/var/log".neededForBoot = true;
|
||||
|
||||
services.btrfs.autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
fileSystems = [
|
||||
"/"
|
||||
"${home}/${lib.head (lib.attrNames homeFolders)}"
|
||||
];
|
||||
};
|
||||
|
||||
# Subvolume roots are created root-owned; hand them to the owner. The home
|
||||
# directory itself is listed first so the mount points have a parent.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${home} 0700 ${owner.name} users -"
|
||||
]
|
||||
++ lib.mapAttrsToList (name: _: "d ${home}/${name} 0755 ${owner.name} users -") homeFolders;
|
||||
|
||||
warnings = lib.optional (placeholders != [ ]) ''
|
||||
hosts/desktop/disk-ids.json still has placeholder device paths (${lib.concatStringsSep ", " placeholders}).
|
||||
Run `nix run .#install`, or edit hosts/desktop/disk-ids.json, before installing.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
# desktop: the generated hardware scan (rewritten by install-system) and the
|
||||
# nixos-hardware profiles for an AMD CPU and GPU on an SSD.
|
||||
{ inputs, ... }:
|
||||
{
|
||||
configurations.nixos.desktop.module = {
|
||||
imports = [
|
||||
../../../hosts/desktop/hardware-configuration.nix
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
|
||||
inputs.nixos-hardware.nixosModules.common-gpu-amd
|
||||
inputs.nixos-hardware.nixosModules.common-pc-ssd
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
# desktop: AMD CPU + AMD GPU workstation/gaming PC. Which aspects it runs, plus
|
||||
# the few values that belong to this machine only. Hardware: hardware.nix,
|
||||
# disks: disks.nix. install-system writes hosts/desktop/disk-ids.json and
|
||||
# hosts/desktop/hardware-configuration.nix at the repository root.
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
nixos = config.flake.modules.nixos;
|
||||
hm = config.flake.modules.homeManager;
|
||||
in
|
||||
{
|
||||
configurations.nixos.desktop.module = {
|
||||
# Aspects with a home-manager half (hyprland, noctalia, ssh, theme) add it
|
||||
# to the owner themselves.
|
||||
imports = with nixos; [
|
||||
core
|
||||
secure-boot
|
||||
amd
|
||||
ssh
|
||||
secrets
|
||||
hyprland
|
||||
noctalia
|
||||
audio
|
||||
fonts
|
||||
theme
|
||||
gaming
|
||||
vpn
|
||||
proxy-suite
|
||||
docker
|
||||
gitea-runner
|
||||
];
|
||||
|
||||
# The owner's own programs (home-manager only). A dynamic attribute such
|
||||
# as `${owner.name}` may appear only once per attribute set, so everything
|
||||
# for the owner's home-manager configuration sits in this one block.
|
||||
home-manager.users.${owner.name} = {
|
||||
imports = with hm; [
|
||||
shell
|
||||
git
|
||||
neovim
|
||||
wezterm
|
||||
xdg
|
||||
apps
|
||||
claude-code
|
||||
];
|
||||
|
||||
# Set once at install time; do not change on upgrades.
|
||||
home.stateVersion = "26.05";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
|
||||
time.timeZone = "Europe/Moscow";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# XKB layouts in switching order. The console follows them
|
||||
# (core/locale.nix) and so does Hyprland (desktop/hyprland, via osConfig).
|
||||
services.xserver.xkb = {
|
||||
layout = "us,ru";
|
||||
options = "grp:alt_shift_toggle";
|
||||
};
|
||||
|
||||
# No packet filter on this machine.
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# Set once at install time; do not change on upgrades.
|
||||
system.stateVersion = "26.05";
|
||||
};
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
|
||||
# flake and the install tooling. Wired up in lib/default.nix (mkInstaller).
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
|
||||
# Every flake input including nested ones, so the sources are on the ISO and
|
||||
# a locked flake installs without re-downloading them.
|
||||
allInputs = builtins.genericClosure {
|
||||
startSet = map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues inputs);
|
||||
operator =
|
||||
x:
|
||||
map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues (x.i.inputs or { }));
|
||||
};
|
||||
in
|
||||
{
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
|
||||
accept-flake-config = true;
|
||||
};
|
||||
|
||||
# nmtui / nmcli instead of wpa_supplicant.
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
networkmanager-openvpn
|
||||
];
|
||||
};
|
||||
networking.wireless.enable = lib.mkForce false;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.install-system
|
||||
pkgs.create-keys
|
||||
pkgs.set-password
|
||||
pkgs.secret-from-file
|
||||
pkgs.git
|
||||
pkgs.jq
|
||||
pkgs.age
|
||||
pkgs.sbctl
|
||||
pkgs.btrfs-progs
|
||||
pkgs.neovim
|
||||
inputs.disko.packages.${system}.disko
|
||||
inputs.agenix.packages.${system}.default
|
||||
];
|
||||
|
||||
# The flake itself, read-only. install-system copies it before changing it.
|
||||
environment.etc."nixos-config".source = self;
|
||||
|
||||
system.extraDependencies = map (x: x.i.outPath) allInputs;
|
||||
|
||||
users.motd = ''
|
||||
|
||||
NixOS installer for the "desktop" flake
|
||||
|
||||
1. Network: nmtui (Ethernet works out of the box)
|
||||
2. Install: sudo install-system
|
||||
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
|
||||
--keys-dir DIR for keys/ on a mounted stick)
|
||||
3. Keys: create-keys, set-password, secret-from-file (see the README)
|
||||
|
||||
install-system asks which disks to use and erases them only after you type the host name.
|
||||
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
|
||||
# flake and the install tooling. The installer is not a host: it imports no
|
||||
# other aspect and has no home-manager.
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
overlay = config.flake.overlays.default;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.installer =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
|
||||
# Every flake input including nested ones, so the sources are on the ISO and
|
||||
# a locked flake installs without re-downloading them.
|
||||
allInputs = builtins.genericClosure {
|
||||
startSet = map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues inputs);
|
||||
operator =
|
||||
x:
|
||||
map (i: {
|
||||
key = toString i.outPath;
|
||||
inherit i;
|
||||
}) (lib.attrValues (x.i.inputs or { }));
|
||||
};
|
||||
in
|
||||
{
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
|
||||
accept-flake-config = true;
|
||||
};
|
||||
|
||||
# nmtui / nmcli instead of wpa_supplicant.
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
networkmanager-openvpn
|
||||
];
|
||||
};
|
||||
networking.wireless.enable = lib.mkForce false;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.install-system
|
||||
pkgs.create-keys
|
||||
pkgs.set-password
|
||||
pkgs.secret-from-file
|
||||
pkgs.git
|
||||
pkgs.jq
|
||||
pkgs.age
|
||||
pkgs.sbctl
|
||||
pkgs.btrfs-progs
|
||||
pkgs.neovim
|
||||
inputs.disko.packages.${system}.disko
|
||||
inputs.agenix.packages.${system}.default
|
||||
];
|
||||
|
||||
# The flake itself, read-only. install-system copies it before changing it.
|
||||
environment.etc."nixos-config".source = inputs.self;
|
||||
|
||||
system.extraDependencies = map (x: x.i.outPath) allInputs;
|
||||
|
||||
users.motd = ''
|
||||
|
||||
NixOS installer for the "desktop" flake
|
||||
|
||||
1. Network: nmtui (Ethernet works out of the box)
|
||||
2. Install: sudo install-system
|
||||
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
|
||||
--keys-dir DIR for keys/ on a mounted stick)
|
||||
3. Keys: create-keys, set-password, secret-from-file (see the README)
|
||||
|
||||
install-system asks which disks to use and erases them only after you type the host name.
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
flake.nixosConfigurations.installer = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
{
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
nixpkgs.overlays = [ overlay ];
|
||||
}
|
||||
config.flake.modules.nixos.installer
|
||||
];
|
||||
};
|
||||
|
||||
perSystem =
|
||||
{ system, ... }:
|
||||
{
|
||||
# The ISO is built for x86_64-linux only.
|
||||
packages = lib.optionalAttrs (system == "x86_64-linux") {
|
||||
iso = config.flake.nixosConfigurations.installer.config.system.build.isoImage;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
# proxy-suite (github:FUFSoB/proxy-suite-flake): zapret DPI bypass, the
|
||||
# Telegram WebSocket proxy and the GUI. The MTProto secret is an agenix secret:
|
||||
# secrets/tg-ws-proxy-secret.age the secret (`openssl rand -hex 16`)
|
||||
# (nix run .#secret-from-file -- tg-ws-proxy-secret.age <file>)
|
||||
# proxy-suite reads it through systemd LoadCredential, so root ownership is
|
||||
# enough. Without the file the Telegram proxy stays off and a warning says so.
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
tgSecret = config.meta.secretsDir + "/tg-ws-proxy-secret.age";
|
||||
hasTgSecret = builtins.pathExists tgSecret;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.proxy-suite =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [ inputs.proxy-suite.nixosModules.default ];
|
||||
|
||||
age.secrets = lib.optionalAttrs hasTgSecret {
|
||||
tg-ws-proxy-secret = {
|
||||
file = tgSecret;
|
||||
mode = "0400";
|
||||
};
|
||||
};
|
||||
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
|
||||
proxy = {
|
||||
enable = false;
|
||||
};
|
||||
|
||||
# perAppRouting = {
|
||||
# enable = true;
|
||||
# createDefaultProfiles = true;
|
||||
# proxychains.enable = true;
|
||||
# tun.enable = true;
|
||||
# tproxy.enable = true;
|
||||
# zapret.enable = true;
|
||||
# };
|
||||
|
||||
zapret = {
|
||||
enable = true;
|
||||
zapret-discord-youtube.configName = "general(ALT)";
|
||||
};
|
||||
|
||||
tgWsProxy = {
|
||||
enable = hasTgSecret;
|
||||
secretFile = if hasTgSecret then config.age.secrets.tg-ws-proxy-secret.path else null;
|
||||
bypassTransparentProxy = true;
|
||||
};
|
||||
|
||||
gui.enable = true;
|
||||
};
|
||||
|
||||
warnings = lib.optional (!hasTgSecret) ''
|
||||
The Telegram WebSocket proxy (services.proxy-suite.tgWsProxy) is off:
|
||||
secrets/tg-ws-proxy-secret.age is missing. Create a new secret with
|
||||
`openssl rand -hex 16`, then `nix run .#secret-from-file -- tg-ws-proxy-secret.age <file>`
|
||||
and `git add` it.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# STUB (T2): replaced in phase 2
|
||||
{
|
||||
flake.modules.nixos.vpn = { };
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
# Bootloader: lanzaboote (Secure Boot) or plain systemd-boot, plus kernel.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.boot;
|
||||
in
|
||||
{
|
||||
options.my.boot.secureBoot.enable = lib.mkEnableOption ''
|
||||
Secure Boot through lanzaboote. Keys live in /var/lib/sbctl (create them
|
||||
with `sbctl create-keys` before the first boot). When disabled the system
|
||||
uses plain systemd-boot
|
||||
'';
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot = {
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
initrd.systemd.enable = true;
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.secureBoot.enable {
|
||||
boot = {
|
||||
lanzaboote = {
|
||||
enable = true;
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
configurationLimit = 10;
|
||||
};
|
||||
# lanzaboote installs the boot entries itself.
|
||||
loader.systemd-boot.enable = lib.mkForce false;
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.sbctl ];
|
||||
})
|
||||
|
||||
(lib.mkIf (!cfg.secureBoot.enable) {
|
||||
boot.loader.systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 10;
|
||||
editor = false;
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
# Time zone, locale and keyboard layout (also used by the console and by the
|
||||
# home-manager Hyprland module through osConfig).
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.locale;
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.my.locale = {
|
||||
timeZone = mkOption {
|
||||
type = types.str;
|
||||
example = "Europe/Moscow";
|
||||
description = "IANA time zone name.";
|
||||
};
|
||||
|
||||
defaultLocale = mkOption {
|
||||
type = types.str;
|
||||
default = "en_US.UTF-8";
|
||||
description = "Default system locale (LANG).";
|
||||
};
|
||||
|
||||
keyboardLayouts = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "us" ];
|
||||
example = [
|
||||
"us"
|
||||
"ru"
|
||||
];
|
||||
description = "XKB layouts, in switching order.";
|
||||
};
|
||||
|
||||
keyboardOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "grp:alt_shift_toggle" ];
|
||||
description = "XKB options such as the layout toggle shortcut.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
time.timeZone = cfg.timeZone;
|
||||
|
||||
i18n = {
|
||||
inherit (cfg) defaultLocale;
|
||||
# Russian stays available for apps and games even with an English UI.
|
||||
extraLocales = [ "ru_RU.UTF-8/UTF-8" ];
|
||||
};
|
||||
|
||||
services.xserver.xkb = {
|
||||
layout = lib.concatStringsSep "," cfg.keyboardLayouts;
|
||||
options = lib.concatStringsSep "," cfg.keyboardOptions;
|
||||
};
|
||||
|
||||
# TTY and initrd keymap follow the XKB layout above.
|
||||
console.useXkbConfig = true;
|
||||
};
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
# NetworkManager with the default (closed) firewall. The user joins the
|
||||
# `networkmanager` group in users.nix.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
networking = {
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
networkmanager-openvpn
|
||||
];
|
||||
};
|
||||
|
||||
firewall.enable = false;
|
||||
};
|
||||
programs.nm-applet.enable = true;
|
||||
programs.amnezia-vpn.enable = true;
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
|
||||
proxy = {
|
||||
enable = false;
|
||||
};
|
||||
|
||||
# perAppRouting = {
|
||||
# enable = true;
|
||||
# createDefaultProfiles = true;
|
||||
# proxychains.enable = true;
|
||||
# tun.enable = true;
|
||||
# tproxy.enable = true;
|
||||
# zapret.enable = true;
|
||||
# };
|
||||
|
||||
zapret = {
|
||||
enable = true;
|
||||
zapret-discord-youtube.configName = "general(ALT)";
|
||||
};
|
||||
|
||||
tgWsProxy = {
|
||||
enable = true;
|
||||
secret = "637854682629bfdca35fe9c58e797915";
|
||||
bypassTransparentProxy = true;
|
||||
};
|
||||
|
||||
gui.enable = true;
|
||||
};
|
||||
virtualisation.docker.enable = true;
|
||||
virtualisation.docker.rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
virtualisation.docker.storageDriver = "btrfs";
|
||||
|
||||
services.gitea-actions-runner.instances."performance" = {
|
||||
enable = true;
|
||||
url = "https://git.faumaray.com";
|
||||
name = "Perfrormance Runner";
|
||||
token = "DJrTt1RLMROrXxVBDF1XVvo7wiKhHVxmofBBjl4S";
|
||||
labels = [
|
||||
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
"voelin-release:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
|
||||
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
||||
"echoion-release-serial:docker://git.faumaray.ru/void/echoion-release-builder:gcc-16.1.0"
|
||||
];
|
||||
settings = {
|
||||
runner = {
|
||||
capacity = 5;
|
||||
timeout = "3h";
|
||||
fetch_timeout = "5s";
|
||||
fetch_interval = "1s";
|
||||
};
|
||||
cache = {
|
||||
enabled = true;
|
||||
host = "192.168.255.242"; # or "localhost" if not using isolated docker containers
|
||||
port = 8088;
|
||||
dir = "/var/lib/gitea-runner/cache";
|
||||
};
|
||||
container = {
|
||||
# Ensure the job container passes standard bridge mode
|
||||
network_mode = "bridge";
|
||||
|
||||
# Provide the job containers an alias to reach the host system
|
||||
options = "--add-host=host.docker.internal:host-gateway";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
# Nix daemon settings, binary caches, garbage collection and flake registry.
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
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/${config.my.user.name}/nixos-config";
|
||||
};
|
||||
|
||||
# Lets prebuilt binaries (editors' language servers, game launchers) run.
|
||||
nix-ld.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
# The primary (only) interactive user.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.user;
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
passwordSecret = "${cfg.name}-password";
|
||||
hasPasswordSecret = config.age.secrets ? ${passwordSecret};
|
||||
in
|
||||
{
|
||||
options.my.user = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
example = "faumaray";
|
||||
description = "Login name of the primary user.";
|
||||
};
|
||||
|
||||
fullName = mkOption {
|
||||
type = types.str;
|
||||
description = "Display name (GECOS), also used for git.";
|
||||
};
|
||||
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
description = "E-mail address, used for git.";
|
||||
};
|
||||
|
||||
uid = mkOption {
|
||||
type = types.int;
|
||||
default = 1000;
|
||||
description = "Numeric user id.";
|
||||
};
|
||||
|
||||
extraGroups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Groups in addition to the ones every desktop user gets.";
|
||||
};
|
||||
|
||||
sshAuthorizedKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Public keys allowed to log in over SSH.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
users.mutableUsers = true;
|
||||
|
||||
users.users.${cfg.name} = {
|
||||
isNormalUser = true;
|
||||
inherit (cfg) uid;
|
||||
description = cfg.fullName;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"video"
|
||||
"audio"
|
||||
"input"
|
||||
"render"
|
||||
"docker"
|
||||
]
|
||||
++ lib.optional config.my.gaming.enable "gamemode"
|
||||
++ cfg.extraGroups;
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keys = cfg.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 "${cfg.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.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# Every NixOS module of this flake (exported as `nixosModules.default`).
|
||||
# Each file declares its own `my.*` options and is inert until enabled.
|
||||
{
|
||||
imports = [
|
||||
./core/nix.nix
|
||||
./core/boot.nix
|
||||
./core/locale.nix
|
||||
./core/users.nix
|
||||
./core/networking.nix
|
||||
|
||||
./hardware/amd.nix
|
||||
./hardware/disks.nix
|
||||
|
||||
./security/secrets.nix
|
||||
./security/ssh.nix
|
||||
|
||||
./desktop/hyprland.nix
|
||||
./desktop/noctalia.nix
|
||||
./desktop/audio.nix
|
||||
./desktop/fonts.nix
|
||||
|
||||
./gaming/steam.nix
|
||||
];
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# PipeWire as the single audio server (ALSA, PulseAudio and JACK clients).
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
config = lib.mkIf config.my.desktop.hyprland.enable {
|
||||
services = {
|
||||
pipewire = {
|
||||
enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
# 32-bit ALSA clients: Wine/Proton games.
|
||||
support32Bit = true;
|
||||
};
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
wireplumber.enable = true;
|
||||
};
|
||||
|
||||
pulseaudio.enable = false;
|
||||
};
|
||||
|
||||
# Lets PipeWire take realtime scheduling for low-latency audio.
|
||||
security.rtkit.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
# System fonts and the default families fontconfig falls back to.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = lib.mkIf config.my.desktop.hyprland.enable {
|
||||
fonts = {
|
||||
packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-color-emoji
|
||||
inter
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.symbols-only
|
||||
monaspace
|
||||
];
|
||||
|
||||
fontconfig.defaultFonts = {
|
||||
monospace = [ "Monaspace Radon" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
# Hyprland session: UWSM-managed compositor, greetd login, portals, keyring and
|
||||
# the small system services a desktop needs. Noctalia, audio and fonts are
|
||||
# separate files gated on the same option.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.desktop.hyprland;
|
||||
in
|
||||
{
|
||||
options.my.desktop.hyprland.enable = lib.mkEnableOption "the Hyprland desktop session";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# package/portalPackage stay default: the overlay swaps in the flake builds.
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
settings = {
|
||||
Autologin = {
|
||||
Session = "hyprland.desktop";
|
||||
User = "faumaray";
|
||||
};
|
||||
};
|
||||
};
|
||||
services.greetd = {
|
||||
enable = false;
|
||||
# Keeps boot messages from drawing over the greeter.
|
||||
useTextGreeter = true;
|
||||
settings.default_session = {
|
||||
command = lib.concatStringsSep " " [
|
||||
(lib.getExe pkgs.tuigreet)
|
||||
"--time"
|
||||
"--remember"
|
||||
"--remember-user-session"
|
||||
"--asterisks"
|
||||
"--sessions ${config.services.displayManager.sessionData.desktops}/share/wayland-sessions"
|
||||
];
|
||||
user = "greeter";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.extraPortals = [
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
pkgs.xdg-desktop-portal-hyprland
|
||||
];
|
||||
|
||||
security.polkit.enable = true;
|
||||
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
security.pam.services.greetd.enableGnomeKeyring = true;
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# Electron/Chromium apps use native Wayland.
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
# Removable drives and trash/mounts in the file manager.
|
||||
services.udisks2.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wl-clipboard
|
||||
cliphist
|
||||
grim
|
||||
slurp
|
||||
brightnessctl
|
||||
playerctl
|
||||
pavucontrol
|
||||
kdePackages.dolphin
|
||||
kdePackages.dolphin-plugins
|
||||
hyprpicker
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
# Noctalia shell, system side. The user service is started by home-manager
|
||||
# (modules/home), so `programs.noctalia.systemd` stays off here.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = lib.mkIf config.my.desktop.hyprland.enable {
|
||||
programs.noctalia = {
|
||||
enable = true;
|
||||
package = pkgs.noctalia;
|
||||
# NetworkManager, Bluetooth, UPower and power-profiles-daemon, which the
|
||||
# shell's panels talk to.
|
||||
recommendedServices.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
# Steam + Proton, gamescope, gamemode and MangoHud.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.gaming;
|
||||
in
|
||||
{
|
||||
options.my.gaming.enable = lib.mkEnableOption "the gaming stack (Steam, Proton-GE, gamescope, gamemode)";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true;
|
||||
localNetworkGameTransfers.openFirewall = true;
|
||||
dedicatedServer.openFirewall = false;
|
||||
gamescopeSession.enable = true;
|
||||
extraCompatPackages = [ pkgs.proton-ge-bin ];
|
||||
protontricks.enable = true;
|
||||
# Steam Input on Wayland (controllers acting as keyboard/mouse).
|
||||
extest.enable = true;
|
||||
};
|
||||
|
||||
gamescope = {
|
||||
enable = false;
|
||||
# Lets gamescope raise its own priority.
|
||||
capSysNice = true;
|
||||
};
|
||||
|
||||
gamemode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general.renice = 10;
|
||||
gpu = {
|
||||
apply_gpu_optimisations = "accept-responsibility";
|
||||
gpu_device = 0;
|
||||
amd_performance_level = "high";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hardware.steam-hardware.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
mangohud
|
||||
protonplus
|
||||
];
|
||||
|
||||
# Some Proton games exhaust the default map count and crash.
|
||||
boot.kernel.sysctl."vm.max_map_count" = 2147483642;
|
||||
};
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
# AMD CPU + Radeon GPU. nixos-hardware (common-cpu-amd, -pstate, -gpu-amd,
|
||||
# -pc-ssd) is imported by the host; defaults that overlap use mkDefault.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.hardware.amd;
|
||||
in
|
||||
{
|
||||
options.my.hardware.amd = {
|
||||
enable = lib.mkEnableOption "AMD CPU and Radeon GPU support";
|
||||
|
||||
rocm.enable = lib.mkEnableOption "ROCm/HIP compute stack (rocminfo, rocm-smi, /opt/rocm/hip)";
|
||||
|
||||
lact.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "LACT daemon for GPU monitoring, fan curves and overclocking.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
hardware = {
|
||||
graphics = {
|
||||
enable = true;
|
||||
# Steam/Proton and Wine need the 32-bit Mesa drivers.
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
amdgpu = {
|
||||
initrd.enable = lib.mkDefault true;
|
||||
opencl.enable = true;
|
||||
};
|
||||
|
||||
cpu.amd.updateMicrocode = lib.mkDefault true;
|
||||
};
|
||||
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vulkan-tools
|
||||
mesa-demos
|
||||
radeontop
|
||||
nvtopPackages.amd
|
||||
lm_sensors
|
||||
];
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.lact.enable {
|
||||
services.lact.enable = true;
|
||||
# LACT needs the overdrive bit in amdgpu.ppfeaturemask to tune clocks.
|
||||
hardware.amdgpu.overdrive.enable = true;
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.rocm.enable {
|
||||
environment.systemPackages = with pkgs.rocmPackages; [
|
||||
rocminfo
|
||||
rocm-smi
|
||||
];
|
||||
|
||||
# Many HIP applications look for the runtime in /opt/rocm/hip.
|
||||
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
# Declarative disk layout, generated into `disko.devices` from `my.disks`.
|
||||
#
|
||||
# system disk (NVMe): ESP + btrfs "nixos" with @root @home @nix @log @swap
|
||||
# data disk (SATA): btrfs "data", one subvolume per home folder, each
|
||||
# mounted inside the user's home (~/Games, ~/Music, ...)
|
||||
#
|
||||
# `disko-install` / the install script partitions the disks from this; on a
|
||||
# running system the same data produces the matching `fileSystems` entries.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.disks;
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
user = config.my.user.name;
|
||||
home = "/home/${user}";
|
||||
folders = cfg.data.homeFolders;
|
||||
hasFolders = cfg.data.enable && folders != { };
|
||||
|
||||
# Compression keeps the NVMe small-write friendly; noatime avoids metadata writes.
|
||||
btrfsOptions = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
];
|
||||
|
||||
placeholderDevices = lib.filter (d: lib.hasInfix "CHANGE-ME" d) (
|
||||
[ cfg.system.device ] ++ lib.optional cfg.data.enable cfg.data.device
|
||||
);
|
||||
in
|
||||
{
|
||||
options.my.disks = {
|
||||
enable = lib.mkEnableOption "the disko-managed disk layout";
|
||||
|
||||
system = {
|
||||
device = mkOption {
|
||||
type = types.str;
|
||||
example = "/dev/disk/by-id/nvme-Samsung_SSD_990_PRO_1TB_S6XXXXXXXXXXXX";
|
||||
description = "Whole disk for the ESP and the btrfs root. Use a stable /dev/disk/by-id path.";
|
||||
};
|
||||
|
||||
espSize = mkOption {
|
||||
type = types.str;
|
||||
default = "2G";
|
||||
description = "Size of the EFI system partition (mounted on /boot).";
|
||||
};
|
||||
|
||||
swapSize = mkOption {
|
||||
type = types.str;
|
||||
default = "16G";
|
||||
description = "Size of the swapfile in the @swap subvolume.";
|
||||
};
|
||||
};
|
||||
|
||||
data = {
|
||||
enable = lib.mkEnableOption "the second (data) disk";
|
||||
|
||||
device = mkOption {
|
||||
type = types.str;
|
||||
example = "/dev/disk/by-id/ata-Samsung_SSD_870_EVO_2TB_S6XXXXXXXXXXXX";
|
||||
description = "Whole disk holding the home folder subvolumes.";
|
||||
};
|
||||
|
||||
mountOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
"compress=zstd:1"
|
||||
"noatime"
|
||||
# The machine still boots (to the system disk) if the SSD is missing.
|
||||
"nofail"
|
||||
"x-systemd.device-timeout=10s"
|
||||
];
|
||||
description = "Mount options of every data subvolume.";
|
||||
};
|
||||
|
||||
homeFolders = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options.subvolume = mkOption {
|
||||
type = types.str;
|
||||
default = "@" + lib.toLower name;
|
||||
defaultText = lib.literalExpression ''"@" + lib.toLower name'';
|
||||
description = "Btrfs subvolume backing this folder.";
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = { };
|
||||
example = lib.literalExpression ''{ Games = { }; Music.subvolume = "@tunes"; }'';
|
||||
description = ''
|
||||
Folders of the home directory that live on the data disk. The attribute
|
||||
name is the folder name and is mounted at /home/<user>/<name>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
disko.devices.disk.system = {
|
||||
type = "disk";
|
||||
inherit (cfg.system) device;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = cfg.system.espSize;
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
# Only root may read the ESP (random seed, lanzaboote images).
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [
|
||||
"-f"
|
||||
"-L"
|
||||
"nixos"
|
||||
];
|
||||
subvolumes = {
|
||||
"@root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
"@log" = {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = btrfsOptions;
|
||||
};
|
||||
# No compression on the swapfile's subvolume.
|
||||
"@swap" = {
|
||||
mountpoint = "/swap";
|
||||
mountOptions = [ "noatime" ];
|
||||
swap.swapfile.size = cfg.system.swapSize;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Logs must be mounted before journald starts in stage 2.
|
||||
fileSystems."/var/log".neededForBoot = true;
|
||||
|
||||
services.btrfs.autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
fileSystems = [
|
||||
"/"
|
||||
]
|
||||
++ lib.optional hasFolders "${home}/${lib.head (lib.attrNames folders)}";
|
||||
};
|
||||
|
||||
warnings = lib.optional (placeholderDevices != [ ]) ''
|
||||
my.disks still has placeholder device paths (${lib.concatStringsSep ", " placeholderDevices}).
|
||||
Run `nix run .#install`, or edit hosts/desktop/disk-ids.json, before installing.
|
||||
'';
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.data.enable {
|
||||
disko.devices.disk.data = {
|
||||
type = "disk";
|
||||
inherit (cfg.data) device;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions.data = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [
|
||||
"-f"
|
||||
"-L"
|
||||
"data"
|
||||
];
|
||||
subvolumes = lib.mapAttrs' (
|
||||
name: folder:
|
||||
lib.nameValuePair folder.subvolume {
|
||||
mountpoint = "${home}/${name}";
|
||||
inherit (cfg.data) mountOptions;
|
||||
}
|
||||
) folders;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Subvolume roots are created root-owned; hand them to the user. The
|
||||
# home directory itself is listed first so the mount points have a parent.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${home} 0700 ${user} users -"
|
||||
]
|
||||
++ lib.mapAttrsToList (name: _: "d ${home}/${name} 0755 ${user} users -") folders;
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
# agenix secrets. Every secret file is optional: a secret is only declared when
|
||||
# its .age file exists in `my.secrets.dir`, so a fresh clone still evaluates.
|
||||
#
|
||||
# <user>-password.age hashed login password (mkpasswd -m yescrypt)
|
||||
# ssh-<key>.age private SSH key, installed for the user (home-manager
|
||||
# links it to ~/.ssh/<key>)
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.secrets;
|
||||
user = config.my.user.name;
|
||||
|
||||
secretFile = name: cfg.dir + "/${name}.age";
|
||||
exists = name: builtins.pathExists (secretFile name);
|
||||
|
||||
passwordSecrets = lib.optionalAttrs (exists "${user}-password") {
|
||||
"${user}-password" = {
|
||||
file = secretFile "${user}-password";
|
||||
mode = "0400";
|
||||
};
|
||||
};
|
||||
|
||||
sshSecrets = lib.listToAttrs (
|
||||
map (
|
||||
key:
|
||||
lib.nameValuePair "ssh-${key}" {
|
||||
file = secretFile "ssh-${key}";
|
||||
owner = user;
|
||||
mode = "0400";
|
||||
}
|
||||
) (lib.filter (key: exists "ssh-${key}") cfg.userSshKeys)
|
||||
);
|
||||
in
|
||||
{
|
||||
options.my.secrets = {
|
||||
enable = lib.mkEnableOption "agenix secrets from the repository's secrets/ directory";
|
||||
|
||||
dir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = ../../../secrets;
|
||||
defaultText = lib.literalExpression "../../../secrets";
|
||||
description = ''
|
||||
Directory holding the *.age files. In a flake only files tracked by git
|
||||
are visible, so `git add` new secrets before building.
|
||||
'';
|
||||
};
|
||||
|
||||
userSshKeys = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
"id_ed25519"
|
||||
"id_ed25519_work"
|
||||
];
|
||||
description = "SSH key names; each maps to secrets/ssh-<name>.age if present.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# The host key is generated on the install USB (`create-keys`) and copied
|
||||
# to the target, so secrets can be decrypted on the very first boot.
|
||||
age.identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
age.secrets = passwordSecrets // sshSecrets;
|
||||
|
||||
environment.systemPackages = [
|
||||
inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
pkgs.age
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Key-only OpenSSH server. The host key is also the agenix identity.
|
||||
{
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
};
|
||||
hostKeys = [
|
||||
{
|
||||
type = "ed25519";
|
||||
path = "/etc/ssh/ssh_host_ed25519_key";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# The keyring (NixOS) and home-manager provide the agent.
|
||||
programs.ssh.startAgent = false;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
# agenix. The module itself is part of `core`, so `config.age.secrets` always
|
||||
# exists (users.nix, install-facts.nix and the home-manager ssh aspect read
|
||||
# it). The `secrets` aspect decrypts the owner's secrets with the host key.
|
||||
#
|
||||
# Every secret is optional: it is declared only when its .age file exists in
|
||||
# meta.secretsDir, so a fresh clone still evaluates.
|
||||
# <owner>-password.age hashed login password (mkpasswd -m yescrypt)
|
||||
# ssh-<key>.age private SSH key of the owner (meta.owner.sshKeys);
|
||||
# home-manager links it to ~/.ssh/<key> (security/ssh.nix)
|
||||
# Service secrets are declared next to their service (dev/gitea-runner.nix,
|
||||
# network/proxy-suite.nix) with the same pattern.
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.meta) owner secretsDir;
|
||||
|
||||
secretFile = name: secretsDir + "/${name}.age";
|
||||
exists = name: builtins.pathExists (secretFile name);
|
||||
|
||||
passwordSecrets = lib.optionalAttrs (exists "${owner.name}-password") {
|
||||
"${owner.name}-password" = {
|
||||
file = secretFile "${owner.name}-password";
|
||||
mode = "0400";
|
||||
};
|
||||
};
|
||||
|
||||
sshSecrets = lib.listToAttrs (
|
||||
map (
|
||||
key:
|
||||
lib.nameValuePair "ssh-${key}" {
|
||||
file = secretFile "ssh-${key}";
|
||||
owner = owner.name;
|
||||
mode = "0400";
|
||||
}
|
||||
) (lib.filter (key: exists "ssh-${key}") owner.sshKeys)
|
||||
);
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.core.imports = [ inputs.agenix.nixosModules.default ];
|
||||
|
||||
flake.modules.nixos.secrets =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# The host key is generated on the install USB (`create-keys`) and copied
|
||||
# to the target, so secrets can be decrypted on the very first boot.
|
||||
age.identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
age.secrets = passwordSecrets // sshSecrets;
|
||||
|
||||
environment.systemPackages = [
|
||||
inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
pkgs.age
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
# SSH, both halves:
|
||||
# NixOS key-only OpenSSH server; its host key is also the agenix identity.
|
||||
# home-manager the owner's client config, agent and keys. Private keys are
|
||||
# agenix secrets decrypted into /run/agenix (security/secrets.nix);
|
||||
# this only links them into ~/.ssh, reading what the NixOS side
|
||||
# declared through `osConfig.age.secrets`.
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (config.meta) owner secretsDir;
|
||||
hmSsh = config.flake.modules.homeManager.ssh;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.ssh = {
|
||||
home-manager.users.${owner.name}.imports = [ hmSsh ];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
};
|
||||
hostKeys = [
|
||||
{
|
||||
type = "ed25519";
|
||||
path = "/etc/ssh/ssh_host_ed25519_key";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# home-manager's ssh-agent service provides the agent.
|
||||
programs.ssh.startAgent = false;
|
||||
};
|
||||
|
||||
flake.modules.homeManager.ssh =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Keys that have a secret on this host. Without one nothing is linked, so
|
||||
# a fresh install still works and ssh uses whatever key the user makes.
|
||||
keys = lib.filter (k: osConfig.age.secrets ? "ssh-${k}") owner.sshKeys;
|
||||
|
||||
pubFile = k: secretsDir + "/ssh-${k}.pub";
|
||||
|
||||
# The decrypted file lives outside the store, so link it by absolute path.
|
||||
keyFiles = lib.listToAttrs (
|
||||
map (
|
||||
k:
|
||||
lib.nameValuePair ".ssh/${k}" {
|
||||
source = config.lib.file.mkOutOfStoreSymlink osConfig.age.secrets."ssh-${k}".path;
|
||||
}
|
||||
) keys
|
||||
);
|
||||
|
||||
# Public keys are not secret, so they are plain files from the repo.
|
||||
pubFiles = lib.listToAttrs (
|
||||
map (k: lib.nameValuePair ".ssh/${k}.pub" { source = pubFile k; }) (
|
||||
lib.filter (k: builtins.pathExists (pubFile k)) keys
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
# Spell the defaults out below instead of relying on the deprecated ones.
|
||||
enableDefaultConfig = false;
|
||||
|
||||
settings = {
|
||||
"*" = {
|
||||
# Load a key into the agent on first use, so the passphrase (if any)
|
||||
# is typed once per login.
|
||||
AddKeysToAgent = "yes";
|
||||
ServerAliveInterval = 60;
|
||||
ServerAliveCountMax = 3;
|
||||
HashKnownHosts = false;
|
||||
UserKnownHostsFile = "~/.ssh/known_hosts";
|
||||
};
|
||||
|
||||
"github.com" = {
|
||||
User = "git";
|
||||
IdentityFile = "~/.ssh/id_ed25519";
|
||||
# Offer only this key, not everything in the agent.
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
"git.protei.ru" = {
|
||||
User = "git";
|
||||
IdentityFile = "~/.ssh/id_ed25519_work";
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# A plain user service rather than gnome-keyring's agent: no keyring to
|
||||
# unlock, and it sets SSH_AUTH_SOCK for shells, systemd and D-Bus.
|
||||
services.ssh-agent.enable = true;
|
||||
|
||||
home.file = keyFiles // pubFiles;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
# Theme: one palette, fonts, cursor and icons for the whole desktop, applied by
|
||||
# Stylix (github:nix-community/stylix).
|
||||
# NixOS Stylix itself (its home-manager module is added to every
|
||||
# home-manager user and inherits these settings), the TTY
|
||||
# palette and the default font families.
|
||||
# home-manager which programs Stylix themes.
|
||||
# Targets are opt-in (`autoEnable = false`): Stylix touches only what is listed
|
||||
# here. A new program that Stylix supports gets its `stylix.targets.<name>`
|
||||
# line in this file.
|
||||
{ config, inputs, ... }:
|
||||
let
|
||||
inherit (config.meta) owner;
|
||||
hmTheme = config.flake.modules.homeManager.theme;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.theme =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.stylix.nixosModules.stylix ];
|
||||
|
||||
home-manager.users.${owner.name}.imports = [ hmTheme ];
|
||||
|
||||
stylix = {
|
||||
enable = true;
|
||||
# With autoEnable Stylix would also write GNOME, KDE, X resources, gedit,
|
||||
# gdu, Blender, ... configs and rebuild gtksourceview through an overlay.
|
||||
autoEnable = false;
|
||||
|
||||
polarity = "dark";
|
||||
|
||||
# Catppuccin Mocha, from tinted-theming/schemes base16/catppuccin-mocha.yaml.
|
||||
# Inline, so evaluation needs no import-from-derivation. Another scheme:
|
||||
# base16Scheme = "${pkgs.base16-schemes}/share/themes/<name>.yaml";
|
||||
base16Scheme = {
|
||||
scheme = "Catppuccin Mocha";
|
||||
author = "https://github.com/catppuccin/catppuccin";
|
||||
slug = "catppuccin-mocha";
|
||||
variant = "dark";
|
||||
base00 = "1e1e2e"; # base
|
||||
base01 = "181825"; # mantle
|
||||
base02 = "313244"; # surface0
|
||||
base03 = "45475a"; # surface1
|
||||
base04 = "585b70"; # surface2
|
||||
base05 = "cdd6f4"; # text
|
||||
base06 = "f5e0dc"; # rosewater
|
||||
base07 = "b4befe"; # lavender
|
||||
base08 = "f38ba8"; # red
|
||||
base09 = "fab387"; # peach
|
||||
base0A = "f9e2af"; # yellow
|
||||
base0B = "a6e3a1"; # green
|
||||
base0C = "94e2d5"; # teal
|
||||
base0D = "89b4fa"; # blue
|
||||
base0E = "cba6f7"; # mauve
|
||||
base0F = "f2cdcd"; # flamingo
|
||||
};
|
||||
|
||||
# No wallpaper: Noctalia draws it, so every Stylix wallpaper part stays off.
|
||||
image = null;
|
||||
|
||||
fonts = {
|
||||
monospace = {
|
||||
package = pkgs.monaspace;
|
||||
name = "Monaspace Radon";
|
||||
};
|
||||
sansSerif = {
|
||||
package = pkgs.inter;
|
||||
name = "Inter";
|
||||
};
|
||||
serif = {
|
||||
package = pkgs.noto-fonts;
|
||||
name = "Noto Serif";
|
||||
};
|
||||
emoji = {
|
||||
package = pkgs.noto-fonts-color-emoji;
|
||||
name = "Noto Color Emoji";
|
||||
};
|
||||
};
|
||||
|
||||
cursor = {
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Classic";
|
||||
size = 24;
|
||||
};
|
||||
|
||||
icons = {
|
||||
enable = true;
|
||||
package = pkgs.papirus-icon-theme;
|
||||
dark = "Papirus-Dark";
|
||||
light = "Papirus-Light";
|
||||
};
|
||||
|
||||
targets = {
|
||||
# TTY palette (vt.default_{red,grn,blu} kernel parameters).
|
||||
console.enable = true;
|
||||
# fontconfig default families from `fonts` above, and their packages.
|
||||
fontconfig.enable = true;
|
||||
font-packages.enable = true;
|
||||
# programs.dconf, which home-manager's GTK settings need.
|
||||
gtk.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
flake.modules.homeManager.theme = {
|
||||
stylix.targets = {
|
||||
gtk = {
|
||||
enable = true;
|
||||
# No Flatpak here: do not write ~/.themes or Flatpak overrides.
|
||||
flatpakSupport.enable = false;
|
||||
};
|
||||
qt.enable = true;
|
||||
hyprland.enable = true;
|
||||
noctalia = {
|
||||
enable = true;
|
||||
# Keep Noctalia's own panel opacities and the shell font chosen for it.
|
||||
opacity.enable = false;
|
||||
fonts.override.sansSerif.name = "Monaspace Krypton";
|
||||
};
|
||||
wezterm = {
|
||||
enable = true;
|
||||
fonts.override.monospace.name = "Monaspace Krypton";
|
||||
};
|
||||
bat.enable = true;
|
||||
btop.enable = true;
|
||||
fzf.enable = true;
|
||||
starship.enable = true;
|
||||
mpv.enable = true;
|
||||
zathura.enable = true;
|
||||
# Not enabled:
|
||||
# - neovim: cli/neovim/init.lua still sets the catppuccin colorscheme;
|
||||
# Stylix's mini.base16 would run after it and stack a second one.
|
||||
# - firefox: needs a declared profile (programs.firefox.profiles);
|
||||
# declaring one would replace the existing Firefox profile.
|
||||
};
|
||||
|
||||
# libadwaita/GTK 4 apps read the preference from dconf.
|
||||
gtk.colorScheme = "dark";
|
||||
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# faumaray, the owner of this flake. Identity data only; the aspects read it
|
||||
# through `config.meta.owner` (schema: modules/flake/meta.nix).
|
||||
{
|
||||
meta.owner = {
|
||||
name = "faumaray";
|
||||
fullName = "faumaray";
|
||||
email = "faumaray@gmail.com";
|
||||
sshKeys = [
|
||||
"id_ed25519"
|
||||
"id_ed25519_work"
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user