bring back nix-darwin hosts compatability

This commit is contained in:
Yan Lin 2025-11-13 10:40:27 +01:00
parent 1b6a0430d2
commit 0bf4fb87c6
13 changed files with 579 additions and 31 deletions

View file

@ -1,5 +1,10 @@
{ 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 = [
@ -8,11 +13,11 @@
}))
];
# Papis configuration
home.file.".config/papis/config".text = ''
home.file."${papisConfigDir}/config".text = ''
[settings]
default-library = main
editor = nvim
opentool = evince
opentool = ${if pkgs.stdenv.isDarwin then "open -a Preview" else "evince"}
# Document management
ref-format = {doc[author]}{doc[year]}
@ -43,7 +48,7 @@
'';
# Papis bibliography template
home.file.".config/papis/templates/bibitem.template".text = ''
home.file."${papisConfigDir}/templates/bibitem.template".text = ''
{doc[title]} ({doc[year]}). {doc[author]}.
Venue: {doc[journal]} {doc[booktitle]} {doc[eprinttype]} {doc[eprint]} {doc[eventtitle]}
Tags: {doc[tags]}
@ -52,7 +57,7 @@
'';
# Papis BibTeX template
home.file.".config/papis/templates/bibtex.template".text = ''
home.file."${papisConfigDir}/templates/bibtex.template".text = ''
@{doc[type]}{{{doc[ref]},
author = {{{doc[author]}}},
title = {{{doc[title]}}},
@ -68,23 +73,23 @@
'';
# Papis citation template
home.file.".config/papis/templates/citation.template".text = ''
home.file."${papisConfigDir}/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/.config/papis/templates/bibitem.template\"";
pals = "papis list --template \"$HOME/${papisConfigDir}/templates/bibitem.template\"";
# Add new entry with bibtex
paadd = "papis add --from bibtex";
# BibTeX export
pabib = "papis list --template \"$HOME/.config/papis/templates/bibtex.template\"";
pabib = "papis list --template \"$HOME/${papisConfigDir}/templates/bibtex.template\"";
# Citation formatting
pacite = "papis list --template \"$HOME/.config/papis/templates/citation.template\"";
pacite = "papis list --template \"$HOME/${papisConfigDir}/templates/citation.template\"";
# File operations
paurl = "papis addto -u";