This commit is contained in:
Harald Hoyer 2024-01-11 10:26:46 +00:00
parent 66c05f9093
commit 45d6f4b0f3
205 changed files with 9040 additions and 342 deletions

View file

@ -0,0 +1,58 @@
{ options
, config
, lib
, pkgs
, ...
}:
with lib;
with lib.plusultra; let
cfg = config.plusultra.apps.firefox;
defaultSettings = {
"browser.aboutwelcome.enabled" = false;
"browser.meta_refresh_when_inactive.disabled" = true;
"browser.startup.homepage" = "https://start.duckduckgo.com/?kak=-1&kal=-1&kao=-1&kaq=-1&kt=Hack+Nerd+Font&kae=d&ks=m&k7=2e3440&kj=3b4252&k9=eceff4&kaa=d8dee9&ku=1&k8=d8dee9&kx=81a1c1&k21=3b4252&k18=1&k5=2&kp=-2&k1=-1&kaj=u&kay=b&kk=-1&kax=-1&kap=-1&kau=-1";
"browser.bookmarks.showMobileBookmarks" = true;
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.aboutConfig.showWarning" = false;
"browser.ssb.enabled" = true;
};
in
{
options.plusultra.apps.firefox = with types; {
enable = mkBoolOpt false "Whether or not to enable Firefox.";
extraConfig =
mkOpt str "" "Extra configuration for the user profile JS file.";
userChrome =
mkOpt str "" "Extra configuration for the user chrome CSS file.";
settings = mkOpt attrs defaultSettings "Settings to apply to the profile.";
};
config = mkIf cfg.enable {
plusultra.desktop.addons.firefox-nordic-theme = enabled;
plusultra.home = {
extraOptions = {
programs.firefox = {
enable = true;
package = pkgs.firefox.override {
cfg = {
# FIXME: This method of enabling browser pass support is
# deprecated, but the suggested solution requires using
# the NixOS module rather than Home-Manager. Update this
# if/when Home-Manager gets support for:
# `programs.firefox.extraNativeMessagingHosts.packages`
enableBrowserpass = true;
};
};
profiles.${config.plusultra.user.name} = {
inherit (cfg) extraConfig userChrome settings;
id = 0;
name = config.plusultra.user.name;
};
};
};
};
};
}

View file

@ -0,0 +1,18 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.apps.iterm2;
in
{
options.plusultra.apps.iterm2 = with types; {
enable = mkBoolOpt false "Whether or not to enable iTerm2.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
iterm2
];
};
}

View file

@ -0,0 +1,14 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.apps.vscode;
in
{
options.plusultra.apps.vscode = with types; {
enable = mkBoolOpt false "Whether or not to enable vscode.";
};
config =
mkIf cfg.enable { environment.systemPackages = with pkgs; [ vscode ]; };
}

View file

@ -0,0 +1,47 @@
inputs @ { options
, config
, lib
, pkgs
, ...
}:
with lib;
with lib.plusultra; let
cfg = config.plusultra.cli-apps.neovim;
in
{
options.plusultra.cli-apps.neovim = with types; {
enable = mkBoolOpt false "Whether or not to enable neovim.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
# FIXME: As of today (2022-12-09), `page` no longer works with my Neovim
# configuration. Either something in my configuration is breaking it or `page` is busted.
# page
plusultra.neovim
];
environment.variables = {
# PAGER = "page";
# MANPAGER =
# "page -C -e 'au User PageDisconnect sleep 100m|%y p|enew! |bd! #|pu p|set ft=man'";
PAGER = "less";
MANPAGER = "less";
NPM_CONFIG_PREFIX = "$HOME/.npm-global";
EDITOR = "nvim";
};
plusultra.home = {
configFile = {
"dashboard-nvim/.keep".text = "";
};
extraOptions = {
# Use Neovim for Git diffs.
programs.zsh.shellAliases.vimdiff = "nvim -d";
programs.bash.shellAliases.vimdiff = "nvim -d";
programs.fish.shellAliases.vimdiff = "nvim -d";
};
};
};
}

View file

@ -0,0 +1,23 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.desktop.addons.firefox-nordic-theme;
profileDir = ".mozilla/firefox/${config.plusultra.user.name}";
in
{
options.plusultra.desktop.addons.firefox-nordic-theme = with types; {
enable = mkBoolOpt false "Whether to enable the Nordic theme for firefox.";
};
config = mkIf cfg.enable {
plusultra.apps.firefox = {
extraConfig = builtins.readFile
"${pkgs.plusultra.firefox-nordic-theme}/configuration/user.js";
userChrome = ''
@import "${pkgs.plusultra.firefox-nordic-theme}/userChrome.css";
'';
};
};
}

View file

@ -0,0 +1,109 @@
{ lib, pkgs, config, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.desktop.addons.skhd;
mkScript = name: file: pkgs.writeShellApplication {
inherit name;
checkPhase = "";
text = builtins.readFile file;
};
open-iterm2 = mkScript "open-iterm2" ./scripts/open-iterm2.sh;
in
{
options.plusultra.desktop.addons.skhd = {
enable = mkEnableOption "skhd";
};
config = mkIf cfg.enable {
services.skhd = {
enable = true;
skhdConfig = ''
# Movement
shift + cmd - h : yabai -m window --focus west
shift + cmd - j : yabai -m window --focus south
shift + cmd - k : yabai -m window --focus north
shift + cmd - l : yabai -m window --focus east
# Window Movement
lctrl + shift + cmd - h : yabai -m window --swap west
lctrl + shift + cmd - j : yabai -m window --swap south
lctrl + shift + cmd - k : yabai -m window --swap north
lctrl + shift + cmd - l : yabai -m window --swap east
# Window Resize
lctrl + cmd - h : yabai -m window --resize left:-50:0; \
yabai -m window --resize right:-50:0
lctrl + cmd - j : yabai -m window --resize bottom:0:50; \
yabai -m window --resize top:0:50
lctrl + cmd - k : yabai -m window --resize top:0:-50; \
yabai -m window --resize bottom:0:-50
lctrl + cmd - l : yabai -m window --resize right:50:0; \
yabai -m window --resize left:50:0
lctrl + alt - h : yabai -m window --resize left:-10:0; \
yabai -m window --resize right:-10:0
lctrl + alt - j : yabai -m window --resize bottom:0:10; \
yabai -m window --resize top:0:10
lctrl + alt - k : yabai -m window --resize top:0:-10; \
yabai -m window --resize bottom:0:-10
lctrl + alt - l : yabai -m window --resize right:10:0; \
yabai -m window --resize left:10:0
lctrl + cmd - e : yabai -m space --balance
# Move Window To Space
lctrl + shift + cmd - m : yabai -m window --space last; yabai -m space --focus last
lctrl + shift + cmd - p : yabai -m window --space prev; yabai -m space --focus prev
lctrl + shift + cmd - n : yabai -m window --space next; yabai -m space --focus next
lctrl + shift + cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1
lctrl + shift + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
lctrl + shift + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3
lctrl + shift + cmd - 4 : yabai -m window --space 4; yabai -m space --focus 4
# Focus Space
# shift + cmd - m : yabai -m space --focus last
# shift + cmd - p : yabai -m space --focus prev
# shift + cmd - n : yabai -m space --focus next
shift + cmd - 1 : yabai -m space --focus 1
shift + cmd - 2 : yabai -m space --focus 2
shift + cmd - 3 : yabai -m space --focus 3
shift + cmd - 4 : yabai -m space --focus 4
# Insert Direction
lctrl + shift + cmd - v : yabai -m window --insert south
lctrl + shift + cmd - b : yabai -m window --insert east
lctrl + shift + cmd - s : yabai -m window --insert stack
# Floating Windows
# shift + cmd - space : \
# yabai -m window --toggle float; \
# yabai -m window --toggle border
shift + cmd - space : yabai -m window --toggle float
# Terminal
shift + cmd - return : ${open-iterm2}/bin/open-iterm2
# Fullscreen
alt - f : yabai -m window --toggle zoom-fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# Restart Yabai
shift + lctrl + alt - r : \
/usr/bin/env osascript <<< \
"display notification \"Restarting Yabai\" with title \"Yabai\""; \
launchctl kickstart -k "gui/$UID/org.nixos.yabai"
# Restart Spacebar
shift + lctrl + alt - s : \
/usr/bin/env osascript <<< \
"display notification \"Restarting Spacebar\" with title \"Spacebar\""; \
launchctl kickstart -k "gui/$UID/org.nixos.spacebar"
'';
};
};
}

View file

@ -0,0 +1,14 @@
# Detects if iTerm2 is running
if ! pgrep -f "iTerm" > /dev/null 2>&1; then
open -a "/Applications/Nix Apps/iTerm2.app"
else
# Create a new window
script='tell application "iTerm2" to create window with default profile'
! osascript -e "${script}" > /dev/null 2>&1 && {
# Get pids for any app with "iTerm" and kill
while IFS="" read -r pid; do
kill -15 "${pid}"
done < <(pgrep -f "iTerm")
open -a "/Applications/Nix Apps/iTerm2.app"
}
fi

View file

@ -0,0 +1,47 @@
{ lib, pkgs, config, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.desktop.addons.spacebar;
in
{
options.plusultra.desktop.addons.spacebar = {
enable = mkEnableOption "Spacebar";
};
config = mkIf cfg.enable {
services.spacebar = {
enable = true;
package = pkgs.spacebar;
config = {
position = "top";
display = "all";
height = 32;
title = "on";
spaces = "on";
clock = "on";
power = "off";
padding_left = 10;
padding_right = 10;
spacing_left = 10;
spacing_right = 10;
foreground_color = "0xffeceff4";
background_color = "0xff1d2128";
text_font = ''"Hack Nerd Font Mono:Regular:14.0"'';
icon_font = ''"Hack Nerd Font Mono:Regular:20.0"'';
# Shell entries apparently break the whole bar...
# https://github.com/cmacrae/spacebar/issues/104
# right_shell_icon = "";
# right_shell_command = ''"whoami"'';
# right_shell = "on";
};
};
};
}

View file

@ -0,0 +1,77 @@
{ lib
, pkgs
, config
, ...
}:
let
cfg = config.plusultra.desktop.yabai;
inherit (lib) types mkEnableOption mkIf;
inherit (lib.plusultra) mkOpt enabled;
in
{
options.plusultra.desktop.yabai = {
enable = mkEnableOption "Yabai";
enable-scripting-addition = mkOpt types.bool true "Whether to enable the scripting addition for Yabai. (Requires SIP to be disabled)";
};
config = mkIf cfg.enable {
plusultra.desktop.addons = {
skhd = enabled;
spacebar = enabled;
};
services.yabai = {
enable = true;
enableScriptingAddition = cfg.enable-scripting-addition;
config = {
layout = "bsp";
auto_balance = "off";
debug_output = "on";
top_padding = 8;
right_padding = 8;
left_padding = 8;
bottom_padding = 8;
window_gap = 6;
window_topmost = "on";
window_shadow = "float";
# As of macOS Sonoma, window borders break Yabai and cause a bunch of lag.
window_border = "off";
# window_border = "on";
# window_border_width = 5;
# window_border_radius = 14;
# window_border_blur = "off";
# window_border_hidpi = "on";
# insert_feedback_color = "0xffb48ead";
# normal_window_border_color = "0x002e3440";
# active_window_border_color = "0xff5e81ac";
external_bar = "all:${builtins.toString config.services.spacebar.config.height}:0";
# mouse_modifier = "alt";
mouse_modifier = "cmd";
mouse_action1 = "move";
mouse_action2 = "resize";
};
extraConfig = ''
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off
yabai -m rule --add label="System Preferences" app="^System Preferences$" title=".*" manage=off
yabai -m rule --add label="App Store" app="^App Store$" manage=off
yabai -m rule --add label="Activity Monitor" app="^Activity Monitor$" manage=off
yabai -m rule --add label="Calculator" app="^Calculator$" manage=off
yabai -m rule --add label="Dictionary" app="^Dictionary$" manage=off
yabai -m rule --add label="mpv" app="^mpv$" manage=off
yabai -m rule --add label="Software Update" title="Software Update" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
'';
};
};
}

View file

@ -0,0 +1,40 @@
{ options, config, pkgs, lib, inputs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.home;
in
{
# imports = with inputs; [
# home-manager.darwinModules.home-manager
# ];
options.plusultra.home = with types; {
file = mkOpt attrs { }
"A set of files to be managed by home-manager's <option>home.file</option>.";
configFile = mkOpt attrs { }
"A set of files to be managed by home-manager's <option>xdg.configFile</option>.";
extraOptions = mkOpt attrs { } "Options to pass directly to home-manager.";
homeConfig = mkOpt attrs { } "Final config for home-manager.";
};
config = {
plusultra.home.extraOptions = {
home.stateVersion = mkDefault "22.11";
home.file = mkAliasDefinitions options.plusultra.home.file;
xdg.enable = true;
xdg.configFile = mkAliasDefinitions options.plusultra.home.configFile;
};
snowfallorg.user.${config.plusultra.user.name}.home.config = mkAliasDefinitions options.plusultra.home.extraOptions;
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
# users.${config.plusultra.user.name} = args:
# mkAliasDefinitions options.plusultra.home.extraOptions;
};
};
}

View file

@ -0,0 +1,74 @@
{ options
, config
, pkgs
, lib
, ...
}:
with lib;
with lib.plusultra; let
cfg = config.plusultra.nix;
in
{
options.plusultra.nix = with types; {
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
package = mkOpt package pkgs.nixUnstable "Which nix package to use.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
deploy-rs
nixfmt
nix-index
nix-prefetch-git
];
nix =
let
users = [ "root" config.plusultra.user.name ];
in
{
package = cfg.package;
settings = {
experimental-features = "nix-command flakes";
http-connections = 50;
warn-dirty = false;
log-lines = 50;
# Large builds apparently fail due to an issue with darwin:
# https://github.com/NixOS/nix/issues/4119
sandbox = false;
# This appears to break on darwin
# https://github.com/NixOS/nix/issues/7273
auto-optimise-store = false;
allow-import-from-derivation = true;
trusted-users = users;
allowed-users = users;
# NOTE: This configuration is generated by nix-installer so I'm adding it here in
# case it becomes important.
extra-nix-path = "nixpkgs=flake:nixpkgs";
build-users-group = "nixbld";
};
#// (lib.optionalAttrs config.plusultra.tools.direnv.enable {
# keep-outputs = true;
# keep-derivations = true;
#});
gc = {
automatic = true;
interval = { Day = 7; };
options = "--delete-older-than 30d";
user = config.plusultra.user.name;
};
# flake-utils-plus
generateRegistryFromInputs = true;
generateNixPathFromInputs = true;
linkInputs = true;
};
};
}

View file

@ -0,0 +1,84 @@
{ lib, config, pkgs, inputs, ... }:
let
inherit (lib) types mkEnableOption mkIf;
inherit (lib.plusultra) mkOpt;
cfg = config.plusultra.security.gpg;
gpgConf = "${inputs.gpg-base-conf}/gpg.conf";
gpgAgentConf = ''
enable-ssh-support
default-cache-ttl 60
max-cache-ttl 120
'';
guide = "${inputs.yubikey-guide}/README.md";
theme = pkgs.fetchFromGitHub {
owner = "jez";
repo = "pandoc-markdown-css-theme";
rev = "019a4829242937761949274916022e9861ed0627";
sha256 = "1h48yqffpaz437f3c9hfryf23r95rr319lrb3y79kxpxbc9hihxb";
};
guideHTML = pkgs.runCommand "yubikey-guide" { } ''
${pkgs.pandoc}/bin/pandoc \
--standalone \
--metadata title="Yubikey Guide" \
--from markdown \
--to html5+smart \
--toc \
--template ${theme}/template.html5 \
--css ${theme}/docs/css/theme.css \
--css ${theme}/docs/css/skylighting-solarized-theme.css \
-o $out \
${guide}
'';
reload-yubikey = pkgs.writeShellScriptBin "reload-yubikey" ''
${pkgs.gnupg}/bin/gpg-connect-agent "scd serialno" "learn --force" /bye
'';
in
{
options.plusultra.security.gpg = {
enable = mkEnableOption "GPG";
agentTimeout = mkOpt types.int 5 "The amount of time to wait before continuing with shell init.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
gnupg
];
environment.shellInit = ''
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)
${pkgs.coreutils}/bin/timeout ${builtins.toString cfg.agentTimeout} ${pkgs.gnupg}/bin/gpgconf --launch gpg-agent
gpg_agent_timeout_status=$?
if [ "$gpg_agent_timeout_status" = 124 ]; then
# Command timed out...
echo "GPG Agent timed out..."
echo 'Run "gpgconf --launch gpg-agent" to try and launch it again.'
fi
'';
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
plusultra.home.file = {
".gnupg/.keep".text = "";
".gnupg/yubikey-guide.md".source = guide;
".gnupg/yubikey-guide.html".source = guideHTML;
".gnupg/gpg.conf".source = gpgConf;
".gnupg/gpg-agent.conf".text = gpgAgentConf;
};
};
}

View file

@ -0,0 +1,17 @@
{ lib, config, ... }:
let
inherit (lib) types mkIf;
inherit (lib.plusultra) mkOpt enabled;
cfg = config.plusultra.services.nix-daemon;
in
{
options.plusultra.services.nix-daemon = {
enable = mkOpt types.bool true "Whether to enable the Nix daemon.";
};
config = mkIf cfg.enable {
services.nix-daemon = enabled;
};
}

View file

@ -0,0 +1,43 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.suites.common;
in
{
options.plusultra.suites.common = with types; {
enable = mkBoolOpt false "Whether or not to enable common configuration.";
};
config = mkIf cfg.enable {
programs.zsh = enabled;
plusultra = {
nix = enabled;
apps = {
iterm2 = enabled;
};
cli-apps = {
neovim = enabled;
};
tools = {
git = enabled;
flake = enabled;
};
system = {
fonts = enabled;
input = enabled;
interface = enabled;
};
security = {
gpg = enabled;
};
};
};
}

View file

@ -0,0 +1,35 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.suites.development;
in
{
options.plusultra.suites.development = with types; {
enable = mkBoolOpt false
"Whether or not to enable common development configuration.";
};
config = mkIf cfg.enable {
plusultra = {
apps = {
vscode = enabled;
};
tools = {
# at = enabled;
# direnv = enabled;
# go = enabled;
# http = enabled;
# k8s = enabled;
node = enabled;
# titan = enabled;
python = enabled;
java = enabled;
};
# virtualisation = { podman = enabled; };
};
};
}

View file

@ -0,0 +1,32 @@
{ options, config, pkgs, lib, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.system.fonts;
in
{
options.plusultra.system.fonts = with types; {
enable = mkBoolOpt false "Whether or not to manage fonts.";
fonts = mkOpt (listOf package) [ ] "Custom font packages to install.";
};
config = mkIf cfg.enable {
environment.variables = {
# Enable icons in tooling since we have nerdfonts.
LOG_ICONS = "true";
};
fonts = {
fontDir = enabled;
fonts = with pkgs;
[
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
(nerdfonts.override { fonts = [ "Hack" ]; })
] ++ cfg.fonts;
};
};
}

View file

@ -0,0 +1 @@
{ "~a" = (); "~b" = (); "~c" = (); "~d" = (); "~e" = (); "~f" = (); "~g" = (); "~h" = (); "~i" = (); "~j" = (); "~k" = (); "~l" = (); "~m" = (); "~n" = (); "~o" = (); "~p" = (); "~q" = (); "~r" = (); "~s" = (); "~t" = (); "~u" = (); "~v" = (); "~w" = (); "~x" = (); "~y" = (); "~z" = (); }

View file

@ -0,0 +1,55 @@
{ options, config, pkgs, lib, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.system.input;
in
{
options.plusultra.system.input = with types; {
enable = mkEnableOption "macOS input";
};
config = mkIf cfg.enable (mkMerge [
{
system = {
keyboard = {
enableKeyMapping = true;
remapCapsLockToEscape = true;
};
defaults = {
".GlobalPreferences" = {
"com.apple.mouse.scaling" = "1";
};
NSGlobalDomain = {
AppleKeyboardUIMode = 3;
ApplePressAndHoldEnabled = false;
KeyRepeat = 2;
InitialKeyRepeat = 15;
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
NSAutomaticQuoteSubstitutionEnabled = false;
NSAutomaticPeriodSubstitutionEnabled = false;
NSAutomaticSpellingCorrectionEnabled = false;
};
};
};
snowfallorg.user.${config.plusultra.user.name}.home.config = {
home.activation = {
# Disable special keys when using Option as a modifier.
# https://superuser.com/questions/941286/disable-default-option-key-binding
disableSpecialKeys = lib.home-manager.hm.dag.entryAfter [ "writeBoundary" ] ''
set +e
$DRY_RUN_CMD /usr/bin/sudo mkdir -p $HOME/Library/KeyBindings
$DRY_RUN_CMD /usr/bin/sudo cp '${builtins.toPath ./DefaultKeyBinding.dict}' "$HOME/Library/KeyBindings/DefaultKeyBinding.dict"
set -e
'';
};
};
}
]);
}

View file

@ -0,0 +1,29 @@
{ options, config, pkgs, lib, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.system.interface;
in
{
options.plusultra.system.interface = with types; {
enable = mkEnableOption "macOS interface";
};
config = mkIf cfg.enable {
system.defaults = {
dock.autohide = true;
finder = {
AppleShowAllExtensions = true;
FXEnableExtensionChangeWarning = false;
};
NSGlobalDomain = {
_HIHideMenuBar = true;
AppleShowScrollBars = "Always";
};
};
plusultra.home.file.".hushlogin".text = "";
};
}

View file

@ -0,0 +1,18 @@
{ lib, config, pkgs, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.tools.flake;
in
{
options.plusultra.tools.flake = {
enable = mkEnableOption "Flake";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
snowfallorg.flake
];
};
}

View file

@ -0,0 +1,43 @@
{ options, config, pkgs, lib, ... }:
with lib;
with lib.plusultra;
let
cfg = config.plusultra.tools.git;
gpg = config.plusultra.security.gpg;
user = config.plusultra.user;
in
{
options.plusultra.tools.git = with types; {
enable = mkBoolOpt false "Whether or not to install and configure git.";
userName = mkOpt types.str user.fullName "The name to configure git with.";
userEmail = mkOpt types.str user.email "The email to configure git with.";
signingKey =
mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ git ];
plusultra.home.extraOptions = {
programs.git = {
enable = true;
inherit (cfg) userName userEmail;
lfs = enabled;
signing = {
key = cfg.signingKey;
signByDefault = mkIf gpg.enable true;
};
extraConfig = {
init = { defaultBranch = "main"; };
pull = { rebase = true; };
push = { autoSetupRemote = true; };
core = { whitespace = "trailing-space,space-before-tab"; };
safe = {
directory = "${config.users.users.${user.name}.home}/work/config";
};
};
};
};
};
}

View file

@ -0,0 +1,17 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.tools.java;
in
{
options.plusultra.tools.java = with types; {
enable = mkBoolOpt false "Whether or not to enable Java.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
jdk
];
};
}

View file

@ -0,0 +1,42 @@
{ options
, config
, pkgs
, lib
, ...
}:
with lib;
with lib.plusultra; let
cfg = config.plusultra.tools.node;
in
{
options.plusultra.tools.node = with types; {
enable = mkBoolOpt false "Whether or not to install and configure git";
pkg = mkOpt package pkgs.nodejs "The NodeJS package to use";
prettier = {
enable = mkBoolOpt true "Whether or not to install Prettier";
pkg =
mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use";
};
yarn = {
enable = mkBoolOpt true "Whether or not to install Yarn";
pkg = mkOpt package pkgs.nodePackages.yarn "The NodeJS package to use";
};
pnpm = {
enable = mkBoolOpt true "Whether or not to install Pnpm";
pkg = mkOpt package pkgs.nodePackages.pnpm "The NodeJS package to use";
};
flyctl = {
enable = mkBoolOpt true "Whether or not to install flyctl";
pkg = mkOpt package pkgs.flyctl "The flyctl package to use";
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs;
[ cfg.pkg ]
++ (lib.optional cfg.prettier.enable cfg.prettier.pkg)
++ (lib.optional cfg.yarn.enable cfg.yarn.pkg)
++ (lib.optional cfg.pnpm.enable cfg.pnpm.pkg)
++ (lib.optional cfg.flyctl.enable cfg.flyctl.pkg);
};
}

View file

@ -0,0 +1,22 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.plusultra;
let cfg = config.plusultra.tools.python;
in
{
options.plusultra.tools.python = with types; {
enable = mkBoolOpt false "Whether or not to enable Python.";
};
config =
mkIf cfg.enable {
environment.systemPackages = with pkgs; [
(python311.withPackages (ps:
with ps; [
numpy
])
)
];
};
}

View file

@ -0,0 +1,45 @@
{ lib
, config
, pkgs
, ...
}:
let
inherit (lib) types mkIf mkDefault;
inherit (lib.plusultra) mkOpt;
cfg = config.plusultra.user;
is-linux = pkgs.stdenv.isLinux;
is-darwin = pkgs.stdenv.isDarwin;
in
{
options.plusultra.user = {
name = mkOpt types.str "short" "The user account.";
fullName = mkOpt types.str "Jake Hamilton" "The full name of the user.";
email = mkOpt types.str "jake.hamilton@hey.com" "The email of the user.";
uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account.";
};
config = {
users.users.${cfg.name} = {
# NOTE: Setting the uid here is required for another
# module to evaluate successfully since it reads
# `users.users.${plusultra.user.name}.uid`.
uid = mkIf (cfg.uid != null) cfg.uid;
};
snowfallorg.user.${config.plusultra.user.name}.home.config = {
home = {
file = {
".profile".text = ''
# The default file limit is far too low and throws an error when rebuilding the system.
# See the original with: ulimit -Sa
ulimit -n 4096
'';
};
};
};
};
}