refactor: change to litterate config
Configuration is now held by the `.org` files. All `.nix` files are tangled from the org-mode files.
This commit is contained in:
@@ -14,6 +14,7 @@ in {
|
||||
m.cli
|
||||
m.desktop
|
||||
m.dev
|
||||
m.games
|
||||
m.media
|
||||
m.my-services
|
||||
m.security
|
||||
@@ -32,6 +33,7 @@ in {
|
||||
cli.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
desktop.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
dev.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
games.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
media.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
security.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
myServices.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
|
||||
@@ -68,15 +68,12 @@
|
||||
};
|
||||
osd.enableMicrophone = true;
|
||||
bar = {
|
||||
status = {
|
||||
showAudio = true;
|
||||
showKbLayout = false;
|
||||
};
|
||||
# status = {
|
||||
# showAudio = true;
|
||||
# showKbLayout = false;
|
||||
# };
|
||||
tray.compact = true;
|
||||
};
|
||||
services = mkIf (config.home.gpuType != null) {
|
||||
inherit (config.home) gpuType;
|
||||
};
|
||||
session.commands = {
|
||||
logout = ["uwsm" "stop"];
|
||||
shutdown = ["systemctl" "poweroff"];
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{config, ...}: let
|
||||
m = config.flake.modules.homeManager;
|
||||
in {
|
||||
flake.modules.homeManager.games = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games;
|
||||
in {
|
||||
imports = [
|
||||
m.mangohud
|
||||
m.game-packages
|
||||
];
|
||||
|
||||
options.home.games.fullDesktop = mkEnableOption "Enable all optional game-related modules";
|
||||
config.home.games = {
|
||||
mangohud.enable = mkDefault cfg.fullDesktop;
|
||||
game-packages.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#+title: Games
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* Games
|
||||
A small category to group everything gaming-related: performance
|
||||
overlays, launchers, and whatever else I add to it later. Here’s the
|
||||
skeleton of the =homeManager.games= module.
|
||||
#+begin_src nix :tangle yes
|
||||
{config, ...}: let
|
||||
m = config.flake.modules.homeManager;
|
||||
in {
|
||||
flake.modules.homeManager.games = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games;
|
||||
in {
|
||||
imports = [
|
||||
m.mangohud
|
||||
m.game-packages
|
||||
];
|
||||
|
||||
<<fulldesktop-option>>
|
||||
<<fulldesktop-cascade>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** The =fullDesktop= Toggle
|
||||
Like my other categories, =fullDesktop= is the one switch that turns
|
||||
everything in this category on by default, while still letting a host
|
||||
override one specific piece if it wants to.
|
||||
#+name: fulldesktop-option
|
||||
#+begin_src nix
|
||||
options.home.games.fullDesktop = mkEnableOption "Enable all optional game-related modules";
|
||||
#+end_src
|
||||
|
||||
#+name: fulldesktop-cascade
|
||||
#+begin_src nix
|
||||
config.home.games = {
|
||||
mangohud.enable = mkDefault cfg.fullDesktop;
|
||||
game-packages.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
#+end_src
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
flake.modules.homeManager.mangohud = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games.mangohud;
|
||||
in {
|
||||
options.home.games.mangohud.enable = mkEnableOption "Enable MangoHud performance overlay";
|
||||
config.programs.mangohud = mkIf cfg.enable {
|
||||
enable = true;
|
||||
enableSessionWide = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#+title: MangoHud
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* MangoHud
|
||||
[[https://github.com/flightlessmango/MangoHud][MangoHud]] is the performance overlay I use to keep an eye on FPS, frame
|
||||
time and GPU/CPU usage while gaming. Here’s the =homeManager.mangohud=
|
||||
module.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.homeManager.mangohud = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games.mangohud;
|
||||
in {
|
||||
<<options>>
|
||||
<<config>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Declaring the Option
|
||||
#+name: options
|
||||
#+begin_src nix
|
||||
options.home.games.mangohud.enable = mkEnableOption "Enable MangoHud performance overlay";
|
||||
#+end_src
|
||||
|
||||
** Enabling It Session-Wide
|
||||
=enableSessionWide= turns MangoHud on for my whole session. It
|
||||
auto-launches for any game or app that supports it.
|
||||
#+name: config
|
||||
#+begin_src nix
|
||||
config.programs.mangohud = mkIf cfg.enable {
|
||||
enable = true;
|
||||
enableSessionWide = true;
|
||||
};
|
||||
#+end_src
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
flake.modules.homeManager.game-packages = {
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games.game-packages;
|
||||
vs-cairn = pkgs.callPackage ../../../packages/cairn.nix {};
|
||||
in {
|
||||
options.home.games.game-packages.enable = mkEnableOption "Install game launchers and clients";
|
||||
config.home.packages = mkIf cfg.enable (with pkgs; [
|
||||
atlauncher
|
||||
heroic
|
||||
openmw
|
||||
openttd-jgrpp
|
||||
moonlight-qt
|
||||
vintagestory
|
||||
vs-cairn
|
||||
]);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
#+title: Game Launchers
|
||||
#+setupfile: ../../headers
|
||||
|
||||
* Game Launchers
|
||||
The actual game launchers and clients I use, kept separate from my
|
||||
catch-all package list so they only show up on hosts that actually
|
||||
want them. Here’s the =homeManager.game-packages= module.
|
||||
#+begin_src nix :tangle yes
|
||||
{
|
||||
flake.modules.homeManager.game-packages = {
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.games.game-packages;
|
||||
<<cairn-decl>>
|
||||
in {
|
||||
<<options>>
|
||||
<<config>>
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Declaring the Option
|
||||
#+name: options
|
||||
#+begin_src nix
|
||||
options.home.games.game-packages.enable = mkEnableOption "Install game launchers and clients";
|
||||
#+end_src
|
||||
|
||||
** The Packages
|
||||
=atlauncher= and =heroic= are launchers for Minecraft and for
|
||||
Epic/GOG/Amazon respectively. =openmw= is an open-source
|
||||
reimplementation of Morrowind’s engine. It makes the experience a lot
|
||||
more enjoyable, especially on a 2K 21:9 screen like the one I use on
|
||||
my main computer. =openttd-jgrpp= is OpenTTD with the JGR patchpack.
|
||||
=moonlight-qt= lets me stream from my gaming machine to another one on
|
||||
the network (mostly via Tailscale).
|
||||
#+name: config
|
||||
#+begin_src nix
|
||||
config.home.packages = mkIf cfg.enable (with pkgs; [
|
||||
atlauncher
|
||||
heroic
|
||||
openmw
|
||||
openttd-jgrpp
|
||||
moonlight-qt
|
||||
<<vs-packages>>
|
||||
]);
|
||||
#+end_src
|
||||
|
||||
** VintageStory
|
||||
The game =vintagestory= is, well, Vintage Story, and where all my free
|
||||
time has been disappearing into since early 2026. I also package
|
||||
myself [[https://cairns.gg/][Cairns]], as there isn’t any official Nix package as far as I am
|
||||
aware.
|
||||
|
||||
First, to keep things simple, let me import the Cairns package into
|
||||
our module. I call it =vs-cairn= in this module to ensure there is no
|
||||
name conflict with any other package.
|
||||
#+name: cairn-decl
|
||||
#+begin_src nix
|
||||
vs-cairn = pkgs.callPackage ../../../packages/cairn.nix {};
|
||||
#+end_src
|
||||
|
||||
Now, wee can add both =vintagestory= and =vs-cairn= to the list of
|
||||
installed packages.
|
||||
#+name: vs-packages
|
||||
#+begin_src nix
|
||||
vintagestory
|
||||
vs-cairn
|
||||
#+end_src
|
||||
|
||||
*** Packaging Cairn
|
||||
#+name: metadata-source
|
||||
| Name | Cairns |
|
||||
| Package Name | cairn |
|
||||
| Package Version | 0.9.11 |
|
||||
| Description | Modpacks for Vintage Story |
|
||||
| Website | https://cairns.gg/ |
|
||||
|
||||
#+name: metadata
|
||||
#+begin_src emacs-lisp :exports none :var metadata=metadata-source meta="pname" quotes="yes"
|
||||
(let ((out (cadr (nth (cond ((string= "name" meta) 0)
|
||||
((string= "pname" meta) 1)
|
||||
((string= "version" meta) 2)
|
||||
((string= "description" meta) 3)
|
||||
((string= "website" meta) 4))
|
||||
metadata))))
|
||||
(if (string= quotes "yes") (format "\"%s\"" out)
|
||||
out))
|
||||
#+end_src
|
||||
|
||||
The binary =cairn= is a self-contained .NET single-file bundle: the
|
||||
native apphost has a trailer baking in an absolute offset to the
|
||||
embedded bundle manifest, so any rewrite of the binary
|
||||
(=autoPatchelfHook=, or even the default fixup strip/shrink-rpath passes
|
||||
of =stdenv=) shifts that offset and the binary refuses to start. We must
|
||||
therefore leave the binary bytes untouched and instead feed its
|
||||
runtime =dlopen()= calls (SkiaSharp, Avalonia's X11 backend, ...)
|
||||
through =LD_LIBRARY_PATH= via a wrapper.
|
||||
#+begin_src nix :tangle ../../../packages/cairn.nix
|
||||
# https://cairns.gg/
|
||||
{
|
||||
stdenv,
|
||||
fetchzip,
|
||||
makeWrapper,
|
||||
lib,
|
||||
fontconfig,
|
||||
freetype,
|
||||
libx11,
|
||||
libxext,
|
||||
libxrandr,
|
||||
libxinerama,
|
||||
libxi,
|
||||
libxcursor,
|
||||
libxrender,
|
||||
libxfixes,
|
||||
libxtst,
|
||||
libxcb,
|
||||
libxkbcommon,
|
||||
libglvnd,
|
||||
libICE,
|
||||
libSM,
|
||||
dbus,
|
||||
libxshmfence,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = <<metadata()>>;
|
||||
version = <<metadata(meta="version")>>;
|
||||
src = fetchzip {
|
||||
url = "https://download.cairns.gg/releases/${version}/${pname}-${version}-linux-x64.tar.gz";
|
||||
hash = "sha256-UbjeEbP4o6y+0j1oeF3RwqTuunGB5wD0CSpdFDk97/U=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
|
||||
dontBuild = true;
|
||||
dontPatchELF = true;
|
||||
dontStrip = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 $src/cairn $out/bin/cairn
|
||||
wrapProgram $out/bin/cairn \
|
||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
|
||||
stdenv.cc.cc.lib
|
||||
fontconfig
|
||||
freetype
|
||||
libx11
|
||||
libxext
|
||||
libxrandr
|
||||
libxinerama
|
||||
libxi
|
||||
libxcursor
|
||||
libxrender
|
||||
libxfixes
|
||||
libxtst
|
||||
libxcb
|
||||
libxkbcommon
|
||||
libglvnd
|
||||
libICE
|
||||
libSM
|
||||
dbus
|
||||
libxshmfence
|
||||
]}
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cat > $out/share/applications/cairn.desktop <<EOF
|
||||
<<cairns-desktop>>
|
||||
EOF
|
||||
|
||||
install -Dm644 ${./cairn.svg} $out/share/icons/hicolor/scalable/apps/${pname}.svg
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = <<metadata(meta="description")>>;
|
||||
homepage = <<metadata(meta="website")>>;
|
||||
platforms = ["x86_64-linux"];
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
There is no official =.desktop= file for Cairns, so let me create one.
|
||||
#+name: cairns-desktop
|
||||
#+begin_src conf-desktop :tangle no :noweb yes
|
||||
[Desktop Entry]
|
||||
Version=<<metadata(meta="version", quotes="no")>>
|
||||
Name=<<metadata(meta="name", quotes="no")>>
|
||||
Comment=<<metadata(meta="description", quotes="no")>>
|
||||
Exec=$out/bin/cairn
|
||||
Icon=<<metadata(meta="pname", quotes="no")>>
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Games
|
||||
#+end_src
|
||||
@@ -1,7 +1,11 @@
|
||||
{config, ...}: let
|
||||
m = config.flake.modules.homeManager;
|
||||
in {
|
||||
flake.modules.homeManager."phundrak-marpa" = {config, ...}: {
|
||||
flake.modules.homeManager."phundrak-marpa" = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [m.phundrak];
|
||||
|
||||
home = {
|
||||
@@ -11,6 +15,9 @@ in {
|
||||
dev.ai = {
|
||||
enable = true;
|
||||
ollama.gpu = "rocm";
|
||||
mcpServers = {
|
||||
nix.command = "${pkgs.mcp-nixos}/bin/mcp-nixos";
|
||||
};
|
||||
};
|
||||
desktop = {
|
||||
hyprland.host = "marpa";
|
||||
@@ -18,9 +25,9 @@ in {
|
||||
};
|
||||
phundrak.sshKey.content = builtins.readFile ../keys/id_marpa.pub;
|
||||
};
|
||||
programs.caelestia.settings.bar.status = {
|
||||
showBattery = false;
|
||||
showWifi = false;
|
||||
};
|
||||
# programs.caelestia.settings.bar.status = {
|
||||
# showBattery = false;
|
||||
# showWifi = false;
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -56,13 +56,6 @@
|
||||
watchmate
|
||||
chatterino7
|
||||
|
||||
# Games
|
||||
atlauncher
|
||||
heroic
|
||||
openmw
|
||||
openttd-jgrpp
|
||||
moonlight-qt
|
||||
|
||||
# Gnome stuff
|
||||
gnomeExtensions.tray-icons-reloaded
|
||||
gthumb
|
||||
|
||||
Reference in New Issue
Block a user