move all files to new nixfmt rfc

This commit is contained in:
Noah Masur 2024-04-20 09:42:06 -04:00
parent b23efc4d77
commit e43fc0f8db
No known key found for this signature in database
159 changed files with 5309 additions and 4537 deletions

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: rec { { pkgs, ... }:
rec {
# Show quick helper # Show quick helper
default = import ./help.nix { inherit pkgs; }; default = import ./help.nix { inherit pkgs; };
@ -30,5 +31,4 @@
# Run neovim as an app # Run neovim as an app
neovim = import ./neovim.nix { inherit pkgs; }; neovim = import ./neovim.nix { inherit pkgs; };
nvim = neovim; nvim = neovim;
} }

View File

@ -1,19 +1,19 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age # nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "encrypt-secret" '' program = builtins.toString (
pkgs.writeShellScript "encrypt-secret" ''
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2 printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
read -p "Secret: " secret read -p "Secret: " secret
printf "\nEncrypting...\n\n" 1>&2 printf "\nEncrypting...\n\n" 1>&2
tmpfile=$(mktemp) tmpfile=$(mktemp)
echo "''${secret}" > ''${tmpfile} echo "''${secret}" > ''${tmpfile}
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${ ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile
builtins.toString ../misc/public-keys
} $tmpfile
rm $tmpfile rm $tmpfile
''); ''
);
} }

View File

@ -1,10 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# This script will partition and format drives; use at your own risk! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "format-root" '' program = builtins.toString (
pkgs.writeShellScript "format-root" ''
set -e set -e
DISK=$1 DISK=$1
@ -34,6 +36,6 @@
--flake "path:$(pwd)#root" \ --flake "path:$(pwd)#root" \
--arg disk "/dev/''${DISK}" --arg disk "/dev/''${DISK}"
''); ''
);
} }

View File

@ -1,8 +1,10 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "default" '' program = builtins.toString (
pkgs.writeShellScript "default" ''
${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options" ${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.' ${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.'
echo "" echo ""
@ -18,6 +20,6 @@
' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}' ' {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
echo "" echo ""
echo "" echo ""
''); ''
);
} }

View File

@ -1,11 +1,13 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix # Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
# This script will partition and format drives; use at your own risk! # This script will partition and format drives; use at your own risk!
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "installer" '' program = builtins.toString (
pkgs.writeShellScript "installer" ''
set -e set -e
DISK=$1 DISK=$1
@ -43,6 +45,6 @@
mount /dev/disk/by-label/boot /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE} ${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
''); ''
);
} }

View File

@ -1,13 +1,15 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "loadkey" '' program = builtins.toString (
pkgs.writeShellScript "loadkey" ''
printf "\nEnter the seed phrase for your SSH key...\n" printf "\nEnter the seed phrase for your SSH key...\n"
printf "\nThen press ^D when complete.\n\n" printf "\nThen press ^D when complete.\n\n"
mkdir -p ~/.ssh/ mkdir -p ~/.ssh/
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519 ${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
printf "\n\nContinuing activation.\n\n" printf "\n\nContinuing activation.\n\n"
''); ''
);
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
@ -8,5 +9,4 @@
colors = (import ../colorscheme/nord).dark; colors = (import ../colorscheme/nord).dark;
}) })
}/bin/nvim"; }/bin/nvim";
} }

View File

@ -1,8 +1,10 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "netdata-cloud" '' program = builtins.toString (
pkgs.writeShellScript "netdata-cloud" ''
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
echo "Please run as root" echo "Please run as root"
exit 1 exit 1
@ -14,6 +16,6 @@
chown -R netdata:netdata /var/lib/netdata chown -R netdata:netdata /var/lib/netdata
${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen) ${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
printf "\n\nNow restart netdata service.\n\n" printf "\n\nNow restart netdata service.\n\n"
''); ''
);
} }

View File

@ -1,9 +1,11 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "readme" '' program = builtins.toString (
pkgs.writeShellScript "readme" ''
${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md} ${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
''); ''
);
} }

View File

@ -1,8 +1,10 @@
{ pkgs, ... }: { { pkgs, ... }:
{
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "rebuild" '' program = builtins.toString (
pkgs.writeShellScript "rebuild" ''
echo ${pkgs.system} echo ${pkgs.system}
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"} SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
if [ "$SYSTEM" == "darwin" ]; then if [ "$SYSTEM" == "darwin" ]; then
@ -10,6 +12,6 @@
else else
doas nixos-rebuild switch --flake ${builtins.toString ../.} doas nixos-rebuild switch --flake ${builtins.toString ../.}
fi fi
''); ''
);
} }

View File

@ -1,10 +1,12 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# nix run github:nmasur/dotfiles#reencrypt-secrets ./private # nix run github:nmasur/dotfiles#reencrypt-secrets ./private
type = "app"; type = "app";
program = builtins.toString (pkgs.writeShellScript "reencrypt-secrets" '' program = builtins.toString (
pkgs.writeShellScript "reencrypt-secrets" ''
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Must provide directory to reencrypt." echo "Must provide directory to reencrypt."
exit 1 exit 1
@ -16,12 +18,10 @@
${pkgs.age}/bin/age --decrypt \ ${pkgs.age}/bin/age --decrypt \
--identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile --identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
echo "Encrypting ''${encryptedfile}..." echo "Encrypting ''${encryptedfile}..."
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${ ${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile > $encryptedfile
builtins.toString ../misc/public-keys
} $tmpfile > $encryptedfile
rm $tmpfile rm $tmpfile
done done
echo "Finished." echo "Finished."
''); ''
);
} }

View File

@ -16,9 +16,7 @@
base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted
base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ... base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ...
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
base0E = base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
"#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
base0F =
"#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
}; };
} }

View File

@ -2,8 +2,7 @@
{ {
name = "gruvbox-dark"; # Dark, Medium name = "gruvbox-dark"; # Dark, Medium
author = author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
dark = { dark = {
base00 = "#1D2122"; # ---- This is the change from normal gruvbox base00 = "#1D2122"; # ---- This is the change from normal gruvbox
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,7 +1,6 @@
{ {
name = "gruvbox"; # Dark, Medium name = "gruvbox"; # Dark, Medium
author = author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
dark = { dark = {
base00 = "#282828"; # ---- base00 = "#282828"; # ----
base01 = "#3c3836"; # --- base01 = "#3c3836"; # ---

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
_1password = { _1password = {
@ -10,9 +16,16 @@
}; };
config = lib.mkIf (config.gui.enable && config._1password.enable) { config = lib.mkIf (config.gui.enable && config._1password.enable) {
unfreePackages = [ "1password" "_1password-gui" "1password-cli" ]; unfreePackages = [
"1password"
"_1password-gui"
"1password-cli"
];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui _1password ]; home.packages = with pkgs; [
_1password-gui
_1password
];
}; };
# https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app # https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
@ -26,5 +39,4 @@
firefox firefox
''; '';
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
alacritty = { alacritty = {
@ -28,7 +34,9 @@
opacity = 1.0; opacity = 1.0;
}; };
scrolling.history = 10000; scrolling.history = 10000;
font = { size = 14.0; }; font = {
size = 14.0;
};
key_bindings = [ key_bindings = [
# Used for word completion in fish_user_key_bindings # Used for word completion in fish_user_key_bindings
{ {

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./1password.nix ./1password.nix
@ -12,5 +13,4 @@
./slack.nix ./slack.nix
./yt-dlp.nix ./yt-dlp.nix
]; ];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
discord = { discord = {

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
@ -22,8 +27,7 @@
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
profiles.default = { profiles.default = {
id = 0; id = 0;
name = "default"; name = "default";
@ -49,32 +53,24 @@
"app.update.auto" = false; "app.update.auto" = false;
"browser.aboutConfig.showWarning" = false; "browser.aboutConfig.showWarning" = false;
"browser.warnOnQuit" = false; "browser.warnOnQuit" = false;
"browser.quitShortcut.disabled" = "browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
if pkgs.stdenv.isLinux then true else false;
"browser.theme.dark-private-windows" = true; "browser.theme.dark-private-windows" = true;
"browser.toolbars.bookmarks.visibility" = false; "browser.toolbars.bookmarks.visibility" = false;
"browser.startup.page" = 3; # Restore previous session "browser.startup.page" = 3; # Restore previous session
"browser.newtabpage.enabled" = false; # Make new tabs blank "browser.newtabpage.enabled" = false; # Make new tabs blank
"trailhead.firstrun.didSeeAboutWelcome" = "trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
true; # Disable welcome splash
"dom.forms.autocomplete.formautofill" = false; # Disable autofill "dom.forms.autocomplete.formautofill" = false; # Disable autofill
"extensions.formautofill.creditCards.enabled" = "extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
false; # Disable credit cards
"dom.payments.defaults.saveAddress" = false; # Disable address save "dom.payments.defaults.saveAddress" = false; # Disable address save
"general.autoScroll" = true; # Drag middle-mouse to scroll "general.autoScroll" = true; # Drag middle-mouse to scroll
"services.sync.prefs.sync.general.autoScroll" = "services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
false; # Prevent disabling autoscroll
"extensions.pocket.enabled" = false; "extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
true; # Allow userChrome.css
"layout.css.color-mix.enabled" = true; "layout.css.color-mix.enabled" = true;
"ui.systemUsesDarkTheme" = "ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
if config.theme.dark == true then 1 else 0; "media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
"media.ffmpeg.vaapi.enabled" =
true; # Enable hardware video acceleration
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups "cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
"devtools.command-button-screenshot.enabled" = "devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
true; # Scrolling screenshot of entire page
"svg.context-properties.content.enabled" = true; # Sidebery styling "svg.context-properties.content.enabled" = true; # Sidebery styling
}; };
userChrome = '' userChrome = ''
@ -160,33 +156,34 @@
extraConfig = ""; extraConfig = "";
}; };
}; };
xdg.mimeApps = { xdg.mimeApps = {
associations.added = { "text.html" = [ "firefox.desktop" ]; }; associations.added = {
defaultApplications = { "text.html" = [ "firefox.desktop" ]; }; "text.html" = [ "firefox.desktop" ];
};
defaultApplications = {
"text.html" = [ "firefox.desktop" ];
};
}; };
xsession.windowManager.i3.config.keybindings = xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux {
"${ "${
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
}+Shift+b" = "exec ${ }+Shift+b" = "exec ${
# Don't name the script `firefox` or it will affect grep # Don't name the script `firefox` or it will affect grep
builtins.toString (pkgs.writeShellScript "focus-ff.sh" '' builtins.toString (
pkgs.writeShellScript "focus-ff.sh" ''
count=$(ps aux | grep -c firefox) count=$(ps aux | grep -c firefox)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id firefox" i3-msg "exec --no-startup-id firefox"
sleep 0.5 sleep 0.5
fi fi
i3-msg "[class=firefox] focus" i3-msg "[class=firefox] focus"
'') ''
)
}"; }";
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
kitty = { kitty = {
@ -13,20 +19,19 @@
# Set the Rofi-Systemd terminal for viewing logs # Set the Rofi-Systemd terminal for viewing logs
# Using optionalAttrs because only available in NixOS # Using optionalAttrs because only available in NixOS
environment = { } // lib.attrsets.optionalAttrs environment =
(builtins.hasAttr "sessionVariables" config.environment) { { }
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty"; sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Set the i3 terminal # Set the i3 terminal
xsession.windowManager.i3.config.terminal = xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
lib.mkIf pkgs.stdenv.isLinux "kitty";
# Set the Rofi terminal for running programs # Set the Rofi terminal for running programs
programs.rofi.terminal = programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
# Display images in the terminal # Display images in the terminal
programs.fish.shellAliases = { programs.fish.shellAliases = {
@ -48,16 +53,14 @@
# Kitty scrollback nvim # Kitty scrollback nvim
"kitty_mod+h" = "kitty_scrollback_nvim"; "kitty_mod+h" = "kitty_scrollback_nvim";
"kitty_mod+g" = "kitty_mod+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
"kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
}; };
settings = { settings = {
# Required for kitty-scrollback.nvim # Required for kitty-scrollback.nvim
allow_remote_control = "socket-only"; allow_remote_control = "socket-only";
listen_on = "unix:/tmp/kitty"; listen_on = "unix:/tmp/kitty";
action_alias = action_alias = "kitty_scrollback_nvim kitten ${pkgs.vimPlugins.kitty-scrollback-nvim}/python/kitty_scrollback_nvim.py";
"kitty_scrollback_nvim kitten ${pkgs.vimPlugins.kitty-scrollback-nvim}/python/kitty_scrollback_nvim.py";
# Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache) # Colors (adapted from: https://github.com/kdrag0n/base16-kitty/blob/master/templates/default-256.mustache)
background = config.theme.colors.base00; background = config.theme.colors.base00;

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
media = { media = {
@ -44,7 +50,10 @@
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
associations.removed = { associations.removed = {
"application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ]; "application/pdf" = [
"mupdf.desktop"
"wine-extension-pdf.desktop"
];
}; };
defaultApplications = { defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
@ -53,9 +62,6 @@
"image/*" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ];
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
obsidian = { obsidian = {
@ -18,7 +24,5 @@
# Broken on 2023-12-11 # Broken on 2023-12-11
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8 # https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
qbittorrent = { qbittorrent = {
@ -14,8 +20,6 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ qbittorrent ]; home.packages = with pkgs; [ qbittorrent ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
slack = { slack = {
@ -15,5 +21,4 @@
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
yt-dlp = { yt-dlp = {
@ -27,9 +33,6 @@
}; };
programs.fish.shellAbbrs.yt = "yt-dlp"; programs.fish.shellAbbrs.yt = "yt-dlp";
}; };
}; };
} }

View File

@ -1,7 +1,19 @@
{ config, lib, pkgs, ... }: { {
config,
lib,
pkgs,
...
}:
{
imports = imports = [
[ ./applications ./mail ./neovim ./programming ./repositories ./shell ]; ./applications
./mail
./neovim
./programming
./repositories
./shell
];
options = { options = {
user = lib.mkOption { user = lib.mkOption {
@ -17,8 +29,7 @@
download = lib.mkOption { download = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "XDG directory for downloads"; description = "XDG directory for downloads";
default = default = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
}; };
}; };
identityFile = lib.mkOption { identityFile = lib.mkOption {
@ -47,10 +58,9 @@
homePath = lib.mkOption { homePath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Path of user's home directory."; description = "Path of user's home directory.";
default = builtins.toPath (if pkgs.stdenv.isDarwin then default = builtins.toPath (
"/Users/${config.user}" if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
else );
"/home/${config.user}");
}; };
dotfilesPath = lib.mkOption { dotfilesPath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
@ -122,11 +132,19 @@
}; };
}; };
config = let stateVersion = "23.05"; config =
in { let
stateVersion = "23.05";
in
{
# Basic common system packages for all devices # Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ]; environment.systemPackages = with pkgs; [
git
vim
wget
curl
];
# Use the system-level nixpkgs instead of Home Manager's # Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
@ -137,13 +155,10 @@
# Allow specified unfree packages (identified elsewhere) # Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name # Retrieves package object based on string name
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages;
builtins.elem (lib.getName pkg) config.unfreePackages;
# Pin a state version to prevent warnings # Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion; home-manager.users.${config.user}.home.stateVersion = stateVersion;
home-manager.users.root.home.stateVersion = stateVersion; home-manager.users.root.home.stateVersion = stateVersion;
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.mail.aerc.enable = lib.mkEnableOption "Aerc email."; options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
@ -75,7 +81,9 @@
"<Esc>" = ":clear<Enter>"; "<Esc>" = ":clear<Enter>";
}; };
"messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; }; "messages:folder=Drafts" = {
"<Enter>" = ":recall<Enter>";
};
view = { view = {
"/" = ":toggle-key-passthrough <Enter> /"; "/" = ":toggle-key-passthrough <Enter> /";
@ -148,21 +156,19 @@
"<C-p>" = ":prev-tab<Enter>"; "<C-p>" = ":prev-tab<Enter>";
"<C-n>" = ":next-tab<Enter>"; "<C-n>" = ":next-tab<Enter>";
}; };
}; };
extraConfig = { extraConfig = {
general.unsafe-accounts-conf = true; general.unsafe-accounts-conf = true;
viewer = { pager = "${pkgs.less}/bin/less -R"; }; viewer = {
pager = "${pkgs.less}/bin/less -R";
};
filters = { filters = {
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"text/calendar" = "text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar";
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar"; "text/html" = "${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
"text/html" =
"${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
# "text/*" = # "text/*" =
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "''; # ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"${pkgs.aerc}/libexec/aerc/filters/colorize";
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize"; "message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh"; "application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
"application/pdf" = "${pkgs.zathura}/bin/zathura -"; "application/pdf" = "${pkgs.zathura}/bin/zathura -";
@ -184,26 +190,27 @@
name = "aerc"; name = "aerc";
exec = "kitty aerc %u"; exec = "kitty aerc %u";
}; };
xsession.windowManager.i3.config.keybindings = xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux {
"${ "${
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
}+Shift+e" = "exec ${ }+Shift+e" = "exec ${
# Don't name the script `aerc` or it will affect grep # Don't name the script `aerc` or it will affect grep
builtins.toString (pkgs.writeShellScript "focus-mail.sh" '' builtins.toString (
pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc) count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id kitty --class aerc aerc" i3-msg "exec --no-startup-id kitty --class aerc aerc"
sleep 0.25 sleep 0.25
fi fi
i3-msg "[class=aerc] focus" i3-msg "[class=aerc] focus"
'') ''
)
}"; }";
}; };
programs.fish.shellAbbrs = { ae = "aerc"; }; programs.fish.shellAbbrs = {
ae = "aerc";
};
}; };
}; };
} }

View File

@ -1,6 +1,16 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
imports = [ ./himalaya.nix ./aerc.nix ./system.nix ]; imports = [
./himalaya.nix
./aerc.nix
./system.nix
];
options = { options = {
mail.enable = lib.mkEnableOption "Mail service."; mail.enable = lib.mkEnableOption "Mail service.";
@ -26,7 +36,9 @@
config = lib.mkIf config.mail.enable { config = lib.mkIf config.mail.enable {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.mbsync = { enable = true; }; programs.mbsync = {
enable = true;
};
# Automatically check for mail and keep files synced locally # Automatically check for mail and keep files synced locally
services.mbsync = lib.mkIf pkgs.stdenv.isLinux { services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
@ -44,8 +56,11 @@
# Better local mail search # Better local mail search
programs.notmuch = { programs.notmuch = {
enable = true; enable = true;
new.ignore = new.ignore = [
[ ".mbsyncstate.lock" ".mbsyncstate.journal" ".mbsyncstate.new" ]; ".mbsyncstate.lock"
".mbsyncstate.journal"
".mbsyncstate.new"
];
}; };
accounts.email = { accounts.email = {
@ -54,8 +69,11 @@
maildirBasePath = "${config.homePath}/mail"; maildirBasePath = "${config.homePath}/mail";
accounts = { accounts = {
home = let address = "${config.mail.user}@${config.mail.server}"; home =
in { let
address = "${config.mail.user}@${config.mail.server}";
in
{
userName = address; userName = address;
realName = config.fullName; realName = config.fullName;
primary = true; primary = true;
@ -80,13 +98,15 @@
enable = true; enable = true;
boxes = [ "Inbox" ]; boxes = [ "Inbox" ];
onNotify = "${pkgs.isync}/bin/mbsync -a"; onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost = lib.mkIf onNotifyPost =
config.home-manager.users.${config.user}.services.dunst.enable lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; "${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
}; };
# Name of the directory in maildir for this account # Name of the directory in maildir for this account
maildir = { path = "main"; }; maildir = {
path = "main";
};
# Bi-directional syncing options for local files # Bi-directional syncing options for local files
mbsync = { mbsync = {
@ -104,11 +124,7 @@
notmuch.enable = true; notmuch.enable = true;
# Used to login and send and receive emails # Used to login and send and receive emails
passwordCommand = passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
"${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${
pkgs.writeText "mailpass.age"
(builtins.readFile ../../../private/mailpass.age)
}";
smtp = { smtp = {
host = config.mail.smtpHost; host = config.mail.smtpHost;
@ -118,8 +134,6 @@
}; };
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, lib, ... }: { { config, lib, ... }:
{
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email."; options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
@ -6,7 +7,9 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.himalaya = { enable = true; }; programs.himalaya = {
enable = true;
};
accounts.email.accounts.home.himalaya = { accounts.email.accounts.home.himalaya = {
enable = true; enable = true;
settings = { settings = {
@ -15,9 +18,9 @@
}; };
}; };
programs.fish.shellAbbrs = { hi = "himalaya"; }; programs.fish.shellAbbrs = {
hi = "himalaya";
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (config.mail.enable || config.server) { config = lib.mkIf (config.mail.enable || config.server) {
@ -8,17 +14,15 @@
# The system user for sending automatic notifications # The system user for sending automatic notifications
accounts.email.accounts.system = accounts.email.accounts.system =
let address = "system@${config.mail.server}"; let
in { address = "system@${config.mail.server}";
in
{
userName = address; userName = address;
realName = "NixOS System"; realName = "NixOS System";
primary = !config.mail.enable; # Only primary if mail not enabled primary = !config.mail.enable; # Only primary if mail not enabled
inherit address; inherit address;
passwordCommand = passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
pkgs.writeText "mailpass-system.age"
(builtins.readFile ../../../private/mailpass-system.age)
}";
msmtp.enable = true; msmtp.enable = true;
smtp = { smtp = {
host = config.mail.smtpHost; host = config.mail.smtpHost;
@ -26,9 +30,6 @@
tls.enable = true; tls.enable = true;
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Plugin for aligning text programmatically # Plugin for aligning text programmatically

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Shows buffers in a VSCode-style tab layout # Shows buffers in a VSCode-style tab layout
@ -11,7 +12,7 @@
diagnostics = "nvim_lsp"; diagnostics = "nvim_lsp";
always_show_bufferline = false; always_show_bufferline = false;
separator_style = "slant"; separator_style = "slant";
offsets = [{ filetype = "NvimTree"; }]; offsets = [ { filetype = "NvimTree"; } ];
}; };
}; };
lua = '' lua = ''

View File

@ -1,4 +1,10 @@
{ pkgs, lib, config, ... }: { {
pkgs,
lib,
config,
...
}:
{
# Sets Neovim colors based on Nix colorscheme # Sets Neovim colors based on Nix colorscheme
@ -18,5 +24,4 @@
} }
''; '';
}; };
} }

View File

@ -1,4 +1,5 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
plugins = [ plugins = [
pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp-nvim-lsp
@ -25,21 +26,15 @@
# Basic completion keybinds # Basic completion keybinds
mapping = { mapping = {
"['<C-n>']" = dsl.rawLua "['<C-n>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })"; "['<C-p>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
"['<C-p>']" = dsl.rawLua "['<Down>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })"; "['<Up>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<Down>']" = dsl.rawLua
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<Up>']" = dsl.rawLua
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)"; "['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)"; "['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()"; "['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
"['<CR>']" = dsl.rawLua "['<CR>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })"; "['<C-r>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"['<C-r>']" = dsl.rawLua
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
"['<Esc>']" = dsl.rawLua '' "['<Esc>']" = dsl.rawLua ''
function(_) function(_)
cmp.mapping({ cmp.mapping({
@ -72,13 +67,19 @@
name = "rg"; # Grep for text from the current directory name = "rg"; # Grep for text from the current directory
keyword_length = 6; keyword_length = 6;
max_item_count = 10; max_item_count = 10;
option = { additional_arguments = "--ignore-case"; }; option = {
additional_arguments = "--ignore-case";
};
} }
]; ];
# Styling of the completion menu # Styling of the completion menu
formatting = { formatting = {
fields = [ "kind" "abbr" "menu" ]; fields = [
"kind"
"abbr"
"menu"
];
format = dsl.rawLua '' format = dsl.rawLua ''
function(entry, vim_item) function(entry, vim_item)
local kind_icons = { local kind_icons = {
@ -125,7 +126,6 @@
native_menu = false; # Use cmp menu instead of Vim menu native_menu = false; # Use cmp menu instead of Vim menu
ghost_text = true; # Show preview auto-completion ghost_text = true; # Show preview auto-completion
}; };
}; };
lua = '' lua = ''
@ -145,5 +145,4 @@
}), }),
}) })
''; '';
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
plugins = [ pkgs.vimPlugins.gitsigns-nvim ]; plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
setup.gitsigns = { }; setup.gitsigns = { };
lua = builtins.readFile ./gitsigns.lua; lua = builtins.readFile ./gitsigns.lua;

View File

@ -1,4 +1,10 @@
{ pkgs, dsl, lib, ... }: { {
pkgs,
dsl,
lib,
...
}:
{
plugins = [ plugins = [
pkgs.vimPlugins.vim-surround # Keybinds for surround characters pkgs.vimPlugins.vim-surround # Keybinds for surround characters
pkgs.vimPlugins.vim-eunuch # File manipulation commands pkgs.vimPlugins.vim-eunuch # File manipulation commands
@ -13,7 +19,11 @@
# Initialize some plugins # Initialize some plugins
setup.Comment = { }; setup.Comment = { };
setup.colorizer = { user_default_options = { names = false; }; }; setup.colorizer = {
user_default_options = {
names = false;
};
};
setup.glow = { }; setup.glow = { };
setup.which-key = { }; setup.which-key = { };
setup.kitty-scrollback = { }; setup.kitty-scrollback = { };
@ -54,12 +64,15 @@
vim.o.backup = true; # Easier to recover and more secure vim.o.backup = true; # Easier to recover and more secure
vim.bo.swapfile = false; # Instead of swaps, create backups vim.bo.swapfile = false; # Instead of swaps, create backups
vim.bo.undofile = true; # Keeps undos after quit vim.bo.undofile = true; # Keeps undos after quit
vim.o.backupdir = vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")''; vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
# Required for nvim-cmp completion # Required for nvim-cmp completion
vim.opt.completeopt = [ "menu" "menuone" "noselect" ]; vim.opt.completeopt = [
"menu"
"menuone"
"noselect"
];
lua = lib.mkBefore '' lua = lib.mkBefore ''
vim.loader.enable() vim.loader.enable()

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
plugins = [ pkgs.vimPlugins.lualine-nvim ]; plugins = [ pkgs.vimPlugins.lualine-nvim ];
setup.lualine = { setup.lualine = {
options = { options = {

View File

@ -1,8 +1,9 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }:
{
plugins = [ plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins: (pkgs.vimPlugins.nvim-treesitter.withPlugins (
with pkgs.tree-sitter-grammars; [ _plugins: with pkgs.tree-sitter-grammars; [
tree-sitter-bash tree-sitter-bash
tree-sitter-c tree-sitter-c
tree-sitter-fish tree-sitter-fish
@ -19,7 +20,8 @@
tree-sitter-toml tree-sitter-toml
tree-sitter-vimdoc tree-sitter-vimdoc
tree-sitter-yaml tree-sitter-yaml
])) ]
))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.playground # Tree-sitter experimenting pkgs.vimPlugins.playground # Tree-sitter experimenting
pkgs.vimPlugins.nginx-vim pkgs.vimPlugins.nginx-vim
@ -34,9 +36,15 @@
]; ];
setup."nvim-treesitter.configs" = { setup."nvim-treesitter.configs" = {
highlight = { enable = true; }; highlight = {
indent = { enable = true; }; enable = true;
matchup = { enable = true; }; # Uses vim-matchup };
indent = {
enable = true;
};
matchup = {
enable = true;
}; # Uses vim-matchup
textobjects = { textobjects = {
select = { select = {
@ -70,5 +78,4 @@
-- Use HCL parser with .tf files -- Use HCL parser with .tf files
vim.treesitter.language.register('hcl', 'terraform') vim.treesitter.language.register('hcl', 'terraform')
''; '';
} }

View File

@ -1,4 +1,5 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
# Telescope is a fuzzy finder that can work with different sub-plugins # Telescope is a fuzzy finder that can work with different sub-plugins
@ -20,9 +21,15 @@
}; };
}; };
pickers = { pickers = {
find_files = { theme = "ivy"; }; find_files = {
oldfiles = { theme = "ivy"; }; theme = "ivy";
buffers = { theme = "dropdown"; }; };
oldfiles = {
theme = "ivy";
};
buffers = {
theme = "dropdown";
};
}; };
extensions = { extensions = {
fzy_native = { }; fzy_native = { };
@ -33,5 +40,4 @@
setup.project_nvim = { }; setup.project_nvim = { };
lua = builtins.readFile ./telescope.lua; lua = builtins.readFile ./telescope.lua;
} }

View File

@ -1,4 +1,10 @@
{ pkgs, dsl, config, ... }: { {
pkgs,
dsl,
config,
...
}:
{
# Toggleterm provides a floating terminal inside the editor for quick access # Toggleterm provides a floating terminal inside the editor for quick access
@ -15,5 +21,4 @@
${if config.github then (builtins.readFile ./github.lua) else ""} ${if config.github then (builtins.readFile ./github.lua) else ""}
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""} ${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
''; '';
} }

View File

@ -1,8 +1,12 @@
{ pkgs, dsl, ... }: { { pkgs, dsl, ... }:
{
# This plugin creates a side drawer for navigating the current project # This plugin creates a side drawer for navigating the current project
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ]; plugins = [
pkgs.vimPlugins.nvim-tree-lua
pkgs.vimPlugins.nvim-web-devicons
];
# Disable netrw eagerly # Disable netrw eagerly
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129 # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
@ -16,12 +20,14 @@
hijack_netrw = true; # Works as the file manager hijack_netrw = true; # Works as the file manager
sync_root_with_cwd = true; # Change project whenever currend dir changes sync_root_with_cwd = true; # Change project whenever currend dir changes
respect_buf_cwd = true; # Change to exact location of focused buffer respect_buf_cwd = true; # Change to exact location of focused buffer
update_focused_file = { # Change project based on the focused buffer update_focused_file = {
# Change project based on the focused buffer
enable = true; enable = true;
update_root = true; update_root = true;
ignore_list = { }; ignore_list = { };
}; };
diagnostics = { # Enable LSP and linter integration diagnostics = {
# Enable LSP and linter integration
enable = true; enable = true;
icons = { icons = {
hint = ""; hint = "";
@ -30,7 +36,8 @@
error = ""; error = "";
}; };
}; };
renderer = { # Show files with changes vs. current commit renderer = {
# Show files with changes vs. current commit
icons = { icons = {
glyphs = { glyphs = {
git = { git = {
@ -61,7 +68,8 @@
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split')) vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
end end
''; '';
view = { # Set look and feel view = {
# Set look and feel
width = 30; width = 30;
side = "left"; side = "left";
number = false; number = false;
@ -73,5 +81,4 @@
lua = '' lua = ''
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true }) vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
''; '';
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
@ -9,8 +14,8 @@ let
github = true; github = true;
kubernetes = config.kubernetes.enable; kubernetes = config.kubernetes.enable;
}; };
in
in { {
options.neovim.enable = lib.mkEnableOption "Neovim."; options.neovim.enable = lib.mkEnableOption "Neovim.";
@ -33,7 +38,9 @@ in {
# Create quick aliases for launching Neovim # Create quick aliases for launching Neovim
programs.fish = { programs.fish = {
shellAliases = { vim = "nvim"; }; shellAliases = {
vim = "nvim";
};
shellAbbrs = { shellAbbrs = {
v = lib.mkForce "nvim"; v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'"; vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
@ -45,23 +52,22 @@ in {
# Requires removing some of the ANSI escape codes that are sent to the # Requires removing some of the ANSI escape codes that are sent to the
# scrollback using sed and baleia, as well as removing several # scrollback using sed and baleia, as well as removing several
# unnecessary features. # unnecessary features.
programs.kitty.settings.scrollback_pager = programs.kitty.settings.scrollback_pager = "${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
"${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
# Create a desktop option for launching Neovim from a file manager # Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim) # (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux { xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
name = "Neovim wrapper"; name = "Neovim wrapper";
exec = "kitty nvim %F"; exec = "kitty nvim %F";
mimeType = [ "text/plain" "text/markdown" ]; mimeType = [
"text/plain"
"text/markdown"
];
}; };
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux { xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
"text/plain" = [ "nvim.desktop" ]; "text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ]; "text/markdown" = [ "nvim.desktop" ];
}; };
}; };
}; };
} }

View File

@ -26,13 +26,25 @@
# ] ++ extraConfig; # ] ++ extraConfig;
# } # }
{ pkgs, colors, terraform ? false, github ? false, kubernetes ? false, ... }: {
pkgs,
colors,
terraform ? false,
github ? false,
kubernetes ? false,
...
}:
# Comes from nix2vim overlay: # Comes from nix2vim overlay:
# https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix # https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix
pkgs.neovimBuilder { pkgs.neovimBuilder {
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
inherit colors terraform github kubernetes; inherit
colors
terraform
github
kubernetes
;
imports = [ imports = [
../config/align.nix ../config/align.nix
../config/bufferline.nix ../config/bufferline.nix

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./haskell.nix ./haskell.nix
@ -9,5 +10,4 @@
./rust.nix ./rust.nix
./terraform.nix ./terraform.nix
]; ];
} }

View File

@ -1,14 +1,12 @@
{ config, lib, ... }: { { config, lib, ... }:
{
options.haskell.enable = lib.mkEnableOption "Haskell programming language."; options.haskell.enable = lib.mkEnableOption "Haskell programming language.";
config = lib.mkIf config.haskell.enable { config = lib.mkIf config.haskell.enable {
# Binary Cache for Haskell.nix # Binary Cache for Haskell.nix
nix.settings.trusted-public-keys = nix.settings.trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
[ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
nix.settings.substituters = [ "https://cache.iog.io" ]; nix.settings.substituters = [ "https://cache.iog.io" ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools."; options.kubernetes.enable = lib.mkEnableOption "Kubernetes tools.";
@ -99,12 +105,16 @@
views = { views = {
charts = { charts = {
bgColor = "default"; bgColor = "default";
defaultDialColors = defaultDialColors = [
[ config.theme.colors.base0D config.theme.colors.base08 ]; config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue # - *blue
# - *red # - *red
defaultChartColors = defaultChartColors = [
[ config.theme.colors.base0D config.theme.colors.base08 ]; config.theme.colors.base0D
config.theme.colors.base08
];
# - *blue # - *blue
# - *red # - *red
}; };
@ -149,9 +159,6 @@
}; };
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.lua.enable = lib.mkEnableOption "Lua programming language."; options.lua.enable = lib.mkEnableOption "Lua programming language.";
@ -8,5 +14,4 @@
sumneko-lua-language-server # Lua LSP sumneko-lua-language-server # Lua LSP
]; ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.nixlang.enable = lib.mkEnableOption "Nix programming language."; options.nixlang.enable = lib.mkEnableOption "Nix programming language.";

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.python.enable = lib.mkEnableOption "Python programming language."; options.python.enable = lib.mkEnableOption "Python programming language.";
@ -13,10 +19,9 @@
python310Packages.flake8 # Python linter python310Packages.flake8 # Python linter
]; ];
programs.fish.shellAbbrs = { py = "python3"; }; programs.fish.shellAbbrs = {
py = "python3";
};
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.rust.enable = lib.mkEnableOption "Rust programming language."; options.rust.enable = lib.mkEnableOption "Rust programming language.";
@ -6,12 +12,16 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.fish.shellAbbrs = { ca = "cargo"; }; programs.fish.shellAbbrs = {
ca = "cargo";
home.packages = with pkgs; [ cargo rustc clippy gcc ];
}; };
home.packages = with pkgs; [
cargo
rustc
clippy
gcc
];
};
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.terraform.enable = lib.mkEnableOption "Terraform tools."; options.terraform.enable = lib.mkEnableOption "Terraform tools.";
@ -15,9 +21,6 @@
terraform-ls # Language server terraform-ls # Language server
tflint # Linter tflint # Linter
]; ];
}; };
}; };
} }

View File

@ -1,5 +1,8 @@
{ ... }: { { ... }:
{
imports = [ ./dotfiles.nix ./notes.nix ];
imports = [
./dotfiles.nix
./notes.nix
];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Allows me to make sure I can work on my dotfiles locally # Allows me to make sure I can work on my dotfiles locally
@ -11,23 +17,17 @@
home.activation = { home.activation = {
# Always clone dotfiles repository if it doesn't exist # Always clone dotfiles repository if it doesn't exist
cloneDotfiles = cloneDotfiles = config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
config.home-manager.users.${config.user}.lib.dag.entryAfter
[ "writeBoundary" ] ''
if [ ! -d "${config.dotfilesPath}" ]; then if [ ! -d "${config.dotfilesPath}" ]; then
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}") $DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
$DRY_RUN_CMD ${pkgs.git}/bin/git \ $DRY_RUN_CMD ${pkgs.git}/bin/git \
clone ${config.dotfilesRepo} "${config.dotfilesPath}" clone ${config.dotfilesRepo} "${config.dotfilesPath}"
fi fi
''; '';
}; };
# Set a variable for dotfiles repo, not necessary but convenient # Set a variable for dotfiles repo, not necessary but convenient
home.sessionVariables.DOTS = config.dotfilesPath; home.sessionVariables.DOTS = config.dotfilesPath;
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, lib, ... }: { { config, lib, ... }:
{
# Shell history sync # Shell history sync
@ -10,7 +11,10 @@
programs.atuin = { programs.atuin = {
enable = true; enable = true;
flags = [ "--disable-up-arrow" "--disable-ctrl-r" ]; flags = [
"--disable-up-arrow"
"--disable-ctrl-r"
];
settings = { settings = {
auto_sync = true; auto_sync = true;
update_check = false; update_check = false;
@ -27,13 +31,9 @@
keymap_mode = "vim-normal"; keymap_mode = "vim-normal";
}; };
}; };
}; };
# Give root user the same setup # Give root user the same setup
home-manager.users.root.programs.atuin = home-manager.users.root.programs.atuin = config.home-manager.users.${config.user}.programs.atuin;
config.home-manager.users.${config.user}.programs.atuin;
}; };
} }

View File

@ -1,12 +1,17 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = { config = {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.bash = { programs.bash = {
enable = true; enable = true;
shellAliases = shellAliases = config.home-manager.users.${config.user}.programs.fish.shellAliases;
config.home-manager.users.${config.user}.programs.fish.shellAliases;
initExtra = ""; initExtra = "";
profileExtra = ""; profileExtra = "";
}; };
@ -14,7 +19,6 @@
programs.starship.enableBashIntegration = false; programs.starship.enableBashIntegration = false;
programs.zoxide.enableBashIntegration = true; programs.zoxide.enableBashIntegration = true;
programs.fzf.enableBashIntegration = true; programs.fzf.enableBashIntegration = true;
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Convenience utilities from charm.sh # Convenience utilities from charm.sh
@ -12,7 +18,5 @@
charm # Manage account and filesystem charm # Manage account and filesystem
pop # Send emails from a TUI pop # Send emails from a TUI
]; ];
}; };
} }

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./atuin.nix ./atuin.nix
./bash ./bash

View File

@ -1,10 +1,15 @@
{ config, ... }: { { config, ... }:
{
# Enables quickly entering Nix shells when changing directories # Enables quickly entering Nix shells when changing directories
home-manager.users.${config.user}.programs.direnv = { home-manager.users.${config.user}.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
config = { whitelist = { prefix = [ config.dotfilesPath ]; }; }; config = {
whitelist = {
prefix = [ config.dotfilesPath ];
};
};
}; };
# programs.direnv.direnvrcExtra = '' # programs.direnv.direnvrcExtra = ''
@ -28,5 +33,4 @@
keep-outputs = true keep-outputs = true
keep-derivations = true keep-derivations = true
''; '';
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
users.users.${config.user}.shell = pkgs.fish; users.users.${config.user}.shell = pkgs.fish;
programs.fish.enable = true; # Needed for LightDM to remember username programs.fish.enable = true; # Needed for LightDM to remember username
@ -46,7 +52,9 @@
fish_user_key_bindings = { fish_user_key_bindings = {
body = builtins.readFile ./functions/fish_user_key_bindings.fish; body = builtins.readFile ./functions/fish_user_key_bindings.fish;
}; };
ip = { body = builtins.readFile ./functions/ip.fish; }; ip = {
body = builtins.readFile ./functions/ip.fish;
};
json = { json = {
description = "Tidy up JSON using jq"; description = "Tidy up JSON using jq";
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
@ -112,8 +120,7 @@
moon = "curl wttr.in/Moon"; moon = "curl wttr.in/Moon";
# Cheat Sheets # Cheat Sheets
ssl = ssl = "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -"; fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -";
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub"; publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
forloop = "for i in (seq 1 100)"; forloop = "for i in (seq 1 100)";
@ -122,7 +129,6 @@
dc = "$DOTS/bin/docker_cleanup"; dc = "$DOTS/bin/docker_cleanup";
dr = "docker run --rm -it"; dr = "docker run --rm -it";
db = "docker build . -t"; db = "docker build . -t";
}; };
shellInit = ""; shellInit = "";
}; };
@ -132,6 +138,5 @@
programs.starship.enableFishIntegration = true; programs.starship.enableFishIntegration = true;
programs.zoxide.enableFishIntegration = true; programs.zoxide.enableFishIntegration = true;
programs.fzf.enableFishIntegration = true; programs.fzf.enableFishIntegration = true;
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, pkgs, ... }: { { config, pkgs, ... }:
{
# FZF is a fuzzy-finder for the terminal # FZF is a fuzzy-finder for the terminal
@ -25,17 +26,20 @@
''; '';
}; };
}; };
shellAbbrs = { lsf = "ls -lh | fzf"; }; shellAbbrs = {
lsf = "ls -lh | fzf";
};
}; };
# Global fzf configuration # Global fzf configuration
home.sessionVariables = let fzfCommand = "fd --type file"; home.sessionVariables =
in { let
fzfCommand = "fd --type file";
in
{
FZF_DEFAULT_COMMAND = fzfCommand; FZF_DEFAULT_COMMAND = fzfCommand;
FZF_CTRL_T_COMMAND = fzfCommand; FZF_CTRL_T_COMMAND = fzfCommand;
FZF_DEFAULT_OPTS = "-m --height 50% --border"; FZF_DEFAULT_OPTS = "-m --height 50% --border";
}; };
}; };
} }

View File

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let home-packages = config.home-manager.users.${config.user}.home.packages; let
home-packages = config.home-manager.users.${config.user}.home.packages;
in { in
{
options = { options = {
gitName = lib.mkOption { gitName = lib.mkOption {
@ -28,16 +34,26 @@ in {
userName = config.gitName; userName = config.gitName;
userEmail = config.gitEmail; userEmail = config.gitEmail;
extraConfig = { extraConfig = {
core.pager = core.pager = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F";
"${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight | less -F"; interactive.difffilter = "${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight";
interactive.difffilter = pager = {
"${pkgs.git}/share/git/contrib/diff-highlight/diff-highlight"; branch = "false";
pager = { branch = "false"; }; };
safe = { directory = config.dotfilesPath; }; safe = {
pull = { ff = "only"; }; directory = config.dotfilesPath;
push = { autoSetupRemote = "true"; }; };
init = { defaultBranch = "master"; }; pull = {
rebase = { autosquash = "true"; }; ff = "only";
};
push = {
autoSetupRemote = "true";
};
init = {
defaultBranch = "master";
};
rebase = {
autosquash = "true";
};
gpg = { gpg = {
format = "ssh"; format = "ssh";
ssh.allowedSignersFile = "~/.config/git/allowed-signers"; ssh.allowedSignersFile = "~/.config/git/allowed-signers";
@ -45,11 +61,16 @@ in {
# commit.gpgsign = true; # commit.gpgsign = true;
# tag.gpgsign = true; # tag.gpgsign = true;
}; };
ignores = [ ".direnv/**" "result" ]; ignores = [
includes = [{ ".direnv/**"
"result"
];
includes = [
{
path = "~/.config/git/personal"; path = "~/.config/git/personal";
condition = "gitdir:~/dev/personal/"; condition = "gitdir:~/dev/personal/";
}]; }
];
}; };
# Personal git config # Personal git config
@ -86,8 +107,7 @@ in {
gl = "git log --graph --decorate --oneline -20"; gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline"; gll = "git log --graph --decorate --oneline";
gco = "git checkout"; gco = "git checkout";
gcom = '' gcom = ''git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)'';
gcob = "git switch -c"; gcob = "git switch -c";
gb = "git branch"; gb = "git branch";
gpd = "git push origin -d"; gpd = "git push origin -d";
@ -101,11 +121,18 @@ in {
}; };
# Required for fish commands # Required for fish commands
home.packages = with pkgs; [ fish fzf bat ]; home.packages = with pkgs; [
fish
fzf
bat
];
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages programs.fish.functions =
&& builtins.elem pkgs.bat home-packages) { lib.mkIf (builtins.elem pkgs.fzf home-packages && builtins.elem pkgs.bat home-packages)
git = { body = builtins.readFile ./fish/functions/git.fish; }; {
git = {
body = builtins.readFile ./fish/functions/git.fish;
};
git-add-fuzzy = { git-add-fuzzy = {
body = builtins.readFile ./fish/functions/git-add-fuzzy.fish; body = builtins.readFile ./fish/functions/git-add-fuzzy.fish;
}; };
@ -152,7 +179,5 @@ in {
}; };
}; };
}; };
}; };
} }

View File

@ -1,21 +1,24 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.gh = programs.gh = lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
enable = true; enable = true;
gitCredentialHelper.enable = true; gitCredentialHelper.enable = true;
settings.git_protocol = "https"; settings.git_protocol = "https";
extensions = [ pkgs.gh-collaborators ]; extensions = [ pkgs.gh-collaborators ];
}; };
programs.fish = programs.fish = lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
shellAbbrs = { shellAbbrs = {
ghr = "gh repo view -w"; ghr = "gh repo view -w";
gha = gha = "gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view";
"gh run list | head -1 | awk '{ print \\$\\(NF-2\\) }' | xargs gh run view";
grw = "gh run watch"; grw = "gh run watch";
grf = "gh run view --log-failed"; grf = "gh run view --log-failed";
grl = "gh run view --log"; grl = "gh run view --log";
@ -76,7 +79,5 @@
} }
'') '')
]; ];
}; };
} }

View File

@ -1,4 +1,5 @@
{ config, ... }: { { config, ... }:
{
config = { config = {
@ -9,12 +10,9 @@
settings = { settings = {
user = { user = {
name = config.home-manager.users.${config.user}.programs.git.userName; name = config.home-manager.users.${config.user}.programs.git.userName;
email = email = config.home-manager.users.${config.user}.programs.git.userEmail;
config.home-manager.users.${config.user}.programs.git.userEmail;
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
programs.fish = { programs.fish = {
@ -62,22 +68,22 @@
# Create nix-index if doesn't exist # Create nix-index if doesn't exist
home.activation.createNixIndex = home.activation.createNixIndex =
let cacheDir = "${config.homePath}/.cache/nix-index"; let
in lib.mkIf cacheDir = "${config.homePath}/.cache/nix-index";
config.home-manager.users.${config.user}.programs.nix-index.enable in
(config.home-manager.users.${config.user}.lib.dag.entryAfter lib.mkIf config.home-manager.users.${config.user}.programs.nix-index.enable (
[ "writeBoundary" ] '' config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ${cacheDir} ]; then if [ ! -d ${cacheDir} ]; then
$DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path} $DRY_RUN_CMD ${pkgs.nix-index}/bin/nix-index -f ${pkgs.path}
fi fi
''); ''
);
# Set automatic generation cleanup for home-manager # Set automatic generation cleanup for home-manager
nix.gc = { nix.gc = {
automatic = config.nix.gc.automatic; automatic = config.nix.gc.automatic;
options = config.nix.gc.options; options = config.nix.gc.options;
}; };
}; };
nix = { nix = {
@ -92,7 +98,10 @@
}; };
# For security, only allow specific users # For security, only allow specific users
settings.allowed-users = [ "@wheel" config.user ]; settings.allowed-users = [
"@wheel"
config.user
];
# Enable features in Nix commands # Enable features in Nix commands
extraOptions = '' extraOptions = ''
@ -110,8 +119,7 @@
# Add community Cachix to binary cache # Add community Cachix to binary cache
# Don't use with macOS because blocked by corporate firewall # Don't use with macOS because blocked by corporate firewall
builders-use-substitutes = true; builders-use-substitutes = true;
substituters = substituters = lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ];
lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ];
trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [ trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
@ -119,9 +127,6 @@
# Scans and hard links identical files in the store # Scans and hard links identical files in the store
# Not working with macOS: https://github.com/NixOS/nix/issues/7273 # Not working with macOS: https://github.com/NixOS/nix/issues/7273
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true; auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user}.programs.starship = { home-manager.users.${config.user}.programs.starship = {
enable = true; enable = true;
@ -29,7 +35,9 @@
truncate_to_repo = true; truncate_to_repo = true;
truncation_length = 100; truncation_length = 100;
}; };
git_branch = { format = "[$symbol$branch]($style)"; }; git_branch = {
format = "[$symbol$branch]($style)";
};
git_commit = { git_commit = {
format = "( @ [$hash]($style) )"; format = "( @ [$hash]($style) )";
only_detached = false; only_detached = false;
@ -56,8 +64,9 @@
format = "[$symbol $name]($style)"; format = "[$symbol $name]($style)";
symbol = ""; symbol = "";
}; };
python = { format = "[\${version}\\(\${virtualenv}\\)]($style)"; }; python = {
format = "[\${version}\\(\${virtualenv}\\)]($style)";
};
}; };
}; };
} }

View File

@ -10,8 +10,8 @@ let
.terraform/ .terraform/
.target/ .target/
/Library/''; /Library/'';
in
in { {
config = { config = {
@ -70,9 +70,6 @@ in {
body = "${pkgs.prettyping}/bin/prettyping --nolegend $target"; body = "${pkgs.prettyping}/bin/prettyping --nolegend $target";
}; };
}; };
}; };
}; };
} }

View File

@ -1,16 +1,21 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
home.packages = let home.packages =
let
ldap_scheme = "ldaps"; ldap_scheme = "ldaps";
magic_number = "2"; magic_number = "2";
magic_end_seq = "corp"; magic_end_seq = "corp";
magic_prefix = "take"; magic_prefix = "take";
ldap_host = ldap_host = "${magic_prefix}${magic_number}.t${magic_number}.${magic_end_seq}";
"${magic_prefix}${magic_number}.t${magic_number}.${magic_end_seq}";
ldap_port = 636; ldap_port = 636;
ldap_dc_1 = "${magic_prefix}${magic_number}"; ldap_dc_1 = "${magic_prefix}${magic_number}";
ldap_dc_2 = "t${magic_number}"; ldap_dc_2 = "t${magic_number}";
@ -24,9 +29,7 @@
ldapsearch -LLL \ ldapsearch -LLL \
-B -o ldif-wrap=no \ -B -o ldif-wrap=no \
-H "${ldap_scheme}://${ldap_host}:${builtins.toString ldap_port}" \ -H "${ldap_scheme}://${ldap_host}:${builtins.toString ldap_port}" \
-D "${pkgs.lib.toUpper magic_prefix}${magic_number}\\${ -D "${pkgs.lib.toUpper magic_prefix}${magic_number}\\${pkgs.lib.toLower config.user}" \
pkgs.lib.toLower config.user
}" \
-w "$(${pkgs._1password}/bin/op item get T${magic_number} --fields label=password)" \ -w "$(${pkgs._1password}/bin/op item get T${magic_number} --fields label=password)" \
-b "DC=${ldap_dc_1},DC=${ldap_dc_2},DC=${ldap_dc_3}" \ -b "DC=${ldap_dc_1},DC=${ldap_dc_2},DC=${ldap_dc_3}" \
-s "sub" -x "(cn=$SEARCH_FILTER)" \ -s "sub" -x "(cn=$SEARCH_FILTER)" \
@ -39,8 +42,11 @@
ldapg_script = pkgs.writeShellScriptBin "ldapg" '' ldapg_script = pkgs.writeShellScriptBin "ldapg" ''
${ldap_script}/bin/ldap "$@" | jq '[ .[].member] | add' ${ldap_script}/bin/ldap "$@" | jq '[ .[].member] | add'
''; '';
in [ ldap_script ldapm_script ldapg_script ]; in
[
ldap_script
ldapm_script
ldapg_script
];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# MacOS-specific settings for Alacritty # MacOS-specific settings for Alacritty
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -647,5 +653,4 @@
]; ];
}; };
}; };
} }

View File

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
./alacritty.nix ./alacritty.nix
@ -14,5 +15,4 @@
./user.nix ./user.nix
./utilities.nix ./utilities.nix
]; ];
} }

View File

@ -1,11 +1,10 @@
{ pkgs, ... }: { { pkgs, ... }:
{
config = { config = {
# MacOS-specific settings for Fish # MacOS-specific settings for Fish
programs.fish.useBabelfish = true; programs.fish.useBabelfish = true;
programs.fish.babelfishPackage = pkgs.babelfish; programs.fish.babelfishPackage = pkgs.babelfish;
}; };
} }

View File

@ -1,17 +1,22 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
home.packages = with pkgs; home.packages = with pkgs; [ (nerdfonts.override { fonts = [ "VictorMono" ]; }) ];
[ (nerdfonts.override { fonts = [ "VictorMono" ]; }) ];
programs.alacritty.settings = { font.normal.family = "VictorMono"; }; programs.alacritty.settings = {
font.normal.family = "VictorMono";
};
programs.kitty.font = { programs.kitty.font = {
package = (pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; }); package = (pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; });
name = "VictorMono Nerd Font Mono"; name = "VictorMono Nerd Font Mono";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Hammerspoon - MacOS custom automation scripting # Hammerspoon - MacOS custom automation scripting
@ -6,12 +12,9 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua; xdg.configFile."hammerspoon/init.lua".source = ./hammerspoon/init.lua;
xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = xdg.configFile."hammerspoon/Spoons/ControlEscape.spoon".source = ./hammerspoon/Spoons/ControlEscape.spoon;
./hammerspoon/Spoons/ControlEscape.spoon; xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = ./hammerspoon/Spoons/DismissAlerts.spoon;
xdg.configFile."hammerspoon/Spoons/DismissAlerts.spoon".source = xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source = pkgs.substituteAll {
./hammerspoon/Spoons/DismissAlerts.spoon;
xdg.configFile."hammerspoon/Spoons/Launcher.spoon/init.lua".source =
pkgs.substituteAll {
src = ./hammerspoon/Spoons/Launcher.spoon/init.lua; src = ./hammerspoon/Spoons/Launcher.spoon/init.lua;
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app"; firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
discord = "${pkgs.discord}/Applications/Discord.app"; discord = "${pkgs.discord}/Applications/Discord.app";
@ -19,17 +22,15 @@
obsidian = "${pkgs.obsidian}/Applications/Obsidian.app"; obsidian = "${pkgs.obsidian}/Applications/Obsidian.app";
slack = "${pkgs.slack}/Applications/Slack.app"; slack = "${pkgs.slack}/Applications/Slack.app";
}; };
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = ./hammerspoon/Spoons/MoveWindow.spoon;
./hammerspoon/Spoons/MoveWindow.spoon;
home.activation.reloadHammerspoon = home.activation.reloadHammerspoon =
config.home-manager.users.${config.user}.lib.dag.entryAfter config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ]
[ "writeBoundary" ] '' ''
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()" $DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.reload()"
$DRY_RUN_CMD sleep 1 $DRY_RUN_CMD sleep 1
$DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()" $DRY_RUN_CMD /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.console.clearConsole()"
''; '';
}; };
homebrew.casks = [ "hammerspoon" ]; homebrew.casks = [ "hammerspoon" ];
@ -38,7 +39,5 @@
defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua" defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua"
sudo killall Dock sudo killall Dock
''; '';
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# Homebrew - Mac-specific packages that aren't in Nix # Homebrew - Mac-specific packages that aren't in Nix
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -14,8 +20,7 @@
''; '';
# Add homebrew paths to CLI path # Add homebrew paths to CLI path
home-manager.users.${config.user}.home.sessionPath = home-manager.users.${config.user}.home.sessionPath = [ "/opt/homebrew/bin/" ];
[ "/opt/homebrew/bin/" ];
homebrew = { homebrew = {
enable = true; enable = true;
@ -43,7 +48,5 @@
# "epic-games" # Not packaged for Nix # "epic-games" # Not packaged for Nix
]; ];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
# MacOS-specific settings for Kitty # MacOS-specific settings for Kitty
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -13,5 +19,4 @@
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
networking = { networking = {
@ -7,5 +13,4 @@
# hostName = ""; # hostName = "";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -27,7 +33,5 @@
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -102,7 +108,6 @@
"${pkgs.kitty}/Applications/kitty.app" "${pkgs.kitty}/Applications/kitty.app"
"/System/Applications/System Settings.app" "/System/Applications/System Settings.app"
]; ];
}; };
finder = { finder = {
@ -118,7 +123,6 @@
# Allow quitting of Finder application # Allow quitting of Finder application
QuitMenuItem = true; QuitMenuItem = true;
}; };
# Disable "Are you sure you want to open" dialog # Disable "Are you sure you want to open" dialog
@ -165,12 +169,9 @@
eventTimeFormat = ''"show"''; eventTimeFormat = ''"show"'';
eventTitleFormat = ''"none"''; eventTitleFormat = ''"none"'';
eventTitleIconFormat = ''"iconCalendar"''; eventTitleIconFormat = ''"iconCalendar"'';
slackBrowser = slackBrowser = ''{"deletable":true,"arguments":"","name":"Slack","path":""}'';
''{"deletable":true,"arguments":"","name":"Slack","path":""}''; zoomBrowser = ''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
zoomBrowser = KeyboardShortcuts_joinEventShortcut = ''{"carbonModifiers":6400,"carbonKeyCode":38}'';
''{"deletable":true,"arguments":"","name":"Zoom","path":""}'';
KeyboardShortcuts_joinEventShortcut =
''{"carbonModifiers":6400,"carbonKeyCode":38}'';
timeFormat = ''"12-hour"''; timeFormat = ''"12-hour"'';
}; };
}; };
@ -178,7 +179,6 @@
CustomSystemPreferences = { CustomSystemPreferences = {
}; };
}; };
# Settings that don't have an option in nix-darwin # Settings that don't have an option in nix-darwin
@ -199,9 +199,6 @@
defaults write -globalDomain NSStatusItemSelectionPadding -int 6 defaults write -globalDomain NSStatusItemSelectionPadding -int 6
defaults write -globalDomain NSStatusItemSpacing -int 6 defaults write -globalDomain NSStatusItemSpacing -int 6
''; '';
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer"; options.tmux.enable = lib.mkEnableOption "Tmux terminal multiplexer";
@ -127,7 +133,5 @@
tan = "tmux attach-session -t noah"; tan = "tmux attach-session -t noah";
tnn = "tmux new-session -s noah"; tnn = "tmux new-session -s noah";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf pkgs.stdenv.isDarwin { config = lib.mkIf pkgs.stdenv.isDarwin {
@ -6,22 +12,20 @@
# macOS user # macOS user
home = config.homePath; home = config.homePath;
shell = pkgs.fish; # Default shell shell = pkgs.fish; # Default shell
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Default shell setting doesn't work # Default shell setting doesn't work
home.sessionVariables = { SHELL = "${pkgs.fish}/bin/fish"; }; home.sessionVariables = {
SHELL = "${pkgs.fish}/bin/fish";
};
# Used for aerc # Used for aerc
xdg.enable = true; xdg.enable = true;
}; };
# Fix for: 'Error: HOME is set to "/var/root" but we expect "/var/empty"' # Fix for: 'Error: HOME is set to "/var/root" but we expect "/var/empty"'
home-manager.users.root.home.homeDirectory = lib.mkForce "/var/root"; home-manager.users.root.home.homeDirectory = lib.mkForce "/var/root";
}; };
} }

View File

@ -1,8 +1,16 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
unfreePackages = [ "consul" "vault-bin" ]; unfreePackages = [
"consul"
"vault-bin"
];
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -38,7 +46,5 @@
# Shortcut to edit hosts file # Shortcut to edit hosts file
hosts = "sudo nvim /etc/hosts"; hosts = "sudo nvim /etc/hosts";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
calibre = { calibre = {
@ -16,6 +22,8 @@
}; };
# Forces Calibre to use dark mode # Forces Calibre to use dark mode
environment.sessionVariables = { CALIBRE_USE_DARK_PALETTE = "1"; }; environment.sessionVariables = {
CALIBRE_USE_DARK_PALETTE = "1";
};
}; };
} }

View File

@ -1,5 +1,8 @@
{ ... }: { { ... }:
{
imports = [ ./calibre.nix ./nautilus.nix ];
imports = [
./calibre.nix
./nautilus.nix
];
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
nautilus = { nautilus = {
@ -28,18 +34,15 @@
# Generates a QR code and previews it with sushi # Generates a QR code and previews it with sushi
programs.fish.functions = { programs.fish.functions = {
qr = { qr = {
body = body = "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
"${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
}; };
}; };
# Set Nautilus as default for opening directories # Set Nautilus as default for opening directories
xdg.mimeApps = { xdg.mimeApps = {
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ]; associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
defaultApplications."inode/directory" = defaultApplications."inode/directory" = lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
}; };
}; };
# Delete Trash files older than 1 week # Delete Trash files older than 1 week
@ -48,7 +51,5 @@
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
script = "${pkgs.trash-cli}/bin/trash-empty 7"; script = "${pkgs.trash-cli}/bin/trash-empty 7";
}; };
}; };
} }

View File

@ -1,6 +1,12 @@
{ ... }: { { ... }:
{
imports =
[ ./applications ./gaming ./graphical ./hardware ./services ./system ];
imports = [
./applications
./gaming
./graphical
./hardware
./services
./system
];
} }

View File

@ -1,10 +1,14 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.chiaki.enable = options.gaming.chiaki.enable = lib.mkEnableOption "Chiaki PlayStation remote play client.";
lib.mkEnableOption "Chiaki PlayStation remote play client.";
config = lib.mkIf config.gaming.chiaki.enable { config = lib.mkIf config.gaming.chiaki.enable {
environment.systemPackages = with pkgs; [ chiaki ]; environment.systemPackages = with pkgs; [ chiaki ];
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
imports = [ imports = [
./chiaki.nix ./chiaki.nix

View File

@ -1,11 +1,17 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.dwarf-fortress.enable = options.gaming.dwarf-fortress.enable = lib.mkEnableOption "Dwarf Fortress free edition.";
lib.mkEnableOption "Dwarf Fortress free edition.";
config = lib.mkIf config.gaming.dwarf-fortress.enable { config = lib.mkIf config.gaming.dwarf-fortress.enable {
unfreePackages = [ "dwarf-fortress" ]; unfreePackages = [ "dwarf-fortress" ];
environment.systemPackages = let environment.systemPackages =
let
dfDesktopItem = pkgs.makeDesktopItem { dfDesktopItem = pkgs.makeDesktopItem {
name = "dwarf-fortress"; name = "dwarf-fortress";
desktopName = "Dwarf Fortress"; desktopName = "Dwarf Fortress";
@ -15,15 +21,14 @@
dtDesktopItem = pkgs.makeDesktopItem { dtDesktopItem = pkgs.makeDesktopItem {
name = "dwarftherapist"; name = "dwarftherapist";
desktopName = "Dwarf Therapist"; desktopName = "Dwarf Therapist";
exec = exec = "${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dwarftherapist";
"${pkgs.dwarf-fortress-packages.dwarf-fortress-full}/bin/dwarftherapist";
terminal = false; terminal = false;
}; };
in [ in
[
pkgs.dwarf-fortress-packages.dwarf-fortress-full pkgs.dwarf-fortress-packages.dwarf-fortress-full
dfDesktopItem dfDesktopItem
dtDesktopItem dtDesktopItem
]; ];
}; };
} }

View File

@ -1,11 +1,16 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let home-packages = config.home-manager.users.${config.user}.home.packages; let
home-packages = config.home-manager.users.${config.user}.home.packages;
in
{
in { options.gaming.legendary.enable = lib.mkEnableOption "Legendary Epic Games launcher.";
options.gaming.legendary.enable =
lib.mkEnableOption "Legendary Epic Games launcher.";
config = lib.mkIf config.gaming.legendary.enable { config = lib.mkIf config.gaming.legendary.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -28,17 +33,18 @@ in {
log_level = error log_level = error
''; '';
home.file = let home.file =
let
ignorePatterns = '' ignorePatterns = ''
.wine/ .wine/
drive_c/''; drive_c/'';
in { in
{
".rgignore".text = ignorePatterns; ".rgignore".text = ignorePatterns;
".fdignore".text = ignorePatterns; ".fdignore".text = ignorePatterns;
}; };
programs.fish.functions = programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages) {
lib.mkIf (builtins.elem pkgs.fzf home-packages) {
epic-games = { epic-games = {
body = '' body = ''
set game (legendary list 2>/dev/null \ set game (legendary list 2>/dev/null \
@ -49,8 +55,6 @@ in {
''; '';
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.lutris.enable = lib.mkEnableOption "Lutris game installer."; options.gaming.lutris.enable = lib.mkEnableOption "Lutris game installer.";
@ -9,5 +15,4 @@
wineWowPackages.stable # 32-bit and 64-bit wineWowPackages wineWowPackages.stable # 32-bit and 64-bit wineWowPackages
]; ];
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
@ -6,8 +11,8 @@ let
publicPort = 49732; publicPort = 49732;
rconPort = 25575; rconPort = 25575;
rconPassword = "thiscanbeanything"; rconPassword = "thiscanbeanything";
in
in { {
config = lib.mkIf config.services.minecraft-server.enable { config = lib.mkIf config.services.minecraft-server.enable {
@ -52,7 +57,9 @@ in {
# https://dataswamp.org/~solene/2022-08-20-on-demand-minecraft-with-systemd.html # https://dataswamp.org/~solene/2022-08-20-on-demand-minecraft-with-systemd.html
# Prevent Minecraft from starting by default # Prevent Minecraft from starting by default
systemd.services.minecraft-server = { wantedBy = pkgs.lib.mkForce [ ]; }; systemd.services.minecraft-server = {
wantedBy = pkgs.lib.mkForce [ ];
};
# Listen for connections on the public port, to trigger the actual # Listen for connections on the public port, to trigger the actual
# listen-minecraft service. # listen-minecraft service.
@ -65,18 +72,25 @@ in {
# Proxy traffic to local port, and trigger hook-minecraft # Proxy traffic to local port, and trigger hook-minecraft
systemd.services.listen-minecraft = { systemd.services.listen-minecraft = {
path = [ pkgs.systemd ]; path = [ pkgs.systemd ];
requires = [ "hook-minecraft.service" "listen-minecraft.socket" ]; requires = [
after = [ "hook-minecraft.service" "listen-minecraft.socket" ]; "hook-minecraft.service"
serviceConfig.ExecStart = "listen-minecraft.socket"
"${pkgs.systemd.out}/lib/systemd/systemd-socket-proxyd 127.0.0.1:${ ];
toString localPort after = [
}"; "hook-minecraft.service"
"listen-minecraft.socket"
];
serviceConfig.ExecStart = "${pkgs.systemd.out}/lib/systemd/systemd-socket-proxyd 127.0.0.1:${toString localPort}";
}; };
# Start Minecraft if required and wait for it to be available # Start Minecraft if required and wait for it to be available
# Then unlock the listen-minecraft.service # Then unlock the listen-minecraft.service
systemd.services.hook-minecraft = { systemd.services.hook-minecraft = {
path = with pkgs; [ systemd libressl busybox ]; path = with pkgs; [
systemd
libressl
busybox
];
# Start Minecraft and the auto-shutdown timer # Start Minecraft and the auto-shutdown timer
script = '' script = ''
@ -87,9 +101,7 @@ in {
# Keep checking until the service is available # Keep checking until the service is available
postStart = '' postStart = ''
for i in $(seq 60); do for i in $(seq 60); do
if ${pkgs.libressl.nc}/bin/nc -z 127.0.0.1 ${ if ${pkgs.libressl.nc}/bin/nc -z 127.0.0.1 ${toString localPort} > /dev/null ; then
toString localPort
} > /dev/null ; then
exit 0 exit 0
fi fi
${pkgs.busybox.out}/bin/sleep 1 ${pkgs.busybox.out}/bin/sleep 1
@ -144,7 +156,5 @@ in {
fi fi
''; '';
}; };
}; };
} }

View File

@ -1,17 +1,19 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.ryujinx.enable = options.gaming.ryujinx.enable = lib.mkEnableOption "Ryujinx Nintendo Switch application.";
lib.mkEnableOption "Ryujinx Nintendo Switch application.";
config = lib.mkIf config.gaming.ryujinx.enable { config = lib.mkIf config.gaming.ryujinx.enable {
environment.systemPackages = with pkgs; [ ryujinx ]; environment.systemPackages = with pkgs; [ ryujinx ];
home-manager.users.${config.user}.xdg.desktopEntries.ryujinx = home-manager.users.${config.user}.xdg.desktopEntries.ryujinx = lib.mkIf pkgs.stdenv.isLinux {
lib.mkIf pkgs.stdenv.isLinux {
name = "Ryujinx"; name = "Ryujinx";
exec = exec = "env DOTNET_EnableAlternateStackCheck=1 Ryujinx -r /home/${config.user}/media/games/ryujinx/ %f";
"env DOTNET_EnableAlternateStackCheck=1 Ryujinx -r /home/${config.user}/media/games/ryujinx/ %f";
}; };
}; };
} }

View File

@ -1,10 +1,21 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options.gaming.steam.enable = lib.mkEnableOption "Steam game launcher."; options.gaming.steam.enable = lib.mkEnableOption "Steam game launcher.";
config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) {
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;
unfreePackages = [ "steam" "steam-original" "steamcmd" "steam-run" ]; unfreePackages = [
"steam"
"steam-original"
"steamcmd"
"steam-run"
];
programs.steam = { programs.steam = {
enable = true; enable = true;
@ -13,8 +24,7 @@
# Adapted in part from: https://github.com/Shawn8901/nix-configuration/blob/1c48be94238a9f463cf0bbd1e1842a4454286514/modules/nixos/steam-compat-tools/default.nix # Adapted in part from: https://github.com/Shawn8901/nix-configuration/blob/1c48be94238a9f463cf0bbd1e1842a4454286514/modules/nixos/steam-compat-tools/default.nix
# Based on: https://github.com/NixOS/nixpkgs/issues/73323 # Based on: https://github.com/NixOS/nixpkgs/issues/73323
extraEnv = { extraEnv = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = STEAM_EXTRA_COMPAT_TOOLS_PATHS = lib.makeBinPath [ pkgs.proton-ge-custom ];
lib.makeBinPath [ pkgs.proton-ge-custom ];
}; };
}; };
}; };
@ -27,13 +37,10 @@
# Allow downloading of GE-Proton and other versions # Allow downloading of GE-Proton and other versions
protonup-qt protonup-qt
]; ];
# Seems like NetworkManager can help speed up Steam launch # Seems like NetworkManager can help speed up Steam launch
# https://www.reddit.com/r/archlinux/comments/qguhco/steam_startup_time_arch_1451_seconds_fedora_34/hi8opet/ # https://www.reddit.com/r/archlinux/comments/qguhco/steam_startup_time_arch_1451_seconds_fedora_34/hi8opet/
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
}; };
} }

View File

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
imports = [ imports = [
./dunst.nix ./dunst.nix
@ -49,7 +50,5 @@
type = lib.types.path; type = lib.types.path;
description = "Wallpaper background image file"; description = "Wallpaper background image file";
}; };
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
@ -8,7 +13,5 @@
home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ]; home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run"; gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
}; };
} }

View File

@ -25,7 +25,5 @@
}; };
}; };
}; };
}; };
} }

View File

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let fontName = "Victor Mono"; let
fontName = "Victor Mono";
in { in
{
config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) {
@ -24,7 +30,5 @@ in {
programs.kitty.font.name = fontName; programs.kitty.font.name = fontName;
services.dunst.settings.global.font = "Hack Nerd Font 14"; services.dunst.settings.global.font = "Hack Nerd Font 14";
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
options = { options = {
gtk.theme = { gtk.theme = {
@ -18,11 +24,13 @@
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
gtk = let gtk =
let
gtkExtraConfig = { gtkExtraConfig = {
gtk-application-prefer-dark-theme = config.theme.dark; gtk-application-prefer-dark-theme = config.theme.dark;
}; };
in { in
{
enable = true; enable = true;
theme = { theme = {
name = config.gtk.theme.name; name = config.gtk.theme.name;
@ -31,7 +39,6 @@
gtk3.extraConfig = gtkExtraConfig; gtk3.extraConfig = gtkExtraConfig;
gtk4.extraConfig = gtkExtraConfig; gtk4.extraConfig = gtkExtraConfig;
}; };
}; };
# Required for setting GTK theme (for preferred-color-scheme in browser) # Required for setting GTK theme (for preferred-color-scheme in browser)
@ -44,8 +51,8 @@
package = config.gtk.theme.package; package = config.gtk.theme.package;
}; };
environment.sessionVariables = { GTK_THEME = config.gtk.theme.name; }; environment.sessionVariables = {
GTK_THEME = config.gtk.theme.name;
};
}; };
} }

View File

@ -1,18 +1,23 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
lockCmd = lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span"; lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
lockUpdate = in
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span"; {
in {
config = lib.mkIf pkgs.stdenv.isLinux { config = lib.mkIf pkgs.stdenv.isLinux {
services.xserver.windowManager = { services.xserver.windowManager = {
i3 = { enable = config.services.xserver.enable; }; i3 = {
enable = config.services.xserver.enable;
};
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -23,7 +28,8 @@ in {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = config.services.xserver.enable; enable = config.services.xserver.enable;
config = let config =
let
modifier = "Mod4"; # Super key modifier = "Mod4"; # Super key
ws1 = "1:I"; ws1 = "1:I";
ws2 = "2:II"; ws2 = "2:II";
@ -35,20 +41,25 @@ in {
ws8 = "8:VIII"; ws8 = "8:VIII";
ws9 = "9:IX"; ws9 = "9:IX";
ws10 = "10:X"; ws10 = "10:X";
in { in
{
modifier = modifier; modifier = modifier;
assigns = { assigns = {
"${ws1}" = [{ class = "Firefox"; }]; "${ws1}" = [ { class = "Firefox"; } ];
"${ws2}" = [ "${ws2}" = [
{ class = "kitty"; } { class = "kitty"; }
{ class = "aerc"; } { class = "aerc"; }
{ class = "obsidian"; } { class = "obsidian"; }
]; ];
"${ws3}" = [{ class = "discord"; }]; "${ws3}" = [ { class = "discord"; } ];
"${ws4}" = [ { class = "steam"; } { class = "Steam"; } ]; "${ws4}" = [
{ class = "steam"; }
{ class = "Steam"; }
];
}; };
bars = [{ command = "echo"; }]; # Disable i3bar bars = [ { command = "echo"; } ]; # Disable i3bar
colors = let colors =
let
background = config.theme.colors.base00; background = config.theme.colors.base00;
inactiveBackground = config.theme.colors.base01; inactiveBackground = config.theme.colors.base01;
border = config.theme.colors.base01; border = config.theme.colors.base01;
@ -57,10 +68,16 @@ in {
inactiveText = config.theme.colors.base04; inactiveText = config.theme.colors.base04;
urgentBackground = config.theme.colors.base08; urgentBackground = config.theme.colors.base08;
indicator = "#00000000"; indicator = "#00000000";
in { in
{
background = config.theme.colors.base00; background = config.theme.colors.base00;
focused = { focused = {
inherit background indicator text border; inherit
background
indicator
text
border
;
childBorder = background; childBorder = background;
}; };
focusedInactive = { focusedInactive = {
@ -98,12 +115,9 @@ in {
# Disable dynamic sleep # Disable dynamic sleep
# https://github.com/rockowitz/ddcutil/issues/323 # https://github.com/rockowitz/ddcutil/issues/323
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30"; "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"Shift+F11" = "Shift+F11" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30"; "XF86MonBrightnessUp" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"XF86MonBrightnessUp" = "XF86MonBrightnessDown" = "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 + 30";
"XF86MonBrightnessDown" =
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --disable-dynamic-sleep --display 2 setvcp 10 - 30";
# Media player controls # Media player controls
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
@ -112,30 +126,20 @@ in {
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
# Launchers # Launchers
"${modifier}+Return" = "${modifier}+Return" = "exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
"exec --no-startup-id kitty; workspace ${ws2}; layout tabbed"; "${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}";
"${modifier}+space" = "${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}";
"exec --no-startup-id ${config.launcherCommand}"; "${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}";
"${modifier}+Shift+s" =
"exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" =
"exec --no-startup-id ${config.audioSwitchCommand}";
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}"; "Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
"${modifier}+Shift+period" = "${modifier}+Shift+period" = "exec --no-startup-id ${config.powerCommand}";
"exec --no-startup-id ${config.powerCommand}"; "${modifier}+Shift+m" = "exec --no-startup-id ${config.brightnessCommand}";
"${modifier}+Shift+m" = "${modifier}+c" = "exec --no-startup-id ${config.calculatorCommand}";
"exec --no-startup-id ${config.brightnessCommand}";
"${modifier}+c" =
"exec --no-startup-id ${config.calculatorCommand}";
"${modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = '' "${modifier}+Shift+q" = ''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = "exec ${lockCmd}"; "${modifier}+Shift+x" = "exec ${lockCmd}";
"${modifier}+Mod1+h" = "${modifier}+Mod1+h" = "exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'"; "${modifier}+Mod1+r" = "exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
"${modifier}+Mod1+r" =
"exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
# Window options # Window options
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";
@ -181,26 +185,16 @@ in {
"${modifier}+0" = "workspace ${ws10}"; "${modifier}+0" = "workspace ${ws10}";
# Move windows # Move windows
"${modifier}+Shift+1" = "${modifier}+Shift+1" = "move container to workspace ${ws1}; workspace ${ws1}";
"move container to workspace ${ws1}; workspace ${ws1}"; "${modifier}+Shift+2" = "move container to workspace ${ws2}; workspace ${ws2}";
"${modifier}+Shift+2" = "${modifier}+Shift+3" = "move container to workspace ${ws3}; workspace ${ws3}";
"move container to workspace ${ws2}; workspace ${ws2}"; "${modifier}+Shift+4" = "move container to workspace ${ws4}; workspace ${ws4}";
"${modifier}+Shift+3" = "${modifier}+Shift+5" = "move container to workspace ${ws5}; workspace ${ws5}";
"move container to workspace ${ws3}; workspace ${ws3}"; "${modifier}+Shift+6" = "move container to workspace ${ws6}; workspace ${ws6}";
"${modifier}+Shift+4" = "${modifier}+Shift+7" = "move container to workspace ${ws7}; workspace ${ws7}";
"move container to workspace ${ws4}; workspace ${ws4}"; "${modifier}+Shift+8" = "move container to workspace ${ws8}; workspace ${ws8}";
"${modifier}+Shift+5" = "${modifier}+Shift+9" = "move container to workspace ${ws9}; workspace ${ws9}";
"move container to workspace ${ws5}; workspace ${ws5}"; "${modifier}+Shift+0" = "move container to workspace ${ws10}; workspace ${ws10}";
"${modifier}+Shift+6" =
"move container to workspace ${ws6}; workspace ${ws6}";
"${modifier}+Shift+7" =
"move container to workspace ${ws7}; workspace ${ws7}";
"${modifier}+Shift+8" =
"move container to workspace ${ws8}; workspace ${ws8}";
"${modifier}+Shift+9" =
"move container to workspace ${ws9}; workspace ${ws9}";
"${modifier}+Shift+0" =
"move container to workspace ${ws10}; workspace ${ws10}";
# Move screens # Move screens
"${modifier}+Control+l" = "move workspace to output right"; "${modifier}+Control+l" = "move workspace to output right";
@ -208,12 +202,9 @@ in {
# Resizing # Resizing
"${modifier}+r" = ''mode "resize"''; "${modifier}+r" = ''mode "resize"'';
"${modifier}+Control+Shift+h" = "${modifier}+Control+Shift+h" = "resize shrink width 10 px or 10 ppt";
"resize shrink width 10 px or 10 ppt"; "${modifier}+Control+Shift+j" = "resize grow height 10 px or 10 ppt";
"${modifier}+Control+Shift+j" = "${modifier}+Control+Shift+k" = "resize shrink height 10 px or 10 ppt";
"resize grow height 10 px or 10 ppt";
"${modifier}+Control+Shift+k" =
"resize shrink height 10 px or 10 ppt";
"${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt"; "${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt";
}; };
modes = { }; modes = { };
@ -224,13 +215,11 @@ in {
notification = false; notification = false;
} }
{ {
command = command = "i3-msg workspace ${ws2}, move workspace to output right";
"i3-msg workspace ${ws2}, move workspace to output right";
notification = false; notification = false;
} }
{ {
command = command = "i3-msg workspace ${ws1}, move workspace to output left";
"i3-msg workspace ${ws1}, move workspace to output left";
notification = false; notification = false;
} }
]; ];
@ -266,22 +255,26 @@ in {
# Update lock screen cache only if cache is empty # Update lock screen cache only if cache is empty
home.activation.updateLockScreenCache = home.activation.updateLockScreenCache =
let cacheDir = "${config.homePath}/.cache/betterlockscreen/current"; let
in lib.mkIf config.services.xserver.enable cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
(config.home-manager.users.${config.user}.lib.dag.entryAfter in
[ "writeBoundary" ] '' lib.mkIf config.services.xserver.enable (
config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then
$DRY_RUN_CMD ${lockUpdate} $DRY_RUN_CMD ${lockUpdate}
fi fi
''); ''
);
}; };
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service # Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
systemd.services.lock = { systemd.services.lock = {
enable = config.services.xserver.enable; enable = config.services.xserver.enable;
description = "Lock the screen on resume from suspend"; description = "Lock the screen on resume from suspend";
before = [ "sleep.target" "suspend.target" ]; before = [
"sleep.target"
"suspend.target"
];
serviceConfig = { serviceConfig = {
User = config.user; User = config.user;
Type = "simple"; Type = "simple";
@ -290,9 +283,10 @@ in {
ExecStart = lockCmd; ExecStart = lockCmd;
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1"; ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
}; };
wantedBy = [ "sleep.target" "suspend.target" ]; wantedBy = [
"sleep.target"
"suspend.target"
];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
@ -31,18 +37,21 @@
]; ];
shadow = false; shadow = false;
shadowExclude = [ ]; shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ]; shadowOffsets = [
(-10)
(-10)
];
shadowOpacity = 0.5; shadowOpacity = 0.5;
vSync = true; vSync = true;
}; };
xsession.windowManager.i3.config.startup = [{ xsession.windowManager.i3.config.startup = [
{
command = "systemctl --user restart picom"; command = "systemctl --user restart picom";
always = true; always = true;
notification = false; notification = false;
}]; }
];
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { {
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
@ -46,8 +52,11 @@
# wm-restack = "i3"; # wm-restack = "i3";
# override-redirect = true; # override-redirect = true;
}; };
"module/i3" = let padding = 2; "module/i3" =
in { let
padding = 2;
in
{
type = "internal/i3"; type = "internal/i3";
pin-workspaces = false; pin-workspaces = false;
show-urgent = true; show-urgent = true;
@ -105,7 +114,8 @@
type = "custom/script"; type = "custom/script";
interval = 10; interval = 10;
format = "<label>"; format = "<label>";
exec = builtins.toString (pkgs.writeShellScript "mailcount.sh" '' exec = builtins.toString (
pkgs.writeShellScript "mailcount.sh" ''
${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null ${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null
UNREAD=$( UNREAD=$(
${pkgs.notmuch}/bin/notmuch count \ ${pkgs.notmuch}/bin/notmuch count \
@ -119,10 +129,9 @@
else else
echo "%{T2}%{T-} $UNREAD " echo "%{T2}%{T-} $UNREAD "
fi fi
''); ''
click-left = );
"i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'"; click-left = "i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
}; };
"module/network" = { "module/network" = {
type = "internal/network"; type = "internal/network";
@ -220,13 +229,13 @@
}; };
}; };
xsession.windowManager.i3.config.startup = [{ xsession.windowManager.i3.config.startup = [
{
command = "pkill polybar; polybar -r main"; command = "pkill polybar; polybar -r main";
always = true; always = true;
notification = false; notification = false;
}]; }
];
}; };
}; };
} }

Some files were not shown because too many files have changed in this diff Show More