diff --git a/hosts/ni/default.nix b/hosts/ni/default.nix index fe37c92e..30690ac4 100644 --- a/hosts/ni/default.nix +++ b/hosts/ni/default.nix @@ -7,7 +7,7 @@ ]; # My custom configuration with my custom modules starts here. - modules = { + profiles = { agenix.enable = true; archiving.enable = true; desktop = { @@ -24,10 +24,6 @@ virtualization.enable = true; neovim.enable = true; }; - themes = { - disableLimit = true; - themes.a-happy-gnome.enable = true; - }; users.users.foo-dogsquared.settings = { extraGroups = [ "wheel" "audio" "docker" "podman" "network-manager" ]; hashedPassword = @@ -36,7 +32,11 @@ createHome = true; home = "/home/foo-dogsquared"; }; - hardware-setup.backup-archive.enable = true; + }; + hardware-setup.backup-archive.enable = true; + themes = { + disableLimit = true; + themes.a-happy-gnome.enable = true; }; # Use the systemd-boot EFI boot loader. diff --git a/modules/home-manager/desktop.nix b/modules/home-manager/profiles/desktop.nix similarity index 95% rename from modules/home-manager/desktop.nix rename to modules/home-manager/profiles/desktop.nix index e7e5c30c..61693b9a 100644 --- a/modules/home-manager/desktop.nix +++ b/modules/home-manager/profiles/desktop.nix @@ -1,9 +1,9 @@ # Enables all of my usual setup for desktop-oriented stuff. { config, options, lib, pkgs, ... }: -let cfg = config.modules.desktop; +let cfg = config.profiles.desktop; in { - options.modules.desktop = { + options.profiles.desktop = { enable = lib.mkEnableOption "installations of desktop apps"; graphics.enable = lib.mkEnableOption "installations of graphics-related apps"; diff --git a/modules/home-manager/dev.nix b/modules/home-manager/profiles/dev.nix similarity index 96% rename from modules/home-manager/dev.nix rename to modules/home-manager/profiles/dev.nix index f966776c..21897a12 100644 --- a/modules/home-manager/dev.nix +++ b/modules/home-manager/profiles/dev.nix @@ -2,9 +2,9 @@ # If you're looking for text editors, go to `./editors.nix`. { config, options, lib, pkgs, ... }: -let cfg = config.modules.dev; +let cfg = config.profiles.dev; in { - options.modules.dev = { + options.profiles.dev = { enable = lib.mkEnableOption "foo-dogsquared's user-specific development setup"; shell.enable = diff --git a/modules/home-manager/editors.nix b/modules/home-manager/profiles/editors.nix similarity index 94% rename from modules/home-manager/editors.nix rename to modules/home-manager/profiles/editors.nix index 094eb9ed..af19f5f6 100644 --- a/modules/home-manager/editors.nix +++ b/modules/home-manager/profiles/editors.nix @@ -7,9 +7,9 @@ # for me is not worth to maintain. { config, options, lib, pkgs, ... }: -let cfg = config.modules.editors; +let cfg = config.profiles.editors; in { - options.modules.editors = { + options.profiles.editors = { neovim.enable = lib.mkEnableOption "foo-dogsquared's Neovim setup with Nix"; emacs.enable = lib.mkEnableOption "foo-dogsquared's (Doom) Emacs setup"; }; @@ -51,6 +51,7 @@ in { ## :lang org +roam2 sqlite + anystyle-cli ]; }) ]; diff --git a/modules/home-manager/i18n.nix b/modules/home-manager/profiles/i18n.nix similarity index 93% rename from modules/home-manager/i18n.nix rename to modules/home-manager/profiles/i18n.nix index a38d6b6a..e1ffa442 100644 --- a/modules/home-manager/i18n.nix +++ b/modules/home-manager/profiles/i18n.nix @@ -1,9 +1,9 @@ # Instant setup for using internationalized languages. { config, options, lib, pkgs, ... }: -let cfg = config.modules.i18n; +let cfg = config.profiles.i18n; in { - options.modules.i18n.enable = + options.profiles.i18n.enable = lib.mkEnableOption "fcitx5 as input method engine"; config = lib.mkIf cfg.enable { diff --git a/modules/home-manager/research.nix b/modules/home-manager/profiles/research.nix similarity index 86% rename from modules/home-manager/research.nix rename to modules/home-manager/profiles/research.nix index 9e0b8edb..509fa41d 100644 --- a/modules/home-manager/research.nix +++ b/modules/home-manager/profiles/research.nix @@ -1,8 +1,8 @@ { config, options, lib, pkgs, ... }: -let cfg = config.modules.research; +let cfg = config.profiles.research; in { - options.modules.research.enable = + options.profiles.research.enable = lib.mkEnableOption "my usual toolbelt for research"; config = lib.mkIf cfg.enable { @@ -16,5 +16,7 @@ in { yt-dlp # The general purpose video downloader. zotero # It's actually good at archiving despite not being a researcher myself. ]; + + services.syncthing.enable = true; }; } diff --git a/modules/home-manager/services/archivebox.nix b/modules/home-manager/services/archivebox.nix new file mode 100644 index 00000000..8610f052 --- /dev/null +++ b/modules/home-manager/services/archivebox.nix @@ -0,0 +1,41 @@ +{ config, options, lib, pkgs, ... }: + +let + cfg = config.services.archivebox; +in { + options.services.archivebox = { + enable = lib.mkEnableOption "Archivebox service"; + + port = lib.mkOption { + type = lib.types.port; + description = "The port number to be used for the server at localhost."; + default = 8000; + example = 8888; + }; + + archivePath = lib.mkOption { + type = with lib.types; either path str; + description = "The path of the Archivebox archive."; + example = "\${config.xdg.dataHome}/archivebox"; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.archivebox ]; + systemd.user.services.archivebox-server = { + Unit = { + Description = "Archivebox server for ${cfg.archivePath}"; + After = "network.target"; + Documentation = [ "https://docs.archivebox.io/" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service = { + ExecStart = "${pkgs.archivebox}/bin/archivebox server localhost:${toString cfg.port}"; + WorkingDirectory = cfg.archivePath; + Restart = "on-failure"; + }; + }; + }; +} diff --git a/modules/home-manager/bleachbit.nix b/modules/home-manager/services/bleachbit.nix similarity index 97% rename from modules/home-manager/bleachbit.nix rename to modules/home-manager/services/bleachbit.nix index 564a0cd2..f5af9b2d 100644 --- a/modules/home-manager/bleachbit.nix +++ b/modules/home-manager/services/bleachbit.nix @@ -1,8 +1,8 @@ { config, options, lib, pkgs, ... }: -let cfg = config.modules.bleachbit; +let cfg = config.services.bleachbit; in { - options.modules.bleachbit = { + options.services.bleachbit = { enable = lib.mkEnableOption "automated cleanup with Bleachbit"; startAt = lib.mkOption { type = lib.types.str; diff --git a/modules/nixos/hardware-setup/backup-archive.nix b/modules/nixos/hardware-setup/backup-archive.nix index e38d9833..6fb3af3e 100644 --- a/modules/nixos/hardware-setup/backup-archive.nix +++ b/modules/nixos/hardware-setup/backup-archive.nix @@ -3,14 +3,14 @@ # TODO: Make this a generic service. # There are multiple external storage drives now. -let cfg = config.modules.hardware-setup.backup-archive; +let cfg = config.hardware-setup.backup-archive; in { - options.modules.hardware-setup.backup-archive.enable = lib.mkEnableOption + options.hardware-setup.backup-archive.enable = lib.mkEnableOption "external hard drive and automated backup service with BorgBackup"; config = lib.mkIf cfg.enable { assertions = [{ - assertion = config.modules.agenix.enable; + assertion = config.profiles.agenix.enable; message = "Agenix module is not enabled."; }]; @@ -34,7 +34,8 @@ in { ]; }; - modules.services.borgmatic.jobs.external-storage = { + # This uses the custom borgmatic NixOS service. + services.borgmatic.jobs.external-storage = { startAt = "04/6:00:00"; configPath = config.age.secrets.external-backup-borgmatic-settings.path; }; diff --git a/modules/nixos/agenix.nix b/modules/nixos/profiles/agenix.nix similarity index 86% rename from modules/nixos/agenix.nix rename to modules/nixos/profiles/agenix.nix index 6c52349f..b5a5bcd1 100644 --- a/modules/nixos/agenix.nix +++ b/modules/nixos/profiles/agenix.nix @@ -1,9 +1,9 @@ # A module that automates setting up agenix for your system. { inputs, lib, options, config, system, ... }: -let cfg = config.modules.agenix; +let cfg = config.profiles.agenix; in { - options.modules.agenix.enable = + options.profiles.agenix.enable = lib.mkEnableOption "agenix-related config on your system"; imports = [ inputs.agenix.nixosModules.age ]; diff --git a/modules/nixos/archiving.nix b/modules/nixos/profiles/archiving.nix similarity index 90% rename from modules/nixos/archiving.nix rename to modules/nixos/profiles/archiving.nix index 76fa8bb8..2a192b75 100644 --- a/modules/nixos/archiving.nix +++ b/modules/nixos/profiles/archiving.nix @@ -1,9 +1,9 @@ # All of your embarrassing moments, marked here forever. { config, options, lib, pkgs, ... }: -let cfg = config.modules.archiving; +let cfg = config.profiles.archiving; in { - options.modules.archiving.enable = + options.profiles.archiving.enable = lib.mkEnableOption "installation of various archiving tools"; # This is not going to set BorgBackup NixOS services for you. diff --git a/modules/nixos/desktop.nix b/modules/nixos/profiles/desktop.nix similarity index 97% rename from modules/nixos/desktop.nix rename to modules/nixos/profiles/desktop.nix index 87767860..c52dd2c0 100644 --- a/modules/nixos/desktop.nix +++ b/modules/nixos/profiles/desktop.nix @@ -3,9 +3,9 @@ # That can be found in the `themes` module. { config, options, lib, pkgs, ... }: -let cfg = config.modules.desktop; +let cfg = config.profiles.desktop; in { - options.modules.desktop = { + options.profiles.desktop = { enable = lib.mkEnableOption "all desktop-related services and default programs"; audio.enable = @@ -40,6 +40,7 @@ in { (lib.mkIf cfg.audio.enable { # Enable the preferred audio workflow. + sound.enable = false; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { diff --git a/modules/nixos/dev.nix b/modules/nixos/profiles/dev.nix similarity index 98% rename from modules/nixos/dev.nix rename to modules/nixos/profiles/dev.nix index 0ccc0a30..d99a84f6 100644 --- a/modules/nixos/dev.nix +++ b/modules/nixos/profiles/dev.nix @@ -1,9 +1,9 @@ # The module for anything dev-related. { config, options, lib, pkgs, ... }: -let cfg = config.modules.dev; +let cfg = config.profiles.dev; in { - options.modules.dev = { + options.profiles.dev = { enable = lib.mkEnableOption "configurations of foo-dogsquared's barebones requirement for a development environment."; shell.enable = lib.mkEnableOption diff --git a/modules/nixos/users.nix b/modules/nixos/profiles/users.nix similarity index 96% rename from modules/nixos/users.nix rename to modules/nixos/profiles/users.nix index 0d4304ef..5b34a843 100644 --- a/modules/nixos/users.nix +++ b/modules/nixos/profiles/users.nix @@ -7,10 +7,10 @@ { inputs, config, options, lib, ... }: let - cfg = config.modules.users; + cfg = config.profiles.users; users = lib.attrNames cfg.users; homeManagerUserModules = lib.getUsers "home-manager" users; - homeManagerModules = lib.filesToAttr ../home-manager; + homeManagerModules = lib.filesToAttr ../../home-manager; homeManagerUsers = lib.attrNames homeManagerUserModules; nonexistentUsers = lib.filter (name: !lib.elem name homeManagerUsers) users; @@ -33,7 +33,7 @@ let mapUsers = f: lib.mapAttrs f cfg.users; in { - options.modules.users = { + options.profiles.users = { users = lib.mkOption { default = { }; description = '' diff --git a/modules/nixos/services/borgmatic.nix b/modules/nixos/services/borgmatic.nix index 61e61feb..681d9c82 100644 --- a/modules/nixos/services/borgmatic.nix +++ b/modules/nixos/services/borgmatic.nix @@ -2,7 +2,7 @@ { config, options, lib, pkgs, ... }: let - cfg = config.modules.services.borgmatic; + cfg = config.services.borgmatic; jobOption = { name, config, ... }: { options = { @@ -27,7 +27,7 @@ let }; }; in { - options.modules.services.borgmatic = { + options.services.borgmatic = { jobs = lib.mkOption { type = with lib.types; attrsOf (submodule jobOption); description = "borgmatic jobs with each bearing a configuration file to be used."; diff --git a/modules/nixos/themes/a-happy-gnome/default.nix b/modules/nixos/themes/a-happy-gnome/default.nix index 3efd1b0e..b4601ae7 100644 --- a/modules/nixos/themes/a-happy-gnome/default.nix +++ b/modules/nixos/themes/a-happy-gnome/default.nix @@ -4,15 +4,15 @@ # See https://github.com/NixOS/nixpkgs/issues/54150 for more details. let name = "a-happy-gnome"; - cfg = config.modules.themes.themes.a-happy-gnome; dconf = pkgs.gnome3.dconf; customDconfDb = pkgs.stdenv.mkDerivation { name = "${name}-dconf-db"; buildCommand = "${dconf}/bin/dconf compile $out ${./config/dconf}"; }; + cfg = config.themes.themes.a-happy-gnome; in { - options.modules.themes.themes.a-happy-gnome.enable = lib.mkEnableOption "'A happy GNOME', foo-dogsquared's configuration of GNOME desktop environment"; + options.themes.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; diff --git a/modules/nixos/themes/default.nix b/modules/nixos/themes/default.nix index 8113a447..738e002f 100644 --- a/modules/nixos/themes/default.nix +++ b/modules/nixos/themes/default.nix @@ -3,9 +3,9 @@ # You can also show your desktop being modularized like this. { config, options, lib, pkgs, ... }: -let cfg = config.modules.themes; +let cfg = config.themes; in { - options.modules.themes.disableLimit = lib.mkOption { + options.themes.disableLimit = lib.mkOption { type = lib.types.bool; default = false; description = '' diff --git a/users/home-manager/foo-dogsquared/default.nix b/users/home-manager/foo-dogsquared/default.nix index f13603db..80825e18 100644 --- a/users/home-manager/foo-dogsquared/default.nix +++ b/users/home-manager/foo-dogsquared/default.nix @@ -26,8 +26,7 @@ }; # My custom modules. - modules = { - bleachbit.enable = true; + profiles = { i18n.enable = true; dev = { enable = true; @@ -42,4 +41,12 @@ }; research.enable = true; }; + + services = { + archivebox = { + enable = true; + archivePath = "%h/library/archives"; + }; + bleachbit.enable = true; + }; }