diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix new file mode 100644 index 00000000..3e9dd481 --- /dev/null +++ b/lib/modules/programs.nix @@ -0,0 +1,98 @@ +{ 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"] + ]; + }; + }; +} diff --git a/lib/modules/software.nix b/lib/modules/software.nix index d51361e0..e3d23416 100644 --- a/lib/modules/software.nix +++ b/lib/modules/software.nix @@ -1,33 +1,14 @@ { lib, config, ... }: let - inherit (lib) mkDefault mkOption types; + inherit (lib) 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; - }; - })); - }; in { imports = [ - ./programs/git.nix - ./programs/nextcloud.nix - ./programs/oh-my-posh.nix - ./programs/rclone.nix + ./programs.nix ]; options = { valhalla = { - users = mkUsersOption cfg; - linux.users = mkUsersOption cfg.linux; - windows.users = mkUsersOption cfg.windows; - software = let inherit (cfg.software) coding common desktopExperience school server; in { diff --git a/lib/modules/valhalla.nix b/lib/modules/valhalla.nix index 25fa9008..8d0b6113 100644 --- a/lib/modules/valhalla.nix +++ b/lib/modules/valhalla.nix @@ -6,6 +6,7 @@ in { ./i18n.nix ./os.nix ./partition.nix + ./programs.nix ./software.nix ./users.nix ./windows.nix