more updates

This commit is contained in:
Noah Masur
2025-02-05 17:25:29 -05:00
parent bb1a36330b
commit 620c72f731
23 changed files with 423 additions and 280 deletions

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