more updates

This commit is contained in:
Noah Masur 2025-02-05 17:25:29 -05:00
parent bb1a36330b
commit 620c72f731
No known key found for this signature in database
23 changed files with 423 additions and 280 deletions

View File

@ -37,40 +37,22 @@
description = "Path to existing private key file.";
default = "/etc/ssh/ssh_host_ed25519_key";
};
gui = {
enable = lib.mkEnableOption {
description = "Enable graphics.";
default = false;
};
};
theme = {
colors = lib.mkOption {
type = lib.types.attrs;
description = "Base16 color scheme.";
default = (import ../colorscheme/gruvbox).dark;
};
dark = lib.mkOption {
type = lib.types.bool;
description = "Enable dark mode.";
default = true;
};
};
homePath = lib.mkOption {
type = lib.types.path;
description = "Path of user's home directory.";
default = builtins.toPath (
if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
);
};
dotfilesPath = lib.mkOption {
type = lib.types.path;
description = "Path of dotfiles repository.";
default = config.homePath + "/dev/personal/dotfiles";
};
dotfilesRepo = lib.mkOption {
type = lib.types.str;
description = "Link to dotfiles repository HTTPS URL.";
};
# homePath = lib.mkOption {
# type = lib.types.path;
# description = "Path of user's home directory.";
# default = builtins.toPath (
# if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
# );
# };
# dotfilesPath = lib.mkOption {
# type = lib.types.path;
# description = "Path of dotfiles repository.";
# default = config.homePath + "/dev/personal/dotfiles";
# };
# dotfilesRepo = lib.mkOption {
# type = lib.types.str;
# description = "Link to dotfiles repository HTTPS URL.";
# };
unfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "List of unfree packages to allow.";
@ -81,88 +63,88 @@
description = "List of insecure packages to allow.";
default = [ ];
};
hostnames = {
audiobooks = lib.mkOption {
type = lib.types.str;
description = "Hostname for audiobook server (Audiobookshelf).";
};
budget = lib.mkOption {
type = lib.types.str;
description = "Hostname for budgeting server (ActualBudget).";
};
files = lib.mkOption {
type = lib.types.str;
description = "Hostname for files server (Filebrowser).";
};
git = lib.mkOption {
type = lib.types.str;
description = "Hostname for git server (Gitea).";
};
metrics = lib.mkOption {
type = lib.types.str;
description = "Hostname for metrics server.";
};
minecraft = lib.mkOption {
type = lib.types.str;
description = "Hostname for Minecraft server.";
};
paperless = lib.mkOption {
type = lib.types.str;
description = "Hostname for document server (paperless-ngx).";
};
photos = lib.mkOption {
type = lib.types.str;
description = "Hostname for photo management (Immich).";
};
prometheus = lib.mkOption {
type = lib.types.str;
description = "Hostname for Prometheus server.";
};
influxdb = lib.mkOption {
type = lib.types.str;
description = "Hostname for InfluxDB2 server.";
};
secrets = lib.mkOption {
type = lib.types.str;
description = "Hostname for passwords and secrets (Vaultwarden).";
};
stream = lib.mkOption {
type = lib.types.str;
description = "Hostname for video/media library (Jellyfin).";
};
content = lib.mkOption {
type = lib.types.str;
description = "Hostname for personal content system (Nextcloud).";
};
books = lib.mkOption {
type = lib.types.str;
description = "Hostname for books library (Calibre-Web).";
};
download = lib.mkOption {
type = lib.types.str;
description = "Hostname for download services.";
};
irc = lib.mkOption {
type = lib.types.str;
description = "Hostname for IRC services.";
};
n8n = lib.mkOption {
type = lib.types.str;
description = "Hostname for n8n automation.";
};
notifications = lib.mkOption {
type = lib.types.str;
description = "Hostname for push notification services (ntfy).";
};
status = lib.mkOption {
type = lib.types.str;
description = "Hostname for status page (Uptime-Kuma).";
};
transmission = lib.mkOption {
type = lib.types.str;
description = "Hostname for peer2peer downloads (Transmission).";
};
};
# hostnames = {
# audiobooks = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for audiobook server (Audiobookshelf).";
# };
# budget = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for budgeting server (ActualBudget).";
# };
# files = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for files server (Filebrowser).";
# };
# git = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for git server (Gitea).";
# };
# metrics = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for metrics server.";
# };
# minecraft = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for Minecraft server.";
# };
# paperless = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for document server (paperless-ngx).";
# };
# photos = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for photo management (Immich).";
# };
# prometheus = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for Prometheus server.";
# };
# influxdb = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for InfluxDB2 server.";
# };
# secrets = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for passwords and secrets (Vaultwarden).";
# };
# stream = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for video/media library (Jellyfin).";
# };
# content = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for personal content system (Nextcloud).";
# };
# books = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for books library (Calibre-Web).";
# };
# download = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for download services.";
# };
# irc = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for IRC services.";
# };
# n8n = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for n8n automation.";
# };
# notifications = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for push notification services (ntfy).";
# };
# status = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for status page (Uptime-Kuma).";
# };
# transmission = lib.mkOption {
# type = lib.types.str;
# description = "Hostname for peer2peer downloads (Transmission).";
# };
# };
};
config =

View File

@ -1,18 +1,24 @@
_final: prev:
let
listToAttrsByField =
field: list:
builtins.listToAttrs (
map (v: {
name = v.${field};
value = v;
}) list
);
lib = prev.lib;
packages = lib.pipe [
(lib.filesystem.listFilesRecursive ../pkgs)
packagesDirectory = lib.filesystem.listFilesRecursive ../pkgs;
packages = lib.pipe packagesDirectory [
# Get only files called package.nix
(builtins.filter (name: (lib.hasSuffix "package.nix" name)))
(builtins.map (package: prev.callPackage package))
# Apply callPackage to create a derivation
(builtins.map prev.callPackage)
# Convert the list to an attrset
(listToAttrsByField "name")
];
in
{
loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix { };
aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2 { };
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup { };
nmasur-neovim = prev.callPackage ../pkgs/applications/editors/neovim/nmasur/neovim { };
}
packages

View File

@ -1,67 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
neovim = import ./package {
inherit pkgs;
colors = config.theme.colors;
terraform = config.terraform.enable;
github = true;
kubernetes = config.kubernetes.enable;
};
in
{
options.neovim.enable = lib.mkEnableOption "Neovim.";
config = lib.mkIf config.neovim.enable {
home-manager.users.${config.user} =
{
home.packages = [ neovim ];
# Use Neovim as the editor for git commit messages
programs.git.extraConfig.core.editor = "nvim";
programs.jujutsu.settings.ui.editor = "nvim";
# Set Neovim as the default app for text editing and manual pages
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
};
# Create quick aliases for launching Neovim
programs.fish = {
shellAliases = {
vim = "nvim";
};
shellAbbrs = {
v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
vll = "nvim -c 'Telescope oldfiles'";
};
};
# Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
name = "Neovim wrapper";
exec = "${config.home-manager.users.${config.user}.programs.rofi.terminal} nvim %F";
mimeType = [
"text/plain"
"text/markdown"
];
};
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
"text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ];
};
};
};
}

View File

@ -0,0 +1,55 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.nmasur.presets.gtk;
in
{
options.nmasur.presets.gtk = {
enable = lib.mkEnableOption "Gnome GTK settings";
theme = {
name = lib.mkOption {
type = lib.types.str;
default = "Adwaita-dark";
};
package = lib.mkPackageOption pkgs "gnome-themes-extra" { };
};
};
config = lib.mkIf cfg.enable {
# Cursor
home.pointerCursor = {
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
size = 24;
gtk.enable = true;
x11.enable = true;
};
# Enable num lock on login
xsession.numlock.enable = true;
# Dark theme
gtk = {
enable = true;
theme = {
name = cfg.theme.name;
package = cfg.theme.package;
};
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = config.theme.mode == "dark";
};
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = config.theme.mode == "dark";
};
};
};
}

View File

@ -22,12 +22,13 @@ in
path = lib.mkOption {
type = lib.types.path;
description = "Path to dotfiles on disk";
default = config.homePath + "/dev/personal/dotfiles";
default = config.home.homeDirectory + "/dev/personal/dotfiles";
};
};
config = lib.mkIf cfg.enable {
# Always make the dotfiles directory considered safe for git and direnv
programs.git.extraConfig.safe.directory = cfg.path;
programs.direnv.config.whitelist.prefix = [ cfg.path ];
@ -37,8 +38,7 @@ in
cloneDotfiles = config.lib.dag.entryAfter [ "writeBoundary" "loadkey" ] ''
if [ ! -d "${cfg.path}" ]; then
run mkdir --parents $VERBOSE_ARG $(dirname "${cfg.path}")
run ${pkgs.git}/bin/git \
clone ${cfg.repo} "${cfg.path}"
run ${lib.getExe pkgs.git} clone ${cfg.repo} "${cfg.path}"
fi
'';
};

View File

@ -67,7 +67,7 @@ in
"extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
"layout.css.color-mix.enabled" = true;
"ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
"ui.systemUsesDarkTheme" = if config.theme.mode == "dark" then 1 else 0;
"media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
"devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page

View File

@ -6,12 +6,12 @@
}:
let
cfg = config.nmasur.presets.programs.msmtp;
cfg = config.nmasur.presets.programs.msmtp-system;
in
{
options.nmasur.presets.programs.msmtp.enable = lib.mkEnableOption "System outgoing mail";
options.nmasur.presets.programs.msmtp-system.enable = lib.mkEnableOption "System outgoing mail";
config = lib.mkIf cfg.enable {
programs.msmtp.enable = true;

View File

@ -13,13 +13,16 @@ in
options.nmasur.presets.programs.nixpkgs-darwin.enable = lib.mkEnableOption {
description = "Nixpkgs tools for macOS";
default = config.nmasur.presets.programs.nixpkgs && pkgs.stdenv.isDarwin;
default =
config.nmasur.presets.programs.nixpkgs.enable
&& pkgs.stdenv.isDarwin
&& config.nmasur.presets.programs.dotfiles.enable;
};
config = lib.mkIf (cfg.enable) {
programs.fish = {
shellAbbrs = {
shellAbbrs = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
nr = {
function = lib.mkForce "rebuild-darwin";
};
@ -27,23 +30,23 @@ in
function = lib.mkForce "rebuild-darwin-offline";
};
};
functions = {
functions = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
rebuild-darwin = {
body = ''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "darwin-rebuild switch --flake ${config.dotfilesPath}#lookingglass"
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "darwin-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path}#lookingglass"
'';
};
rebuild-darwin-offline = {
body = ''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "darwin-rebuild switch --option substitute false --flake ${config.dotfilesPath}#lookingglass"
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "darwin-rebuild switch --option substitute false --flake ${config.nmasur.presets.programs.dotfiles.path}#lookingglass"
'';
};
rebuild-home = lib.mkForce {
body = ''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#lookingglass";
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "${lib.getExe pkgs.home-manager} switch --flake ${config.nmasur.presets.programs.dotfiles.path}#lookingglass";
'';
};
};

View File

@ -24,13 +24,13 @@ in
nps = "nix repl --expr 'import <nixpkgs>{}'";
nixo = "man configuration.nix";
nixh = "man home-configuration.nix";
nr = {
nr = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
function = "rebuild-nixos";
};
nro = {
nro = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
function = "rebuild-nixos-offline";
};
hm = {
hm = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
function = "rebuild-home";
};
};
@ -56,25 +56,25 @@ in
commandline -f repaint
'';
};
rebuild-nixos = {
rebuild-nixos = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
body = # fish
''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName}"
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path}#${config.networking.hostName}"
'';
};
rebuild-nixos-offline = {
rebuild-nixos-offline = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
body = # fish
''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "doas nixos-rebuild switch --option substitute false --flake ${config.dotfilesPath}#${config.networking.hostName}"
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "doas nixos-rebuild switch --option substitute false --flake ${config.nmasur.presets.programs.dotfiles.path}#${config.networking.hostName}"
'';
};
rebuild-home = {
rebuild-home = lib.mkIf config.nmasur.presets.programs.dotfiles.enable {
body = # fish
''
git -C ${config.dotfilesPath} add --intent-to-add --all
echo "${lib.getExe pkgs.home-manager} switch --flake ${config.dotfilesPath}#${config.networking.hostName}";
git -C ${config.nmasur.presets.programs.dotfiles.path} add --intent-to-add --all
echo "${lib.getExe pkgs.home-manager} switch --flake ${config.nmasur.presets.programs.dotfiles.path}#${config.networking.hostName}";
'';
};
};
@ -99,7 +99,7 @@ in
# Create nix-index if doesn't exist
home.activation.createNixIndex =
let
cacheDir = "${config.homePath}/.cache/nix-index";
cacheDir = "${config.xdg.cacheHome}/nix-index";
in
lib.mkIf config.programs.nix-index.enable (
config.lib.dag.entryAfter [ "writeBoundary" ] ''
@ -141,10 +141,12 @@ in
settings = {
# Add community Cachix to binary cache
# Don't use with macOS because blocked by corporate firewall
# Don't use at work because blocked by corporate firewall
builders-use-substitutes = true;
substituters = lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ];
trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [
substituters = lib.mkIf (!config.nmasur.profiles.work.enable) [
"https://nix-community.cachix.org"
];
trusted-public-keys = lib.mkIf (!config.nmasur.profiles.work.enable) [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];

View File

@ -20,7 +20,7 @@ in
path = lib.mkOption {
type = lib.types.path;
description = "Path to notes on disk";
default = config.homePath + "/dev/personal/notes";
default = config.home.homeDirectory + "/dev/personal/notes";
};
};

View File

@ -0,0 +1,24 @@
{ config, lib, ... }:
let
cfg = config.nmasur.presets.programs.notmuch;
in
{
options.nmasur.presets.programs.notmuch.enable = lib.mkEnableOption "Notmuch mail indexing";
config = lib.mkIf cfg.enable {
# Better local mail search
programs.notmuch = {
enable = true;
new.ignore = [
".mbsyncstate.lock"
".mbsyncstate.journal"
".mbsyncstate.new"
];
};
};
}

View File

@ -202,9 +202,9 @@ in
''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = lib.mkIf cfg.commands.lockScreen != null "exec ${cfg.commands.lockScreen}";
"${modifier}+Mod1+h" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.nmasur.presets.programs.dotfiles.path}#${config.networking.hostName} || read'";
"${modifier}+Mod1+r" =
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"exec --no-startup-id ${lib.getExe cfg.terminal} -e sh -c 'doas nixos-rebuild switch --flake ${config.nmasur.presets.programs.dotfiles.path}#${config.networking.hostName} || read'";
# Window options
"${modifier}+q" = "kill";
@ -322,7 +322,7 @@ in
# Update lock screen cache only if cache is empty
home.activation.updateLockScreenCache =
let
cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
cacheDir = "${config.xdg.cacheHome}/betterlockscreen/current";
in
lib.mkIf cfg.commands.updateLockScreen != null (
config.lib.dag.entryAfter [ "writeBoundary" ] ''

View File

@ -0,0 +1,123 @@
{
config,
pkgs,
lib,
...
}:
{
options = {
mail.enable = lib.mkEnableOption "Mail service.";
mail.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;
description = "Server name for the email address.";
};
mail.imapHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Server host for IMAP (reading mail).";
};
mail.smtpHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Server host for SMTP (sending mail).";
};
};
config = lib.mkIf config.mail.enable {
home-manager.users.${config.user} = {
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";
};
# 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;
accounts.email = {
# 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"
];
# Options for contact completion
alot = { };
imap = {
host = config.mail.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'";
};
# 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;
};
};
};
};
};
};
}

View File

@ -1,6 +1,5 @@
{
config,
pkgs,
lib,
...
}:
@ -15,35 +14,7 @@ in
config = lib.mkIf cfg.enable {
# Cursor
home.pointerCursor = {
name = lib.mkDefault "Adwaita";
package = lib.mkDefault pkgs.adwaita-icon-theme;
size = lib.mkDefault 24;
gtk.enable = lib.mkDefault true;
x11.enable = lib.mkDefault true;
};
# Enable num lock on login
xsession.numlock.enable = lib.mkDefault true;
# Dark theme
gtk =
let
gtkExtraConfig = {
gtk-application-prefer-dark-theme = lib.mkDefault config.theme.dark;
};
in
{
enable = lib.mkDefault true;
theme = {
name = lib.mkDefault config.gtk.theme.name;
package = lib.mkDefault config.gtk.theme.package;
};
gtk3.extraConfig = lib.mkDefault gtkExtraConfig;
gtk4.extraConfig = lib.mkDefault gtkExtraConfig;
};
nmasur.gtk.enable = lib.mkDefault true;
programs.zed-editor.enable = lib.mkDefault true;
};

View File

@ -6,10 +6,10 @@
}:
let
cfg = config.nmasur.profiles.common;
cfg = config.nmasur.profiles.power-user;
in
{
options.nmasur.profiles.common.enable = lib.mkEnableOption "Extra home-manager config";
options.nmasur.profiles.power-user.enable = lib.mkEnableOption "power user home-manager config";
config = lib.mkIf cfg.enable {
home.packages = lib.mkDefault [

View File

@ -0,0 +1,26 @@
{ lib, ... }:
{
options.theme = {
name = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Color palette name (fallback when individual colors aren't specified)";
default = null;
};
colors = lib.mkOption {
type = lib.types.attrs;
description = "Base16 color scheme.";
default = (import ../colorscheme/gruvbox).dark;
};
mode = lib.mkOption {
type = lib.types.enum [
"light"
"dark"
];
description = "Light or dark mode";
default = "dark";
};
};
}

View File

@ -18,7 +18,9 @@ in
homebrew.casks = [ "hammerspoon" ];
system.activationScripts.postUserActivation.text = ''
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${config.homePath}/.config/hammerspoon/init.lua"
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${
config.home-manager.users.${config.user}.xdg.configHome
}/hammerspoon/init.lua"
sudo killall Dock
'';

View File

@ -15,7 +15,7 @@ in
config = lib.mkIf cfg.enable {
users.users."${config.user}" = {
# macOS user
home = config.homePath;
home = config.home-manager.users.${config.user}.home.homeDirectory;
uid = 502;
# shell = pkgs.fish; # Default shell
};

View File

@ -1,5 +1,6 @@
{
config,
pkgs,
lib,
...
}:
@ -16,6 +17,13 @@ in
type = lib.types.path;
description = "Wallpaper background image file";
};
gtk.theme = {
name = lib.mkOption {
type = lib.types.str;
default = "Adwaita-dark";
};
package = lib.mkPackageOption pkgs "gnome-themes-extra" { };
};
};
config = lib.mkIf cfg.enable {
@ -34,6 +42,13 @@ in
extraSeatDefaults = ''
greeter-hide-users = false
'';
# Make the login screen dark
greeters.gtk.theme = {
name = cfg.gtk.theme.name;
package = cfg.gtk.theme.package;
};
};
};
};

View File

@ -11,7 +11,14 @@ in
{
options.nmasur.presets.services.nix-autoupgrade.enable = lib.mkEnableOption "Nix auto upgrade";
options.nmasur.presets.services.nix-autoupgrade = {
enable = lib.mkEnableOption "Nix auto upgrade";
repo = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Git URL of the flake repository to use for upgrades";
default = "git@github.com:nmasur/dotfiles";
};
};
config = lib.mkIf cfg.enable {
@ -19,7 +26,7 @@ in
system.autoUpgrade = {
enable = true;
dates = "09:33";
flake = "git+${config.dotfilesRepo}";
flake = "git+${cfg.repo}";
randomizedDelaySec = "25min";
operation = "switch";
allowReboot = true;
@ -46,8 +53,8 @@ in
set +e
systemctl status $SERVICE_ID >> $TEMPFILE
set -e
${pkgs.msmtp}/bin/msmtp \
--file=${config.homePath}/.config/msmtp/config \
${lib.getExe pkgs.msmtp} \
--file=${config.home-manager.users.${config.user}.xdg.configDir}/msmtp/config \
--account=system \
${address} < $TEMPFILE
'';

View File

@ -25,9 +25,9 @@ in
Unit.Description = "Get latest notes.";
Service = {
Type = "oneshot";
ExecStartPre = "${pkgs.git}/bin/git -C /data/git/notes reset --hard master";
ExecStart = "${pkgs.git}/bin/git -C /data/git/notes pull";
WorkingDirectory = config.homePath;
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;
Environment = "PATH=${pkgs.openssh}/bin";
};
};

View File

@ -82,15 +82,10 @@ in
services.dbus.packages = [ pkgs.dconf ];
programs.dconf.enable = true;
# Make the login screen dark
services.xserver.displayManager.lightdm.greeters.gtk.theme = {
name = config.gtk.theme.name;
package = config.gtk.theme.package;
};
environment.sessionVariables = {
GTK_THEME = config.gtk.theme.name;
};
# TODO: can we get rid of this?
# environment.sessionVariables = {
# GTK_THEME = config.gtk.theme.name;
# };
};
}

View File

@ -7,7 +7,6 @@
let
cfg = config.services.betterlockscreen;
lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
in
{
@ -29,7 +28,7 @@ in
Type = "simple";
Environment = "DISPLAY=:0";
TimeoutSec = "infinity";
ExecStart = lockCmd;
ExecStart = "${lib.getExe pkgs.betterlockscreen} --lock --display 1 --blur 0.5 --span";
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
};
wantedBy = [