Add enable option for other software

This commit is contained in:
Manuel Thalmann 2024-10-13 22:04:43 +02:00
parent fe37ad29e0
commit 6b06a5d2ce
3 changed files with 101 additions and 21 deletions

98
lib/modules/programs.nix Normal file
View file

@ -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"]
];
};
};
}

View file

@ -1,33 +1,14 @@
{ lib, config, ... }: { lib, config, ... }:
let let
inherit (lib) mkDefault mkOption types; inherit (lib) mkOption types;
cfg = config.valhalla; cfg = config.valhalla;
mkUsersOption = osConfig: mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
config = {
programs = builtins.mapAttrs (
name: config: {
enable = mkDefault config.enable;
}) osConfig.programs;
};
}));
};
in { in {
imports = [ imports = [
./programs/git.nix ./programs.nix
./programs/nextcloud.nix
./programs/oh-my-posh.nix
./programs/rclone.nix
]; ];
options = { options = {
valhalla = { valhalla = {
users = mkUsersOption cfg;
linux.users = mkUsersOption cfg.linux;
windows.users = mkUsersOption cfg.windows;
software = let software = let
inherit (cfg.software) coding common desktopExperience school server; inherit (cfg.software) coding common desktopExperience school server;
in { in {

View file

@ -6,6 +6,7 @@ in {
./i18n.nix ./i18n.nix
./os.nix ./os.nix
./partition.nix ./partition.nix
./programs.nix
./software.nix ./software.nix
./users.nix ./users.nix
./windows.nix ./windows.nix