mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 02:40:14 +00:00
more adjustments
This commit is contained in:
@ -199,20 +199,19 @@ in
|
||||
exec = "${config.terminalLaunchCommand} aerc %u";
|
||||
};
|
||||
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
|
||||
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+Shift+e" =
|
||||
"exec ${
|
||||
# Don't name the script `aerc` or it will affect grep
|
||||
builtins.toString (
|
||||
pkgs.writeShellScript "focus-mail.sh" ''
|
||||
count=$(ps aux | grep -c aerc)
|
||||
if [ "$count" -eq 1 ]; then
|
||||
i3-msg "exec --no-startup-id ${config.terminal} start --class aerc -- aerc"
|
||||
sleep 0.25
|
||||
fi
|
||||
i3-msg "[class=aerc] focus"
|
||||
''
|
||||
)
|
||||
}";
|
||||
"${config.xsession.windowManager.i3.config.modifier}+Shift+e" = "exec ${
|
||||
# Don't name the script `aerc` or it will affect grep
|
||||
builtins.toString (
|
||||
pkgs.writeShellScript "focus-mail.sh" ''
|
||||
count=$(ps aux | grep -c aerc)
|
||||
if [ "$count" -eq 1 ]; then
|
||||
i3-msg "exec --no-startup-id ${config.terminal} start --class aerc -- aerc"
|
||||
sleep 0.25
|
||||
fi
|
||||
i3-msg "[class=aerc] focus"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
|
@ -183,20 +183,19 @@ in
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
|
||||
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+Shift+b" =
|
||||
"exec ${
|
||||
# Don't name the script `firefox` or it will affect grep
|
||||
builtins.toString (
|
||||
pkgs.writeShellScript "focus-ff.sh" ''
|
||||
count=$(ps aux | grep -c firefox)
|
||||
if [ "$count" -eq 1 ]; then
|
||||
i3-msg "exec --no-startup-id firefox"
|
||||
sleep 0.5
|
||||
fi
|
||||
i3-msg "[class=firefox] focus"
|
||||
''
|
||||
)
|
||||
}";
|
||||
"${config.xsession.windowManager.i3.config.modifier}+Shift+b" = "exec ${
|
||||
# Don't name the script `firefox` or it will affect grep
|
||||
builtins.toString (
|
||||
pkgs.writeShellScript "focus-ff.sh" ''
|
||||
count=$(ps aux | grep -c firefox)
|
||||
if [ "$count" -eq 1 ]; then
|
||||
i3-msg "exec --no-startup-id firefox"
|
||||
sleep 0.5
|
||||
fi
|
||||
i3-msg "[class=firefox] focus"
|
||||
''
|
||||
)
|
||||
}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ in
|
||||
scs = "systemctl status";
|
||||
sca = "systemctl cat";
|
||||
m = "make";
|
||||
t = "trash";
|
||||
|
||||
# Vim (overwritten by Neovim)
|
||||
v = "vim";
|
||||
|
@ -25,7 +25,7 @@ let
|
||||
-B -o ldif-wrap=no \
|
||||
-E pr=5000/prompt \
|
||||
-H "${ldap_scheme}://''${LDAP_HOST}:${builtins.toString ldap_port}" \
|
||||
-D "${pkgs.lib.toUpper magic_prefix}2\\${pkgs.lib.toLower config.user}" \
|
||||
-D "${pkgs.lib.toUpper magic_prefix}2\\${pkgs.lib.toLower config.home.username}" \
|
||||
-w "$(${pkgs._1password-cli}/bin/op item get T2 --fields label=password --reveal)" \
|
||||
-b "dc=''${LDAP_HOST//./,dc=}" \
|
||||
-s "sub" -x "(cn=''${SEARCH_FILTER})" \
|
||||
|
@ -18,7 +18,7 @@ in
|
||||
|
||||
# Quick button for launching nautilus
|
||||
xsession.windowManager.i3.config.keybindings = {
|
||||
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+n" =
|
||||
"${config.xsession.windowManager.i3.config.modifier}+n" =
|
||||
"exec --no-startup-id ${pkgs.nautilus}/bin/nautilus";
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.programs.nixpkgs;
|
||||
in
|
||||
|
||||
@ -124,7 +125,7 @@ in
|
||||
# For security, only allow specific users
|
||||
settings.allowed-users = [
|
||||
"@wheel" # Anyone in the wheel group
|
||||
config.user # The current user
|
||||
config.home.username # The current user
|
||||
];
|
||||
|
||||
# Enable features in Nix commands
|
||||
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nmasur.presets.programs.obsidian;
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
nmasur.presets.programs.obsidian = {
|
||||
enable = lib.mkEnableOption "Obsidian markdown wiki";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
unfreePackages = [ "obsidian" ];
|
||||
home.packages = with pkgs; [ obsidian ];
|
||||
|
||||
# Broken on 2023-12-11
|
||||
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
|
||||
# insecurePackages = [ "electron-25.9.0" ];
|
||||
};
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
|
||||
options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer";
|
||||
|
||||
config.home-manager.users.${config.user} = lib.mkIf config.tmux.enable {
|
||||
config = lib.mkIf config.tmux.enable {
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
@ -28,13 +28,11 @@ in
|
||||
};
|
||||
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./Spoons/MoveWindow.spoon;
|
||||
|
||||
home.activation.reloadHammerspoon =
|
||||
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ]
|
||||
''
|
||||
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
|
||||
$DRY_RUN_CMD sleep 1
|
||||
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
|
||||
'';
|
||||
home.activation.reloadHammerspoon = config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
|
||||
$DRY_RUN_CMD sleep 1
|
||||
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -4,119 +4,120 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) fullName;
|
||||
cfg = config.nmasur.presets.services.mbsync;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
mail.enable = lib.mkEnableOption "Mail service.";
|
||||
mail.user = lib.mkOption {
|
||||
options.nmasur.preset.services.mbsync = {
|
||||
enable = lib.mkEnableOption "Mail service.";
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "User name for the email address.";
|
||||
default = config.user;
|
||||
};
|
||||
mail.server = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
server = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Server name for the email address.";
|
||||
};
|
||||
mail.imapHost = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
imapHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Server host for IMAP (reading mail).";
|
||||
};
|
||||
mail.smtpHost = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
smtpHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Server host for SMTP (sending mail).";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.mail.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
};
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Automatically check for mail and keep files synced locally
|
||||
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
||||
enable = true;
|
||||
frequency = "*:0/5";
|
||||
postExec = "${lib.getExe pkgs.notmuch} new";
|
||||
};
|
||||
# Automatically check for mail and keep files synced locally
|
||||
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
||||
enable = true;
|
||||
frequency = "*:0/5";
|
||||
postExec = "${lib.getExe pkgs.notmuch} new";
|
||||
};
|
||||
|
||||
# Used to watch for new mail and trigger sync
|
||||
services.imapnotify.enable = pkgs.stdenv.isLinux;
|
||||
# Used to watch for new mail and trigger sync
|
||||
services.imapnotify.enable = pkgs.stdenv.isLinux;
|
||||
|
||||
# Allows sending email from CLI/sendmail
|
||||
programs.msmtp.enable = true;
|
||||
# Allows sending email from CLI/sendmail
|
||||
programs.msmtp.enable = true;
|
||||
|
||||
accounts.email = {
|
||||
accounts.email = {
|
||||
|
||||
# Where email files are stored
|
||||
maildirBasePath = "${config.home.homeDirectory}/mail";
|
||||
# Where email files are stored
|
||||
maildirBasePath = "${config.home.homeDirectory}/mail";
|
||||
|
||||
accounts = {
|
||||
home =
|
||||
let
|
||||
address = "${config.mail.user}@${config.mail.server}";
|
||||
in
|
||||
{
|
||||
userName = address;
|
||||
realName = config.fullName;
|
||||
primary = true;
|
||||
inherit address;
|
||||
aliases = map (user: "${user}@${config.mail.server}") [
|
||||
"me"
|
||||
"hey"
|
||||
"admin"
|
||||
];
|
||||
accounts = {
|
||||
home =
|
||||
let
|
||||
address = "${cfg.user}@${cfg.server}";
|
||||
in
|
||||
{
|
||||
userName = address;
|
||||
realName = fullName;
|
||||
primary = true;
|
||||
inherit address;
|
||||
aliases = map (user: "${user}@${cfg.server}") [
|
||||
"me"
|
||||
"hey"
|
||||
"admin"
|
||||
];
|
||||
|
||||
# Options for contact completion
|
||||
alot = { };
|
||||
# Options for contact completion
|
||||
alot = { };
|
||||
|
||||
imap = {
|
||||
host = config.mail.imapHost;
|
||||
port = 993;
|
||||
tls.enable = true;
|
||||
};
|
||||
imap = {
|
||||
host = cfg.imapHost;
|
||||
port = 993;
|
||||
tls.enable = true;
|
||||
};
|
||||
|
||||
# Watch for mail and run notifications or sync
|
||||
imapnotify = {
|
||||
enable = true;
|
||||
boxes = [ "Inbox" ];
|
||||
onNotify = "${pkgs.isync}/bin/mbsync -a";
|
||||
onNotifyPost =
|
||||
lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
|
||||
"${lib.getExe pkgs.libnotify} 'New mail arrived'";
|
||||
};
|
||||
# Watch for mail and run notifications or sync
|
||||
imapnotify = {
|
||||
enable = true;
|
||||
boxes = [ "Inbox" ];
|
||||
onNotify = "${pkgs.isync}/bin/mbsync -a";
|
||||
onNotifyPost = lib.mkIf config.services.dunst.enable "${lib.getExe pkgs.libnotify} 'New mail arrived'";
|
||||
};
|
||||
|
||||
# Name of the directory in maildir for this account
|
||||
maildir = {
|
||||
path = "main";
|
||||
};
|
||||
# Name of the directory in maildir for this account
|
||||
maildir = {
|
||||
path = "main";
|
||||
};
|
||||
|
||||
# Bi-directional syncing options for local files
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "both";
|
||||
expunge = "both";
|
||||
remove = "both";
|
||||
patterns = [ "*" ];
|
||||
extraConfig.channel = {
|
||||
CopyArrivalDate = "yes"; # Sync time of original message
|
||||
};
|
||||
};
|
||||
|
||||
# Enable indexing
|
||||
notmuch.enable = true;
|
||||
|
||||
# Used to login and send and receive emails
|
||||
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
|
||||
|
||||
smtp = {
|
||||
host = config.mail.smtpHost;
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
# Bi-directional syncing options for local files
|
||||
mbsync = {
|
||||
enable = true;
|
||||
create = "both";
|
||||
expunge = "both";
|
||||
remove = "both";
|
||||
patterns = [ "*" ];
|
||||
extraConfig.channel = {
|
||||
CopyArrivalDate = "yes"; # Sync time of original message
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Enable indexing
|
||||
notmuch.enable = true;
|
||||
|
||||
# Used to login and send and receive emails
|
||||
passwordCommand = "${lib.getExe pkgs.age} --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
|
||||
|
||||
smtp = {
|
||||
host = cfg.smtpHost;
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -35,9 +35,14 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAliases = {
|
||||
# Move files to XDG trash on the commandline
|
||||
trash = lib.mkDefault "${pkgs.trash-cli}/bin/trash-put";
|
||||
programs.fish = {
|
||||
shellAliases = {
|
||||
# Move files to XDG trash on the commandline
|
||||
trash = lib.mkDefault "${pkgs.trash-cli}/bin/trash-put";
|
||||
};
|
||||
shellAbbrs = {
|
||||
t = "trash";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ in
|
||||
pkgs.jo # JSON output
|
||||
pkgs.osc # Clipboard over SSH
|
||||
pkgs.qrencode # Generate qr codes
|
||||
# pkgs.ren # Rename files
|
||||
# pkgs.rep # Replace text in files
|
||||
pkgs.ren # Rename files
|
||||
pkgs.rep # Replace text in files
|
||||
pkgs.spacer # Output lines in terminal
|
||||
pkgs.tealdeer # Cheatsheets
|
||||
pkgs.vimv-rs # Batch rename files
|
||||
|
@ -58,6 +58,7 @@ in
|
||||
k9s.enable = lib.mkDefault true;
|
||||
kubectl.enable = lib.mkDefault true;
|
||||
ldapsearch.enable = lib.mkDefault true;
|
||||
obsidian.enable = lib.mkDefault true;
|
||||
ripgrep.enable = lib.mkDefault true;
|
||||
starship.enable = lib.mkDefault true;
|
||||
terraform.enable = lib.mkDefault true;
|
||||
|
@ -6,7 +6,7 @@
|
||||
name = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Color palette name (fallback when individual colors aren't specified)";
|
||||
default = null;
|
||||
default = "gruvbox";
|
||||
};
|
||||
colors = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
|
@ -5,6 +5,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.user;
|
||||
in
|
||||
|
||||
@ -13,14 +14,14 @@ in
|
||||
options.nmasur.presets.services.user.enable = lib.mkEnableOption "macoS user settings";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users."${config.user}" = {
|
||||
users.users."${username}" = {
|
||||
# macOS user
|
||||
home = config.home-manager.users.${config.user}.home.homeDirectory;
|
||||
home = config.home-manager.users.${username}.home.homeDirectory;
|
||||
uid = 502;
|
||||
# shell = pkgs.fish; # Default shell
|
||||
};
|
||||
# This might fix the shell issues
|
||||
users.knownUsers = [ config.user ];
|
||||
users.knownUsers = [ username ];
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
let
|
||||
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.nmasur.presets.services.calibre-web;
|
||||
libraryPath = "/data/books";
|
||||
in
|
||||
@ -58,7 +58,7 @@ in
|
||||
services.cloudflare-dyndns.domains = [ hostnames.books ];
|
||||
|
||||
# Grant user access to Calibre directories
|
||||
users.users.${config.user}.extraGroups = [ "calibre-web" ];
|
||||
users.users.${username}.extraGroups = [ "calibre-web" ];
|
||||
|
||||
# Run a backup on a schedule
|
||||
systemd.timers.calibre-backup = {
|
||||
|
@ -25,6 +25,7 @@
|
||||
# Set ca = "<public key>"
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.cloudflared;
|
||||
in
|
||||
|
||||
@ -74,7 +75,7 @@ in
|
||||
# Must match the username portion of the email address in Cloudflare
|
||||
# Access
|
||||
"ssh/authorized_principals".text = ''
|
||||
${config.user}
|
||||
${username}
|
||||
'';
|
||||
};
|
||||
|
||||
@ -82,7 +83,7 @@ in
|
||||
services.openssh.extraConfig = ''
|
||||
PubkeyAuthentication yes
|
||||
TrustedUserCAKeys /etc/ssh/ca.pub
|
||||
Match User '${config.user}'
|
||||
Match User '${username}'
|
||||
AuthorizedPrincipalsFile /etc/ssh/authorized_principals
|
||||
# if there is no existing AuthenticationMethods
|
||||
AuthenticationMethods publickey
|
||||
|
@ -6,7 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.nmasur.presets.services.gitea;
|
||||
giteaPath = "/var/lib/gitea"; # Default service directory
|
||||
in
|
||||
@ -59,7 +59,7 @@ in
|
||||
extraConfig = null;
|
||||
};
|
||||
|
||||
users.users.${config.user}.extraGroups = [ "gitea" ];
|
||||
users.users.${username}.extraGroups = [ "gitea" ];
|
||||
|
||||
caddy.routes = [
|
||||
# Prevent public access to Prometheus metrics.
|
||||
|
@ -14,17 +14,17 @@ in
|
||||
endpoint = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 endpoint for Litestream backups";
|
||||
# default = null;
|
||||
default = "s3.us-west-002.backblazeb2.com";
|
||||
};
|
||||
bucket = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 bucket for Litestream backups";
|
||||
# default = null;
|
||||
default = "noahmasur-backup";
|
||||
};
|
||||
accessKeyId = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 access key ID for Litestream backups";
|
||||
# default = null;
|
||||
default = "0026b0e73b2e2c80000000005";
|
||||
};
|
||||
accessKeySecret = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
|
@ -6,7 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.nmasur.presets.services.nextcloud;
|
||||
in
|
||||
{
|
||||
@ -212,7 +212,7 @@ in
|
||||
};
|
||||
|
||||
# Grant user access to Nextcloud directories
|
||||
users.users.${config.user}.extraGroups = [ "nextcloud" ];
|
||||
users.users.${username}.extraGroups = [ "nextcloud" ];
|
||||
|
||||
# Open to groups, allowing for backups
|
||||
systemd.services.phpfpm-nextcloud.serviceConfig.StateDirectoryMode = lib.mkForce "0770";
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.nix-autoupgrade;
|
||||
in
|
||||
|
||||
@ -54,7 +55,7 @@ in
|
||||
systemctl status $SERVICE_ID >> $TEMPFILE
|
||||
set -e
|
||||
${lib.getExe pkgs.msmtp} \
|
||||
--file=${config.home-manager.users.${config.user}.xdg.configDir}/msmtp/config \
|
||||
--file=${config.home-manager.users.${username}.xdg.configDir}/msmtp/config \
|
||||
--account=system \
|
||||
${address} < $TEMPFILE
|
||||
'';
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.notes-git-sync;
|
||||
in
|
||||
|
||||
@ -27,7 +28,7 @@ in
|
||||
Type = "oneshot";
|
||||
ExecStartPre = "${lib.getExe pkgs.git} -C /data/git/notes reset --hard master";
|
||||
ExecStart = "${lib.getExe pkgs.git} -C /data/git/notes pull";
|
||||
WorkingDirectory = config.home-manager.users.${config.user}.home.homeDirectory;
|
||||
WorkingDirectory = config.home-manager.users.${username}.home.homeDirectory;
|
||||
Environment = "PATH=${pkgs.openssh}/bin";
|
||||
};
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.openssh;
|
||||
in
|
||||
{
|
||||
@ -16,7 +17,9 @@ in
|
||||
publicKeys = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
description = "Public SSH keys authorized for this system.";
|
||||
default = null;
|
||||
default = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
|
||||
];
|
||||
};
|
||||
# permitRootLogin = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
@ -38,7 +41,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
users.users.${config.user}.openssh.authorizedKeys.keys = lib.mkIf (
|
||||
users.users.${username}.openssh.authorizedKeys.keys = lib.mkIf (
|
||||
cfg.publicKeys != null
|
||||
) cfg.publicKeys;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.nmasur.presets.services.paperless;
|
||||
in
|
||||
{
|
||||
@ -28,7 +28,7 @@ in
|
||||
|
||||
# Allow Nextcloud and user to see files
|
||||
users.users.nextcloud.extraGroups = lib.mkIf config.services.nextcloud.enable [ "paperless" ];
|
||||
users.users.${config.user}.extraGroups = [ "paperless" ];
|
||||
users.users.${username}.extraGroups = [ "paperless" ];
|
||||
|
||||
caddy.routes = [
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.presets.services.postgresql;
|
||||
in
|
||||
{
|
||||
@ -23,7 +24,7 @@ in
|
||||
identMap = ''
|
||||
root postgres postgres
|
||||
root root postgres
|
||||
admin ${config.user} admin
|
||||
admin ${username} admin
|
||||
'';
|
||||
ensureUsers = [
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ in
|
||||
bucket = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "S3 bucket for Restic backups";
|
||||
default = null;
|
||||
default = "noahmasur-restic";
|
||||
};
|
||||
accessKeySecretPair = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
|
@ -9,7 +9,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.nmasur.presets.services.transmission;
|
||||
in
|
||||
{
|
||||
@ -34,7 +34,7 @@ in
|
||||
rpc-authentication-required = true;
|
||||
rpc-port = 9091;
|
||||
rpc-bind-address = "0.0.0.0";
|
||||
rpc-username = config.user;
|
||||
rpc-username = username;
|
||||
# This is a salted hash of the real password
|
||||
# https://github.com/tomwijnroks/transmission-pwgen
|
||||
rpc-password = "{c4c5145f6e18bcd3c7429214a832440a45285ce26jDOBGVW";
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.profiles.base;
|
||||
in
|
||||
|
||||
@ -19,7 +20,7 @@ in
|
||||
users.mutableUsers = lib.mkDefault false;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.${config.user} = {
|
||||
users.users.${username} = {
|
||||
|
||||
# Create a home directory for human user
|
||||
isNormalUser = lib.mkDefault true;
|
||||
|
@ -6,6 +6,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.profiles.gui;
|
||||
in
|
||||
|
||||
@ -53,7 +54,7 @@ in
|
||||
hardware.i2c.enable = lib.mkDefault true;
|
||||
|
||||
# Grant main user access to external monitors
|
||||
users.users.${config.user}.extraGroups = lib.mkDefault [ "i2c" ];
|
||||
users.users.${username}.extraGroups = lib.mkDefault [ "i2c" ];
|
||||
|
||||
services.xserver.displayManager = {
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.nmasur.settings) username;
|
||||
cfg = config.nmasur.profiles.shared-media;
|
||||
in
|
||||
|
||||
@ -18,7 +19,7 @@ in
|
||||
users.groups.shared = { };
|
||||
|
||||
# Give the human user access to the shared group
|
||||
users.users.${config.user}.extraGroups = [ config.users.groups.shared.name ];
|
||||
users.users.${username}.extraGroups = [ config.users.groups.shared.name ];
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
type = lib.types.str;
|
||||
description = "Human readable name of the user";
|
||||
};
|
||||
options.hostnames = lib.mkOption {
|
||||
hostnames = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
description = "Map of service names to FQDNs";
|
||||
default = { };
|
||||
|
@ -5,7 +5,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.nmasur.settings) hostnames;
|
||||
inherit (config.nmasur.settings) hostnames username;
|
||||
cfg = config.services.filebrowser;
|
||||
|
||||
dataDir = "/var/lib/filebrowser";
|
||||
@ -18,7 +18,7 @@ let
|
||||
database = "${dataDir}/filebrowser.db";
|
||||
root = "";
|
||||
"auth.method" = "json";
|
||||
username = config.user;
|
||||
username = username;
|
||||
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
|
||||
password = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za";
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ in
|
||||
enable = lib.mkEnableOption "Wait for identity file oneshot";
|
||||
identityFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = config.identityFile;
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user