diff --git a/lib/default.nix b/lib/default.nix index 1694b51f..94b8b367 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -99,8 +99,7 @@ rec { - `list` is a list of usernames as strings - `attrset` is a set of valid users with the name as the key and the path as the value. Example: - # Assuming only 'foo-dogsquared' is the existing user. - # Get valid users from home-manager. + # Assuming only 'foo-dogsquared' is the existing user for 'home-manager'. getUsers "home-manager" [ "foo-dogsquared" "archie" "brad" ] => { foo-dogsquared = /home/foo-dogsquared/projects/nixos-config/users/foo-dogsquared; } */ @@ -108,7 +107,7 @@ rec { let userModules = filesToAttr ../users/${type}; invalidUsernames = [ "config" "modules" ]; - in lib.filterAttrs (n: _: !lib.elem n invalidUsernames) userModules; + in lib.filterAttrs (n: _: !lib.elem n invalidUsernames && lib.elem n users) userModules; # Return the path of `secrets` from `../secrets`. getSecret = path: ../secrets/${path}; diff --git a/modules/home-manager/desktop.nix b/modules/home-manager/desktop.nix index c2c86512..e7e5c30c 100644 --- a/modules/home-manager/desktop.nix +++ b/modules/home-manager/desktop.nix @@ -8,7 +8,8 @@ in { graphics.enable = lib.mkEnableOption "installations of graphics-related apps"; audio.enable = lib.mkEnableOption "installations of audio-related apps"; - multimedia.enable = lib.mkEnableOption "installations for opening multimedia files"; + multimedia.enable = + lib.mkEnableOption "installations for opening multimedia files"; }; config = lib.mkIf cfg.enable (lib.mkMerge [ diff --git a/modules/home-manager/dev.nix b/modules/home-manager/dev.nix index ff6401a2..f966776c 100644 --- a/modules/home-manager/dev.nix +++ b/modules/home-manager/dev.nix @@ -1,9 +1,12 @@ +# Arsenal for development (which is rare nowadays). ;p +# If you're looking for text editors, go to `./editors.nix`. { config, options, lib, pkgs, ... }: let cfg = config.modules.dev; in { options.modules.dev = { - enable = lib.mkEnableOption "myy user-specific development setup"; + enable = + lib.mkEnableOption "foo-dogsquared's user-specific development setup"; shell.enable = lib.mkEnableOption "configuration of foo-dogsquared's shell of choice"; }; @@ -12,6 +15,7 @@ in { ({ home.packages = with pkgs; [ lazygit # Git interface for the lazy. + github-cli # So you don't have to use much of GitHub on the site, I guess. 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. diff --git a/modules/home-manager/i18n.nix b/modules/home-manager/i18n.nix index 260532a3..a38d6b6a 100644 --- a/modules/home-manager/i18n.nix +++ b/modules/home-manager/i18n.nix @@ -26,5 +26,12 @@ in { fcitx5-mozc # Japanese input addon. ]; }; + + # The i18n module has already set session variables but just to be sure... + systemd.user.sessionVariables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; }; } diff --git a/modules/nixos/hardware-setup/backup-archive.nix b/modules/nixos/hardware-setup/backup-archive.nix index f8f71c40..764db6a3 100644 --- a/modules/nixos/hardware-setup/backup-archive.nix +++ b/modules/nixos/hardware-setup/backup-archive.nix @@ -3,10 +3,10 @@ # TODO: Make this a generic service. # There are multiple external storage drives now. -let - cfg = config.modules.hardware-setup.backup-archive; +let cfg = config.modules.hardware-setup.backup-archive; in { - options.modules.hardware-setup.backup-archive.enable = lib.mkEnableOption "external hard drive and automated backup service with BorgBackup"; + options.modules.hardware-setup.backup-archive.enable = lib.mkEnableOption + "external hard drive and automated backup service with BorgBackup"; config = lib.mkIf cfg.enable { assertions = [{ @@ -14,7 +14,8 @@ in { message = "Agenix module is not enabled."; }]; - age.secrets.external-backup-borgmatic-settings.file = lib.getSecret "archive/password"; + age.secrets.external-backup-borgmatic-settings.file = + lib.getSecret "archive/borgmatic.json"; fileSystems."/mnt/external-storage" = { device = "/dev/disk/by-uuid/665A391C5A38EB07"; fsType = "ntfs"; @@ -37,10 +38,9 @@ in { Description = "Backup with Borgmatic"; Wants = [ "network-online.target" ]; After = [ "network-online.target" ]; - ConditionACPower = true; }; - startAt = "04/3:00:00"; + startAt = "04/2:00:00"; serviceConfig = { # Delay start to prevent backups running during boot. Note that systemd-inhibit requires dbus and # dbus-user-session to be installed. @@ -54,7 +54,7 @@ in { ProtectSystem = "full"; MemoryDenyWriteExecute = "no"; NoNewPrivileges = "yes"; - PrivateDevices= "yes"; + PrivateDevices = "yes"; PrivateTmp = "yes"; ProtectClock = "yes"; ProtectControlGroups = "yes"; diff --git a/modules/nixos/users.nix b/modules/nixos/users.nix index 7834d777..0d4304ef 100644 --- a/modules/nixos/users.nix +++ b/modules/nixos/users.nix @@ -36,9 +36,9 @@ in { options.modules.users = { users = lib.mkOption { default = { }; - description = - "A set of users from the `./users/home-manager` directory to be included in the NixOS config. - This will also create the appropriate user settings in users.users in the NixOS configuration."; + description = '' + A set of users from the `./users/home-manager` directory to be included in the NixOS config. + This will also create the appropriate user settings in users.users in the NixOS configuration.''; example = { foo-dogsquared.settings = { extraGroups = [ "wheel" "audio" "libvirtd" ]; @@ -68,10 +68,8 @@ in { # Mapping each users to the respective user configuration. # Setting users for home-manager. home-manager.users = mapUsers (user: _: - let - homeManagerUserModulePath = lib.getAttr user homeManagerUserModules; - homeManagerUserConfig = import homeManagerUserModulePath; - in homeManagerUserConfig); + let homeManagerUserModulePath = lib.getAttr user homeManagerUserModules; + in import homeManagerUserModulePath); # NixOS users. users.users = mapUsers (user: opts: diff --git a/users/home-manager/foo-dogsquared/default.nix b/users/home-manager/foo-dogsquared/default.nix index ab66882b..f13603db 100644 --- a/users/home-manager/foo-dogsquared/default.nix +++ b/users/home-manager/foo-dogsquared/default.nix @@ -2,9 +2,9 @@ { home.packages = with pkgs; [ - brave - emacs - github-cli + neovim + borgmatic + borgbackup ncmpcpp ];