feat(mc): add midnight commander with declarative config

Public baseline module: installs `mc` plus `ouch` (backs the F2 pack/unpack
entries, archive format inferred from the extension), and ships `ini`, `menu`,
and a generated `panels.ini` into `$XDG_CONFIG_HOME/mc`.

`local.mc.otherDir` exposes the other-panel start dir as an option defaulting
to `config.home.homeDirectory`, so the one personal value isn't baked in. The
F2 user menu is trimmed to the entries that match this config (imv/zathura/mpv
openers, ouch pack/unpack, man view); the stock rcp/uudecode/news/latex cruft
is dropped. `auto_save_setup=false` keeps mc from rewriting the read-only store
symlinks on exit.
This commit is contained in:
2026-07-10 22:46:32 +02:00
parent 8f9eff1640
commit eab578e699
4 changed files with 263 additions and 1 deletions
+72
View File
@@ -0,0 +1,72 @@
# Midnight Commander: TUI file manager. Its config (ini, panels, F2 user menu)
# is opinionated but generic, so it lives in the public baseline alongside the
# other desktop tooling. The only personal value is the right-panel start dir,
# exposed as an option defaulting to the consumer's own home.
#
# ouch backs the F2 pack/unpack entries (one tool, archive format inferred from
# the extension), so it ships with mc to keep the menu self-contained.
#
# mc honours XDG natively: config in $XDG_CONFIG_HOME/mc (the files below),
# mutable runtime state (history, cursor positions) in $XDG_DATA_HOME/mc — no
# env vars needed. `ini` sets auto_save_setup=false so mc never rewrites these
# read-only store symlinks on exit.
{ config, lib, pkgs, ... }:
{
options.local.mc.otherDir = lib.mkOption {
type = lib.types.str;
default = config.home.homeDirectory;
defaultText = lib.literalExpression "config.home.homeDirectory";
description = "Startup directory for mc's other (right) panel.";
};
config = {
home.packages = [ pkgs.mc pkgs.ouch ];
xdg.configFile = {
"mc/ini".source = ./assets/mc/ini;
"mc/menu".source = ./assets/mc/menu;
# Generated (not a static asset) so other_dir tracks the option instead of
# baking in a personal path.
"mc/panels.ini".text = ''
[New Left Panel]
display=listing
reverse=false
case_sensitive=true
exec_first=false
sort_order=name
list_mode=full
brief_cols=2
user_format=half type name | size | perm | mtime
user_status0=half type name | size | perm
user_status1=half type name | size | perm
user_status2=half type name | size | perm
user_status3=half type name | owner | group | ctime
user_mini_status=true
list_format=user
[New Right Panel]
display=listing
reverse=false
case_sensitive=true
exec_first=false
sort_order=name
list_mode=full
brief_cols=2
user_format=half type name | size | perm | mtime
user_status0=half type name | size | perm
user_status1=half type name | size | perm
user_status2=half type name | size | perm
user_status3=half type name | owner | group | ctime
user_mini_status=true
list_format=user
[Dirs]
current_is_left=true
other_dir=${config.local.mc.otherDir}
'';
};
};
}