{ lib, config, ... }: let inherit (lib) mkEnableOption mkDefault mkOption types; cfg = config.valhalla; mkUsersOption = osConfig: mkOption { type = types.attrsOf (types.submodule ( { ... }: { config = { programs = builtins.mapAttrs ( name: config: { enable = mkDefault config.enable; }) osConfig.programs; }; })); }; mkPrograms = infos: builtins.foldl' (info: programs: programs // { "${info.0}" = { enable = mkEnableOption info.1; }; }) { } infos; in { imports = [ ./programs/git.nix ./programs/nextcloud.nix ./programs/oh-my-posh.nix ./programs/rclone.nix ]; options = { valhalla = { users = mkUsersOption cfg; linux.users = mkUsersOption cfg.linux; windows.users = mkUsersOption cfg.windows; programs = mkPrograms [ ["aliae" "aliae"] ["brave" "Brave Browser"] ["discord" "Discord"] ["docker" "docker"] ["firefox" "Firefox Web Browser"] ["git" "git"] ["nextcloud" "Nextcloud Client"] ["oh-my-posh" "Oh My Posh"] ["openssh" "OpenSSH"] ["osu!lazer" "osu!lazer"] ["pennywise" "Pennywise"] ["powershell" "PowerShell Core"] ["retroarch" "RetroArch"] ["steam" "Steam"] ["thunderbird" "Thunderbird"] ["vscode" "Visual Studio Code"] ["zoxide" "zoxide"] ]; linux.programs = mkPrograms [ ["bash" "Bash"] ["fish" "fish"] ["icedtea" "IcedTea"] ["grub" "GRUB"] ["lghub" "Logitech G Hub"] ["logo-ls" "logo-ls"] ["lutris" "Lutris"] ["minegrub-theme" "Minegrub Theme"] ["nodejs-n" "n"] ["nuke-usb" "nuke-usb"] ["nvidia-dkms" "Nvidia Drivers"] ["plasma" "Plasma"] ["pyenv" "pyenv"] ["rclone" "rclone"] ["sddm" "SDDM"] ["vim" "Vim"] ["virt-manager" "Virtual Machine Manager"] ["waydroid" "Waydroid"] ["xone" "xone"] ]; windows.programs = mkPrograms [ ["maniaplanet" "ManiaPlanet"] ["msedge-redirect" "MSEdgeRedirect"] ["nvs" "Node Version Switcher"] ["osu!" "Osu!"] ["putty" "PuTTY"] ["rewasd" "reWASD"] ["terminal-icons" "Terminal Icons"] ["tm-nations-forever" "TrackMania Nations Forever"] ["tm-united-forever" "TrackMania United Forever"] ["tobii-gamehub" "Tobii Game Hub"] ["tobii-ghost" "Tobii Ghost"] ["ubiquiti-unifi-controller" "Ubiquiti UniFi Controller"] ["visualstudio" "Visual Studio"] ["winscp" "WinSCP"] ]; }; }; }