Make miscellaneous updates :)

This commit is contained in:
foo-dogsquared 2021-12-26 16:02:57 +08:00
parent 9f7dc70ab8
commit 405fd9f1e1
7 changed files with 31 additions and 22 deletions

View File

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

View File

@ -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 [

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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 <literal>users.users</literal> 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 <literal>users.users</literal> 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:

View File

@ -2,9 +2,9 @@
{
home.packages = with pkgs; [
brave
emacs
github-cli
neovim
borgmatic
borgbackup
ncmpcpp
];