Update modules

- Add `modules.desktop.cleanup` for the usual cleanup activties in
  NixOS.
- Update to proper descriptions for module options added with
  `lib.mkEnableOption`.
- Additional packages for various modules.
- Deleted `modules/home-manager/alacritty`. It is pretty useless though.
  :(
This commit is contained in:
Gabriel Arazas 2021-12-11 13:16:45 +08:00
parent 09f8a1f763
commit efc578e961
12 changed files with 130 additions and 108 deletions

View File

@ -64,12 +64,6 @@
i18n.defaultLocale = "en_US.UTF-8";
# Sane config for the package manager.
nix.gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 2w";
};
# TODO: Remove this after nix-command and flakes has been considered stable.
#
# Since we're using flakes to make this possible, we need it.

View File

@ -1,16 +0,0 @@
{ config, options, lib, pkgs, ... }:
let
cfg = config.modules.alacritty;
in
{
options.modules.alacritty.enable = lib.mkEnableOption "Enable Alacritty config";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ alacritty ];
xdg.configFile."alacritty" = {
source = ../config/alacritty;
recursive = true;
};
};
}

View File

@ -1,14 +1,13 @@
# Enables all of my usual setup for desktop-oriented stuff.
{ config, options, lib, pkgs, ... }:
let
cfg = config.modules.desktop;
in
{
let cfg = config.modules.desktop;
in {
options.modules.desktop = {
enable = lib.mkEnableOption "Enable installations of desktop apps.";
graphics.enable = lib.mkEnableOption "Install graphics-related apps.";
audio.enable = lib.mkEnableOption "Install audio-related apps.";
enable = lib.mkEnableOption "installations of desktop apps";
graphics.enable =
lib.mkEnableOption "installations of graphics-related apps";
audio.enable = lib.mkEnableOption "installations of audio-related apps";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
@ -39,7 +38,7 @@ in
services.easyeffects.enable = true;
services.fluidsynth = {
enable = true;
soundServices = "pipewire-pulse";
soundService = "pipewire-pulse";
};
})
]);

View File

@ -1,45 +1,42 @@
{ config, options, lib, pkgs, ... }:
let
cfg = config.modules.dev;
in
{
options.modules.dev = {
enable = lib.mkEnableOption "Enable my user-specific development setup.";
shell.enable = lib.mkEnableOption "Configures my shell of choice.";
};
let cfg = config.modules.dev;
in {
options.modules.dev = {
enable = lib.mkEnableOption "myy user-specific development setup";
shell.enable =
lib.mkEnableOption "configuration of foo-dogsquared's shell of choice";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
({
home.packages = with pkgs; [
neovim # My text editor of choice.
lazygit # Git interface for the lazy.
fzf # A fuzzy finder that enables fuzzy finding not furry finding, a common misconception.
gopass # An improved version of the password manager for hipsters.
perl534Packages.vidir # Bulk rename for your organizing needs.
zellij # A modern tmux?
lf # File manager in the terminal, really.
config = lib.mkIf cfg.enable (lib.mkMerge [
({
home.packages = with pkgs; [
neovim # My text editor of choice.
lazygit # Git interface for the lazy.
fzf # A fuzzy finder that enables fuzzy finding not furry finding, a common misconception.
gopass # An improved version of the password manager for hipsters.
perl534Packages.vidir # Bulk rename for your organizing needs.
zellij # A modern tmux?
lf # File manager in the terminal, really.
# Coreutils replacement.
fd # Oh nice, a more reliable `find`.
ripgrep # On nice, a more reliable `grep`.
exa # Oh nice, a shinier `ls`.
bat # dog > bat > cat
];
})
# Coreutils replacement.
fd # Oh nice, a more reliable `find`.
ripgrep # On nice, a more reliable `grep`.
exa # Oh nice, a shinier `ls`.
bat # dog > bat > cat
];
})
(lib.mkIf cfg.shell.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide.enable = true;
programs.starship = {
enable = true;
settings = {
add_newline = false;
};
};
})
]);
(lib.mkIf cfg.shell.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.zoxide.enable = true;
programs.starship = {
enable = true;
settings = { add_newline = false; };
};
})
]);
}

View File

@ -1,21 +1,30 @@
# Instant setup for using internationalized languages.
{ config, options, lib, pkgs, ... }:
let
cfg = config.modules.i18n;
in
{
options.modules.i18n.enable = lib.mkEnableOption "Enable fcitx5 as input method engine.";
let cfg = config.modules.i18n;
in {
options.modules.i18n.enable =
lib.mkEnableOption "fcitx5 as input method engine";
config = lib.mkIf cfg.enable {
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-gtk # Add support for GTK-based programs.
libsForQt5.fcitx5-qt # Add support for QT-based programs.
fcitx5-lua # Add Lua support.
fcitx5-rime # Chinese input addon.
fcitx5-mozc # Japanese input addon.
];
};
config = lib.mkIf cfg.enable {
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-extra
noto-fonts-emoji
];
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-gtk # Add support for GTK-based programs.
libsForQt5.fcitx5-qt # Add support for QT-based programs.
fcitx5-lua # Add Lua support.
fcitx5-rime # Chinese input addon.
fcitx5-mozc # Japanese input addon.
];
};
}
};
}

View File

@ -1,14 +1,16 @@
{ config, options, lib, pkgs, ... }:
let
cfg = config.modules.research;
let cfg = config.modules.research;
in {
options.modules.tools.enable = lib.mkEnableOptions "Enable my usual toolbelt for research.";
options.modules.research.enable =
lib.mkEnableOption "my usual toolbelt for research";
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
archivebox # The ultimate archiving solution!
archivebox # The ultimate archiving solution created by a pirate!
curl # The general purpose downloader.
fanficfare # It's for the badly written fanfics.
internetarchive # All of the potential vintage collection of questionable materials at your fingertips.
newsboat # Reading news easily on the command line?
qbittorrent # The pirate's toolkit for downloading Linux ISOs.
zotero # It's actually good at archiving despite not being a researcher myself.

View File

@ -1,10 +1,10 @@
# A module that automates setting up agenix for your system.
{ inputs, lib, options, config, ... }:
{ inputs, lib, options, config, system, ... }:
let cfg = config.modules.agenix;
in {
options.modules.agenix.enable =
lib.mkEnableOption "Automate agenix-related config on your system";
lib.mkEnableOption "agenix-related config on your system";
imports = [ inputs.agenix.nixosModules.age ];
config = lib.mkIf cfg.enable {

View File

@ -4,7 +4,7 @@
let cfg = config.modules.archiving;
in {
options.modules.archiving.enable =
lib.mkEnableOption "Install and configure archiving tools.";
lib.mkEnableOption "installation of various archiving tools";
# This is not going to set BorgBackup NixOS services for you.
# Please do it for host-specific configs instead.

View File

@ -6,13 +6,14 @@
let cfg = config.modules.desktop;
in {
options.modules.desktop = {
enable = lib.mkEnableOption
"Enables all desktop-related services and default programs.";
audio.enable = lib.mkEnableOption
"Enables all desktop audio-related services such as Pipewire.";
fonts.enable = lib.mkEnableOption "Enables font-related config.";
hardware.enable = lib.mkEnableOption
"Enables the common hardware-related configuration.";
enable =
lib.mkEnableOption "all desktop-related services and default programs";
audio.enable =
lib.mkEnableOption "all desktop audio-related services such as Pipewire";
fonts.enable = lib.mkEnableOption "font-related configuration";
hardware.enable =
lib.mkEnableOption "the common hardware-related configuration";
cleanup.enable = lib.mkEnableOption "activation of cleanup services";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
@ -100,5 +101,36 @@ in {
# Welp, this is surprising...
services.printing.enable = true;
})
(lib.mkIf cfg.cleanup.enable {
# Weekly garbage collection of Nix store.
nix.gc = {
automatic = true;
persistent = true;
dates = "weekly";
options = "--delete-older-than 21d";
};
# Clear logs that are more than a month old weekly.
systemd = {
services.clean-log = {
description = "Weekly log cleanup";
documentation = [ "man:journalctl(1)" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.systemd}/bin/journalctl --vacuum-time=30d";
};
};
timers.clean-log = {
description = "Weekly log cleanup";
documentation = [ "man:journalctl(1)" ];
timerConfig = {
OnCalendar = "weekly";
Persistent = true;
};
};
};
})
]);
}

View File

@ -6,11 +6,11 @@ let cfg = config.modules.dev;
in {
options.modules.dev = {
enable = lib.mkEnableOption
"Configures my barebones requirement for a development environment.";
shell.enable =
lib.mkEnableOption "Installs of the shell utilities I rely on.";
virtualization.enable = lib.mkEnableOption
"Configures my virtualization-related stuff for my development. (I sometimes have to use these.)";
"configurations of foo-dogsquared's barebones requirement for a development environment.";
shell.enable = lib.mkEnableOption
"installation of the shell utilities foo-dogsquared rely on";
virtualization.enable =
lib.mkEnableOption "virtualization-related stuff for development";
};
config = lib.mkIf cfg.enable (lib.mkMerge [

View File

@ -4,8 +4,8 @@
let cfg = config.modules.editors;
in {
options.modules.editors = {
neovim.enable = lib.mkEnableOption "Enable Neovim and its components";
vscode.enable = lib.mkEnableOption "Enable Visual Studio Code";
neovim.enable = lib.mkEnableOption "Neovim and its components";
vscode.enable = lib.mkEnableOption "Visual Studio Code";
};
config = lib.mkMerge [
@ -15,6 +15,9 @@ in {
defaultEditor = true;
withNodeJs = true;
withRuby = true;
# I want the BLEEDING EDGE!
package = pkgs.neovim-nightly;
};
environment.systemPackages = with pkgs; [ editorconfig-core-c ];

View File

@ -1,5 +1,7 @@
{ config, options, lib, pkgs, ... }:
# TODO: Custom dconf database which is not yet possible.
# See https://github.com/NixOS/nixpkgs/issues/54150 for more details.
let
name = "a-happy-gnome";
cfg = config.modules.themes.a-happy-gnome;
@ -10,7 +12,7 @@ let
};
in
{
options.modules.themes.a-happy-gnome.enable = lib.mkEnableOption "Enables my configuration of GNOME Shell.";
options.modules.themes.a-happy-gnome.enable = lib.mkEnableOption "'A happy GNOME', foo-dogsquared's configuration of GNOME desktop environment";
config = lib.mkIf cfg.enable {
services.xserver.enable = true;