programs: remove explicit default definitions

This commit is contained in:
2023-07-03 07:49:44 +00:00
parent 9f1d61c781
commit 9340d5f391
7 changed files with 312 additions and 416 deletions

View File

@@ -1,173 +1,120 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let {
inherit (builtins) attrNames; sane.programs = {
# PACKAGE SETS
flattenedPkgs = pkgs // (with pkgs; { consoleMediaUtils = {
# XXX can't `inherit` a nested attr, so we move them to the toplevel package = null;
"cacert.unbundled" = pkgs.cacert.unbundled; suggestedPrograms = [
"gnome.cheese" = gnome.cheese; "ffmpeg"
"gnome.dconf-editor" = gnome.dconf-editor; "imagemagick"
"gnome.file-roller" = gnome.file-roller; "sox"
"gnome.gnome-disk-utility" = gnome.gnome-disk-utility; "yt-dlp"
"gnome.gnome-maps" = gnome.gnome-maps; ];
"gnome.nautilus" = gnome.nautilus;
"gnome.gnome-system-monitor" = gnome.gnome-system-monitor;
"gnome.gnome-terminal" = gnome.gnome-terminal;
"gnome.gnome-weather" = gnome.gnome-weather;
"gnome.totem" = gnome.totem;
"libsForQt5.plasmatube" = libsForQt5.plasmatube;
});
sysadminPkgs = {
inherit (flattenedPkgs)
btrfs-progs
"cacert.unbundled" # some services require unbundled /etc/ssl/certs
cryptsetup
dig
efibootmgr
fatresize
fd
file
gawk
git
gptfdisk
hdparm
htop
iftop
inetutils # for telnet
iotop
iptables
jq
killall
lsof
miniupnpc
nano
neovim
netcat
nethogs
nmap
openssl
parted
pciutils
powertop
pstree
ripgrep
screen
smartmontools
socat
strace
subversion
tcpdump
tree
usbutils
wget
wirelesstools # iwlist
;
};
sysadminExtraPkgs = {
# application-specific packages
inherit (pkgs)
backblaze-b2
duplicity
sqlite # to debug sqlite3 databases
;
};
iphonePkgs = {
inherit (pkgs)
ifuse
ipfs
libimobiledevice
;
};
tuiPkgs = {
inherit (pkgs)
aerc # email client
msmtp # sendmail
offlineimap # email mailox sync
sfeed # RSS fetcher
visidata # TUI spreadsheet viewer/editor
w3m
;
};
consoleMediaPkgs = {
inherit (pkgs)
ffmpeg
imagemagick
sox
yt-dlp
;
}; };
# TODO: split these into smaller groups. # TODO: split these into smaller groups.
# - moby doesn't want a lot of these. # - moby doesn't want a lot of these.
# - categories like # - categories like
# - dev? # - dev?
# - debugging? # - debugging?
consolePkgs = { consoleUtils = {
inherit (pkgs) package = null;
alsaUtils # for aplay, speaker-test suggestedPrograms = [
# cdrtools "alsaUtils" # for aplay, speaker-test
clinfo # "cdrtools"
dmidecode "clinfo"
efivar "dmidecode"
# flashrom "efivar"
fwupd # "flashrom"
gh # MS GitHub cli "fwupd"
git # needed as a user package, for config. "gh" # MS GitHub cli
# gnupg "git" # needed as a user package, for config.
# gocryptfs # "gnupg"
# gopass # "gocryptfs"
# gopass-jsonapi # "gopass"
kitty # TODO: move to GUI, but `ssh servo` from kitty sets `TERM=xterm-kitty` in the remove and breaks things # "gopass-jsonapi"
libsecret # for managing user keyrings. TODO: what needs this? lift into the consumer "kitty" # TODO: move to GUI, but `ssh servo` from kitty sets `TERM=xterm-kitty` in the remove and breaks things
lm_sensors # for sensors-detect. TODO: what needs this? lift into the consumer "libsecret" # for managing user keyrings. TODO: what needs this? lift into the consumer
lshw "lm_sensors" # for sensors-detect. TODO: what needs this? lift into the consumer
# memtester "lshw"
neovim # needed as a user package, for swap persistence # "memtester"
# nettools "neovim" # needed as a user package, for swap persistence
# networkmanager # "nettools"
nix-index # "networkmanager"
nixpkgs-review "nix-index"
# nixos-generators "nixpkgs-review"
nmon # "nixos-generators"
# node2nix "nmon"
# oathToolkit # for oathtool # "node2nix"
# ponymix # "oathToolkit" # for oathtool
pulsemixer # "ponymix"
python3 "pulsemixer"
ripgrep # needed as a user package so that its user-level config file can be installed "python3"
rsync "ripgrep" # needed as a user package so that its user-level config file can be installed
# python3Packages.eyeD3 # music tagging "rsync"
sane-scripts # "python3Packages.eyeD3" # music tagging
sequoia "sane-scripts"
snapper "sequoia"
sops "snapper"
speedtest-cli "sops"
# ssh-to-age "speedtest-cli"
sudo # "ssh-to-age"
# tageditor # music tagging "sudo"
unar # "tageditor" # music tagging
wireguard-tools "unar"
xdg-terminal-exec "wireguard-tools"
xdg-utils # for xdg-open "xdg-terminal-exec"
# yarn "xdg-utils" # for xdg-open
zsh # "yarn"
; "zsh"
];
}; };
desktopGuiApps = {
guiPkgs = { package = null;
inherit (flattenedPkgs) suggestedPrograms = [
# celluloid # mpv frontend "audacity"
cozy # audiobook player "blanket" # ambient noise generator
# emote "brave" # for the integrated wallet -- as a backup
evince # works on phosh "chromium"
"dino"
"electrum"
"element-desktop"
# "font-manager" #< depends on webkitgtk4_0 (expensive to build)
"gajim" # XMPP client
"gimp" # broken on phosh
"gnome.dconf-editor"
"gnome.gnome-disk-utility"
# "gnome.totem" # video player, supposedly supports UPnP
"handbrake"
"hase"
"inkscape"
"jellyfin-media-player"
"kdenlive"
"kid3" # audio tagging
"krita"
"libreoffice-fresh"
"mumble"
"obsidian"
"slic3r"
"steam"
"wireshark" # could maybe ship the cli as sysadmin pkg
];
};
guiApps = {
package = null;
suggestedPrograms = [
"web-browser"
"tuiApps"
] ++ lib.optional (pkgs.system == "x86_64-linux") "x86GuiApps"
++ [
# "celluloid" # mpv frontend
"cozy" # audiobook player
# "emote"
"evince" # works on phosh
# { pkg = fluffychat-moby; persist.plaintext = [ ".local/share/chat.fluffy.fluffychat" ]; } # TODO: ship normal fluffychat on non-moby? # { pkg = fluffychat-moby; persist.plaintext = [ ".local/share/chat.fluffy.fluffychat" ]; } # TODO: ship normal fluffychat on non-moby?
# foliate # e-book reader # "foliate" # e-book reader
# XXX by default fractal stores its state in ~/.local/share/<UUID>. # XXX by default fractal stores its state in ~/.local/share/<UUID>.
# after logging in, manually change ~/.local/share/keyrings/... to point it to some predictable subdir. # after logging in, manually change ~/.local/share/keyrings/... to point it to some predictable subdir.
@@ -176,159 +123,134 @@ let
# { pkg = fractal-next; persist.private = [ ".local/share/fractal" ]; } # { pkg = fractal-next; persist.private = [ ".local/share/fractal" ]; }
# "gnome.cheese" # "gnome.cheese"
# gnome-feeds # RSS reader (with claimed mobile support) # "gnome-feeds" # RSS reader (with claimed mobile support)
"gnome.file-roller" "gnome.file-roller"
# "gnome.gnome-maps" # works on phosh # "gnome.gnome-maps" # works on phosh
"gnome.nautilus" "gnome.nautilus"
# gnome-podcasts # "gnome-podcasts"
# "gnome.gnome-system-monitor" # "gnome.gnome-system-monitor"
# "gnome.gnome-terminal" # works on phosh # "gnome.gnome-terminal" # works on phosh
# "gnome.gnome-weather" # "gnome.gnome-weather"
gpodder "gpodder"
gthumb "gthumb"
komikku "komikku"
koreader "koreader"
lemoa # lemmy app "lemoa" # lemmy app
# lollypop # "lollypop"
mepo # maps viewer "mepo" # maps viewer
# mpv # "mpv"
# networkmanagerapplet # "networkmanagerapplet"
# newsflash # "newsflash"
nheko "nheko"
pavucontrol "pavucontrol"
# picard # music tagging # "picard" # music tagging
# "libsForQt5.plasmatube" # Youtube player # "libsForQt5.plasmatube" # Youtube player
soundconverter "soundconverter"
# sublime-music # "sublime-music"
# tdesktop # broken on phosh # "tdesktop" # broken on phosh
# tokodon # "tokodon"
tuba # mastodon/pleroma client (stores pw in keyring) "tuba" # mastodon/pleroma client (stores pw in keyring)
vlc "vlc"
# pleroma client (Electron). input is broken on phosh. TODO(2023/02/02): fix electron19 input (insecure) # "whalebird" # pleroma client (Electron). input is broken on phosh.
# whalebird "xterm" # broken on phosh
xterm # broken on phosh ];
;
};
desktopGuiPkgs = {
inherit (flattenedPkgs)
audacity
blanket # ambient noise generator
brave # for the integrated wallet -- as a backup
chromium
dino
electrum
element-desktop
# font-manager #< depends on webkitgtk4_0 (expensive to build)
gajim # XMPP client
gimp # broken on phosh
"gnome.dconf-editor"
"gnome.gnome-disk-utility"
# "gnome.totem" # video player, supposedly supports UPnP
handbrake
hase
inkscape
jellyfin-media-player
kdenlive
kid3 # audio tagging
krita
libreoffice-fresh
mumble
obsidian
slic3r
steam
wireshark # could maybe ship the cli as sysadmin pkg
;
};
x86GuiPkgs = {
inherit (pkgs)
discord
# kaiteki # Pleroma client
# gnome.zenity # for kaiteki (it will use qarma, kdialog, or zenity)
# gpt2tc # XXX: unreliable mirror
# logseq # Personal Knowledge Management
losslesscut-bin
makemkv
monero-gui
signal-desktop
spotify
tor-browser-bundle-bin
zecwallet-lite
;
};
# packages not part of any package set; not enabled by default
otherPkgs = {
inherit (pkgs)
lemmy-server
mx-sanebot
stepmania
;
};
# define -- but don't enable -- the packages in some attrset.
declarePkgs = pkgsAsAttrs: lib.mapAttrs (_n: p: {
# no need to actually define the package here: it's defaulted
# package = mkDefault p;
}) pkgsAsAttrs;
in
{
sane.programs = lib.mkMerge [
(declarePkgs consoleMediaPkgs)
(declarePkgs consolePkgs)
(declarePkgs desktopGuiPkgs)
(declarePkgs guiPkgs)
(declarePkgs iphonePkgs)
(declarePkgs sysadminPkgs)
(declarePkgs sysadminExtraPkgs)
(declarePkgs tuiPkgs)
(declarePkgs x86GuiPkgs)
(declarePkgs otherPkgs)
{
# link the various package sets into their own meta packages
consoleMediaUtils = {
package = null;
suggestedPrograms = attrNames consoleMediaPkgs;
};
consoleUtils = {
package = null;
suggestedPrograms = attrNames consolePkgs;
};
desktopGuiApps = {
package = null;
suggestedPrograms = attrNames desktopGuiPkgs;
};
guiApps = {
package = null;
suggestedPrograms = (attrNames guiPkgs)
++ [ "web-browser" ]
++ [ "tuiApps" ]
++ lib.optional (pkgs.system == "x86_64-linux") "x86GuiApps";
}; };
iphoneUtils = { iphoneUtils = {
package = null; package = null;
suggestedPrograms = attrNames iphonePkgs; suggestedPrograms = [
"ifuse"
"ipfs"
"libimobiledevice"
];
}; };
sysadminUtils = { sysadminUtils = {
package = null; package = null;
suggestedPrograms = attrNames sysadminPkgs; suggestedPrograms = [
"btrfs-progs"
"cacert.unbundled" # some services require unbundled /etc/ssl/certs
"cryptsetup"
"dig"
"efibootmgr"
"fatresize"
"fd"
"file"
"gawk"
"git"
"gptfdisk"
"hdparm"
"htop"
"iftop"
"inetutils" # for telnet
"iotop"
"iptables"
"jq"
"killall"
"lsof"
"miniupnpc"
"nano"
"neovim"
"netcat"
"nethogs"
"nmap"
"openssl"
"parted"
"pciutils"
"powertop"
"pstree"
"ripgrep"
"screen"
"smartmontools"
"socat"
"strace"
"subversion"
"tcpdump"
"tree"
"usbutils"
"wget"
"wirelesstools" # iwlist
];
}; };
sysadminExtraUtils = { sysadminExtraUtils = {
package = null; package = null;
suggestedPrograms = attrNames sysadminExtraPkgs; suggestedPrograms = [
"backblaze-b2"
"duplicity"
"sqlite" # to debug sqlite3 databases
];
}; };
tuiApps = { tuiApps = {
package = null; package = null;
suggestedPrograms = attrNames tuiPkgs; suggestedPrograms = [
"aerc" # email client
"msmtp" # sendmail
"offlineimap" # email mailox sync
"sfeed" # RSS fetcher
"visidata" # TUI spreadsheet viewer/editor
"w3m" # web browser
];
}; };
x86GuiApps = { x86GuiApps = {
package = null; package = null;
suggestedPrograms = attrNames x86GuiPkgs; suggestedPrograms = [
"discord"
# "kaiteki" # Pleroma client
# "gnome.zenity" # for kaiteki (it will use qarma, kdialog, or zenity)
# "gpt2tc" # XXX: unreliable mirror
# "logseq" # Personal Knowledge Management
"losslesscut-bin"
"makemkv"
"monero-gui"
"signal-desktop"
"spotify"
"tor-browser-bundle-bin"
"zecwallet-lite"
];
}; };
}
{
# nontrivial package definitions # INDIVIDUAL PACKAGE DEFINITIONS
dino.persist.private = [ ".local/share/dino" ]; dino.persist.private = [ ".local/share/dino" ];
@@ -388,6 +310,5 @@ in
# zcash coins. safe to delete, just slow to regenerate (10-60 minutes) # zcash coins. safe to delete, just slow to regenerate (10-60 minutes)
zecwallet-lite.persist.private = [ ".zcash" ]; zecwallet-lite.persist.private = [ ".zcash" ];
} };
];
} }

View File

@@ -6,5 +6,4 @@
}; };
suggestedPrograms = [ "ghostscript" ]; suggestedPrograms = [ "ghostscript" ];
}; };
sane.programs.ghostscript = {};
} }

View File

@@ -1,5 +1,4 @@
{ config, ... }: { config, ... }:
{ {
sane.programs.wireshark = {};
programs.wireshark.enable = config.sane.programs.wireshark.enabled; programs.wireshark.enable = config.sane.programs.wireshark.enabled;
} }

View File

@@ -34,20 +34,6 @@ in
]; ];
}; };
} }
{
sane.programs = {
inherit (pkgs // {
"gnome.gnome-bluetooth" = pkgs.gnome.gnome-bluetooth;
"gnome.gnome-terminal" = pkgs.gnome.gnome-terminal;
"plasma5Packages.konsole" = pkgs.plasma5Packages.konsole;
})
phosh-mobile-settings
"plasma5Packages.konsole"
"gnome.gnome-bluetooth"
"gnome.gnome-terminal"
;
};
}
(mkIf cfg.enable { (mkIf cfg.enable {
sane.programs.phoshApps.enableFor.user.colin = true; sane.programs.phoshApps.enableFor.user.colin = true;

View File

@@ -72,25 +72,6 @@ in
]; ];
}; };
} }
{
sane.programs = {
inherit (pkgs // {
# "gnome.gnome-bluetooth" = pkgs.gnome.gnome-bluetooth;
# "gnome.gnome-control-center" = pkgs.gnome.gnome-control-center;
"sway-contrib.grimshot" = pkgs.sway-contrib.grimshot;
})
swaylock
swayidle
wl-clipboard
blueberry
mako
# "gnome.gnome-bluetooth"
# "gnome.gnome-control-center"
"sway-contrib.grimshot"
wdisplays
;
};
}
(mkIf cfg.enable { (mkIf cfg.enable {
sane.programs.swayApps.enableFor.user.colin = true; sane.programs.swayApps.enableFor.user.colin = true;

View File

@@ -22,9 +22,6 @@ in
}; };
config = mkMerge [ config = mkMerge [
({
sane.programs.qemu = pkgs.qemu;
})
(mkIf cfg.enable { (mkIf cfg.enable {
# enable opt-in emulation of any package at runtime. # enable opt-in emulation of any package at runtime.
# i.e. `nix build '.#host-pkgs.moby.bash' ; qemu-aarch64 ./result/bin/bash`. # i.e. `nix build '.#host-pkgs.moby.bash' ; qemu-aarch64 ./result/bin/bash`.

View File

@@ -225,6 +225,19 @@ in
{ {
# expose the pkgs -- as available to the system -- as a build target. # expose the pkgs -- as available to the system -- as a build target.
system.build.pkgs = pkgs; system.build.pkgs = pkgs;
sane.programs = lib.mkMerge [
# make a program for every (toplevel) package
(lib.mapAttrs (_pkgName: _pkg: {}) pkgs)
# do the same for programs in known groups
(lib.mapAttrs' (pkgName: _pkg: { name = "cacert.${pkgName}"; value = {}; }) pkgs.cacert)
(lib.mapAttrs' (pkgName: _pkg: { name = "gnome.${pkgName}"; value = {}; }) pkgs.gnome)
(lib.mapAttrs' (pkgName: _pkg: { name = "libsForQt5.${pkgName}"; value = {}; }) pkgs.libsForQt5)
(lib.mapAttrs' (pkgName: _pkg: { name = "plasma5Packages.${pkgName}"; value = {}; }) pkgs.plasma5Packages)
(lib.mapAttrs' (pkgName: _pkg: { name = "python3Packages.${pkgName}"; value = {}; }) pkgs.python3Packages)
(lib.mapAttrs' (pkgName: _pkg: { name = "sway-contrib.${pkgName}"; value = {}; }) pkgs.sway-contrib)
];
} }
]; ];
} }