Files
MacNix-config/modules/darwin/files.nix
T

80 lines
3.2 KiB
Nix

{
user,
config,
pkgs,
...
}:
let
xdg_configHome = "${config.users.users.${user}.home}/.config";
xdg_dataHome = "${config.users.users.${user}.home}/.local/share";
xdg_stateHome = "${config.users.users.${user}.home}/.local/state";
inkscapeExtensionsHome = "${config.users.users.${user}.home}/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions";
hatchFillSource = pkgs.fetchzip {
url = "https://gitlab.com/moini_ink/hatch_fill/-/archive/master/hatch_fill-master.tar.gz";
sha256 = "1m3qhvf158dngg7shwd33xhn3bawn9yxw2srv2k8qjn889wjvi82";
};
penPlotterSource = pkgs.fetchzip {
url = "https://github.com/abdulshakoorkakar/Inkscape-ASK-Pen-Plotter-Gcode-Export/archive/b5f1476b4f4f1c5f4e818e066a05bfaf6d2b860d.tar.gz";
sha256 = "18ssw051qi5znkwrxx9y4mbjsq61whahmsk7f20mrqdr9ccbi5m6";
};
penPlotterInx = pkgs.runCommand "penplotter_gcode.inx" { } ''
cp ${penPlotterSource}/penplotter_gcode.inx "$out"
substituteInPlace "$out" \
--replace-fail 'gui-text="Pen up command:">M3 S0</param>' 'gui-text="Pen up command:">G21 G90 G53 G0 Z2</param>' \
--replace-fail 'gui-text="Pen down command:">M3 S180</param>' 'gui-text="Pen down command:">G21 G90 G53 G0 Z0</param>' \
--replace-fail 'gui-text="Travel speed, pen up (mm/min):">4000</param>' 'gui-text="Travel speed, pen up (mm/min):">2000</param>'
'';
in
{
# Shared file definitions moved into the Darwin module set.
"${config.users.users.${user}.home}/.gnupg/common.conf" = {
text = ''
# keyboxd configuration collides with gpg keymanager.app
# use-keyboxd
'';
};
"${config.users.users.${user}.home}/.ssh/authorized_keys" = {
text = ''
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAILVdAx+U1xhcJmh1hRaF0CVB0ivIF/U0oIbAWYPwko4iAAAABHNzaDo= Yubikey 35775013
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIIjnJyJUDnia6ZWPRa5iSBKCb+DMGmFtiFa+9gkeiTwQAAAABHNzaDo= Yubikey 36431751
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFhuPQUHUHchx8wHVCciMi6etzZStkpECbG/r/1imy+kAAAABHNzaDo= Yubikey 36431881
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILCEBZrQ9F3nLhEM9uqdPijut11vhYkdmLtj7gT/zgV3 Key Nov 2024
'';
};
# Raycast script so that "Run Emacs" is available and uses Emacs daemon
"${xdg_dataHome}/bin/emacsclient" = {
executable = true;
text = ''
#!/bin/zsh
#
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Run Emacs
# @raycast.mode silent
#
# Optional parameters:
# @raycast.packageName Emacs
# @raycast.icon ${xdg_dataHome}/img/icons/Emacs.icns
# @raycast.iconDark ${xdg_dataHome}/img/icons/Emacs.icns
if [[ $1 = "-t" ]]; then
# Terminal mode
${pkgs.emacs}/bin/emacsclient -t $@
else
# GUI mode
${pkgs.emacs}/bin/emacsclient -c -n $@
fi
'';
};
"${inkscapeExtensionsHome}/hatch_fill.inx".source = "${hatchFillSource}/hatch_fill.inx";
"${inkscapeExtensionsHome}/hatch_fill.py".source = "${hatchFillSource}/hatch_fill.py";
"${inkscapeExtensionsHome}/penplotter_gcode.inx".source = penPlotterInx;
"${inkscapeExtensionsHome}/penplotter_gcode.py".source = "${penPlotterSource}/penplotter_gcode.py";
}