remove macos and nix-darwin related config

This commit is contained in:
Yan Lin 2025-10-24 12:46:00 +02:00
parent e8d42b488a
commit 0f8fe62245
16 changed files with 62 additions and 640 deletions

View file

@ -1,44 +0,0 @@
{ config, pkgs, ... }:
{
# Homebrew configuration for package management
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap"; # Removes unlisted formulae/casks
upgrade = true;
};
brews = [
# Command-line tools go here
];
casks = [
# GUI applications - manually installed apps now managed by Homebrew
"keepassxc"
"keycastr"
"inkscape"
"firefox"
"obsidian"
"snipaste"
"ghostty"
"slidepilot"
"tencent-meeting"
"ovito"
"microsoft-powerpoint"
"microsoft-word"
"microsoft-excel"
"rectangle"
];
taps = [
# Additional repositories if needed
];
};
# nix-homebrew configuration for declarative Homebrew installation
nix-homebrew = {
enable = true;
enableRosetta = true; # Apple Silicon support
user = "yanlin";
autoMigrate = true; # Migrate existing Homebrew if present
};
}

View file

@ -334,8 +334,8 @@
# OS settings
os = {
open = if pkgs.stdenv.isDarwin then "open {{filename}}" else "xdg-open {{filename}}";
openLink = if pkgs.stdenv.isDarwin then "open {{link}}" else "xdg-open {{link}}";
open = "xdg-open {{filename}}";
openLink = "xdg-open {{link}}";
};
# Disable startup popup

View file

@ -264,8 +264,8 @@ in
{
mode = "n";
key = "<leader>f";
action = ":lua show_file_in_finder()<CR>";
options = { desc = "Show current file in Finder"; };
action = ":lua show_file_in_file_manager()<CR>";
options = { desc = "Show current file in file manager"; };
}
];
@ -298,20 +298,11 @@ in
})
-- Dictionary completion setup
${lib.optionalString pkgs.stdenv.isDarwin ''
require("cmp_dictionary").setup({
paths = { "/usr/share/dict/words" }, -- Standard dictionary path on macOS
exact_length = 2, -- Minimum length before completion
first_case_insensitive = true, -- Case insensitive matching
})
''}
${lib.optionalString (!pkgs.stdenv.isDarwin) ''
require("cmp_dictionary").setup({
paths = { "${pkgs.scowl}/share/dict/wamerican.txt" }, -- Nix-provided dictionary on NixOS
exact_length = 2, -- Minimum length before completion
first_case_insensitive = true, -- Case insensitive matching
})
''}
require("cmp_dictionary").setup({
paths = { "${pkgs.scowl}/share/dict/wamerican.txt" }, -- Nix-provided dictionary
exact_length = 2, -- Minimum length before completion
first_case_insensitive = true, -- Case insensitive matching
})
-- Jupytext setup for Jupyter notebook viewing
require("jupytext").setup({
@ -352,21 +343,18 @@ in
}
-- OSC-52 clipboard integration (matches tmux setup, works with Ghostty)
-- This enables clipboard functionality across SSH, tmux, and multi-platform
-- Only enabled on Linux; macOS uses native clipboard with "unnamedplus"
${lib.optionalString (!pkgs.stdenv.isDarwin) ''
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
''}
-- This enables clipboard functionality across SSH and tmux
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
-- Close all buffers except current (preserving NvimTree and other special buffers)
function close_other_buffers()
@ -392,26 +380,21 @@ in
local filepath = vim.fn.expand('%:p')
if filepath ~= "" then
local escaped_path = vim.fn.shellescape(filepath)
${if pkgs.stdenv.isDarwin then
"vim.fn.system('open ' .. escaped_path)"
else
"vim.fn.system('xdg-open ' .. escaped_path)"}
vim.fn.system('xdg-open ' .. escaped_path)
else
print("No file to open")
end
end
${lib.optionalString pkgs.stdenv.isDarwin ''
function show_file_in_finder()
local filepath = vim.fn.expand('%:p')
if filepath ~= "" then
local escaped_path = vim.fn.shellescape(filepath)
vim.fn.system('open -R ' .. escaped_path)
else
print("No file to show")
end
function show_file_in_file_manager()
local filepath = vim.fn.expand('%:p')
if filepath ~= "" then
local escaped_path = vim.fn.shellescape(filepath)
vim.fn.system('nautilus --select ' .. escaped_path)
else
print("No file to show")
end
''}
end
'';
};
}

View file

@ -1,19 +1,14 @@
{ pkgs, lib, ... }:
let
# Platform-aware papis config directory
papisConfigDir = if pkgs.stdenv.isDarwin then "Library/Application Support/papis" else ".config/papis";
in
{
# Install papis package
home.packages = [ pkgs.papis ];
# Papis configuration
home.file."${papisConfigDir}/config".text = ''
home.file.".config/papis/config".text = ''
[settings]
default-library = main
editor = nvim
opentool = ${if pkgs.stdenv.isDarwin then "open -a Preview" else "evince"}
opentool = evince
# Document management
ref-format = {doc[author]}{doc[year]}
@ -44,7 +39,7 @@ in
'';
# Papis bibliography template
home.file."${papisConfigDir}/templates/bibitem.template".text = ''
home.file.".config/papis/templates/bibitem.template".text = ''
{doc[title]} ({doc[year]}). {doc[author]}.
Venue: {doc[journal]} {doc[booktitle]} {doc[eprinttype]} {doc[eprint]} {doc[eventtitle]}
Tags: {doc[tags]}
@ -53,7 +48,7 @@ in
'';
# Papis BibTeX template
home.file."${papisConfigDir}/templates/bibtex.template".text = ''
home.file.".config/papis/templates/bibtex.template".text = ''
@{doc[type]}{{{doc[ref]},
author = {{{doc[author]}}},
title = {{{doc[title]}}},
@ -69,23 +64,23 @@ in
'';
# Papis citation template
home.file."${papisConfigDir}/templates/citation.template".text = ''
home.file.".config/papis/templates/citation.template".text = ''
{doc[author]}. "{doc[title]}." {doc[journal]}{doc[booktitle]} ({doc[year]}).
'';
# Shell aliases for papis workflow
programs.zsh.shellAliases = {
# Bibliography formatting
pals = "papis list --template \"$HOME/${papisConfigDir}/templates/bibitem.template\"";
pals = "papis list --template \"$HOME/.config/papis/templates/bibitem.template\"";
# Add new entry with bibtex
paadd = "papis add --from bibtex";
# BibTeX export
pabib = "papis list --template \"$HOME/${papisConfigDir}/templates/bibtex.template\"";
pabib = "papis list --template \"$HOME/.config/papis/templates/bibtex.template\"";
# Citation formatting
pacite = "papis list --template \"$HOME/${papisConfigDir}/templates/citation.template\"";
pacite = "papis list --template \"$HOME/.config/papis/templates/citation.template\"";
# File operations
paurl = "papis addto -u";

View file

@ -22,13 +22,7 @@
--delete-excluded
--partial
--partial-dir=.rsync-partial
${lib.optionalString pkgs.stdenv.isDarwin ''
# Preserve extended attributes and ACLs (macOS)
--extended-attributes
--acls
''}
# Network optimization
--compress
--compress-level=6

View file

@ -94,11 +94,6 @@ in
};
};
};
# Override the launchd agent to add RunAtLoad on macOS
launchd.agents.syncthing = lib.mkIf (pkgs.stdenv.isDarwin && config.services.syncthing.enable) {
config.RunAtLoad = true;
};
# Deploy .stignore files to synced folders
home.file."Credentials/.stignore".text = stignoreContent;

View file

@ -3,7 +3,7 @@
{
# Install termscp package
home.packages = [ pkgs.termscp ];
home.file.${if pkgs.stdenv.isDarwin then "Library/Application Support/termscp/config.toml" else ".config/termscp/config.toml"}.text = ''
home.file.".config/termscp/config.toml".text = ''
# termscp configuration file
# Generated by Nix - see modules/termscp.nix for customization