Add enable option for other software
This commit is contained in:
parent
fe37ad29e0
commit
6b06a5d2ce
3 changed files with 101 additions and 21 deletions
98
lib/modules/programs.nix
Normal file
98
lib/modules/programs.nix
Normal 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"]
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -6,6 +6,7 @@ in {
|
|||
./i18n.nix
|
||||
./os.nix
|
||||
./partition.nix
|
||||
./programs.nix
|
||||
./software.nix
|
||||
./users.nix
|
||||
./windows.nix
|
||||
|
|
Loading…
Reference in a new issue