misc: initial commit

This commit is contained in:
Emily 2024-12-28 19:33:49 -05:00
commit 964b99b28d
32 changed files with 1675 additions and 0 deletions

125
home/apps.nix Normal file
View file

@ -0,0 +1,125 @@
{
pkgs,
inputs,
...
}: {
imports = [
./apps/firefox.nix
./apps/syncthing.nix
];
home.packages = [
pkgs.pavucontrol
pkgs.signal-desktop
pkgs.webcord # pkgs.webcord-vencord
pkgs.telegram-desktop
#pkgs.kdePackages.neochat
pkgs.keepassxc
#pkgs.blender-hip
pkgs.buku
pkgs.libreoffice
pkgs.darktable
pkgs.gimp
pkgs.inkscape
pkgs.krita
pkgs.okular
pkgs.localsend
pkgs.ffmpeg # Generally useful
# Music
#pkgs.feishin # sonixd replacement
pkgs.supersonic # Music player by Navidrome author
pkgs.sonixd # Music player; desktop app for Navidrome. Replace w/ Feishin when that supports Subsonic API.
pkgs.spotube # Use Spotify metadata & user to play from YouTube
pkgs.spotify # Proprietary
pkgs.strawberry-qt6 # Fork of Clementine
pkgs.clementine
pkgs.lollypop
# muffon https://muffon.netlify.app/
pkgs.picard # Edit audio metadata, w/ MusicBrainz integration
pkgs.puddletag # Edit audio metadata
pkgs.deadbeef-with-plugins
# pkgs.tauon
pkgs.audacious
# pkgs.asunder # Ripping
pkgs.cyanrip # Ripping
# pkgs.whipper # Ripping
#pkgs.anki # Dep python3.12-pyqt-6.7.0 doesn't build
pkgs.memento # Japanese
# Documents
pkgs.typst # TeX alternative
pkgs.tinymist # LSP for Typst
# Dev
pkgs.vscodium # Consider vscodium-fhs
#pkgs.jetbrains.rider
#pkgs.jetbrains.rust-rover
pkgs.helix
pkgs.zed-editor
# Internet
pkgs.fragments
pkgs.uget # Download manager
# From master because PR #290892 is merged but at the time of writing hasn't made it to unstable yet
# Need it to solve issue #263764
# https://github.com/NixOS/nixpkgs/issues/263764
# https://github.com/NixOS/nixpkgs/pull/290892
# https://github.com/NixOS/nixpkgs/commit/999e0cf59288584616a241c0d8bb7c3c3f1fb417
pkgs.obsidian
pkgs.obs-studio
pkgs.kdePackages.plasmatube
#pkgs.nyxt
pkgs.mpvScripts.uosc
pkgs.mpvScripts.sponsorblock
pkgs.musescore
# inputs.muse-sounds-manager.packages.${pkgs.system}.muse-sounds-manager
pkgs.helio-workstation # music editor
pkgs.lmms # DAW
pkgs.carla # VST host
pkgs.yabridge # Windows VST host
pkgs.yabridgectl
pkgs.surge-XT # VST
];
programs.imv.enable = true;
programs.mangohud = {
enable = true;
};
programs.mpv.enable = true;
programs.thunderbird = {
enable = true;
profiles.default = {
isDefault = true;
};
};
programs.vscode = {
enable = true;
package = pkgs.vscodium;
enableUpdateCheck = false;
userSettings = {
"window.menuBarVisibility" = "toggle";
"rust-analyzer.server.path" = "rust-analyzer"; # look in env
# Library sources for rust-analyzer shall be read-only
"files.readonlyInclude" = {
"**/.cargo/registry/src/**/*.rs" = true;
"**/lib/rustlib/src/rust/library/**/*.rs" = true;
};
};
extensions = with pkgs.vscode-extensions; [
mkhl.direnv
jnoortheen.nix-ide
];
};
programs.zathura.enable = true;
}

83
home/apps/firefox.nix Normal file
View file

@ -0,0 +1,83 @@
{
lib,
pkgs,
osConfig,
...
}: let
enablePlasma = osConfig.services.desktopManager.plasma6.enable;
extension = shortId: uuid: {
name = uuid;
value = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed";
};
};
oldExtensions = builtins.listToAttrs;
ext = shortId: {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed";
};
exts = builtins.mapAttrs (_: ext);
in {
programs.firefox = {
enable = true;
nativeMessagingHosts = [
pkgs.tridactyl-native
];
policies.ExtensionSettings = lib.mkMerge [
(oldExtensions [
# languagetool?
#(extension "tree-style-tab" "treestyletab@piro.sakura.ne.jp")
(extension "sidebery" "{3c078156-979c-498b-8990-85f7987dd929}") # has no email id
(extension "kagi-search-for-firefox" "search@kagi.com")
(extension "ublock-origin" "uBlock0@raymondhill.net")
#(extension "umatrix" "uMatrix@raymondhill.net")
(extension "privacy-badger17" "jid1-MnnxcxisBPnSXQ@jetpack")
(extension "i-dont-care-about-cookies" "jid1-KKzOGWgsW3Ao4Q@jetpack")
# (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}") # has no email id
(extension "keepassxc-browser" "keepassxc-browser@keepassxc.org")
#(extension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}")
#(extension "tabliss" "extension@tabliss.io")
# (extension "bukubrow" "bukubrow@samhh.com")
# (extension "multi-account-containers" "@testpilot-containers")
# (extension "rust-search-extension" "{04188724-64d3-497b-a4fd-7caffe6eab29}") # has no email id
# (extension "tridactyl-vim" "tridactyl.vim@cmcaine.co.uk")
# site-specific
# (extension "libredirect" "7esoorv3@alefvanoon.anonaddy.me")
(extension "toolkit-for-ynab" "{4F1FB113-D7D8-40AE-A5BA-9300EAEA0F51}") # has no email id
(extension "sponsorblock" "sponsorBlocker@ajay.app")
# (extension "steam-database" "firefox-extension@steamdb.info")
])
# TODO: Can we get this from nixpkgs instead?
(lib.mkIf enablePlasma (exts {
"plasma-browser-integration@kde.org" = "plasma-integration";
}))
];
# To add additional extensions, find it on addons.mozilla.org, find
# the short ID in the url (like https://addons.mozilla.org/en-US/firefox/addon/!SHORT_ID!/)
# Then, download the XPI by filling it in to the install_url template, unzip it,
# run `jq .browser_specific_settings.gecko.id manifest.json` or
# `jq .applications.gecko.id manifest.json` to get the UUID
# You dont need to get the UUID from the xpi. You can install it then find the UUID in about:debugging#/runtime/this-firefox.
profiles.default = {
settings = {
"app.normandy.first_run" = false;
"app.shield.optoutstudies.enabled" = false;
"app.update.channel" = "default";
# "browser.link.open_newwindow" = true;
"browser.shell.checkDefaultBrowser" = true;
"browser.urlbar.showSearchSuggestionsFirst" = false;
"browser.vpn_promo.enabled" = false;
# "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org";
# "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org";
"extensions.pocket.enabled" = false;
"media.ffmpeg.vaapi.enabled" = true;
};
};
};
}

18
home/apps/syncthing.nix Normal file
View file

@ -0,0 +1,18 @@
{
lib,
pkgs,
osConfig,
...
}: let
enablePlasma = osConfig.services.desktopManager.plasma6.enable;
enableGnome = osConfig.services.xserver.desktopManager.gnome.enable;
in {
services.syncthing = {
enable = true;
};
home.packages = lib.mkMerge [
(lib.mkIf enablePlasma [pkgs.syncthingtray-qt6])
(lib.mkIf enableGnome [pkgs.gnomeExtensions.syncthing-indicator])
];
}

103
home/default.nix Normal file
View file

@ -0,0 +1,103 @@
{
config,
pkgs,
inputs,
osConfig,
...
}: let
variables = {
# VISUAL = "emacs";
EDITOR = "nvim";
SSH_ASKPASS_REQUIRE = "prefer";
SSH_ASKPASS = "${pkgs.ksshaskpass}/bin/ksshaskpass";
};
in {
imports = [
./xdg.nix
./terminal.nix
./desktop.nix
# ./emacs.nix
./apps.nix
];
home.sessionVariables = variables;
systemd.user.sessionVariables = variables;
fonts.fontconfig.enable = true;
xdg.enable = true;
home.packages = with pkgs; [
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-color-emoji
];
programs.git = {
enable = true;
delta = {
enable = true;
options = {
side-by-side = true;
};
};
# WISH: Figure out difftastic
# difftastic.enable = true;
# https://difftastic.wilfred.me.uk/git.html
# https://tsdh.org/posts/2022-08-01-difftastic-diffing-with-magit.html
userEmail = "git@evar.dev";
userName = "Evar";
extraConfig = {
init.defaultBranch = "main";
# Consider https://jvns.ca/blog/2024/02/16/popular-git-config-options/#pull-ff-only-or-pull-rebase-true
# Make merge conflicts more readable
merge.conflictstyle = "zdiff3";
rebase.autosquash = true;
rebase.autostash = true;
# Consider https://jvns.ca/blog/2024/02/16/popular-git-config-options/#push-default-simple-push-default-current-push-autosetupremote-true
# Add whole commit diff in text editor when writing commit message
#commit.verbose = true;
# Remember how merge conflicts were resolved to restore later
rerere.enabled = true;
# Better diffs
diff.algorithm = "histogram";
status.submoduleSummary = true;
diff.submodule = "log";
submodule.recurse = true;
merge.keepbackup = false;
#merge.tool = "${pkgs.meld}/bin/meld";
};
};
# programs.ssh
programs.ssh = {
enable = true;
addKeysToAgent = "1h";
};
services.ssh-agent.enable = true;
programs.yt-dlp.enable = true;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "23.11";
# Let Home Manager install and manage itself.
#programs.home-manager.enable = true;
}

30
home/desktop.nix Normal file
View file

@ -0,0 +1,30 @@
{
config,
options,
lib,
pkgs,
inputs,
osConfig,
...
}: {
imports = [
./desktop/shared/wayland.nix
./desktop/hyprland.nix
./desktop/plasma.nix
];
# my.desktop.hyprland.enable = true;
my.desktop.plasma.enable = true;
programs.foot = {
enable = true;
settings.main = {
shell = "fish";
font = "monospace:size=10";
app-id = "foot";
pad = "10x8 center";
};
settings.url.osc8-underline = "always";
settings.cursor.style = "beam";
};
}

172
home/desktop/hyprland.nix Normal file
View file

@ -0,0 +1,172 @@
{
config,
lib,
pkgs,
options,
inputs,
osConfig,
...
}: {
imports = [
inputs.ags.homeManagerModules.default
inputs.anyrun.homeManagerModules.default
];
options.my.desktop.hyprland.enable = lib.mkEnableOption "my Hyprland based desktop environment";
config = lib.mkIf config.my.desktop.hyprland.enable {
my.desktop.wayland = true;
wayland.windowManager.hyprland = {
enable = true;
package = osConfig.programs.hyprland.package;
extraConfig = ''
source=${./hyprland}/hyprland.conf
'';
systemd.variables = options.wayland.windowManager.hyprland.systemd.variables.default ++ ["XDG_SESSION_TYPE"];
};
services.cliphist = {
enable = true;
systemdTarget = "hyprland-session.target"; # defaults to graphical-session.target
};
systemd.user.targets.hyprland-session.Unit.Wants = ["plasma-polkit-agent.service"];
programs.ags = {
enable = true;
configDir = ./ags;
};
systemd.user.services.ags = {
Unit.Description = "Aylur's Gtk Shell";
Unit.PartOf = ["hyprland-session.target"];
Install.WantedBy = ["hyprland-session.target"];
Service = let
app = pkgs.writeShellApplication {
name = "ags-wrapped";
runtimeInputs = [config.programs.ags.package pkgs.coreutils];
text = ''ags "$@"'';
};
in {
# Service = {
BusName = "com.github.Aylur.ags.ags";
# ExecStart = "${config.programs.ags.package}/bin/ags --config ${config.programs.ags.configDir}/config.js";
ExecStart = "${app}/bin/ags-wrapped --config ${config.programs.ags.configDir}/config.js";
OOMScoreAdjust = -500;
};
# TODO: reloadTriggers?
# restartTriggers = [ config.programs.ags.configDir ];
};
programs.anyrun = {
enable = true;
config.plugins = with inputs.anyrun.packages.${pkgs.stdenv.hostPlatform.system}; [
applications
dictionary
# kidex
randr
rink
shell
# stdin
symbols
# translate
# websearch
];
};
programs.swaylock = {
enable = true;
settings = {
color = "808080";
font-size = 24;
indicator-idle-visible = false;
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
};
services.swayidle = let
swaylock = "${config.programs.swaylock.package}/bin/swaylock";
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
in {
enable = true;
systemdTarget = "hyprland-session.target"; # defaults to graphical-session.target
extraArgs = [
"-w" # Wait for command to finish executing before continuing
"idlehint"
"300"
];
events = [
{
event = "before-sleep";
command = "${swaylock} -f";
}
# after-resume
{
event = "lock";
command = "${swaylock} -f";
}
{
event = "unlock";
command = "kill -s USR1 swaylock";
}
];
timeouts = [
{
timeout = 300;
command = "${swaylock} -f";
} # 300
{
timeout = 600;
command = "${hyprctl} dispatch dpms off";
resumeCommand = "${hyprctl} dispatch dpms on";
}
# { timeout = 900; command = "${pkgs.systemd}/bin/systemctl suspend"; }
];
};
# TDOD: replace with ags
services.swayosd.enable = true;
services.udiskie.enable = osConfig.services.udisks2.enable;
systemd.user.services.swww = {
Unit.Description = "Animated wallpaper daemon for wayland";
Unit.Documentation = ["man:swww(1)"];
Unit.PartOf = ["hyprland-session.target"];
Install.WantedBy = ["hyprland-session.target"];
# Service.ExecStart = "${pkgs.swww}/bin/swww init --no-daemon";
Service.ExecStart = let
app = pkgs.writeShellApplication {
name = "swww-wrapped";
runtimeInputs = [pkgs.swww];
text = ''
swww init --no-daemon
'';
};
in "${app}/bin/swww-wrapped";
};
systemd.user.services.wayvnc = {
Unit.Description = "Wayland VNC server";
Unit.PartOf = ["graphical-session.target"];
Service.ExecStart = "${pkgs.wayvnc}/bin/wayvnc";
};
# Not sure if this should be per desktop
services.mpris-proxy.enable = true;
programs.foot.settings.colors.alpha = 0.6;
home.packages = [
pkgs.swww
pkgs.wofi
pkgs.polkit-kde-agent
pkgs.libsForQt5.qtwayland
pkgs.qt6Packages.qtwayland
pkgs.grimblast # screenshots on hyprland
pkgs.gnome.gnome-system-monitor
pkgs.gnome.nautilus
];
};
}

28
home/desktop/plasma.nix Normal file
View file

@ -0,0 +1,28 @@
{
config,
lib,
pkgs,
...
}: let
polonium = pkgs.callPackage ../../pkgs/polonium.nix {};
in {
options.my.desktop.plasma.enable = lib.mkEnableOption "my Plasma based desktop environment";
config = lib.mkIf config.my.desktop.plasma.enable {
my.desktop.wayland = true;
home.packages = [
polonium
];
programs.firefox.policies.ExtensionSettings = let
extension = shortId: {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed";
};
in
builtins.mapAttrs (_: extension) {
"plasma-browser-integration@kde.org" = "plasma-integration";
};
};
}

View file

@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}: let
variables = {
NIXOS_OZONE_WL = "1";
STEAM_FORCE_DESKTOPUI_SCALING = "1.5";
};
in {
options.my.desktop.wayland = lib.mkEnableOption "my Wayland options";
config = lib.mkIf config.my.desktop.wayland {
home.sessionVariables = variables;
systemd.user.sessionVariables = variables;
};
}

119
home/terminal.nix Normal file
View file

@ -0,0 +1,119 @@
{
config,
lib,
pkgs,
inputs,
...
}: {
imports = [
inputs.nix-index-database.hmModules.nix-index
];
home.packages = [
pkgs.file
pkgs.pciutils # lspci
pkgs.usbutils # lsusb
pkgs.bottom
pkgs.htop
pkgs.lsof
pkgs.lm_sensors
pkgs.amdgpu_top
#pkgs.rocmPackages.rocm-smi
pkgs.ryzenadj
pkgs.powertop
pkgs.procs
pkgs.sshfs
pkgs.fd
pkgs.libqalculate
# pkgs.havn # port scanner
pkgs.gdu # count code
pkgs.tokei # count code
pkgs.ov # pager
pkgs.zoxide # cd
pkgs.dua
pkgs.unzip
pkgs.unrar-wrapper
pkgs.p7zip
pkgs.atool
pkgs.fastfetch
pkgs.hyfetch
pkgs.helix # `hx` editor
pkgs.jujutsu # `jj` vcs
];
programs.atuin = {
enable = true;
settings.update_check = false;
settings.enter_accept = true;
};
programs.autojump.enable = true;
programs.bat.enable = true;
# maybe move boxxy here?
programs.broot.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
# Externally located cache
stdlib = ''
declare -A direnv_layout_dirs
direnv_layout_dir() {
local hash path
echo "''${direnv_layout_dirs[$PWD]:=$(
hash="$(sha1sum - <<< "$PWD" | head -c40)"
path="''${PWD//[^a-zA-Z0-9]/-}"
echo "${config.xdg.cacheHome}/direnv/layouts/''${hash}''${path}"
)}"
}
'';
};
programs.eza = {
enable = true;
git = true;
icons = "auto";
};
programs.fish = {
enable = true;
functions = {
#__fish_command_not_found_handler = {
# body = "__fish_default_command_not_found_handler $argv[1]";
# onEvent = "fish_command_not_found";
#};
};
shellInit = "set fish_greeting";
};
# maybe move git here?
programs.jq.enable = true;
programs.nix-index.enable = true;
programs.nix-index-database.comma.enable = true;
programs.ripgrep.enable = true;
programs.skim.enable = true;
programs.starship = {
enable = true;
enableTransience = true;
settings.nix_shell.format = "";
};
# programs.yazi = {
# enable = true;
# settings.preview.cache_dir = "${config.xdg.cacheHome}/thumbnails/yazi";
# };
}

31
home/xdg.nix Normal file
View file

@ -0,0 +1,31 @@
{
config,
lib,
pkgs,
...
}: let
inherit (config.xdg) stateHome dataHome configHome cacheHome;
variables = {
# Bash (.bash_history)
HISTFILE = "${stateHome}/bash/history";
# Rust (.cargo)
CARGO_HOME = "${dataHome}/cargo";
RUSTUP_HOME = "${dataHome}/rustup";
# GTK2 (.gtkrc-2.0)
GTK2_RC_FILES = "${configHome}/gtk-2.0/gtkrc";
# XCompose (.compose-cache)
XCOMPOSECACHE = "${cacheHome}/X11/xcompose";
# NuGet (.nuget/packages)
NUGET_PACKAGES = "${dataHome}/NuGetPackages";
};
in {
home.sessionVariables = variables;
systemd.user.sessionVariables = variables;
# Run `xdg-ninja` to check fixable dotfiles
home.packages = [pkgs.xdg-ninja];
}