diff --git a/.gitignore b/.gitignore index e43b0f9..d5fec98 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +result diff --git a/README.md b/README.md index 10533e4..d1e8ea4 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,54 @@ -# my little nix system +# dots +## overview + -## installation -### linux - desktop -1. Boot up NixOS live iso on a system. -2. Clone flake -3. Make a folder for the system under hosts/ -4. Run `nixos-generate-config --dir hosts/HOSTNAME` -6. Set LUKS encryption passphrase via `sudo nano /tmp/secret.key` -7. Run disko `sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount /path/to/disko-config.nix` -8. Copy over flake directory to new system -9. Install system with `sudo nixos-install --flake .#HOSTNAME` - set a password for root -10. Reboot into new system. -11. Open a terminal and run `passwd` -12. Log into normal user and configure networking via `nmtui` -13. Apply dotfiles via `stow stow` in the base of the dotfiles directory. -14. Download a wallpaper and apply it via `matugen image` +my dotfiles for NixOS, macOS or POSIX systems. primarily for systems that support [Nix](https://nixos.org) since they have declarative configuration. although dotfiles (in the stow directory) are made to keep them portable without the need for nix necessarily. +- OS: [NixOS](https://nixos.org) and macOS +- Shell: [fish](https://fishshell.com/) +- Terminal: [Ghostty](https://ghostty.org/) +- Browser: Firefox -#### Secure boot -If a system has a secure boot, install the system WITHOUT the secureboot module. Once the steps above have been completed return here. +linux specific: +- Desktop: [Hyprland](https://hyprland.org/) and [Niri](https://github.com/YaLTeR/niri) +- Status Bar: [Waybar](https://github.com/Alexays/Waybar) +- Launcher: [Vicinae](https://github.com/vicinaehq/vicinae) -1. Generate secureboot signing keys with `sudo nix run nixpkgs#sbctl create-keys` -2. Rebuild the system WITH the secureboot module. -3. Run `sudo sbctl verify` to check if SOME of the files are signed. -4. Reboot your system, in the UEFI enable onboarding secureboot keys, usually a setting called 'Reset to setup mode'. -5. Boot into your NixOS system and run `sudo sbctl enroll-keys --microsoft` to enroll your keys. -6. Reboot into your UEFI again and enable secure boot. +macOS specific: +- Launcher: [Raycast](https://www.raycast.com/) +- Application Firewall: [Lulu](https://objective-see.org/products/lulu.html) -### macOS -1. Install xcode developer tools, determinate nix and brew. -```sh -xcode-select --install -curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +# showcase + + + + + + + + + + + + + + + + + + +
NixOSmacOS
+ +# license +all content in this repository is licensed under the BSD0 license aka 0-Clause BSD license. +``` +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ``` -2. Install Nix flake to system. `nix run nix-darwin/master#darwin-rebuild -- switch` -3. Reboot -4. Install OpenUTAU `https://github.com/stakira/OpenUtau/releases/latest/download/OpenUtau-osx-x64.dmg` -5. Configure non-automated settings -- set accent colour -- set display to be spacious -- customise spotlight settings -- disable bluetooth -- enable firewall -- set wallpaper -- enable switching workspace keybinds diff --git a/assets/linux-bocchi-fastfetch.webp b/assets/linux-bocchi-fastfetch.webp new file mode 100644 index 0000000..9e72c02 Binary files /dev/null and b/assets/linux-bocchi-fastfetch.webp differ diff --git a/assets/linux-mafuyu.webp b/assets/linux-mafuyu.webp new file mode 100644 index 0000000..de5d205 Binary files /dev/null and b/assets/linux-mafuyu.webp differ diff --git a/assets/linux-oneshot-launcher.webp b/assets/linux-oneshot-launcher.webp new file mode 100644 index 0000000..9c36428 Binary files /dev/null and b/assets/linux-oneshot-launcher.webp differ diff --git a/assets/macos-bocchi-fastfetch.webp b/assets/macos-bocchi-fastfetch.webp new file mode 100644 index 0000000..432108c Binary files /dev/null and b/assets/macos-bocchi-fastfetch.webp differ diff --git a/assets/macos-nene.webp b/assets/macos-nene.webp new file mode 100644 index 0000000..5513f14 Binary files /dev/null and b/assets/macos-nene.webp differ diff --git a/assets/macos-oneshot-light.webp b/assets/macos-oneshot-light.webp new file mode 100644 index 0000000..f6df2c8 Binary files /dev/null and b/assets/macos-oneshot-light.webp differ diff --git a/backup.sh b/backup.sh new file mode 100755 index 0000000..3773530 --- /dev/null +++ b/backup.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# stops the script immediately if any error is encountered +set -e + +PINK="\033[35m" +RESET="\033[0m" + +kanidm_backup() { + # $1 = out path + echo -e "$PINK kanidm: backing up database$RESET" + + DATABASE_DUMP_PATH="$(mktemp)" + chown kanidm:kanidm "$DATABASE_DUMP_PATH" + run0 -u kanidm --unit=kanidmd sh -c "kanidmd database backup \"$DATABASE_DUMP_PATH\"" + + rsync "$DATABASE_DUMP_PATH" "$1" + rm "$DATABASE_DUMP_PATH" + + echo -e "$PINK kanidm: DONE$RESET" +} + +postgres_backup() { + # $1 = database to backup + # $2 = location to put backup + echo -e "$PINK postgres($1): backing up database $1 to stdout$RESET" + run0 -u postgres pg_dump --dbname="$1" > "$2" + + echo -e "$PINK postgres($1): DONE$RESET" +} + +if [ "$1" = "" ]; then + echo "$0: [BACKUP_DIR]" + exit 1 +elif [ "$USER" != "root" ]; then + echo "$0: rerun the script as root" + exit 1 +fi + +case "$1" in + /*) echo " ";; + *) echo "$0: use absolute path for backup dir"; exit 1;; +esac + +BACKUP_DIR="$1" +echo -e "$PINK using folder $BACKUP_DIR$RESET" +mkdir --parents "$BACKUP_DIR" + +SERVICES="jellyfin radarr sonarr prowlarr uptime-kuma deluged forgejo karakeep-web karakeep-workers karakeep-browser" + +systemctl stop $SERVICES + +rsync -avP /media/ --exclude "media" --exclude "secrets" --exclude "torrents" --include "torrents/files/*" "$BACKUP_DIR" + +kanidm_backup "$BACKUP_DIR"/apps/kanidm.bak +postgres_backup miniflux "$BACKUP_DIR"/apps/miniflux.sql + +systemctl start $SERVICES + +echo -e "\n\nBACKUP COMPLETED!" diff --git a/flake.lock b/flake.lock index 52e21e8..b066068 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1731098351, - "narHash": "sha256-HQkYvKvaLQqNa10KEFGgWHfMAbWBfFp+4cAgkut+NNE=", + "lastModified": 1754269165, + "narHash": "sha256-0tcS8FHd4QjbCVoxN9jI+PjHgA4vc/IjkUSp+N3zy0U=", "owner": "ipetkov", "repo": "crane", - "rev": "ef80ead953c1b28316cc3f8613904edc2eb90c28", + "rev": "444e81206df3f7d92780680e45858e31d2f07a08", "type": "github" }, "original": { @@ -15,35 +15,14 @@ "type": "github" } }, - "disko": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1746728054, - "narHash": "sha256-eDoSOhxGEm2PykZFa/x9QG5eTH0MJdiJ9aR00VAofXE=", - "owner": "nix-community", - "repo": "disko", - "rev": "ff442f5d1425feb86344c028298548024f21256d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "latest", - "repo": "disko", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -55,11 +34,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -76,11 +55,11 @@ ] }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1754091436, + "narHash": "sha256-XKqDMN1/Qj1DKivQvscI4vmHfDfvYR2pfuFOJiCeewM=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "67df8c627c2c39c41dbec76a1f201929929ab0bd", "type": "github" }, "original": { @@ -89,24 +68,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -137,11 +98,11 @@ ] }, "locked": { - "lastModified": 1747990026, - "narHash": "sha256-sG5VbID+x5+xUC+jjgHibnzg8IllVcH+K2TLmYHLPME=", + "lastModified": 1771587792, + "narHash": "sha256-XGFLdlLOez7f0rmjlF+1TLXyBguy8gx2aBHx/Q5JXxs=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "e2f4ced874406541a7957f7e2b8f05a0d59a0f00", + "rev": "b49fc54950e251f166a2240799315033ab7a8916", "type": "github" }, "original": { @@ -162,16 +123,16 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1737639419, - "narHash": "sha256-AEEDktApTEZ5PZXNDkry2YV2k6t0dTgLPEmAZbnigXU=", + "lastModified": 1762205063, + "narHash": "sha256-If6vQ+KvtKs3ARBO9G3l+4wFSCYtRBrwX1z+I+B61wQ=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "a65905a09e2c43ff63be8c0e86a93712361f871e", + "rev": "88b8a563ff5704f4e8d8e5118fb911fa2110ca05", "type": "github" }, "original": { "owner": "nix-community", - "ref": "v0.4.2", + "ref": "v0.4.3", "repo": "lanzaboote", "type": "github" } @@ -183,11 +144,11 @@ ] }, "locked": { - "lastModified": 1748004251, - "narHash": "sha256-XodjkVWTth3A2JpBqGBkdLD9kkWn94rnv98l3xwKukg=", + "lastModified": 1771520882, + "narHash": "sha256-9SeTZ4Pwr730YfT7V8Azb8GFbwk1ZwiQDAwft3qAD+o=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "33220d4791784e4dd4739edd3f6c028020082f91", + "rev": "6a7fdcd5839ec8b135821179eea3b58092171bcf", "type": "github" }, "original": { @@ -221,15 +182,15 @@ "nix-minecraft": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems" }, "locked": { - "lastModified": 1748051893, - "narHash": "sha256-KV6bgVHPzb9ymVk9WDRX1lkkeoZETMbS/MyPpIOUWVo=", + "lastModified": 1771641457, + "narHash": "sha256-TIekRGfeCwuEmYcWex40RTx0Gd46pqmyUtxdFKb5juI=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "a600d058c19e1668db6ba759ecc4cfd154079ab5", + "rev": "c4e2b8969e09067da9d44b6b5762e1e896418f40", "type": "github" }, "original": { @@ -240,11 +201,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742889210, - "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", + "lastModified": 1769461804, + "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "698214a32beb4f4c8e3942372c694f40848b360d", + "rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d", "type": "github" }, "original": { @@ -254,29 +215,13 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1730741070, - "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { - "lastModified": 1747744144, - "narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", + "lastModified": 1771369470, + "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", + "rev": "0182a361324364ae3f436a63005877674cf45efb", "type": "github" }, "original": { @@ -296,15 +241,14 @@ "nixpkgs": [ "lanzaboote", "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" + ] }, "locked": { - "lastModified": 1731363552, - "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", + "lastModified": 1750779888, + "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", + "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", "type": "github" }, "original": { @@ -315,7 +259,6 @@ }, "root": { "inputs": { - "disko": "disko", "jovian": "jovian", "lanzaboote": "lanzaboote", "nix-darwin": "nix-darwin", @@ -331,11 +274,11 @@ ] }, "locked": { - "lastModified": 1731897198, - "narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=", + "lastModified": 1761791894, + "narHash": "sha256-myRIDh+PxaREz+z9LzbqBJF+SnTFJwkthKDX9zMyddY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "0be641045af6d8666c11c2c40e45ffc9667839b5", + "rev": "59c45eb69d9222a4362673141e00ff77842cd219", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c015bd9..02ccd89 100644 --- a/flake.nix +++ b/flake.nix @@ -4,54 +4,79 @@ inputs = { # NixOS official package source, using the unstable branch here nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - lanzaboote.url = "github:nix-community/lanzaboote/v0.4.2"; + lanzaboote.url = "github:nix-community/lanzaboote/v0.4.3"; lanzaboote.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.url = "github:LnL7/nix-darwin"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; - disko.url = "github:nix-community/disko/latest"; - disko.inputs.nixpkgs.follows = "nixpkgs"; jovian.url = "github:Jovian-Experiments/Jovian-NixOS"; jovian.inputs.nixpkgs.follows = "nixpkgs"; nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; - outputs = { self, nixpkgs, lanzaboote, nix-darwin, disko, jovian, nix-minecraft, ... }@inputs: { + outputs = { self, nixpkgs, lanzaboote, nix-darwin, jovian, nix-minecraft, ... }@inputs: { nixosConfigurations.nijika = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./hosts/nixos-common.nix + ./modules/desktop/default.nix + ./modules/desktop/de/hyprland.nix + ./modules/desktop/japanese-input.nix + ./modules/desktop/login/autologin.nix + ./modules/applications/default.nix + ./modules/applications/keepassxc.nix + ./modules/games/linux.nix + ./modules/browser/firefox.nix + ./modules/nix/linux.nix ./modules/shell.nix - nix-minecraft.nixosModules.minecraft-servers - { nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; } - ./modules/games/server/minecraft/default.nix - ./modules/services/uptime-kuma.nix - ./modules/services/pocketid.nix - ./modules/services/auth/kanidm.nix - ./modules/services/caddy.nix - ./modules/services/forgejo.nix - ./modules/services/miniflux.nix - ./modules/services/media/arr.nix - ./modules/services/media/jellyfin.nix - ./modules/services/ssh.nix - ./modules/services/glance.nix - ./modules/network/avahi.nix - ./modules/network/firewall/opensnitch.nix + ./modules/services/ssh.nix ./modules/network/vpn/tailscale.nix ./modules/users/nico.nix ./modules/hardware/secureboot.nix + ./modules/hardware/bootloader/systemd-boot.nix lanzaboote.nixosModules.lanzaboote ./hosts/nijika/configuration.nix - disko.nixosModules.disko ]; }; - nixosConfigurations.bocchi = nixpkgs.lib.nixosSystem { + nixosConfigurations.seika = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/nixos-common.nix + + ./modules/services/uptime-kuma.nix + ./modules/services/auth/kanidm.nix + ./modules/services/auth/tinyauth.nix + ./modules/services/caddy.nix + ./modules/services/forgejo.nix + ./modules/services/miniflux.nix + ./modules/services/karakeep.nix + ./modules/services/media/arr.nix + ./modules/services/media/jellyfin.nix + ./modules/services/archiveteam-warrior.nix + ./modules/services/samba.nix + ./modules/hardware/restic.nix + + ./modules/network/avahi.nix + ./modules/services/ssh.nix + ./modules/services/dns/coredns.nix + ./modules/services/dns/ddns-updater.nix + ./modules/network/vpn/tailscale.nix + + ./modules/nix/linux.nix + ./modules/shell.nix + ./modules/users/nico.nix + ./modules/hardware/bootloader/systemd-boot.nix + ./hosts/seika/configuration.nix + ]; + }; + + nixosConfigurations.miki = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./hosts/nixos-common.nix @@ -59,20 +84,20 @@ ./modules/nix/linux.nix ./modules/shell.nix + ./modules/services/caddy.nix + ./modules/services/media/jellyfin.nix + ./modules/services/media/arr.nix + ./modules/services/auth/tinyauth.nix + ./modules/services/ssh.nix ./modules/network/vpn/tailscale.nix - nix-minecraft.nixosModules.minecraft-servers - { nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; } - ./modules/games/server/minecraft/default.nix - ./modules/games/server/minecraft/neoforge-1.21.1.nix - ./modules/users/nico.nix ./modules/users/rhys.nix - ./hosts/bocchi/configuration.nix + ./hosts/miki/configuration.nix + ./modules/hardware/bootloader/systemd-boot.nix ./hosts/nixos-common.nix - disko.nixosModules.disko ]; }; @@ -86,6 +111,8 @@ ./modules/games/darwin.nix ./modules/applications/darwin.nix ./modules/desktop/de/darwin.nix + ./modules/desktop/de/yabai.nix + ./modules/desktop/programs/sketchybar.nix ./modules/hardware/darwin.nix ./modules/nix/darwin.nix ./modules/network/vpn/tailscale-darwin.nix diff --git a/hosts/bocchi/configuration.nix b/hosts/bocchi/configuration.nix deleted file mode 100644 index 5100d79..0000000 --- a/hosts/bocchi/configuration.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ./hardware-configuration.nix - ]; - - networking.hostName = "bocchi"; - hardware.graphics.enable = true; - - # game servers - services.minecraft-servers.servers.velocity.enable = lib.mkForce false; - virtualisation.oci-containers.containers.neoforge-1-21-1.ports = [ "25565:25565" ]; - virtualisation.oci-containers.containers.neoforge-1-21-1.environment.SERVER_PORT = lib.mkForce "25565"; - -} diff --git a/hosts/miki/configuration.nix b/hosts/miki/configuration.nix new file mode 100644 index 0000000..73d108b --- /dev/null +++ b/hosts/miki/configuration.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ]; + + networking.hostName = "miki"; + + # gpu drivers + hardware.graphics.enable = true; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_470; + hardware.nvidia.open = false; + + nixpkgs.config.allowUnfree = true; + nixpkgs.config.nvidia.acceptLicense = true; + + swapDevices = [{ + device = "/swapfile"; + size = 8*1024; # 8 GB + }]; + + # so safe!!!! + nixpkgs.config.permittedInsecurePackages = [ + "broadcom-sta-6.30.223.271-59-6.12.65" + ]; +} diff --git a/hosts/bocchi/hardware-configuration.nix b/hosts/miki/hardware-configuration.nix similarity index 100% rename from hosts/bocchi/hardware-configuration.nix rename to hosts/miki/hardware-configuration.nix diff --git a/hosts/nijika/configuration.nix b/hosts/nijika/configuration.nix index eacc352..4892f3b 100644 --- a/hosts/nijika/configuration.nix +++ b/hosts/nijika/configuration.nix @@ -2,7 +2,6 @@ { imports = [ - ./disko.nix ./hardware-configuration.nix ]; @@ -18,9 +17,6 @@ # see: https://github.com/NixOS/nixpkgs/issues/356535 # intel-compute-runtime-legacy1 vpl-gpu-rt # QSV on 11th gen or newer - intel-media-sdk # QSV up to 11th gen intel-ocl # OpenCL support ]; - - services.logind.lidSwitchExternalPower = "ignore"; } diff --git a/hosts/nijika/disko.nix b/hosts/nijika/disko.nix deleted file mode 100644 index 5d73a54..0000000 --- a/hosts/nijika/disko.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ ... }: - -{ - disko.devices = { - disk = { - main = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "root"; - passwordFile = "/tmp/secret.key"; - settings = { - allowDiscards = true; - }; -# additionalKeyFiles = [ "/tmp/additionalSecret.key" ]; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; - "/home" = { - mountpoint = "/home"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; - "/swap" = { - mountpoint = "/.swapvol"; - swap.swapfile.size = "1G"; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/hosts/nijika/hardware-configuration.nix b/hosts/nijika/hardware-configuration.nix index 77a2497..4353ce3 100644 --- a/hosts/nijika/hardware-configuration.nix +++ b/hosts/nijika/hardware-configuration.nix @@ -8,17 +8,44 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "uas" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + fileSystems."/" = + { device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/4a0361b6-b3b4-48dd-a089-babdfa072fc2"; + + fileSystems."/nix" = + { device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/.swapvol" = + { device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + + fileSystems."/home" = + { device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/CF57-9CF0"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/nixos-common.nix b/hosts/nixos-common.nix index 52207d4..2187618 100644 --- a/hosts/nixos-common.nix +++ b/hosts/nixos-common.nix @@ -6,7 +6,6 @@ { # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; # Networking diff --git a/hosts/seika/configuration.nix b/hosts/seika/configuration.nix new file mode 100644 index 0000000..25f3c8f --- /dev/null +++ b/hosts/seika/configuration.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ]; + + networking.hostName = "seika"; + + hardware.graphics.enable = true; + environment.sessionVariables.LIBVA_DRIVER_NAME = "iHD"; + hardware.graphics.extraPackages = with pkgs; [ + intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD + libva-vdpau-driver # Previously vaapiVdpau + intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) + ]; + + services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore"; +} diff --git a/hosts/seika/hardware-configuration.nix b/hosts/seika/hardware-configuration.nix new file mode 100644 index 0000000..2271cd9 --- /dev/null +++ b/hosts/seika/hardware-configuration.nix @@ -0,0 +1,56 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/120b2057-ed32-40c0-b838-25e5713cc5d6"; + fsType = "btrfs"; + options = [ "subvol=@root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/120b2057-ed32-40c0-b838-25e5713cc5d6"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/120b2057-ed32-40c0-b838-25e5713cc5d6"; + fsType = "btrfs"; + options = [ "subvol=@nix" ]; + }; + + fileSystems."/media" = + { device = "/dev/disk/by-uuid/120b2057-ed32-40c0-b838-25e5713cc5d6"; + fsType = "btrfs"; + options = [ "subvol=@media" ]; + }; + + fileSystems."/swap" = + { device = "/dev/disk/by-uuid/120b2057-ed32-40c0-b838-25e5713cc5d6"; + fsType = "btrfs"; + options = [ "subvol=@swap" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E89A-EECA"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/applications/1password.nix b/modules/applications/1password.nix new file mode 100644 index 0000000..71a31cb --- /dev/null +++ b/modules/applications/1password.nix @@ -0,0 +1,19 @@ +{ config, ...}: + +{ + programs._1password.enable = true; + programs._1password-gui = { + enable = true; + polkitPolicyOwners = [ "nico" ]; + }; + + # browser extensions + programs.firefox.policies.ExtensionSettings."{d634138d-c276-4fc8-924b-40a0ea21d284}" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/1password-x-password-manager/latest.xpi"; + }; + + programs.chromium.extensions = [ + "aeblfdkhhhdcdjpifhhbdiojplfjncoa" # 1Password + ]; +} diff --git a/modules/applications/darwin.nix b/modules/applications/darwin.nix index 14ffa1b..e0a0283 100644 --- a/modules/applications/darwin.nix +++ b/modules/applications/darwin.nix @@ -5,27 +5,30 @@ # dock system.defaults.dock.persistent-apps = [ - "/Applications/Firefox.app" + "/Applications/Zen.app" "/Applications/Ghostty.app" - "/Applications/Nix Apps/Spotify.app" - "/Applications/Grayjay.app" - "/Applications/Infuse.app" + "/System/Applications/Music.app" + "/Applications/Nix Apps/KeePassXC.app" + { spacer.small = true; } "/System/Applications/Messages.app" - "/Applications/Nix Apps/Vesktop.app" - - "/Applications/Nix Apps/UTM.app" - + "/Applications/Signal.app" + "/Applications/Nix Apps/Discord.app" "/System/Applications/Mail.app" - "/Applications/Nix Apps/Obsidian.app" - "/Applications/1Password.app" + { spacer.small = true; } + + "/Applications/Nix Apps/Obsidian.app" + "/Applications/Nix Apps/Anki.app" + "/Applications/Reeder.app" + { spacer.small = true; } - "/Applications/OBS.app" "/Applications/Nix Apps/Audacity.app" + "/Applications/Affinity.app" "/Applications/GIMP.app" "/Applications/Krita.app" - "/Applications/Blender.app" - "/Applications/OpenUTAU.app" +# "/Applications/Blender.app" +# "/Applications/OpenUTAU.app" + { spacer.small = true; } ]; # homebrew pkgs @@ -33,28 +36,27 @@ enable = true; onActivation.cleanup = "zap"; casks = [ - "firefox" + "zen" "ghostty" "krita" "blender" "obs" - "grayjay" "gimp" - "1password" + "signal" + "soulseek" + "musicbrainz-picard" + "affinity" "the-unarchiver" - "battery" "linearmouse" - "alt-tab" - "easy-move+resize" "lulu" - "rectangle" + ]; + brews = [ + "mas" ]; masApps = { "Infuse" = 1136220934; + "Reeder Classic" = 1529448980; }; }; - - # hotkey daemon - services.skhd.enable = true; } diff --git a/modules/applications/default.nix b/modules/applications/default.nix index 50fc18f..778eaf5 100644 --- a/modules/applications/default.nix +++ b/modules/applications/default.nix @@ -2,25 +2,31 @@ { environment.systemPackages = with pkgs; [ - spotify audacity obsidian ani-cli - vesktop - _1password-cli + (discord.override { + withVencord = true; + }) + yt-dlp ] ++ lib.optionals pkgs.stdenv.isLinux (with pkgs; [ mpv ghostty thunderbird krita - openutau obs-studio blender - gimp - _1password-gui + gimp3 + signal-desktop-bin + anki + newsflash + nicotine-plus + picard + whipper ]) ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ iina - utm raycast + anki-bin + keepassxc ]); } diff --git a/modules/applications/keepassxc.nix b/modules/applications/keepassxc.nix new file mode 100644 index 0000000..e5a7406 --- /dev/null +++ b/modules/applications/keepassxc.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + keepassxc + ]; + # browser extensions + programs.firefox.policies.ExtensionSettings."keepassxc-browser@keepassxc.org" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi"; + }; + + programs.chromium.extensions = [ + "oboonakemofpalcgghocfoadofidjkkk" # KeePassXC + ]; +} diff --git a/modules/browser/chromium.nix b/modules/browser/chromium.nix new file mode 100644 index 0000000..a18bef7 --- /dev/null +++ b/modules/browser/chromium.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = [ + pkgs.chromium # not enabled through programs.chromium.enable + ]; + + programs.chromium = { + enable = true; + enablePlasmaBrowserIntegration = if (config.services.desktopManager.plasma6.enable == true) then true else false; + + extensions = [ + "ddkjiahejlhfcafbddmgiahcphecmpfh" # ublock origin lite + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader + "mnjggcdmjocbbbhaepdhchncahnbgone" # sponsorblock + "fnaicdffflnofjppbagibeoednhnbjhg" # floccus bookmark sync + ]; + }; +} diff --git a/modules/browser/firefox.nix b/modules/browser/firefox.nix index 7b10ac0..83682fb 100644 --- a/modules/browser/firefox.nix +++ b/modules/browser/firefox.nix @@ -8,6 +8,18 @@ installation_mode = "force_installed"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; }; + "gdpr@cavi.au.dk" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/consent-o-matic/latest.xpi"; + }; + "{cb31ec5d-c49a-4e5a-b240-16c767444f62}" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/indie-wiki-buddy/latest.xpi"; + }; + "myallychou@gmail.com" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/youtube-recommended-videos/latest.xpi"; + }; "@testpilot-containers" = { installation_mode = "force_installed"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/multi-account-containers/latest.xpi"; @@ -20,13 +32,9 @@ installation_mode = "force_installed"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/temporarytabcontainer/latest.xpi"; }; - "keepassxc-browser@keepassxc.org" = { + "sponsorBlocker@ajay.app" = { installation_mode = "force_installed"; - install_url = "https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/latest.xpi"; - }; - "pywalfox@frewacom.org" = { - installation_mode = "force_installed"; - install_url = "https://addons.mozilla.org/firefox/downloads/latest/pywalfox/latest.xpi"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; }; }; @@ -124,15 +132,5 @@ // use same search engine (duckduckgo) for private browsing lockPref("browser.search.separatePrivateDefault", false); - - // stop extensions connecting to the internet - lockPref( - "extensions.webextensions.base-content-security-policy", - "default-src 'none'; script-src 'none'; object-src 'none';" - ); - lockPref( - "extensions.webextensions.base-content-security-policy.v3", - "default-src 'none'; script-src 'none'; object-src 'none';" - ); ''; } diff --git a/modules/desktop/de/aerospace.nix b/modules/desktop/de/aerospace.nix new file mode 100644 index 0000000..202f650 --- /dev/null +++ b/modules/desktop/de/aerospace.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + services.aerospace.enable = true; + services.aerospace.settings = ( builtins.fromTOML ( builtins.readFile ../../../stow/.config/aerospace/aerospace.toml )); + homebrew.brews = [ + "FelixKratz/formulae/borders" + ]; + + environment.systemPackages = with pkgs; [ + matugen + ]; +} diff --git a/modules/desktop/de/darwin.nix b/modules/desktop/de/darwin.nix index ca620c4..0c857e8 100644 --- a/modules/desktop/de/darwin.nix +++ b/modules/desktop/de/darwin.nix @@ -11,6 +11,9 @@ system.defaults.NSGlobalDomain.NSDisableAutomaticTermination = true; system.defaults.NSGlobalDomain.NSDocumentSaveNewDocumentsToCloud = false; + # enable ctrl+cmd to drag windows anywhere + system.defaults.NSGlobalDomain.NSWindowShouldDragOnGesture = true; + # hot corners system.defaults.dock = { wvous-bl-corner = 1; @@ -22,7 +25,6 @@ # login system.defaults.loginwindow.GuestEnabled = false; system.defaults.screensaver.askForPassword = true; - system.defaults.loginwindow.SHOWFULLNAME = true; # user needs to enter username and password to login # control center system.defaults.controlcenter = { diff --git a/modules/desktop/de/hyprland.nix b/modules/desktop/de/hyprland.nix index f07d294..241d33a 100644 --- a/modules/desktop/de/hyprland.nix +++ b/modules/desktop/de/hyprland.nix @@ -5,11 +5,8 @@ # Optional, hint electron apps to use wayland: environment.sessionVariables.NIXOS_OZONE_WL = "1"; - # have portals - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - programs.hyprlock.enable = true; + services.hypridle.enable = true; environment.systemPackages = with pkgs; [ ghostty @@ -21,32 +18,15 @@ wl-clipboard brightnessctl helvum - walker + vicinae playerctl swaynotificationcenter hyprshot matugen - pywalfox-native + glib hyprshade + hyprpolkitagent ]; programs.ssh.startAgent = true; - - # enable polkit - security.polkit.enable = true; - systemd = { - user.services.polkit-gnome-authentication-agent-1 = { - description = "polkit-gnome-authentication-agent-1"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; - }; - }; - }; } diff --git a/modules/desktop/de/kde.nix b/modules/desktop/de/kde.nix index 1cd9c0e..9ee60c6 100644 --- a/modules/desktop/de/kde.nix +++ b/modules/desktop/de/kde.nix @@ -4,26 +4,23 @@ services.desktopManager.plasma6.enable = true; environment.plasma6.excludePackages = with pkgs.kdePackages; [ - plasma-browser-integration konsole (lib.getBin qttools) # Expose qdbus in PATH - ark elisa - gwenview okular - kate khelpcenter - #dolphin baloo-widgets # baloo information in Dolphin dolphin-plugins - spectacle ffmpegthumbs krdp - gwenview - #xwaylandvideobridge + + # gwenview + # dolphin + # spectacle + # xwaylandvideobridge + # kate + # gwenview + # ark + # plasma-browser-integration ]; - - - - } diff --git a/modules/desktop/de/yabai.nix b/modules/desktop/de/yabai.nix new file mode 100644 index 0000000..fea6961 --- /dev/null +++ b/modules/desktop/de/yabai.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +{ + services.yabai = { + enable = true; + enableScriptingAddition = true; + extraConfig = builtins.readFile ../../../stow/.config/yabai/yabairc; + }; + + system.defaults.spaces.spans-displays = lib.mkForce false; + + environment.systemPackages = with pkgs; [ + skhd + matugen + ]; + + homebrew.brews = [ + "FelixKratz/formulae/borders" + ]; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 002678f..d9b755d 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -5,8 +5,14 @@ ./pipewire.nix ./flatpak.nix ./fonts.nix + ./printing.nix ]; # Enable font dir for compatability fonts.fontDir.enable = true; + + # enable desktop portals + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + } diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index 47769b1..dc43db4 100644 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -8,6 +8,8 @@ noto-fonts-cjk-sans # gets japanese and chinese langs nerd-fonts.comic-shanns-mono # programming fonts corefonts # basic web fonts + + comic-neue ]; }; } diff --git a/modules/desktop/japanese-input.nix b/modules/desktop/japanese-input.nix new file mode 100644 index 0000000..d94ce63 --- /dev/null +++ b/modules/desktop/japanese-input.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5.waylandFrontend = true; + fcitx5.addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + ]; + }; + + i18n.inputMethod.fcitx5.settings.inputMethod = { + GroupOrder."0" = "Default"; + "Groups/0" = { + Name = "Default"; + "Default Layout" = "au"; + DefaultIM = "mozc"; + }; + "Groups/0/Items/0".Name = "keyboard-au"; + "Groups/0/Items/1".Name = "mozc"; + }; +} diff --git a/modules/desktop/login/autologin.nix b/modules/desktop/login/autologin.nix index 0c1fa4d..5333372 100644 --- a/modules/desktop/login/autologin.nix +++ b/modules/desktop/login/autologin.nix @@ -6,11 +6,11 @@ enable = true; settings = { initial_session = { - command = if (config.programs.niri.enable == true) then "${pkgs.niri}/bin/niri-session" else if (config.programs.hyprland.enable == true) then "${pkgs.hyprland}/bin/Hyprland" else "${pkgs.zsh}/bin/zsh"; + command = if (config.programs.niri.enable == true) then "${pkgs.niri}/bin/niri-session" else if (config.programs.hyprland.enable == true) then "${pkgs.hyprland}/bin/start-hyprland" else "${pkgs.zsh}/bin/zsh"; user = "nico"; }; default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --asterisks --time --greeting 'nyaaa~~'"; + command = "${lib.getExe pkgs.tuigreet} --asterisks --time --greeting 'nyaaa~~'"; }; }; }; diff --git a/modules/desktop/login/plymouth.nix b/modules/desktop/login/plymouth.nix new file mode 100644 index 0000000..6deb5f0 --- /dev/null +++ b/modules/desktop/login/plymouth.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: { + boot = { + plymouth = { + enable = true; + theme = "bgrt"; + }; + + # Enable "Silent boot" + consoleLogLevel = 3; + initrd.verbose = false; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + ]; + }; +} + diff --git a/modules/desktop/login/sddm.nix b/modules/desktop/login/sddm.nix new file mode 100644 index 0000000..9d7fca0 --- /dev/null +++ b/modules/desktop/login/sddm.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; +} diff --git a/modules/desktop/polkit-gtk.nix b/modules/desktop/polkit-gtk.nix new file mode 100644 index 0000000..c8f26ac --- /dev/null +++ b/modules/desktop/polkit-gtk.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + # enable polkit + security.polkit.enable = true; + systemd = { + user.services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; +} diff --git a/modules/desktop/printing.nix b/modules/desktop/printing.nix new file mode 100644 index 0000000..492cd91 --- /dev/null +++ b/modules/desktop/printing.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + imports = [ + ../network/avahi.nix + ]; + + services.printing.enable = true; + services.avahi.openFirewall = true; +} diff --git a/modules/desktop/programs/sketchybar.nix b/modules/desktop/programs/sketchybar.nix index f23e6a8..116fb65 100644 --- a/modules/desktop/programs/sketchybar.nix +++ b/modules/desktop/programs/sketchybar.nix @@ -1,7 +1,9 @@ { config, lib, pkgs, ... }: { - services.skhd.enable = true; - services.sketchybar.enable = true; system.defaults.NSGlobalDomain._HIHideMenuBar = true; + + homebrew.brews = [ + "FelixKratz/formulae/sketchybar" + ]; } diff --git a/modules/games/darwin.nix b/modules/games/darwin.nix index fd50a97..b287b7a 100644 --- a/modules/games/darwin.nix +++ b/modules/games/darwin.nix @@ -4,16 +4,14 @@ imports = [ ./default.nix ]; homebrew.casks = [ - "whisky" "steam" - "heroic" + "roblox" ]; system.defaults.dock.persistent-apps = [ "/Applications/Steam.app" - "/Applications/Heroic.app" - "/Applications/Whisky.app" "${pkgs.prismlauncher}/Applications/PrismLauncher.app" "${pkgs.osu-lazer-bin}/Applications/osu!.app" + { spacer.small = true; } ]; } diff --git a/modules/games/server/minecraft/building.nix b/modules/games/server/minecraft/building.nix index db7f6a8..3f8a6bd 100644 --- a/modules/games/server/minecraft/building.nix +++ b/modules/games/server/minecraft/building.nix @@ -3,9 +3,9 @@ { services.minecraft-servers.servers.building = { enable = true; - package = pkgs.paperServers.paper-1_21_5; + package = pkgs.paperServers.paper-1_21_11; autoStart = true; - jvmOpts = "-Xms4096M -Xmx4096M"; + jvmOpts = "-Xms1024M -Xmx4096M"; serverProperties = { server-port = 30002; @@ -16,8 +16,8 @@ }; symlinks = { - "plugins/Worldedit.jar" = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/1u6JkXh5/versions/NhJaettg/worldedit-bukkit-7.3.12-beta-01.jar"; sha256 = "sha256-NP5ALYQe6DVVAeTeDGxySKZ8sjQnLjQc8PTbDS+Lbd4="; }; - "plugins/EssentialsX.jar" = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/hXiIvTyT/versions/SKQwLLoQ/EssentialsX-2.21.0.jar"; sha256 = "sha256-VwQyKlSDa5hLEQ9+Igi67RiGwu/tREa0l+Z+US/skMU="; }; + "plugins/Worldedit.jar" = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/1u6JkXh5/versions/qYMNQYjH/worldedit-bukkit-7.3.18-beta-01.jar"; sha256 = "sha256-/TRUrwHhjnyBuCVyS34IWzvILz79RhZjS6k2DLwkUk0="; }; + "plugins/EssentialsX.jar" = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/hXiIvTyT/versions/Oa9ZDzZq/EssentialsX-2.21.2.jar"; sha256 = "sha256-C3WQJvAvPFR8MohvNmbbPB+Uz/c+FBrlZIMT/Q0L38Y="; }; }; }; diff --git a/modules/games/server/minecraft/fabric-modless.nix b/modules/games/server/minecraft/fabric-modless.nix index 1c32ebd..e1e2269 100644 --- a/modules/games/server/minecraft/fabric-modless.nix +++ b/modules/games/server/minecraft/fabric-modless.nix @@ -3,9 +3,9 @@ { services.minecraft-servers.servers.fabric-modless = { enable = true; - package = pkgs.fabricServers.fabric-1_21_5; + package = pkgs.fabricServers.fabric-1_21_11; autoStart = true; - jvmOpts = "-Xms4096M -Xmx4096M"; + jvmOpts = "-Xms1024M -Xmx4096M"; serverProperties = { server-port = 30001; @@ -15,11 +15,11 @@ symlinks = { mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues { - FabricAPI = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/FZ4q3wQK/fabric-api-0.119.9%2B1.21.5.jar"; sha512 = "4eec629514cba71e4792c1ebf357e574713e5fdb3c01c6e7d132ed631bdeaab0b38bcab84d4ade14c6966c24f9938026da2e65c25b58cde4ce9710c49d147e87"; }; - Chunky = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/fALzjamp/versions/mhLtMoLk/Chunky-Fabric-1.4.36.jar"; sha512 = "65a201c246c95f6189a16e715d944e4a7ca7f44a8c4a39c8e6523d8c58e331d6611c78deff050cb4a2a2d80c5b8d84e3593a9b8ff961f7aee3d171a4ef7af2c7"; }; - Ferritecore = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/uXXizFIs/versions/CtMpt7Jr/ferritecore-8.0.0-fabric.jar"; sha512 = "131b82d1d366f0966435bfcb38c362d604d68ecf30c106d31a6261bfc868ca3a82425bb3faebaa2e5ea17d8eed5c92843810eb2df4790f2f8b1e6c1bdc9b7745"; }; - NoChatReports = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/qQyHxfxd/versions/CHlHxkvf/NoChatReports-FABRIC-1.21.5-v2.12.0.jar"; sha512 = "c0825db25672cf8b50face51ec8a6bedb4be50b374a2537640a433c98817bc07c177485e93ab8cee9e3f7bfb1d2eb1460309e818b411764c92426b552487a9f7"; }; - FabricProxyLite = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/8dI2tmqs/versions/AQhF7kvw/FabricProxy-Lite-2.9.0.jar"; sha512 = "3044f36df7e83021210a7c318def18a95b5dbf5e3230bb72a3ddb42ebdda33f248c6d12efcee1240ff0c54600d68d147afa105d04ee37a90acb9409619c89848"; }; + FabricAPI = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/KhCFoeip/fabric-api-0.139.5%2B1.21.11.jar"; sha512 = "hSyedhdbLVHOoZG/zAAFuCTeQz8abeAdZyuegsocq4R4sYBnC8bEgRdE70q+yL0v86sPnBqlZEcT0G8/vMJ48A=="; }; + Chunky = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/fALzjamp/versions/bk9YUabA/Chunky-Fabric-1.4.54.jar"; sha512 = "vxX9sMDiBMKUdmxrkvDcidlulM5PcLmKxC6qRrh4Aq9Wz+tlSHePSUWx/cL+VholR39xGTfb85DiC5TBvQBsrg=="; }; + Ferritecore = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/uXXizFIs/versions/eRLwt73x/ferritecore-8.0.3-fabric.jar"; sha512 = "vmAFQ+SZtZKG+UCfRkl1cK3FGTmuY+qhKsKeZ3jaJ9jHxs0LM0DYvMocyZzmF3mxqPUrmQ+eTpqTqpxkgpBSMQ=="; }; + NoChatReports = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/qQyHxfxd/versions/78RjC1gi/NoChatReports-FABRIC-1.21.10-v2.16.0.jar"; sha512 = "ObLyhPc/gpABK4ucxwCF1ZZoVH/HtOxDqzTkvKazmmaR++MrwzJuQDU7qcFqBjIOUoGDFb53eZparVJjcMvHcw=="; }; + FabricProxyLite = pkgs.fetchurl { url = "https://cdn.modrinth.com/data/8dI2tmqs/versions/nR8AIdvx/FabricProxy-Lite-2.11.0.jar"; sha512 = "wuHZJ59vGaVh+TS4RlQLKKAzWGtLQZucGqJ6xD/8j60s5g4hKhVAbl+jkH/17L5a96XtsYOp7mc3pB5GSuwTdQ=="; }; }); }; }; @@ -27,11 +27,6 @@ services.minecraft-servers.servers.velocity.symlinks."velocity.toml".value = { servers = { fabric-modless = "127.0.0.1:30001"; - - # In what order we should try servers when a player logs in or is kicked from a server. - try = [ - "fabric-modless" - ]; }; }; } diff --git a/modules/games/server/minecraft/forge-1.19.2.nix b/modules/games/server/minecraft/forge-1.19.2.nix index 0c7f0d9..11d1e63 100644 --- a/modules/games/server/minecraft/forge-1.19.2.nix +++ b/modules/games/server/minecraft/forge-1.19.2.nix @@ -22,11 +22,6 @@ services.minecraft-servers.servers.velocity.symlinks."velocity.toml".value = { servers = { forge-1-19-2 = "127.0.0.1:30004"; - - # In what order we should try servers when a player logs in or is kicked from a server. - try = [ - "forge-1-19-2" - ]; }; }; } diff --git a/modules/games/server/minecraft/neoforge-1.21.1.nix b/modules/games/server/minecraft/neoforge-1.21.1.nix index 98297c6..e40527d 100644 --- a/modules/games/server/minecraft/neoforge-1.21.1.nix +++ b/modules/games/server/minecraft/neoforge-1.21.1.nix @@ -10,7 +10,8 @@ TYPE = "NEOFORGE"; VERSION = "1.21.1"; EULA = "TRUE"; - MEMORY = "4G"; + INIT_MEMORY = "1G"; + MAX_MEMORY = "6G"; SERVER_PORT = "30005"; UID = "992"; @@ -21,11 +22,6 @@ services.minecraft-servers.servers.velocity.symlinks."velocity.toml".value = { servers = { neoforge-1-21-1 = "127.0.0.1:30005"; - - # In what order we should try servers when a player logs in or is kicked from a server. - try = [ - "neoforge-1-21-1" - ]; }; }; } diff --git a/modules/games/server/minecraft/velocity.nix b/modules/games/server/minecraft/velocity.nix index 29a2494..b4b2447 100644 --- a/modules/games/server/minecraft/velocity.nix +++ b/modules/games/server/minecraft/velocity.nix @@ -6,10 +6,10 @@ package = pkgs.velocityServers.velocity; autoStart = true; openFirewall = true; - jvmOpts = "-Xms256M -Xmx1024M"; + jvmOpts = "-Xms128M -Xmx1024M"; symlinks = { - "plugins/Luckperms.jar" = pkgs.fetchurl { url = "https://download.luckperms.net/1575/velocity/LuckPerms-Velocity-5.4.158.jar"; sha512 = "07b649db2d2c9f16791d706621dcb606d05bbc1125fa65765e7d4cf4b45778a84f65ca4ad8e461ff146646805072852322cfbd91d66699af5e895d00b233648f"; }; - "plugins/Velocitab.jar" = pkgs.fetchurl { url = "https://hangarcdn.papermc.io/plugins/William278/Velocitab/versions/1.7.5/VELOCITY/Velocitab-1.7.5.jar"; sha512 = "ExyxRVbkzgVRTOZC9yRrwJbNpRnD1aFZa/QlMmBHAjLMXYmM/Q7lRMGtQs3dyrjBI06Z9e01ZaOmTTa2RbtNew=="; }; + "plugins/Luckperms.jar" = pkgs.fetchurl { url = "https://download.luckperms.net/1610/velocity/LuckPerms-Velocity-5.5.21.jar"; sha512 = "xAUogBzYUF71CuutcUPM1QJLVel/6Ihzui1Ksbdrd5qeGDqecULdHJtMNsLCM6XQJndGgBTrGv4xljLzVQsx7A=="; }; + "plugins/Velocitab.jar" = pkgs.fetchurl { url = "https://hangarcdn.papermc.io/plugins/William278/Velocitab/versions/1.7.9/VELOCITY/Velocitab-1.7.9.jar"; sha512 = "2okGzE0QJz8RTOmVCZHBizokEuTwVvKRPwr6JhJUg5kpsWWhkF+k+XCMzI5aMwSbDy7+2W3NE1qvbfFZHAKdsw=="; }; "plugins/Message.jar" = pkgs.fetchurl { url = "https://hangarcdn.papermc.io/plugins/OskarsMC-Plugins/message/versions/1.4.0/VELOCITY/message-1.4.0-all.jar"; sha512 = "62503339714d7d26d71a98b2036cd04e91c9049567a033441d904a5f3190177bdc41dcd5183e6c51eb083a143edbfaf50642d44c99c1b83e7a3546a3654305c8"; }; "plugins/Send.jar" = pkgs.fetchurl { url = "https://github.com/OskarsMC-Plugins/send/releases/download/3.0.0/send-3.0.0.jar"; sha512 = "aff03bb13804cd01ecd649d283bfdb0b3411cb4df045670328a43f53a05f7386a76a536c4fcbbd3cdc718aa300f2ab2940c7437a181e31fa9f1c9c0e591896ab"; }; @@ -21,7 +21,7 @@ config-version = "2.7"; bind = "0.0.0.0:25565"; - motd = "<#09add3>A Velocity Server"; + motd = "A velocity server.\nhosted on ${config.networking.hostName}."; show-max-players = 500; # displayed maximum players, not an actual cap online-mode = true; force-key-authentication = true; @@ -42,6 +42,7 @@ headers = [ "" ]; footers = [ "connected to %server%" ]; format = "%prefix%%username% %server%"; + send_scoreboard_packets = true; nametag.prefix = "%prefix%"; nametag.suffix = ""; sorting_placeholders = [ @@ -63,7 +64,7 @@ messages = { message-sent = " "; - message-received = " "; + message-received = " "; message-socialspy = "✉ spy "; }; diff --git a/modules/hardware/bootloader/limine.nix b/modules/hardware/bootloader/limine.nix new file mode 100644 index 0000000..1bf78ee --- /dev/null +++ b/modules/hardware/bootloader/limine.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + boot.loader.limine = { + enable = true; + validateChecksums = true; + panicOnChecksumMismatch = true; + enableEditor = false; + + + extraEntries = +'' +/memtest86 + protocol: chainload + path: boot():///efi/memtest86/memtest86.efi +''; + additionalFiles = { + "efi/memtest86/memtest86.efi" = "${pkgs.memtest86-efi}/BOOTX64.efi"; + }; + + secureBoot.enable = true; + }; +} diff --git a/modules/hardware/bootloader/systemd-boot.nix b/modules/hardware/bootloader/systemd-boot.nix new file mode 100644 index 0000000..5648970 --- /dev/null +++ b/modules/hardware/bootloader/systemd-boot.nix @@ -0,0 +1,9 @@ +{ config, ... }: + +{ + boot.loader.systemd-boot = { + enable = true; + }; + + boot.loader.timeout = 0; +} diff --git a/modules/hardware/darwin.nix b/modules/hardware/darwin.nix index b818cbd..d507d16 100644 --- a/modules/hardware/darwin.nix +++ b/modules/hardware/darwin.nix @@ -14,10 +14,6 @@ "Ethernet Adaptor" "Thunderbolt Ethernet" ]; - - dns = [ - "1.1.1.1" - ]; }; # keyboard diff --git a/modules/hardware/restic.nix b/modules/hardware/restic.nix new file mode 100644 index 0000000..303fa55 --- /dev/null +++ b/modules/hardware/restic.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, ... }: + +{ + services.restic.backups."${config.networking.hostName}-server" = { + initialize = false; + + paths = [ + "/media" + ]; + + exclude = [ + "/media/secrets" + "/media/torrents" + "/media/media" + + ".cache*" + ".DS_Store" + "logs" + ]; + + checkOpts = [ + "--with-cache" # just to make checks faster + ]; + + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 5" + "--keep-monthly 12" + "--keep-yearly 10" + ]; + + timerConfig = { + OnBootSec = "5m"; # lets wifi connect before starting backups + OnCalendar = "daily"; + Persistent = true; + }; + + # backup postgres databases, kind of hacky but + # i think its the only way to do it without needing + # another backup repo + backupPrepareCommand = '' + rm -f /media/apps/postgres # -f doesn't error if doesn't exist + touch /media/apps/postgres + chmod 600 /media/apps/postgres + ${lib.getExe pkgs.sudo} -u postgres ${config.services.postgresql.package}/bin/pg_dumpall > /media/apps/postgres + ''; + + backupCleanupCommand = '' + rm /media/apps/postgres + ''; + + # https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#other-services-via-rclone + # put something like : "rclone:onedrive:restic" to use as the remote + # + # sudo nix run nixpkgs#rclone -- config + repositoryFile = "/media/secrets/restic-repo"; + + # the passphrase used + passwordFile = "/media/secrets/restic-password"; + }; + + systemd.tmpfiles.rules = [ + "f /media/secrets/restic-repo 0400 root root" + "f /media/secrets/restic-password 0400 root root" + ]; +} diff --git a/modules/network/avahi.nix b/modules/network/avahi.nix index b8db5d4..0beaa0b 100644 --- a/modules/network/avahi.nix +++ b/modules/network/avahi.nix @@ -3,6 +3,7 @@ { services.avahi = { enable = true; - nssmdns = true; + nssmdns4 = true; + nssmdns6 = true; }; } diff --git a/modules/network/ddclient.nix b/modules/network/ddclient.nix new file mode 100644 index 0000000..4044e0a --- /dev/null +++ b/modules/network/ddclient.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + services.ddclient = { + enable = true; + configFile = "/root/nixos/secrets/ddclient.conf"; + }; +} diff --git a/modules/network/firewall/opensnitch.nix b/modules/network/firewall/opensnitch.nix index 31e09e9..16cd950 100644 --- a/modules/network/firewall/opensnitch.nix +++ b/modules/network/firewall/opensnitch.nix @@ -10,6 +10,8 @@ }; rules = { + # + # system services "systemd-timesyncd" = { "name" = "systemd-timesyncd"; "enabled" = true; @@ -18,8 +20,8 @@ "operator" = { "type" = "simple"; "sensitive" = false; - "operand" = "process.path"; - "data" = "${pkgs.systemd}/lib/systemd/systemd-timesyncd"; + "operand" = "lists.domains"; + "data" = builtins.toFile "systemd-timesyncd-opensnitch-rules" (lib.strings.concatStringsSep "\n" config.networking.timeServers); }; }; "nsncd" = { @@ -34,6 +36,157 @@ "data" = "${pkgs.nsncd}/bin/nsncd"; }; }; + "tailscale" = { + "name" = "tailscale"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.tailscale}/bin/.tailscaled-wrapped"; + }; + }; + "avahi-daemon" = { + "name" = "avahi-daemon"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.avahi}/bin/avahi-daemon"; + }; + }; + + # + # services + "prowlarr" = { + "name" = "prowlarr"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "type" = "list"; + "operand" = "list"; + "list" = [ + { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.prowlarr}/lib/prowlarr/Prowlarr"; + } + { + "operand" = "user.name"; + "type" = "simple"; + "sensitive" = false; + "data" = "prowlarr"; + } + ]; + }; + }; + "sonarr" = { + "name" = "sonarr"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "type" = "list"; + "operand" = "list"; + "list" = [ + { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.sonarr}/lib/sonarr/Sonarr"; + } + { + "operand" = "user.name"; + "type" = "simple"; + "sensitive" = false; + "data" = "${config.services.sonarr.user}"; + } + ]; + }; + }; + "radarr" = { + "name" = "radarr"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "type" = "list"; + "operand" = "list"; + "list" = [ + { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.radarr}/lib/radarr/Radarr"; + } + { + "operand" = "user.name"; + "type" = "simple"; + "sensitive" = false; + "data" = "${config.services.radarr.user}"; + } + ]; + }; + }; + "forgejo" = { + "name" = "forgejo"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "type" = "list"; + "operand" = "list"; + "list" = [ + { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.forgejo-lts}/bin/.forgejo-wrapped"; + } + { + "operand" = "user.name"; + "type" = "simple"; + "sensitive" = false; + "data" = "${config.services.forgejo.user}"; + } + ]; + }; + }; + "caddy" = { + "name" = "caddy"; + "enabled" = true; + "action" = "allow"; + "duration" = "always"; + "operator" = { + "type" = "list"; + "operand" = "list"; + "list" = [ + { + "operand" = "process.path"; + "type" = "simple"; + "sensitive" = false; + "data" = "${pkgs.caddy}/bin/caddy"; + } + { + "operand" = "user.name"; + "type" = "simple"; + "sensitive" = false; + "data" = "${config.services.caddy.user}"; + } + ]; + }; + }; + + + # + # desktop applications "firefox" = { "name" = "firefox"; "enabled" = true; diff --git a/modules/network/vpn/tailscale-darwin.nix b/modules/network/vpn/tailscale-darwin.nix index ff37699..9bb2d8f 100644 --- a/modules/network/vpn/tailscale-darwin.nix +++ b/modules/network/vpn/tailscale-darwin.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - homebrew.casks = [ - "tailscale" - ]; + homebrew.masApps = { + "Tailscale" = 1475387142; + }; } diff --git a/modules/network/vpn/tailscale.nix b/modules/network/vpn/tailscale.nix index 578e7ab..90100be 100644 --- a/modules/network/vpn/tailscale.nix +++ b/modules/network/vpn/tailscale.nix @@ -2,4 +2,8 @@ { services.tailscale.enable = true; + services.tailscale.extraSetFlags = [ + "--advertise-exit-node" + ]; + services.tailscale.useRoutingFeatures = "server"; } diff --git a/modules/services/archiveteam-warrior.nix b/modules/services/archiveteam-warrior.nix new file mode 100644 index 0000000..a8a858d --- /dev/null +++ b/modules/services/archiveteam-warrior.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + virtualisation.oci-containers.backend = "podman"; + virtualisation.oci-containers.containers.archiveteam-warrior = { + image = "atdr.meo.ws/archiveteam/warrior-dockerfile"; + ports = [ "8001:8001" ]; + environment = { + "CONCURRENT_ITEMS" = "5"; + "DOWNLOADER" = "astolfo"; + "SELECTED_PROJECT" = "auto"; + }; + }; +} diff --git a/modules/services/auth/kanidm.nix b/modules/services/auth/kanidm.nix index f19285c..7286e9a 100644 --- a/modules/services/auth/kanidm.nix +++ b/modules/services/auth/kanidm.nix @@ -2,11 +2,11 @@ { services.kanidm = { - enableServer = true; - enablePam = false; - package = pkgs.kanidm_1_5; + server.enable = true; + unix.enable = false; + package = pkgs.kanidm_1_9; - serverSettings = { + server.settings = { bindaddress = "127.0.0.1:8443"; ldapbindaddress = "0.0.0.0:636"; domain = "${config.homelab.authDomain}"; @@ -14,6 +14,12 @@ tls_chain = "${config.security.acme.certs.${config.homelab.authDomain}.directory}/cert.pem"; tls_key = "${config.security.acme.certs.${config.homelab.authDomain}.directory}/key.pem"; + + online_backup = { + schedule = "00 22 * * *"; + path = "/media/apps/kanidm"; + versions = 14; + }; }; }; @@ -24,11 +30,10 @@ dnsProvider = "cloudflare"; dnsResolver = "1.1.1.1:53"; dnsPropagationCheck = true; - environmentFile = /var/lib/caddy/secret; }; services.caddy.virtualHosts."${config.homelab.authDomain}" = { - useACMEHost = config.services.kanidm.serverSettings.domain; + useACMEHost = config.services.kanidm.server.settings.domain; extraConfig = '' reverse_proxy https://localhost:8443 { header_up Host "${config.homelab.authDomain}:8443" diff --git a/modules/services/auth/tinyauth.nix b/modules/services/auth/tinyauth.nix new file mode 100644 index 0000000..3bab219 --- /dev/null +++ b/modules/services/auth/tinyauth.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: + +{ + virtualisation.oci-containers.backend = "podman"; + virtualisation.oci-containers.containers.tinyauth = { + image = "ghcr.io/steveiliop56/tinyauth:v4"; + ports = [ + "3009:3000" + ]; + environment = { + "APP_URL" = "https://tinyauth.${config.homelab.domain}"; + + "PROVIDERS_KANIDM_CLIENT_ID" = "tinyauth"; + "PROVIDERS_KANIDM_AUTH_URL" = "https://${config.homelab.authDomain}/ui/oauth2"; + "PROVIDERS_KANIDM_TOKEN_URL" = "https://${config.homelab.authDomain}/oauth2/token"; + "PROVIDERS_KANIDM_USER_INFO_URL" = "https://${config.homelab.authDomain}/oauth2/openid/tinyauth/userinfo"; + "PROVIDERS_KANIDM_REDIRECT_URL" = "https://tinyauth.${config.homelab.domain}/api/oauth/callback/kanidm"; + "PROVIDERS_KANIDM_SCOPES" = "openid email profile groups"; + "PROVIDERS_KANIDM_NAME" = "${config.homelab.authDomain}"; + }; + + environmentFiles = [ + # set variable PROVIDERS_KANIDM_CLIENT_SECRET here + /media/secrets/tinyauth + ]; + }; + + systemd.tmpfiles.rules = [ + "f /media/secrets/tinyauth 0400 root root" + ]; + + services.caddy.extraConfig = '' + (tinyauth_forwarder) { + forward_auth 127.0.0.1:3009 { + uri /api/auth/caddy + } + } + ''; + + + services.caddy.virtualHosts."tinyauth.${config.homelab.domain}" = { + useACMEHost = config.homelab.domain; + extraConfig = '' + reverse_proxy http://localhost:3009 + ''; + }; +} diff --git a/modules/services/caddy.nix b/modules/services/caddy.nix index 0093a13..2339ef7 100644 --- a/modules/services/caddy.nix +++ b/modules/services/caddy.nix @@ -22,11 +22,19 @@ services.caddy = { enable = true; + extraConfig = '' + (block_non_private_ips) { + @non_private_ips not remote_ip 100.64.0.0/10 fd7a:115c:a1e0::/48 private_ranges + abort @non_private_ips + } + ''; }; security.acme = { acceptTerms = true; defaults.email = "hello@astolfo.org"; + defaults.environmentFile = /media/secrets/acme; + defaults.profile = "shortlived"; certs."${config.homelab.domain}" = { group = config.services.caddy.group; @@ -36,8 +44,11 @@ dnsProvider = "cloudflare"; dnsResolver = "1.1.1.1:53"; dnsPropagationCheck = true; - environmentFile = /var/lib/caddy/secret; }; }; + + systemd.tmpfiles.rules = [ + "f /media/secrets/acme 0400 acme acme" + ]; }; } diff --git a/modules/services/adguardhome.nix b/modules/services/dns/adguardhome.nix similarity index 88% rename from modules/services/adguardhome.nix rename to modules/services/dns/adguardhome.nix index 728728f..70a3bec 100644 --- a/modules/services/adguardhome.nix +++ b/modules/services/dns/adguardhome.nix @@ -3,7 +3,7 @@ { services.adguardhome = { enable = true; - mutableSettings = true; + mutableSettings = false; extraArgs = [ "--web-addr" "0.0.0.0:3003" ]; settings = { @@ -27,6 +27,17 @@ filtering = { protection_enabled = true; filtering_enabled = true; + + rewrites = [ + { + domain = "nijika.astolfo.org"; + answer = "100.105.94.30"; + } + { + domain = "*.nijika.astolfo.org"; + answer = "100.105.94.30"; + } + ]; }; # The following notation uses map diff --git a/modules/services/dns/coredns.nix b/modules/services/dns/coredns.nix new file mode 100644 index 0000000..7382617 --- /dev/null +++ b/modules/services/dns/coredns.nix @@ -0,0 +1,25 @@ +{ config, ... }: + +{ + services.coredns = { + enable = true; + config = '' + .:53 { + hosts { + 100.100.144.4 seika.astolfo.org + fallthrough + } + + # rewrite the CNAME to itself so hosts rule apply + rewrite cname exact seika.astolfo.org. seika.astolfo.org. + + forward . 1.1.1.1 + log + errors + } + ''; + }; + + networking.firewall.allowedTCPPorts = [ 53 ]; + networking.firewall.allowedUDPPorts = [ 53 ]; +} diff --git a/modules/services/dns/ddns-updater.nix b/modules/services/dns/ddns-updater.nix new file mode 100644 index 0000000..e382564 --- /dev/null +++ b/modules/services/dns/ddns-updater.nix @@ -0,0 +1,16 @@ +{ config, ... }: + +{ + services.ddns-updater = { + enable = true; + environment = { + SERVER_ENABLED="no"; + + # setup dynamic dns provider here + # https://wiki.nixos.org/wiki/Dynamic_DNS + # https://github.com/qdm12/ddns-updater/blob/master/docs/cloudflare.md + CONFIG_FILEPATH = "/media/secrets/ddns-updater.json"; + PERIOD = "5m"; + }; + }; +} diff --git a/modules/services/forgejo.nix b/modules/services/forgejo.nix index e8b7e4d..a1c2a24 100644 --- a/modules/services/forgejo.nix +++ b/modules/services/forgejo.nix @@ -3,22 +3,20 @@ { services.forgejo = { enable = true; - stateDir = "/var/lib/forgejo"; - repositoryRoot = "${config.services.forgejo.stateDir}/repositories"; + stateDir = "/media/apps/git"; + repositoryRoot = "${config.services.forgejo.stateDir}/repos"; database.createDatabase = true; settings = { session.COOKIE_SECURE = true; server = { - DOMAIN = "git.${config.homelab.domain}"; + DOMAIN = "git.${config.homelab.publicDomain}"; ROOT_URL = "https://${config.services.forgejo.settings.server.DOMAIN}"; SSH_PORT = 22; # PROTOCOL = "https"; HTTP_PORT = 3000; }; - security.REVERSE_PROXY_TRUSTED_PROXIES = "127.0.0.0/8,::1/128"; - service = { ALLOW_ONLY_EXTERNAL_REGISTRATION = true; SHOW_REGISTRATION_BUTTON = false; @@ -27,15 +25,11 @@ }; }; - # configure anubis to prevent AI scrapers from overloading the git server. - services.anubis.instances.forgejo = { - enable = true; - settings = { - TARGET = "http://127.0.0.1:${toString config.services.forgejo.settings.server.HTTP_PORT}"; - SERVE_ROBOTS_TXT = true; - BIND_NETWORK = "tcp"; - BIND = ":3333"; - }; + security.acme.certs."${config.services.forgejo.settings.server.DOMAIN}" = { + domain = "${config.services.forgejo.settings.server.DOMAIN}"; + dnsProvider = "cloudflare"; + dnsResolver = "1.1.1.1:53"; + dnsPropagationCheck = true; }; # forgejo has user keys under its own .ssh/authorizedKeys file. @@ -43,13 +37,10 @@ # in order to only allow that to the forgejo user as it has "/var" services.openssh.authorizedKeysInHomedir = lib.mkForce true; - services.caddy.virtualHosts."git.${config.homelab.domain}" = { - useACMEHost = config.homelab.domain; + services.caddy.virtualHosts."${config.services.forgejo.settings.server.DOMAIN}" = { + useACMEHost = config.services.forgejo.settings.server.DOMAIN; extraConfig = '' - reverse_proxy http://127.0.0.1${toString config.services.anubis.instances.forgejo.settings.BIND} { - header_up X-Real-Ip {remote_host} - header_up X-Http-Version {http.request.proto} - } + reverse_proxy http://localhost:${toString config.services.forgejo.settings.server.HTTP_PORT} ''; }; } diff --git a/modules/services/glance.nix b/modules/services/glance.nix index e38c31b..c642c07 100644 --- a/modules/services/glance.nix +++ b/modules/services/glance.nix @@ -107,6 +107,7 @@ useACMEHost = config.homelab.domain; extraConfig = '' reverse_proxy http://localhost:8888 + import block_non_private_ips ''; }; } diff --git a/modules/services/karakeep.nix b/modules/services/karakeep.nix index aefd116..ec87014 100644 --- a/modules/services/karakeep.nix +++ b/modules/services/karakeep.nix @@ -1,35 +1,38 @@ { config, ... }: { - virtualisation.oci-containers.containers.karakeep = { - image = "ghcr.io/karakeep-app/karakeep:release"; - volumes = [ "/var/lib/karakeep/data:/data" ]; - ports = [ "8023:3000" ]; - environment = { - DATA_DIR = "/data"; # dont change + services.karakeep = { + enable = true; + extraEnvironment = { + PORT = "8023"; - OAUTH_WELLKNOWN_URL = "https://auth.${config.homelab.domain}/.well-known/openid-configuration"; - OAUTH_PROVIDER_NAME = "PocketID"; + OAUTH_WELLKNOWN_URL = "https://${config.homelab.authDomain}/oauth2/openid/karakeep/.well-known/openid-configuration"; + OAUTH_PROVIDER_NAME = "${config.homelab.domain}"; NEXTAUTH_URL = "https://karakeep.${config.homelab.domain}"; DISABLE_PASSWORD_AUTH = "true"; OAUTH_ALLOW_DANGEROUS_EMAIL_ACCOUNT_LINKING = "true"; }; - environmentFiles = [ - # put the environment variable NEXTAUTH_SECRET in here - # with a randomly generated string. gen with `openssl rand -base64 36` - /var/lib/karakeep/nextauth-secret - - # https://pocket-id.org/docs/client-examples/hoarder - /var/lib/karakeep/oidc - ]; + # put OAUTH_CLIENT_SECRET and OAUTH_CLIENT_ID in file + # https://docs.karakeep.app/configuration/environment-variables#authentication--signup + environmentFile = "/media/secrets/karakeep"; }; + + systemd.tmpfiles.rules = [ + "f /media/secrets/karakeep 0400 karakeep karakeep" + ]; + fileSystems."/var/lib/karakeep" = { + device = "/media/apps/karakeep"; + options = [ "bind" ]; + }; + services.caddy.virtualHosts."karakeep.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' reverse_proxy http://localhost:8023 + import block_non_private_ips ''; }; } diff --git a/modules/services/linkding.nix b/modules/services/linkding.nix new file mode 100644 index 0000000..7659543 --- /dev/null +++ b/modules/services/linkding.nix @@ -0,0 +1,61 @@ +{ config, ... }: + +{ + virtualisation.oci-containers.containers.linkding = { + image = "sissbruecker/linkding:latest"; + ports = [ "9090:9090" ]; + volumes = [ "/var/lib/linkding/data:/data" ]; + environmentFiles = [ + # create superuser account before initially signing in + # https://linkding.link/options/#oidc-and-ld_superuser_name + # include following environment variables: + # OIDC_RP_CLIENT_SECRET - set to oidc client secret + /var/lib/linkding/oidc + + ]; + environment = { + # Can be used to run linkding under a context path, for example: linkding/ + # Must end with a slash `/` + "LD_CONTEXT_PATH"=""; + # Username of the initial superuser to create, leave empty to not create one + "LD_SUPERUSER_NAME"=""; + # Option to disable background tasks + "LD_DISABLE_BACKGROUND_TASKS"="False"; + # Option to disable URL validation for bookmarks completely + "LD_DISABLE_URL_VALIDATION"="False"; + # List of trusted origins from which to accept POST requests + # See docs/Options.md for more details + "LD_CSRF_TRUSTED_ORIGINS"=""; + + # OIDC + "LD_ENABLE_OIDC" = "True"; + "OIDC_OP_AUTHORIZATION_ENDPOINT"="https://${config.homelab.authDomain}/ui/oauth2"; + "OIDC_OP_TOKEN_ENDPOINT"="https://${config.homelab.authDomain}/oauth2/token"; + "OIDC_OP_USER_ENDPOINT"="https://${config.homelab.authDomain}/oauth2/openid/linkding/userinfo"; + "OIDC_OP_JWKS_ENDPOINT"="https://${config.homelab.authDomain}/oauth2/openid/linkding/public_key.jwk"; + "OIDC_RP_SIGN_ALGO"="ES256"; + "OIDC_RP_CLIENT_ID"="linkding"; + + # Database settings + # These are currently only required for configuring PostreSQL. + # By default, linkding uses SQLite for which you don't need to configure anything. + + # Database engine, can be sqlite (default) or postgres + "LD_DB_ENGINE"="sqlite"; + # Database name (default: linkding) + "LD_DB_DATABASE"=""; + # Username to connect to the database server (default: linkding) + "LD_DB_USER"=""; + # Password to connect to the database server + "LD_DB_PASSWORD"=""; + }; + }; + + services.caddy.virtualHosts."bookmark.${config.homelab.domain}" = { + useACMEHost = config.homelab.domain; + extraConfig = '' + reverse_proxy http://localhost:9090 + import block_non_private_ips + ''; + }; +} diff --git a/modules/services/media/arr.nix b/modules/services/media/arr.nix index 13103da..710bfe3 100644 --- a/modules/services/media/arr.nix +++ b/modules/services/media/arr.nix @@ -3,83 +3,95 @@ { users.groups.media = {}; - # Finding/Requesting downloading + # + # Downloading movies services.radarr = { enable = true; openFirewall = false; - dataDir = "/var/lib/radarr"; + dataDir = "/media/apps/radarr"; group = "media"; }; - services.sonarr = { - enable = true; - openFirewall = false; - dataDir = "/var/lib/sonarr"; - group = "media"; - }; - - services.prowlarr = { - enable = true; - openFirewall = false; - }; - - services.bazarr = { - enable = true; - openFirewall = false; - group = "media"; - }; - - # Downloading files - services.deluge = { - enable = true; - web.enable = true; - web.openFirewall = false; - group = "media"; - }; - - - # Requesting Frontend - services.jellyseerr = { - enable = true; - port = 5055; - openFirewall = false; - package = pkgs.jellyseerr; - }; - services.caddy.virtualHosts."radarr.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' - reverse_proxy http://localhost:7878 + # For tinyauth + reverse_proxy http://localhost:7878 { + header_up -X-Forwarded-For + } + import block_non_private_ips + import tinyauth_forwarder * ''; }; + + # + # Downloading shows + services.sonarr = { + enable = true; + openFirewall = false; + dataDir = "/media/apps/sonarr"; + group = "media"; + }; + services.caddy.virtualHosts."sonarr.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' - reverse_proxy http://localhost:8989 + reverse_proxy http://localhost:8989 { + header_up -X-Forwarded-For + } + import block_non_private_ips + import tinyauth_forwarder * ''; }; + + # + # Managing Torrent sources + services.prowlarr = { + enable = true; + openFirewall = false; + dataDir = "/media/apps/prowlarr"; + }; + services.caddy.virtualHosts."prowlarr.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' - reverse_proxy http://localhost:9696 + reverse_proxy http://localhost:9696 { + header_up -X-Forwarded-For + } + import tinyauth_forwarder * + import block_non_private_ips ''; }; - services.caddy.virtualHosts."bazarr.${config.homelab.domain}" = { - useACMEHost = config.homelab.domain; - extraConfig = '' - reverse_proxy http://localhost:6767 - ''; + + # + # Downloading torrents + services.deluge = { + enable = true; + dataDir = "/media/apps/deluge"; + web.enable = true; + web.openFirewall = false; + group = "media"; }; + services.caddy.virtualHosts."deluge.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' - reverse_proxy http://localhost:8112 + reverse_proxy http://localhost:8112 { + header_up -X-Forwarded-For + } + import tinyauth_forwarder * + import block_non_private_ips ''; }; - services.caddy.virtualHosts."jellyseer.${config.homelab.domain}" = { - useACMEHost = config.homelab.domain; - extraConfig = '' - reverse_proxy http://localhost:5055 - ''; + + # setup network samba share + services.samba.settings = { + "media" = { + "path" = "/media/media"; + "valid users" = "@users"; + "force user" = "nobody"; + "public" = "no"; + "read only" = "yes"; + }; }; } diff --git a/modules/services/media/jellyfin.nix b/modules/services/media/jellyfin.nix index a0038c4..bd93c70 100644 --- a/modules/services/media/jellyfin.nix +++ b/modules/services/media/jellyfin.nix @@ -6,6 +6,7 @@ enable = true; openFirewall = false; group = "media"; + dataDir = "/media/apps/jellyfin"; }; users.users.jellyfin.extraGroups = [ "render" "video" ]; @@ -14,6 +15,7 @@ # useACMEHost = config.homelab.domain; extraConfig = '' reverse_proxy http://localhost:8096 + import block_non_private_ips ''; }; } diff --git a/modules/services/miniflux.nix b/modules/services/miniflux.nix index 8f0dda4..3f3f0f6 100644 --- a/modules/services/miniflux.nix +++ b/modules/services/miniflux.nix @@ -10,7 +10,7 @@ # OAUTH2_CLIENT_ID = ""; # OAUTH2_CLIENT_SECRET = ""; # https://pocket-id.org/docs/client-examples/miniflux/ - adminCredentialsFile = /var/lib/miniflux/oidc; + adminCredentialsFile = /media/secrets/miniflux; config = { LISTEN_ADDR = "0.0.0.0:8021"; @@ -33,7 +33,7 @@ FILTER_ENTRY_MAX_AGE_DAYS = 1825; # 5 years FORCE_REFRESH_INTERVAL = 30; - POLLING_FREQUENCY = 60; + POLLING_FREQUENCY = 180; OAUTH2_PROVIDER = "oidc"; OAUTH2_REDIRECT_URL = "https://rss.${config.homelab.domain}/oauth2/oidc/callback"; @@ -44,10 +44,15 @@ }; }; + systemd.tmpfiles.rules = [ + "f /media/secrets/miniflux 0400 root root" + ]; + services.caddy.virtualHosts."rss.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' reverse_proxy http://localhost:8021 + import block_non_private_ips ''; }; } diff --git a/modules/services/pocketid.nix b/modules/services/pocketid.nix index b909467..8f3586f 100644 --- a/modules/services/pocketid.nix +++ b/modules/services/pocketid.nix @@ -19,6 +19,7 @@ useACMEHost = config.homelab.domain; extraConfig = '' reverse_proxy http://localhost:8025 + import block_non_private_ips ''; }; } diff --git a/modules/services/samba.nix b/modules/services/samba.nix new file mode 100644 index 0000000..3b2b40f --- /dev/null +++ b/modules/services/samba.nix @@ -0,0 +1,17 @@ +{ config, ... }: + +{ + services.samba = { + enable = true; + openFirewall = true; + settings = { + global = { + "workgroup" = "WORKGROUP"; + "server string" = "${config.networking.hostName}"; + "netbios name" = "${config.networking.hostName}"; + "security" = "user"; + }; + }; + }; +} + diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index 04ef56a..9b16c59 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -6,7 +6,6 @@ enable = true; allowSFTP = true; openFirewall = true; - authorizedKeysInHomedir = false; settings = { PermitRootLogin = "no"; PasswordAuthentication = false; diff --git a/modules/services/uptime-kuma.nix b/modules/services/uptime-kuma.nix index b08cd10..994f781 100644 --- a/modules/services/uptime-kuma.nix +++ b/modules/services/uptime-kuma.nix @@ -9,6 +9,15 @@ }; }; + systemd.tmpfiles.rules = [ + "d /media/apps/uptime-kuma 0700 root root" + ]; + + fileSystems."/var/lib/private/uptime-kuma" = { + device = "/media/apps/uptime-kuma"; + options = [ "bind" ]; + }; + services.caddy.virtualHosts."status.${config.homelab.domain}" = { useACMEHost = config.homelab.domain; extraConfig = '' diff --git a/modules/shell.nix b/modules/shell.nix index 91cbc83..362ef1f 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -4,8 +4,11 @@ programs.zsh.enable = true; programs.zsh.promptInit = ( builtins.readFile ../stow/.zshrc ); + programs.fish.enable = true; + environment.systemPackages = with pkgs; [ neovim + yazi git zoxide tlrc diff --git a/modules/users/alex.nix b/modules/users/alex.nix new file mode 100644 index 0000000..47149e0 --- /dev/null +++ b/modules/users/alex.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ...}: + +{ + users.users.alex = { + description = "Alexander"; + isNormalUser = true; + extraGroups = [ ]; + }; +} diff --git a/modules/users/nico.nix b/modules/users/nico.nix index 66fbd9c..317b762 100644 --- a/modules/users/nico.nix +++ b/modules/users/nico.nix @@ -4,10 +4,10 @@ users.users.nico = { isNormalUser = true; extraGroups = [ "wheel" ]; - shell = pkgs.zsh; + shell = pkgs.fish; }; users.users.nico.openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHzUJnqCpbRxggjyIZo4KWnTyHobPdi/xXkN1/n/yIMD" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFs7CxmkYo58hRm9bGdg7J3500tChjMz/KaDBs0fw975" ]; } diff --git a/modules/users/rhys.nix b/modules/users/rhys.nix index 8b2c365..45a03ce 100644 --- a/modules/users/rhys.nix +++ b/modules/users/rhys.nix @@ -9,6 +9,6 @@ users.users.rhys.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK0Pce0wQKV+wI7rCIiUZgqqkiodTXZ6fMiZezLy9uZk" # laptop - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC+HNs1/r4LMQsfpqXhU7396q5zL9hvfcNdiQSUTIl4R" # phone + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDmLm9HwZXDbySVupNHPlGMtm6Vwx4nxVp2tsGvuSLUr" # phone ]; } diff --git a/modules/virtualisation/virt-manager.nix b/modules/virtualisation/virt-manager.nix new file mode 100644 index 0000000..2a30c5d --- /dev/null +++ b/modules/virtualisation/virt-manager.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + services.qemuGuest.enable = true; + services.spice-vdagentd.enable = true; # enable copy and paste between host and guest +} diff --git a/stow/.config/aerospace/aerospace.toml b/stow/.config/aerospace/aerospace.toml new file mode 100644 index 0000000..18fd9de --- /dev/null +++ b/stow/.config/aerospace/aerospace.toml @@ -0,0 +1,172 @@ +# You can use it to add commands that run after AeroSpace startup. +# Available commands : https://nikitabobko.github.io/AeroSpace/commands +after-startup-command = [ + 'exec-and-forget borders active_color=0xfff74f9e inactive_color=0xffffa8f1 width=6.0', + 'exec-and-forget sh ~/.cache/matugen-jankyborders.sh', + 'exec-and-forget sketchybar' +] + + +# Notify Sketchybar about workspace change +exec-on-workspace-change = ['/bin/bash', '-c', + 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE' +] + +# Start AeroSpace at login - breaks nix darwin +start-at-login = false + +# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization +enable-normalization-flatten-containers = true +enable-normalization-opposite-orientation-for-nested-containers = true + +# See: https://nikitabobko.github.io/AeroSpace/guide#layouts +# The 'accordion-padding' specifies the size of accordion padding +# You can set 0 to disable the padding feature +accordion-padding = 30 + +# Possible values: tiles|accordion +default-root-container-layout = 'tiles' + +# Possible values: horizontal|vertical|auto +# 'auto' means: wide monitor (anything wider than high) gets horizontal orientation, +# tall monitor (anything higher than wide) gets vertical orientation +default-root-container-orientation = 'auto' + +# Mouse follows focus when focused monitor changes +# Drop it from your config, if you don't like this behavior +# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks +# See https://nikitabobko.github.io/AeroSpace/commands#move-mouse +# Fallback value (if you omit the key): on-focused-monitor-changed = [] +on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] + +# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag +# Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key +# Also see: https://nikitabobko.github.io/AeroSpace/goodies#disable-hide-app +automatically-unhide-macos-hidden-apps = true + +# Possible values: (qwerty|dvorak|colemak) +# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping +[key-mapping] +preset = 'qwerty' + +# Gaps between windows (inner-*) and between monitor edges (outer-*). +# Possible values: +# - Constant: gaps.outer.top = 8 +# - Per monitor: gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24] +# In this example, 24 is a default value when there is no match. +# Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'. +# See: +# https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors +[gaps] + inner.horizontal = 12 + inner.vertical = 12 + outer.left = 12 + outer.bottom = 12 + outer.top = 6 + outer.right = 12 + + +[[on-window-detected]] + if.app-id = 'com.objective-see.lulu.app' + check-further-callbacks = true + run = 'layout floating' + +[mode.main.binding] +# All possible keys: +# - Letters. a, b, c, ..., z +# - Numbers. 0, 1, 2, ..., 9 +# - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9 +# - F-keys. f1, f2, ..., f20 +# - Special keys. minus, equal, period, comma, slash, backslash, quote, semicolon, +# backtick, leftSquareBracket, rightSquareBracket, space, enter, esc, +# backspace, tab, pageUp, pageDown, home, end, forwardDelete, +# sectionSign (ISO keyboards only, european keyboards only) +# - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual, +# keypadMinus, keypadMultiply, keypadPlus +# - Arrows. left, down, up, right + +# All possible modifiers: cmd, alt, ctrl, shift +# All possible commands: https://nikitabobko.github.io/AeroSpace/commands + +# App keybinds +alt-shift-f = 'exec-and-forget open ~' +alt-shift-b = 'exec-and-forget /Applications/Zen.app/Contents/MacOS/zen --new-window' +alt-s = 'exec-and-forget screencapture -i -c' + +alt-shift-w = 'exec-and-forget $HOME/.config/aerospace/toggle-tiling.sh off' + +# Layout +# See: https://nikitabobko.github.io/AeroSpace/commands#layout +alt-c = 'layout tiles horizontal vertical' +alt-comma = 'layout accordion horizontal vertical' +alt-space = 'layout floating tiling' +alt-f = 'fullscreen' + +# Moving Focus +# See: https://nikitabobko.github.io/AeroSpace/commands#focus +alt-h = 'focus left' +alt-j = 'focus down' +alt-k = 'focus up' +alt-l = 'focus right' + +# Moving windows +# See: https://nikitabobko.github.io/AeroSpace/commands#move +alt-shift-h = 'move left' +alt-shift-j = 'move down' +alt-shift-k = 'move up' +alt-shift-l = 'move right' + +alt-ctrl-h = 'join-with left' +alt-ctrl-j = 'join-with down' +alt-ctrl-k = 'join-with up' +alt-ctrl-l = 'join-with right' + + +# Resizing Windows +# See: https://nikitabobko.github.io/AeroSpace/commands#resize +alt-minus = 'resize smart -50' +alt-equal = 'resize smart +50' + +# See: https://nikitabobko.github.io/AeroSpace/commands#workspace +alt-1 = 'workspace 1' +alt-2 = 'workspace 2' +alt-3 = 'workspace 3' +alt-4 = 'workspace 4' +alt-5 = 'workspace 5' +alt-6 = 'workspace 6' +alt-7 = 'workspace 7' +alt-8 = 'workspace 8' +alt-9 = 'workspace 9' + +# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace +alt-shift-1 = 'move-node-to-workspace --focus-follows-window 1' +alt-shift-2 = 'move-node-to-workspace --focus-follows-window 2' +alt-shift-3 = 'move-node-to-workspace --focus-follows-window 3' +alt-shift-4 = 'move-node-to-workspace --focus-follows-window 4' +alt-shift-5 = 'move-node-to-workspace --focus-follows-window 5' +alt-shift-6 = 'move-node-to-workspace --focus-follows-window 6' +alt-shift-7 = 'move-node-to-workspace --focus-follows-window 7' +alt-shift-8 = 'move-node-to-workspace --focus-follows-window 8' +alt-shift-9 = 'move-node-to-workspace --focus-follows-window 9' + +# See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth +alt-tab = 'workspace-back-and-forth' + + +# See: https://nikitabobko.github.io/AeroSpace/commands#mode +# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes +alt-shift-semicolon = 'mode service' +[mode.service.binding] +esc = ['reload-config', 'mode main'] +r = ['flatten-workspace-tree', 'mode main'] # reset layout +f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout +backspace = ['close-all-windows-but-current', 'mode main'] + +alt-shift-h = ['join-with left', 'mode main'] +alt-shift-j = ['join-with down', 'mode main'] +alt-shift-k = ['join-with up', 'mode main'] +alt-shift-l = ['join-with right', 'mode main'] + +down = 'volume down' +up = 'volume up' +shift-down = ['volume set 0', 'mode main'] diff --git a/stow/.config/aerospace/toggle-tiling.sh b/stow/.config/aerospace/toggle-tiling.sh new file mode 100755 index 0000000..7a446ae --- /dev/null +++ b/stow/.config/aerospace/toggle-tiling.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +disableTiling () { + defaults write com.apple.dock orientation bottom + defaults write com.apple.dock autohide -bool FALSE + defaults write com.apple.finder CreateDesktop true + + killall Finder Dock sketchybar borders + + aerospace enable off # fails when script called from aerospace directly, bin not in path + /run/current-system/sw/bin/aerospace enable off + + osascript -e 'tell application "System Events" + tell dock preferences + set properties to {autohide menu bar:false, autohide:false} + end tell + end tell' -e 'tell application "System Events" to set visible of (every application process whose visible is true and name is not "Finder") to false' +} + +enableTiling () { + aerospace enable on + sketchybar & disown + sh ~/.cache/matugen-jankyborders.sh & disown + + defaults write com.apple.dock orientation right + defaults write com.apple.dock autohide -bool FALSE + defaults write com.apple.finder CreateDesktop false + killall Dock Finder + + osascript -e ' + tell application "System Events" + tell dock preferences + set properties to {autohide menu bar:true, autohide:true} + end tell + end tell +' +} + +if [ "$1" = "on" ]; then + enableTiling +elif [ "$1" = "off" ]; then + disableTiling +else + echo "$0: [on|off]" +fi diff --git a/stow/.config/fastfetch/ascii.txt b/stow/.config/fastfetch/ascii.txt deleted file mode 100644 index c557d4c..0000000 --- a/stow/.config/fastfetch/ascii.txt +++ /dev/null @@ -1,19 +0,0 @@ -$4⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀$3⡀$4 ⡣⠨⡂⠄⠠⠠⠠⡀⡂⠄⠄⠄⢄⢀⢀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⠀⠀⠀⢀⠠⠨ $3⡡$4⢪⠂⡃⠔⡨⠨⡨⠨⡐⠌⠌⢌⠊⠔⡐⡐⡡⢂⢑⢐⠄⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠄⠄⢆⠁⡀⠨⠨⡐⡐$3⢅$4⠊⠄⠕⡐⠡⡂⡑⠄⢅⠅⠕⡨⢈⢂⢂⠢⢂⠅⡂⡪⠨$3⡀$4⠂⠠⠀⢠⠠⢒⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⠀⡠⠊⢄⠅⢅⢂⠎⡐$3⡡$4⢑⠡⠊⢔⠐⡌⢌⢂⠪⢐⠌⠔⡐⡡⠨⠂⠌⡂⡂$3⠅$4⢌⠢⠐⠐⠣⡘⣸⢈⠢⠐⠀⠀⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠠⢁⠢⡡⠡⢊⢐⠔⡡⢂$3⠊$4⠔⡨⢌⢂⠕⡨⠐⠄⢕⢐⠜⠌⠔⡐⡡⠕⠡⠠$3⠠$4⡈⢀⠈⢀⠐⠈⠄⡇⠢⡡⢑⠒⠐⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠠⡁⡪⢐⠌⢌⢂⢆⡇⡢⢂⠕⡁⡪⢂⢢⢑⢐⠅⡕⠕⠁⢕⠡⢑⢐⠒⢱⠡⢑$3⠡$4⠨⢂⠌⠢⢐⠄⠘⡌⢌⢂⠅⢪⢀⠀⠀⠀⠀⠀⠀ -$4⠀⠀⡢⢊⠔⢡⠪⡐⠔⡮⣺⢐⢐⠌⠔⠅⠕⢕⢐⢅$1⠘⠁⡀⠂$4⡇⠌⡂⠎$1⡀$4⡌⢌⢂⠅$3⠕$4⠡⠨⢊⠔⡈⡂⡰⢐⢐⠅⠅⡀⠁⠄⠀⠀⠀⠀ -$4⠀⢐⠌⡂⢮⡫⢂⠪⡰⣝⢮⡣⢂⠅⢍⠈⡰$2⣖⣵⡗⠣$1⠁$4⢀⠀⠇⠅⡊$1⢀⠁⠀$4⠒⡰⡈⣎⢌⢊⠔⢔⠨⡐⢵⡐⡡⠨⡊⡀⠀⠀⠀⠀⠀⠀ -$4⠀⠕⠌⠂⢸⠐⢅⢊⠎⠊⡗⣱⢐⠡⡂⣜⠁$2⣜⢷⣳⢂$1⠐$4⠀⠠⠨$1⠈⡀⢀$2⠨⣫⣖⢦$4⢊⢨⢂⢂⠇⢅⠊⢜⡮⡺⡌⢌⡖⡐⠀⠀⠀⠀⠀⠀ -$4⠈⠈⠀⠀⠆⢕⠡⢢⠀⠸⢨⢚⢄⢑$1⠠⠐⠀$2⠣⣱⠑⠀$1⠄⠈⠀⠄⠂⠀⡀$2⢰⣗⣧⡉⢧$4⢐⠢⢭⠃⢅⢊⢇⠫⡫$5⡎⡢⢏⢆⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⢕⠡⢊⢮⡂⠀⢊⠪⡢⢢$1⠀⠄⠂⢀⠀⠄⠁⡀⢈⠀⠄⠐⠀⡀$2⢇⠗⡵⠁⢵⠀$4⡽⣱⠡⡑⡌⠆⡆$5⠫⡎⡄⢸⡐⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⡃⡊⡢⡗⠀⠀⠀⠀⢂⢕$1⠀⠄⠂⠀⠄⠐⠀⡀⠠⠀⠆⢀⠁⢀⠀⠡⠀⠄⠂$4⡸⡝⡮$5⡂⡲⠘⠈⠁⠘⠑⢀⢠⠇⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⢐⢑⠜⠀⠀⠀⠀⠀⠀⠂$1⠈⠠⢀⢁⠀⠂⠁⢀⠠⠐⡀⠄⠐⠀⡀⢁⠐⠀⢢$4⡫⡳$5⡱⡈$3⢀⢄⠅$5⠀⠠⠀⠀⠈⠠⠀⠀⠀⠀⠀⠀ -$4⠀⠀⠀⠀⠀⢅⠅⠀⠀⠀⠀⠀⠀⠀$1⠀⠀⠀⠀⠂⣄⡁⡀⠄⠂⢀⠠⠐⠀⢄⢠⡰⡸$4⣜⠮$5⡃⡆⠀⠀$3⠁⠁$5⠀⢀⠀⠈⢀⠀⠁⠀⠄⠠⠀⡀ -$5⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡖⡌⢣⡒⡖⡆⡎⡏⡍⠔ $5⣅⠀⠈⠀⠐⡈⠀⠀$3⠸⣪$5⠀⢠⠉⢪⠪⡱⠐ -$6⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠄⠀$6⡀⣄⣼⣿⣿⡌⡆⡣⢣⡱⡣⢣⠩⡊⢆⢑⠌⢀⠝⡌$5⠌⢇⢧⢓⢄⠁⠀⠀⡀⠠⠀⠀⡀⢨⢊⠈⠀⠀⠀ -$6⠀⠀⠀⠀⠀⠀⠀⠀⠠⠁⠀⠠⠀$6⢮⣟⣔⢮⣖⢽$7⣝⢮⡢⡓⢜⣜⢮$6⢬⣀⢶⠀⠈⠑⡀⠂⢱⠁$5⡔⢔⢑⢄⢅⢀⡀⠠⡠⠐⠁⠁⠁⠀⠀⠀ -$6⠀⠀⠀⠀⠀⠀⠀⠠⠁⡀⠈⡀⠀$6⣟⣞⣞⢞⡮$7⡷⡽$8⣿⣿⣿⣿⣿$7⡽⣕$6⢷⢝⣖⡌⠀⠀⠠⠁⠠$5⠨⠢⠃⠑⠨⠢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -$6⠀⠀⠀⠀⠀⠀⣠⣡⣾⡀⠄⠐⠀$6⢗⡷⣝⣗$7⡯⡯$8⣿⣿⣿⣿⣿⣿⣿$7⢽⢽$6⣕⣗⠀⠄⠈⢀⠀⠡⠀⠅⠀⡢⠀⢨⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ diff --git a/stow/.config/fastfetch/config.jsonc b/stow/.config/fastfetch/config.jsonc index f8f28b8..ebd577d 100644 --- a/stow/.config/fastfetch/config.jsonc +++ b/stow/.config/fastfetch/config.jsonc @@ -1,32 +1,8 @@ { - "logo": { - "source": "$HOME/.config/fastfetch/ascii.txt", - "padding": { - "top": 2, - "right": 6 - }, - "color": { - "1": "38;5;231", // skin - "4": "38;5;217", // hair - "2": "38;5;206", // eyes - "3": "38;5;196", // hair tie - "5": "38;5;15", // kyubey - "6": "38;5;212", // clothes - "7": "38;5;241", // gem border - "8": "38;5;219", // gem inside - "9": "white", - }, - }, "display": { "separator": " ", - "color": { - "title": "38;5;206", - "keys": "38;5;219", - }, }, "modules": [ - "break", - "break", { "type": "title", "keyWidth": 10, @@ -41,8 +17,12 @@ "key": " ", }, { - "type": "packages", - "key": " ", + "type": "wm", + "key": " ", + }, + { + "type": "shell", + "key": " ", }, "break", { @@ -59,27 +39,18 @@ }, "break", { - "type": "shell", - "key": " ", - }, - { - "type": "terminal", - "key": " ", - }, - { - "type": "wm", - "key": " ", - }, - { - "type": "uptime", - "key": " ", + "type": "packages", + "key": " ", }, { "type": "media", "key": "󰝚 ", }, + { + "type": "uptime", + "key": " ", + }, "break", - "colors", - "break", + "colors" ] } diff --git a/stow/.config/fish/.gitignore b/stow/.config/fish/.gitignore new file mode 100644 index 0000000..23efee9 --- /dev/null +++ b/stow/.config/fish/.gitignore @@ -0,0 +1 @@ +fish_variables diff --git a/stow/.config/fish/config.fish b/stow/.config/fish/config.fish new file mode 100644 index 0000000..2a27fa8 --- /dev/null +++ b/stow/.config/fish/config.fish @@ -0,0 +1,92 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + + + # + # shell prompt + # + + # match prompt symbol to OS logo + if test -e /etc/os-release + posix-source /etc/os-release + end + + if test -e /System + set os_icon "" + eval "$(/opt/homebrew/bin/brew shellenv)" + else if [ "$ID" = "nixos" ] + set os_icon "" + else if [ "$ID" = "debian" ] + set os_icon "" + else if [ "$ID" = "fedora" ] + set os_icon "" + else if [ "$ID" = "arch" ] + set os_icon "󰣇" + else + set os_icon "\$" + end + + # set prompt colours + if test -e ~/.cache/zsh_colours.sh + posix-source-universal (string replace -fra "{|}|#|\"" "" (cat ~/.cache/zsh_colours.sh) | psub) + else + set -Ux PRIMARY_COLOUR blue + set -Ux SECONDARY_COLOUR purple + end + + + # construct final prompt + function fish_prompt + # turn os_icon red if an error occurs + set -l prompt_icon + if test $status -ne 0 + set prompt_icon (set_color red)"$os_icon"(set_color normal) + else + set prompt_icon "$os_icon" + end + + # set ssh status + set -l ssh_status + if set -q SSH_CONNECTION + set ssh_status (prompt_login) + end + + # concatenate $HOME to a ~ eg. /home/user to ~ + set shorten_path (string replace -r "^$HOME" "~" "$PWD") + + echo (set_color $PRIMARY_COLOUR)$shorten_path $ssh_status (set_color $SECONDARY_COLOUR)$prompt_icon (set_color normal) + end + + # + # shell intergration + # + + zoxide init fish | source + + # + # environment variables + # + + set -gx EDITOR nvim + set fish_greeting "" + set HOMEBREW_AUTO_UPDATE_SECS 86400 + + # xdg variables + set -gx XDG_CONFIG_HOME "$HOME/.config" # config + set -gx XDG_CACHE_HOME "$HOME/.cache" # cache + set -gx XDG_DATA_HOME "$HOME/.local/share" # data files eg. /usr/share + set -gx XDG_STATE_HOME "$HOME/.local/state" # state files eg. /var/lib + + # make apps use XDG folders + set -gx PYTHON_HISTORY "$XDG_STATE_HOME"/python_history + set -gx PYTHONPYCACHEPREFIX "$XDG_CACHE_HOME"/python + set -gx PYTHONUSERBASE "$XDG_DATA_HOME"/python + set -gx GOPATH "$XDG_STATE_HOME"/go + set -gx GOMODCACHE "$XDG_CACHE_HOME"/go/mod + set -gx NPM_CONFIG_USERCONFIG "$XDG_CONFIG_HOME"/npm/npmrc + + function wget --wraps=wget + wget --hsts-file="$XDG_STATE_HOME/wget-hsts" $argv + end + +end diff --git a/stow/.config/fish/functions/cat.fish b/stow/.config/fish/functions/cat.fish new file mode 100644 index 0000000..abbc480 --- /dev/null +++ b/stow/.config/fish/functions/cat.fish @@ -0,0 +1,4 @@ +function cat --wraps=bat --description 'alias cat bat' + bat $argv + +end diff --git a/stow/.config/fish/functions/ff.fish b/stow/.config/fish/functions/ff.fish new file mode 100644 index 0000000..0fcb5c9 --- /dev/null +++ b/stow/.config/fish/functions/ff.fish @@ -0,0 +1,4 @@ +function ff --wraps=fastfetch --description 'alias ff=fastfetch' + fastfetch $argv + +end diff --git a/stow/.config/fish/functions/ga.fish b/stow/.config/fish/functions/ga.fish new file mode 100644 index 0000000..6661b8c --- /dev/null +++ b/stow/.config/fish/functions/ga.fish @@ -0,0 +1,4 @@ +function ga --wraps='git add' --description 'alias ga=git add' + git add $argv + +end diff --git a/stow/.config/fish/functions/gc.fish b/stow/.config/fish/functions/gc.fish new file mode 100644 index 0000000..f796e70 --- /dev/null +++ b/stow/.config/fish/functions/gc.fish @@ -0,0 +1,4 @@ +function gc --wraps='git commit' --description 'alias gc=git commit' + git commit $argv + +end diff --git a/stow/.config/fish/functions/glo.fish b/stow/.config/fish/functions/glo.fish new file mode 100644 index 0000000..3914ded --- /dev/null +++ b/stow/.config/fish/functions/glo.fish @@ -0,0 +1,4 @@ +function glo --wraps='git log' --description 'alias glo=git log' + git log $argv + +end diff --git a/stow/.config/fish/functions/gph.fish b/stow/.config/fish/functions/gph.fish new file mode 100644 index 0000000..76a0022 --- /dev/null +++ b/stow/.config/fish/functions/gph.fish @@ -0,0 +1,4 @@ +function gph --wraps='git push' --description 'alias gph=git push' + git push $argv + +end diff --git a/stow/.config/fish/functions/gpl.fish b/stow/.config/fish/functions/gpl.fish new file mode 100644 index 0000000..98780ae --- /dev/null +++ b/stow/.config/fish/functions/gpl.fish @@ -0,0 +1,4 @@ +function gpl --wraps='git pull' --description 'alias gpl=git pull' + git pull $argv + +end diff --git a/stow/.config/fish/functions/gs.fish b/stow/.config/fish/functions/gs.fish new file mode 100644 index 0000000..fea3f96 --- /dev/null +++ b/stow/.config/fish/functions/gs.fish @@ -0,0 +1,4 @@ +function gs --wraps='git status' --description 'alias gs=git status' + git status $argv + +end diff --git a/stow/.config/fish/functions/la.fish b/stow/.config/fish/functions/la.fish new file mode 100644 index 0000000..d33eb8f --- /dev/null +++ b/stow/.config/fish/functions/la.fish @@ -0,0 +1,4 @@ +function la --wraps='ls -ah --color=auto' --description 'alias la=ls -ah --color=auto' + ls -ah --color=auto $argv + +end diff --git a/stow/.config/fish/functions/ll.fish b/stow/.config/fish/functions/ll.fish new file mode 100644 index 0000000..874614f --- /dev/null +++ b/stow/.config/fish/functions/ll.fish @@ -0,0 +1,4 @@ +function ll --wraps='ls -l' --wraps='ls -ahl --color=auto' --description 'alias ll=ls -ahl --color=auto' + ls -ahl --color=auto $argv + +end diff --git a/stow/.config/fish/functions/ls.fish b/stow/.config/fish/functions/ls.fish new file mode 100644 index 0000000..eaf48c8 --- /dev/null +++ b/stow/.config/fish/functions/ls.fish @@ -0,0 +1,4 @@ +function ls --description 'alias ls=ls -h --color=auto' + command ls -h --color=auto $argv + +end diff --git a/stow/.config/fish/functions/posix-source-universal.fish b/stow/.config/fish/functions/posix-source-universal.fish new file mode 100644 index 0000000..5fee790 --- /dev/null +++ b/stow/.config/fish/functions/posix-source-universal.fish @@ -0,0 +1,6 @@ +function posix-source-universal + for i in (cat $argv) + set arr (echo $i |tr = \n) + set -Ux $arr[1] $arr[2] + end +end diff --git a/stow/.config/fish/functions/posix-source.fish b/stow/.config/fish/functions/posix-source.fish new file mode 100644 index 0000000..5147014 --- /dev/null +++ b/stow/.config/fish/functions/posix-source.fish @@ -0,0 +1,6 @@ +function posix-source + for i in (cat $argv) + set arr (echo $i |tr = \n) + set -gx $arr[1] $arr[2] + end +end diff --git a/stow/.config/fish/functions/rm.fish b/stow/.config/fish/functions/rm.fish new file mode 100644 index 0000000..5d4ae5f --- /dev/null +++ b/stow/.config/fish/functions/rm.fish @@ -0,0 +1,4 @@ +function rm --wraps=trash --description 'alias rm trash' + trash $argv + +end diff --git a/stow/.config/fish/functions/v.fish b/stow/.config/fish/functions/v.fish new file mode 100644 index 0000000..c4c8a12 --- /dev/null +++ b/stow/.config/fish/functions/v.fish @@ -0,0 +1,4 @@ +function v --wraps=nvim --description 'alias v nvim' + nvim $argv + +end diff --git a/stow/.config/fish/functions/vi.fish b/stow/.config/fish/functions/vi.fish new file mode 100644 index 0000000..1f236aa --- /dev/null +++ b/stow/.config/fish/functions/vi.fish @@ -0,0 +1,4 @@ +function vi --wraps=nvim --description 'alias vi nvim' + nvim $argv + +end diff --git a/stow/.config/fish/functions/vim.fish b/stow/.config/fish/functions/vim.fish new file mode 100644 index 0000000..67df688 --- /dev/null +++ b/stow/.config/fish/functions/vim.fish @@ -0,0 +1,4 @@ +function vim --wraps=nvim --description 'alias vim nvim' + nvim $argv + +end diff --git a/stow/.config/fish/functions/y.fish b/stow/.config/fish/functions/y.fish new file mode 100644 index 0000000..bddb84d --- /dev/null +++ b/stow/.config/fish/functions/y.fish @@ -0,0 +1,8 @@ +function y + set tmp (mktemp -t "yazi-cwd.XXXXXX") + command yazi $argv --cwd-file="$tmp" + if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + builtin cd -- "$cwd" + end + command rm -f -- "$tmp" +end diff --git a/stow/.config/fuzzel/.gitignore b/stow/.config/fuzzel/.gitignore new file mode 100644 index 0000000..64550cc --- /dev/null +++ b/stow/.config/fuzzel/.gitignore @@ -0,0 +1 @@ +colors.ini diff --git a/stow/.config/fuzzel/fuzzel.ini b/stow/.config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..21e7912 --- /dev/null +++ b/stow/.config/fuzzel/fuzzel.ini @@ -0,0 +1,24 @@ +[main] +include = "~/.config/fuzzel/colors.ini" + +prompt="> " +placeholder="Search..." +password-character="*" + +width=40 +use-bold=no +dpi-aware=auto +tabs="4" +terminal="ghostty -e" +keyboard-focus=exclusive + +fields=filename,name,generic,exec,keywords,comment,categories +match-mode="fzf" +sort-result=yes + +layer=top + +[border] +width=2 +radius=10 +selection-radius=10 diff --git a/stow/.config/ghostty/.gitignore b/stow/.config/ghostty/.gitignore new file mode 100644 index 0000000..5fe944e --- /dev/null +++ b/stow/.config/ghostty/.gitignore @@ -0,0 +1 @@ +matugen diff --git a/stow/.config/ghostty/config b/stow/.config/ghostty/config index effae8f..1fc75b5 100644 --- a/stow/.config/ghostty/config +++ b/stow/.config/ghostty/config @@ -1,14 +1,19 @@ -theme = dark:tokyonight,light:tokyonight-day +theme = dark:TokyoNight,light:TokyoNight Day background-opacity = 0.9 background-blur-radius = 20 window-decoration = true gtk-titlebar = false -quit-after-last-window-closed = true font-family = "ComicShannsMono Nerd Font" font-size = 18 window-padding-x = 8 window-padding-y = 8 + +quit-after-last-window-closed = false +keybind = global:opt+shift+q=new_window +keybind = global:cmd+opt+q=toggle_quick_terminal + +config-file = ?matugen diff --git a/stow/.config/hypr/.gitignore b/stow/.config/hypr/.gitignore index f25037d..d868207 100644 --- a/stow/.config/hypr/.gitignore +++ b/stow/.config/hypr/.gitignore @@ -1 +1,2 @@ matugen.conf +hyprlock.conf diff --git a/stow/.config/hypr/appearance.conf b/stow/.config/hypr/appearance.conf new file mode 100644 index 0000000..73ddc8f --- /dev/null +++ b/stow/.config/hypr/appearance.conf @@ -0,0 +1,54 @@ +general { + gaps_in = 3 + gaps_out = 5 + + border_size = 2 + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + col.active_border = rgba(ff6161ee) rgba(cc2a2aee) 45deg + col.inactive_border = rgba(e04254aa) +} + +decoration { + rounding = 10 + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 1.0 + + shadow { + enabled = true + range = 4 + render_power = 3 + color = rgba(1a1a1aee) + } + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur { + enabled = true + size = 5 + passes = 3 + + vibrancy = 0.1696 + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#animations +animations { + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + enabled = true + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +misc { +# force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers + disable_splash_rendering = true + disable_hyprland_logo = true # makes swww startup more seemless +} diff --git a/stow/.config/hypr/binds.conf b/stow/.config/hypr/binds.conf new file mode 100644 index 0000000..fb8d185 --- /dev/null +++ b/stow/.config/hypr/binds.conf @@ -0,0 +1,96 @@ +# +# keybinds +# https://wiki.hyprland.org/Configuring/Keywords/ + +$mainMod = SUPER # Sets "Windows" key as main modifier + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Q, exec, ghostty +bind = $mainMod, B, exec, firefox +bind = $mainMod, D, exec, vicinae toggle +bind = $mainMod shift, D, exec, 1password --quick-access +bind = $mainMod, S, exec, hyprshot -z --clipboard-only -m region +bind = $mainMod shift, S, exec, hyprshot -z --clipboard-only -m window +bind = $mainMod control, S, exec, hyprshot -z --clipboard-only -m active +bind = $mainMod, V, exec, sh ~/.config/hypr/hyprlock.sh + +bind = $mainMod, SPACE, togglefloating, +bind = $mainMod, W, killactive, +bind = $mainMod, M, exit + +#bind = $mainMod, P, pseudo, # dwindle # have no clue what this does +bind = $mainMod, F, fullscreen +bind = $mainMod, C, togglesplit, # dwindle + +# Move focus with mainMod + arrow keys +bind = $mainMod, h, movefocus, l +bind = $mainMod, l, movefocus, r +bind = $mainMod, k, movefocus, u +bind = $mainMod, j, movefocus, d + +# Move window with mainMod + shift + hjkl +bind = $mainMod shift, h, swapwindow, l +bind = $mainMod shift, l, swapwindow, r +bind = $mainMod shift, k, swapwindow, u +bind = $mainMod shift, j, swapwindow, d + +# brightness keys +bindel = , XF86MonBrightnessUp, exec, brightnessctl s +2% +bindel = , XF86MonBrightnessDown, exec, brightnessctl s 2%- + +# media keys +bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ +bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- +bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + +# Requires playerctl +bindl = , XF86AudioPlay, exec, playerctl play-pause +bindl = , XF86AudioPrev, exec, playerctl previous +bindl = , XF86AudioNext, exec, playerctl next + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +input:kb_options = caps:super + +# Controllers Binds +bind = $mainMod, page_up, workspace, e+1 +bind = $mainMod, page_down, workspace, e-1 +bind = $mainMod, insert, exec, hyprexit + + +# gestures +# https://wiki.hyprland.org/Configuring/Variables/#gestures +gesture = 3, horizontal, workspace +gesture = 4, pinch, dispatcher, exec, vicinae toggle +gesture = 4, left, dispatcher, exec, swaync-client -op +gesture = 4, right, dispatcher, exec, swaync-client -cp diff --git a/stow/.config/hypr/hyprland.conf b/stow/.config/hypr/hyprland.conf index 531438a..474d34c 100755 --- a/stow/.config/hypr/hyprland.conf +++ b/stow/.config/hypr/hyprland.conf @@ -1,28 +1,32 @@ +# +# modules +source = binds.conf +source = rules.conf +source = appearance.conf +source = ./matugen.conf -################ -### MONITORS ### -################ - -# See https://wiki.hyprland.org/Configuring/Monitors/ +# +# monitors +# https://wiki.hyprland.org/Configuring/Monitors/ monitor=eDP-1,1920x1080@60,auto,1 -################# -### AUTOSTART ### -################# -# Autostart necessary processes (like notifications daemons, status bars, etc.) -# Or execute your favorite apps at launch like this: +# +# autostart -exec-once = swww-daemon & -exec-once = waybar & -exec-once = swaync & -exec-once = hyprshade auto & -exec-once = walker --gapplication-service +# desktop +exec-once = swww-daemon +exec-once = waybar +exec-once = swaync +exec-once = vicinae server +exec-once = fcitx5 +exec-once = systemctl --user start hyprpolkitagent +exec-once = hyprshade auto +# apps exec-once = opensnitch-ui -exec-once = systemctl status --user polkit-gnome-authentication-agent-1.service - -exec-once = steam -silent & +exec-once = steam -silent +exec-once = 1password --silent ############################# ### ENVIRONMENT VARIABLES ### @@ -32,21 +36,7 @@ exec-once = steam -silent & env = XCURSOR_SIZE,24 env = HYPRCURSOR_SIZE,24 -##################### -### LOOK AND FEEL ### -##################### -# Refer to https://wiki.hyprland.org/Configuring/Variables/ - general { - gaps_in = 3 - gaps_out = 5 - - border_size = 2 - - # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors - col.active_border = rgba(ff6161ee) rgba(cc2a2aee) 45deg - col.inactive_border = rgba(e04254aa) - # Set to true enable resizing windows by clicking and dragging on borders and gaps resize_on_border = true @@ -56,46 +46,6 @@ general { layout = dwindle } -decoration { - rounding = 10 - - # Change transparency of focused and unfocused windows - active_opacity = 1.0 - inactive_opacity = 1.0 - - shadow { - enabled = true - range = 4 - render_power = 3 - color = rgba(1a1a1aee) - } - - # https://wiki.hyprland.org/Configuring/Variables/#blur - blur { - enabled = true - size = 5 - passes = 3 - - vibrancy = 0.1696 - } -} - -# Matugen theming -source = ./matugen.conf - -# https://wiki.hyprland.org/Configuring/Variables/#animations -animations { - # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - enabled = true - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = borderangle, 1, 8, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default -} # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more dwindle { @@ -103,18 +53,8 @@ dwindle { preserve_split = true # You probably want this } -# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more -master { - new_status = master -} - # https://wiki.hyprland.org/Configuring/Variables/#misc misc { -# force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers -# disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( - disable_splash_rendering = true - disable_hyprland_logo = true # makes swww startup more seemless - enable_swallow = true swallow_regex = ^(com.mitchellh.ghostty)$ } @@ -143,150 +83,9 @@ input { } } -# https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - workspace_swipe = true -} - # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more device { name = epic-mouse-v1 sensitivity = -0.5 } - - -################### -### KEYBINDINGS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ -$mainMod = SUPER # Sets "Windows" key as main modifier - -# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, Q, exec, ghostty -bind = $mainMod, B, exec, firefox -bind = $mainMod, D, exec, walker -bind = $mainMod, S, exec, hyprshot -z --clipboard-only -m region -bind = $mainMod shift, S, exec, hyprshot -z --clipboard-only -m window -bind = $mainMod control, S, exec, hyprshot -z --clipboard-only -m active -bind = $mainMod, V, exec, sh ~/.config/hypr/hyprlock.sh - -bind = $mainMod, SPACE, togglefloating, -bind = $mainMod, W, killactive, -bind = $mainMod, M, exit, - -#bind = $mainMod, P, pseudo, # dwindle # have no clue what this does -bind = $mainMod, F, fullscreen -bind = $mainMod, C, togglesplit, # dwindle - -# Move focus with mainMod + arrow keys -bind = $mainMod, h, movefocus, l -bind = $mainMod, l, movefocus, r -bind = $mainMod, k, movefocus, u -bind = $mainMod, j, movefocus, d - -# brightness keys -bindel = , XF86MonBrightnessUp, exec, brightnessctl s +2% -bindel = , XF86MonBrightnessDown, exec, brightnessctl s 2%- - -# media keys -bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ -bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- -bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - -# Requires playerctl -bindl = , XF86AudioPlay, exec, playerctl play-pause -bindl = , XF86AudioPrev, exec, playerctl previous -bindl = , XF86AudioNext, exec, playerctl next - -# Switch workspaces with mainMod + [0-9] -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, workspace, 10 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 - -# Scroll through existing workspaces with mainMod + scroll -bind = $mainMod, mouse_down, workspace, e+1 -bind = $mainMod, mouse_up, workspace, e-1 - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow - -input:kb_options = caps:super - -# Controllers Binds -bind = $mainMod, page_up, workspace, e+1 -bind = $mainMod, page_down, workspace, e-1 -bind = $mainMod, insert, exec, hyprexit - -############################## -### WINDOWS AND WORKSPACES ### -############################## - -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules - -windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. - -windowrulev2 = noborder,initialClass:ulauncher -windowrulev2 = noblur,initialClass:ulauncher -windowrulev2 = noshadow,initialClass:ulauncher - -windowrulev2 = float,initialTitle:(^KeePassXC - Browser Access Request$) - -windowrulev2 = noanim,initialTitle:(^flameshot$) -windowrulev2 = float,initialTitle:(^flameshot$) - -windowrulev2 = float, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) -windowrulev2 = pin, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) -windowrulev2 = noinitialfocus, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) -windowrulev2 = size 502 286, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) -windowrulev2 = move 72% 6%, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) -windowrulev2 = keepaspectratio, initialTitle:(^Picture-in-Picture$), initialClass:(^firefox$) - -windowrulev2 = move -100% -100%, initialClass:(^xwaylandvideobridge$) -windowrulev2 = noinitialfocus, initialClass:(^xwaylandvideobridge$) - -windowrulev2 = dimaround, initialClass:(^polkit-gnome-authentication-agent-1$) -windowrulev2 = center, initialClass:(^polkit-gnome-authentication-agent-1$) -windowrulev2 = float, initialClass:(^polkit-gnome-authentication-agent-1$) -windowrulev2 = pin, initialClass:(^polkit-gnome-authentication-agent-1$) -windowrulev2 = stayfocused, initialClass:(^polkit-gnome-authentication-agent-1$) -windowrulev2 = animation slidein, initialClass:(^polkit-gnome-authentication-agent-1$) - -windowrulev2 = dimaround, initialClass:(^opensnitch_ui$) -windowrulev2 = stayfocused, initialClass:(^opensnitch_ui$) -windowrulev2 = animation slidein, initialClass:(^opensnitch_ui$) -windowrulev2 = float, initialClass:(^opensnitch_ui$) -windowrulev2 = size 960 540, initialClass:(^opensnitch_ui$) -windowrulev2 = center, initialClass:(^opensnitch_ui$) - -windowrulev2 = idleinhibit fullscreen, initialTitle:(.*) - -windowrulev2 = pin, initialTitle:(^Steam Input On-screen Keyboard$) -windowrulev2 = noblur, initialTitle:(^Steam Input On-screen Keyboard$) -windowrulev2 = bordersize 0, initialTitle:(^Steam Input On-screen Keyboard$) -windowrulev2 = noshadow, initialTitle:(^Steam Input On-screen Keyboard$) - -# layer rules -layerrule = animation slide top, waybar diff --git a/stow/.config/hypr/hyprlock.conf b/stow/.config/hypr/hyprlock.conf deleted file mode 100644 index 2cf4d73..0000000 --- a/stow/.config/hypr/hyprlock.conf +++ /dev/null @@ -1,34 +0,0 @@ -general { - hide_cursor = true - grace = 1 - ignore_empty_input = true - enable_fingerprint = true - -} - -background { - path = /tmp/hyprlock-background - blur_passes = 3 - blur_size 15 - noise = 0.01 -} - -input-field { - fade_on_empty = true - halign = right - valign = bottom - position = -100, 100 - inner_color = rgb(0, 0, 0) - outer_color = rgb(0, 0, 0) - font_color = rgb(255, 255, 255) - rounding = 0 -} - -label { - position = 0, 0 - valign = center - halign = center - font_size = 256 - font_family = ComicShannsMono Nerd Font - text = $TIME12 -} diff --git a/stow/.config/hypr/hyprlock.sh b/stow/.config/hypr/hyprlock.sh index 0ea0c07..a766a0b 100755 --- a/stow/.config/hypr/hyprlock.sh +++ b/stow/.config/hypr/hyprlock.sh @@ -1,9 +1,5 @@ #!/bin/sh -# gets the last part of the 'swww query' command -# should work as long as image path does not have spaces -IMAGE="$(swww query | rev | cut -f1 -d' ' | rev)" - -cp "$IMAGE" /tmp/hyprlock-background +1password --lock & hyprlock diff --git a/stow/.config/hypr/rules.conf b/stow/.config/hypr/rules.conf new file mode 100644 index 0000000..14d5fae --- /dev/null +++ b/stow/.config/hypr/rules.conf @@ -0,0 +1,97 @@ +# +# windows and workspaces +# https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + +windowrule { + name = windowrule-1 + suppress_event = maximize + match:class = .* # You'll probably like this. +} + +windowrule { + name = inhibit-fullscreen + idle_inhibit = fullscreen + match:initial_title = (.*) +} + + +windowrule { + name = float-keypass-confirmation + float = on + center = on + size = 600 225 + match:initial_title = (^KeePassXC - .*) +} + +windowrule { + name = windowrule-6 + float = on + pin = on + no_initial_focus = on + size = (monitor_w*0.25) (monitor_h*0.25) + move = ((monitor_w-window_w)-65) 5 + keep_aspect_ratio = false + match:initial_title = (^Picture-in-Picture$) + match:initial_class = (^firefox$) +} + + +windowrule { + name = hide-xwaylandvideobridge + move = (-(monitor_w*1)) (-(monitor_h*1)) + no_initial_focus = on + match:initial_class = (^xwaylandvideobridge$) +} + + +windowrule { + name = polkit + dim_around = on + center = on + float = on + pin = on + stay_focused = on + animation = gnomed + match:initial_title = (^Hyprland Polkit Agent$) +} + + +windowrule { + name = opensnitch-confirmation + dim_around = on + stay_focused = on + animation = slidein + float = on + size = 960 540 + center = on + match:initial_class = (^opensnitch_ui$) + match:initial_title = negative:(^OpenSnitch Network Statistics 1.8.0$) +} + + +windowrule { + name = steam-onscreen-keyboard + pin = on + no_blur = on + border_size = 0 + no_shadow = on + match:initial_title = (^Steam Input On-screen Keyboard$) +} + +# disable fade animation for vicinae only +layerrule { + name = layerrule-1 + no_anim = on + blur = on + ignore_alpha = 0 + match:namespace = vicinae +} + +# layer rules +layerrule { + name = layerrule-2 + animation = slide right + match:namespace = waybar +} + diff --git a/stow/.config/matugen/config.toml b/stow/.config/matugen/config.toml index e19e302..0a86e13 100644 --- a/stow/.config/matugen/config.toml +++ b/stow/.config/matugen/config.toml @@ -1,11 +1,12 @@ +[config] +import_json_files = ["./custom.json"] +caching = false + [config.wallpaper] command = "swww" arguments = ["img", "--transition-type", "center"] set = true -[config.custom_keywords] -font = "ComicShannsMono Nerd Font" - [templates.waybar] input_path = './templates/colors.css' output_path = '~/.config/waybar/colors.css' @@ -23,6 +24,7 @@ output_path = '~/.config/gtk-3.0/gtk.css' [templates.gtk4] input_path = './templates/gtk-colors.css' output_path = '~/.config/gtk-4.0/gtk.css' +post_hook = "gsettings set org.gnome.desktop.interface color-scheme 'prefer-{{mode}}'" [templates.matugen] input_path = './templates/walker.css' @@ -40,7 +42,63 @@ output_path = '~/.config/qt5ct/colors/matugen.conf' input_path = './templates/qtct.conf' output_path = '~/.config/qt6ct/colors/matugen.conf' -[templates.pywalfox] -input_path = './templates/pywalfox.json' -output_path = '~/.cache/wal/colors.json' -post_hook = 'pywalfox update' +[templates.hyprlock] +input_path = './templates/hyprlock.conf' +output_path = '~/.config/hypr/hyprlock.conf' + +[templates.discord] +input_path = './templates/discord.css' +output_path = '~/.config/Vencord/themes/midnight-discord.css' + +[templates.sketchybar] +input_path = './templates/sketchybar.sh' +output_path = '~/.config/sketchybar/colours.sh' +post_hook = 'sketchybar --reload' + +[templates.jankyborders] +input_path = './templates/jankyborders.sh' +output_path = '~/.cache/matugen-jankyborders.sh' +post_hook = 'sh ~/.cache/matugen-jankyborders.sh & disown' + +[templates.zsh] +input_path = './templates/zsh.sh' +output_path = '~/.cache/zsh_colours.sh' + +[templates.fuzzel] +input_path = './templates/fuzzel.ini' +output_path = '~/.config/fuzzel/colors.ini' + +[templates.ghostty] +input_path = './templates/ghostty' +output_path = '~/.config/ghostty/matugen' + +[templates.vicinae] +input_path = './templates/vicinae.toml' +output_path = '~/.local/share/vicinae/themes/matugen.toml' +post_hook = 'vicinae theme set matugen' + +[templates.tmux] +input_path = './templates/tmux.conf' +output_path = '~/.cache/matugen/tmux.conf' +post_hook = 'tmux source-file ~/.cache/matugen/tmux.conf' + +[templates.macos-accent] +colors_to_compare = [ + { name = "-1", color = "#696766" }, # graphite + { name = "0", color = "#C03437" }, # red + { name = "1", color = "#C65D0A" }, # orange + { name = "2", color = "#BE8F0F" }, # yellow + { name = "3", color = "#409226" }, # green + { name = "4", color = "#1B5DC7" }, # blue + { name = "5", color = "#AD29AB" }, # purple + { name = "6", color = "#BC3F77" }, # pink +] + +compare_to = "{{colors.primary.default.hex}}" +pre_hook = "defaults write -globalDomain AppleAccentColor -int {{closest_color}}" +post_hook = "~/.config/matugen/scripts/macos-accent-notification" +input_path = "/dev/null" + +[templates.macos-dark-mode] +input_path = "/dev/null" +post_hook = '~/.config/matugen/scripts/macos-darkmode.sh {{mode}}' diff --git a/stow/.config/matugen/custom.json b/stow/.config/matugen/custom.json new file mode 100644 index 0000000..3d66f10 --- /dev/null +++ b/stow/.config/matugen/custom.json @@ -0,0 +1,5 @@ +{ + "font": "Comic Neue", + "monospace_font": "ComicShannsMono Nerd Font", + "rounding": 0 +} diff --git a/stow/.config/matugen/scripts/macos-accent-notification b/stow/.config/matugen/scripts/macos-accent-notification new file mode 100755 index 0000000..261fc01 --- /dev/null +++ b/stow/.config/matugen/scripts/macos-accent-notification @@ -0,0 +1,14 @@ +#!/usr/bin/env swift +// from: https://alexwlchan.net/2022/changing-the-macos-accent-colour/ + +import Foundation + +let notifications = [ + "AppleColorPreferencesChangedNotification", + "AppleAquaColorVariantChanged" +] + +for name in notifications { + let notifyEvent = Notification.Name(name) + DistributedNotificationCenter.default().post(name: notifyEvent, object: nil) +} diff --git a/stow/.config/matugen/scripts/macos-darkmode.sh b/stow/.config/matugen/scripts/macos-darkmode.sh new file mode 100755 index 0000000..fd9d44e --- /dev/null +++ b/stow/.config/matugen/scripts/macos-darkmode.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$1" = "dark" ]; then + osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to true' +elif [ "$1" = "light" ]; then + osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to false' +else + echo "$0: [dark|light]" +fi diff --git a/stow/.config/matugen/templates/colors.css b/stow/.config/matugen/templates/colors.css index 222a58c..329229c 100644 --- a/stow/.config/matugen/templates/colors.css +++ b/stow/.config/matugen/templates/colors.css @@ -4,7 +4,8 @@ */ * { - font-family: {{ custom.font }}; + font-family: {{ font }}, {{monospace_font}}; + border-radius: {{ rounding }}px; } <* for name, value in colors *> diff --git a/stow/.config/matugen/templates/discord.css b/stow/.config/matugen/templates/discord.css new file mode 100644 index 0000000..a592426 --- /dev/null +++ b/stow/.config/matugen/templates/discord.css @@ -0,0 +1,109 @@ +/** + * @name midnight + * @description A dark, rounded discord theme. + * @author refact0r + * @version 1.6.2 + * @invite nz87hXyvcy + * @website https://github.com/refact0r/midnight-discord + * @source https://github.com/refact0r/midnight-discord/blob/master/midnight.theme.css + * @authorId 508863359777505290 + * @authorLink https://www.refact0r.dev +*/ + +/* IMPORTANT: make sure to enable dark mode in discord settings for the theme to apply properly!!! */ + +@import url('https://refact0r.github.io/midnight-discord/build/midnight.css'); + +/* customize things here */ +:root { + /* font, change to 'gg sans' for default discord font*/ + --font: '{{ font }}'; + --code-font: '{{ monospace_font }}'; + + /* top left corner text */ + --corner-text: 'Midnight'; + + /* color of status indicators and window controls */ + --online-indicator: {{colors.inverse_primary.default.hex}}; /* change to #23a55a for default green */ + --dnd-indicator: {{colors.error.default.hex}}; /* change to #f13f43 for default red */ + --idle-indicator: {{colors.tertiary_container.default.hex}}; /* change to #f0b232 for default yellow */ + --streaming-indicator: {{colors.on_primary.default.hex}}; /* change to #593695 for default purple */ + + /* accent colors */ + --accent-1: {{colors.tertiary.default.hex}}; /* links */ + --accent-2: {{colors.primary.default.hex}}; /* general unread/mention elements, some icons when active */ + --accent-3: {{colors.primary.default.hex}}; /* accent buttons */ + --accent-4: {{colors.surface_bright.default.hex}}; /* accent buttons when hovered */ + --accent-5: {{colors.primary_fixed_dim.default.hex}}; /* accent buttons when clicked */ + --mention: {{colors.surface.default.hex}}; /* mentions & mention messages */ + --mention-hover: {{colors.surface_bright.default.hex}}; /* mentions & mention messages when hovered */ + + /* text colors */ + --text-0: {{colors.surface.default.hex}}; /* text on colored elements */ + --text-1: {{colors.on_surface.default.hex}}; /* other normally white text */ + --text-2: {{colors.on_surface.default.hex}}; /* headings and important text */ + --text-3: {{colors.on_surface_variant.default.hex}}; /* normal text */ + --text-4: {{colors.on_surface_variant.default.hex}}; /* icon buttons and channels */ + --text-5: {{colors.outline.default.hex}}; /* muted channels/chats and timestamps */ + + /* background and dark colors */ + --bg-1: {{colors.primary.default.hex}}; /* dark buttons when clicked */ + --bg-2: {{colors.surface_container_high.default.hex}}; /* dark buttons */ + --bg-3: {{colors.surface_container_low.default.hex}}; /* spacing, secondary elements */ + --bg-4: {{colors.surface.default.hex}}; /* main background color */ + --hover: {{colors.surface_bright.default.hex}}; /* channels and buttons when hovered */ + --active: {{colors.surface_bright.default.hex}}; /* channels and buttons when clicked or selected */ + --message-hover: {{colors.surface_bright.default.hex}}; /* messages when hovered */ + + /* amount of spacing and padding */ + --spacing: 12px; + + /* animations */ + /* ALL ANIMATIONS CAN BE DISABLED WITH REDUCED MOTION IN DISCORD SETTINGS */ + --list-item-transition: 0.2s ease; /* channels/members/settings hover transition */ + --unread-bar-transition: 0.2s ease; /* unread bar moving into view transition */ + --moon-spin-transition: 0.4s ease; /* moon icon spin */ + --icon-spin-transition: 1s ease; /* round icon button spin (settings, emoji, etc.) */ + + /* corner roundness (border-radius) */ + --roundness-xl: {{ rounding }}px; /* roundness of big panel outer corners */ + --roundness-l: {{ rounding }}px; /* popout panels */ + --roundness-m: {{ rounding }}px; /* smaller panels, images, embeds */ + --roundness-s: {{ rounding }}px; /* members, settings inputs */ + --roundness-xs: {{ rounding }}px; /* channels, buttons */ + --roundness-xxs: {{ rounding }}px; /* searchbar, small elements */ + + /* direct messages moon icon */ + /* change to block to show, none to hide */ + --discord-icon: block; /* discord icon */ + --moon-icon: show; /* moon icon */ + --moon-icon-url: url('https://upload.wikimedia.org/wikipedia/commons/c/c4/Font_Awesome_5_solid_moon.svg'); /* custom icon url */ + --moon-icon-size: auto; + + /* filter uncolorable elements to fit theme */ + /* (just set to none, they're too much work to configure) */ + --login-bg-filter: saturate(0.3) hue-rotate(-15deg) brightness(0.4); /* login background artwork */ + --green-to-accent-3-filter: hue-rotate(56deg) saturate(1.43); /* add friend page explore icon */ + --blurple-to-accent-3-filter: hue-rotate(304deg) saturate(0.84) brightness(1.2); /* add friend page school icon */ +} + +/* Setting font in :root doesn't work for some reason */ +body { + font-family: '{{ font }}'; +} + +code { + font-family: '{{monospace_font}}'; +} + +/* Selected chat/friend text */ +.selected_f5eb4b, +.selected_f6f816 .link_d8bfb3 { + color: var(--text-0) !important; + background: var(--accent-3) !important; +} + +.selected_f6f816 .link_d8bfb3 * { + color: var(--text-0) !important; + fill: var(--text-0) !important; +} diff --git a/stow/.config/matugen/templates/fuzzel.ini b/stow/.config/matugen/templates/fuzzel.ini new file mode 100644 index 0000000..d6c657f --- /dev/null +++ b/stow/.config/matugen/templates/fuzzel.ini @@ -0,0 +1,18 @@ +# Fuzzel Colors +# Generated with Matugen + +[main] +font=ComicShannsMono Nerd Font + +[colors] +background={{colors.background.default.hex_stripped}}ff +text={{colors.on_surface.default.hex_stripped}}ff +prompt={{colors.secondary.default.hex_stripped}}ff +placeholder={{colors.tertiary.default.hex_stripped}}ff +input={{colors.primary.default.hex_stripped}}ff +match={{colors.tertiary.default.hex_stripped}}ff +selection={{colors.primary.default.hex_stripped}}ff +selection-text={{colors.background.default.hex_stripped}}ff +selection-match={{colors.on_primary.default.hex_stripped}}ff +counter={{colors.secondary.default.hex_stripped}}ff +border={{colors.primary.default.hex_stripped}}ff diff --git a/stow/.config/matugen/templates/ghostty b/stow/.config/matugen/templates/ghostty new file mode 100644 index 0000000..36c1e94 --- /dev/null +++ b/stow/.config/matugen/templates/ghostty @@ -0,0 +1,2 @@ +background = {{colors.background.default.hex}} +font-family = {{monospace_font}} diff --git a/stow/.config/matugen/templates/hyprland.conf b/stow/.config/matugen/templates/hyprland.conf index fa2cac5..34d47c1 100644 --- a/stow/.config/matugen/templates/hyprland.conf +++ b/stow/.config/matugen/templates/hyprland.conf @@ -5,6 +5,7 @@ general { } decoration { + rounding = {{ rounding }} shadow { color = rgba({{colors.shadow.default.hex_stripped}}ee) } diff --git a/stow/.config/matugen/templates/hyprlock.conf b/stow/.config/matugen/templates/hyprlock.conf new file mode 100644 index 0000000..8a17366 --- /dev/null +++ b/stow/.config/matugen/templates/hyprlock.conf @@ -0,0 +1,71 @@ +general { + grace = 7 +} + +background { + monitor = + path = {{image}} + color = {{colors.primary.default.rgba}} + blur_passes = 1 # 0 disables blurring + blur_size = 3 +# contrast = 0.8916 +# brightness = 0.8172 +} + +label { + monitor = + text = cmd[update:10000] date '+%I' + font_family = {{font}} + font_size = 256 + color = {{colors.primary.default.rgba}} + + position = 0, 256 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:10000] date '+%M' + font_family = {{font}} + font_size = 256 + color = {{colors.secondary.default.rgba}} + + position = 0, 0 + halign = center + valign = center +} + +shape { + size = 500, 700 + position = 0, 100 + rounding = 50 + color = {{colors.background.default.rgba}} + halign = center + valign = center +} + +input-field { + monitor = + font_family = Comic Neue + size = 100, 100 + outline_thickness = 3 + dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_rounding = 0; + dots_center = true + + outer_color = {{colors.primary_container.default.rgba}} + inner_color = {{colors.background.default.rgba}} + font_color = {{colors.on_primary_container.default.rgba}} + fail_color = {{colors.error.default.rgba}} + + fade_on_empty = false + placeholder_text = 🔒 + hide_input = false + rounding = -1 + + position = 0, 100 + halign = center + valign = bottom +} diff --git a/stow/.config/matugen/templates/jankyborders.sh b/stow/.config/matugen/templates/jankyborders.sh new file mode 100644 index 0000000..ce6a348 --- /dev/null +++ b/stow/.config/matugen/templates/jankyborders.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +killall borders + +if [ "{{ rounding }}" = 0 ]; then + exec borders active_color=0xFF{{colors.primary.default.hex_stripped}} inactive_color=0xFF{{colors.background.default.hex_stripped}} width=6.0 style=square +else + exec borders active_color=0xFF{{colors.primary.default.hex_stripped}} inactive_color=0xFF{{colors.background.default.hex_stripped}} width=6.0 style=round +fi diff --git a/stow/.config/matugen/templates/pywalfox.json b/stow/.config/matugen/templates/pywalfox.json deleted file mode 100644 index 9ddf17f..0000000 --- a/stow/.config/matugen/templates/pywalfox.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "wallpaper": "{{image}}", - "alpha": "100", - "colors": { - "color0": "{{colors.background.default.hex}}", - "color1": "", - "color2": "", - "color3": "", - "color4": "", - "color5": "", - "color6": "", - "color7": "", - "color8": "", - "color9": "", - "color10": "{{colors.primary.default.hex}}", - "color11": "", - "color12": "", - "color13": "{{colors.surface_bright.default.hex}}", - "color14": "", - "color15": "{{colors.on_surface.default.hex}}" - } -} diff --git a/stow/.config/matugen/templates/sketchybar.sh b/stow/.config/matugen/templates/sketchybar.sh new file mode 100644 index 0000000..c795bb3 --- /dev/null +++ b/stow/.config/matugen/templates/sketchybar.sh @@ -0,0 +1,16 @@ +export PRIMARY_COLOUR="0xFF{{colors.primary.default.hex_stripped}}" +export PRIMARY_CONTAINER_COLOUR="0xFF{{colors.primary_container.default.hex_stripped}}" +export ON_PRIMARY_CONTAINER_COLOUR="0xFF{{colors.on_primary_container.default.hex_stripped}}" + +export SECONDARY_COLOUR="0xFF{{colors.secondary.default.hex_stripped}}" +export SECONDARY_CONTAINER_COLOUR="0xFF{{colors.secondary_container.default.hex_stripped}}" +export ON_SECONDARY_CONTAINER_COLOUR="0xFF{{colors.on_secondary_container.default.hex_stripped}}" + +export TERTIARY_COLOUR="0xFF{{colors.tertiary.default.hex_stripped}}" +export TERTIARY_CONTAINER_COLOUR="0xFF{{colors.tertiary_container.default.hex_stripped}}" +export ON_TERTIARY_CONTAINER_COLOUR="0xFF{{colors.on_tertiary_container.default.hex_stripped}}" + +export BACKGROUND_COLOUR=0xFF"{{colors.background.default.hex_stripped}}" +export FONT="{{ font }}" +export MONOSPACE_FONT="{{ monospace_font }}" +export ROUNDING="{{ rounding }}" diff --git a/stow/.config/matugen/templates/tmux.conf b/stow/.config/matugen/templates/tmux.conf new file mode 100644 index 0000000..ac1c289 --- /dev/null +++ b/stow/.config/matugen/templates/tmux.conf @@ -0,0 +1,13 @@ +set -g status-style "bg=default" +set -g status-fg "{{ colors.tertiary.default.hex }}" +set -g status-left "#[bg={{ colors.primary_container.default.hex }},fg={{ colors.on_primary_container.default.hex }}]#{?client_prefix,#[reverse]#[bg={{ colors.on_secondary_container.default.hex }}]#[fg=black]#[noreverse]} #S " +set -g status-right "#[fg={{ colors.secondary.default.hex }}]%d/%m #[bg={{ colors.primary_container.default.hex }},fg={{ colors.on_primary_container.default.hex }}] #H " + +# max allowed lenth for statuses to flow into +set -g status-left-length 20 +set -g status-right-length 20 + +# tab bar +set -g window-status-format " #I #W " +set -g window-status-current-format " #I #W " +set -g window-status-current-style bg={{ colors.secondary_container.default.hex }},fg={{ colors.on_secondary_container.default.hex }},bold diff --git a/stow/.config/matugen/templates/vicinae.toml b/stow/.config/matugen/templates/vicinae.toml new file mode 100644 index 0000000..b56dbfb --- /dev/null +++ b/stow/.config/matugen/templates/vicinae.toml @@ -0,0 +1,127 @@ +# Vicinae Matugen Theme Template +# Used LLM for initial generation, then modified to a satisfactory level + +[meta] +name = "Matugen" +description = "Material You theme generated by Matugen - {{mode}} variant" +variant = "{{mode}}" + +# ============================================================================ +# Core Colors +# ============================================================================ + +[colors.core] +accent = "{{colors.primary.default.hex}}" +accent_foreground = "{{colors.on_primary.default.hex}}" +background = "{{colors.surface.default.hex}}" +foreground = "{{colors.on_surface.default.hex}}" +secondary_background = "{{colors.surface_container.default.hex}}" +border = "{{colors.outline_variant.default.hex}}" + +# ============================================================================ +# Window Borders +# ============================================================================ + +[colors.main_window] +border = "{{colors.outline_variant.default.hex}}" + +[colors.settings_window] +border = "{{colors.outline.default.hex}}" + +# ============================================================================ +# Accent Palette +# ============================================================================ + +[colors.accents] +blue = "{{colors.primary.default.hex}}" +green = "{{colors.tertiary.default.hex}}" +magenta = "{{colors.secondary.default.hex}}" +orange = { name = "{{colors.error.default.hex}}", lighter = 40 } +red = "{{colors.error.default.hex}}" +yellow = { name = "{{colors.tertiary.default.hex}}", lighter = 80 } +cyan = { name = "{{colors.primary.default.hex}}", lighter = 50 } +purple = "{{colors.secondary.default.hex}}" + +# ============================================================================ +# Text System +# ============================================================================ + +[colors.text] +default = "{{colors.on_surface.default.hex}}" +muted = "{{colors.on_surface_variant.default.hex}}" +danger = "{{colors.error.default.hex}}" +success = "{{colors.tertiary.default.hex}}" +placeholder = { name = "{{colors.on_surface_variant.default.hex}}", opacity = 0.6 } + +[colors.text.selection] +background = "{{colors.primary.default.hex}}" +foreground = "{{colors.on_primary.default.hex}}" + +[colors.text.links] +default = "{{colors.primary.default.hex}}" +visited = { name = "{{colors.tertiary.default.hex}}", darker = 20 } + +# ============================================================================ +# Input Fields +# ============================================================================ + +[colors.input] +border = "{{colors.outline.default.hex}}" +border_focus = "{{colors.primary.default.hex}}" +border_error = "{{colors.error.default.hex}}" + +# ============================================================================ +# Buttons +# ============================================================================ + +[colors.button.primary] +background = "{{colors.surface_container_high.default.hex}}" +foreground = "{{colors.on_surface.default.hex}}" + +[colors.button.primary.hover] +background = "{{colors.surface_container_highest.default.hex}}" + +[colors.button.primary.focus] +outline = "{{colors.primary.default.hex}}" + +# ============================================================================ +# Lists +# ============================================================================ + +[colors.list.item.hover] +background = { name = "{{colors.primary_container.default.hex}}", opacity = 0.25 } +foreground = "{{colors.on_surface.default.hex}}" + +[colors.list.item.selection] +background = { name = "{{colors.primary_container.default.hex}}", opacity = 0.50 } +foreground = "{{colors.on_primary_container.default.hex}}" +secondary_background = "{{colors.primary_container.default.hex}}" +secondary_foreground = "{{colors.on_primary_container.default.hex}}" + +# ============================================================================ +# Grid Items +# ============================================================================ + +[colors.grid.item] +background = "{{colors.surface_container.default.hex}}" + +[colors.grid.item.hover] +outline = { name = "{{colors.secondary.default.hex}}", opacity = 0.8 } + +[colors.grid.item.selection] +outline = { name = "{{colors.primary.default.hex}}" } + +# ============================================================================ +# Scrollbars +# ============================================================================ + +[colors.scrollbars] +background = { name = "{{colors.primary.default.hex}}", opacity = 0.2 } + +# ============================================================================ +# Loading States +# ============================================================================ + +[colors.loading] +bar = "{{colors.primary.default.hex}}" +spinner = "{{colors.primary.default.hex}}" diff --git a/stow/.config/matugen/templates/walker.css b/stow/.config/matugen/templates/walker.css index 039d8b4..02d62f8 100644 --- a/stow/.config/matugen/templates/walker.css +++ b/stow/.config/matugen/templates/walker.css @@ -8,7 +8,8 @@ @define-color primary {{colors.primary_container.default.hex}}; * { - font-family: {{ custom.font }}; + font-family: {{ font }}; + background-radius: {{ rounding }}px; } #window, @@ -46,7 +47,7 @@ slider, } #box { - border-radius: 20px; + border-radius: {{ rounding }}px; background: @background; padding: 32px; border: 1px solid lighter(@background); @@ -78,7 +79,7 @@ slider, #password, #input, #typeahead { - border-radius: 2px; + border-radius: {{ rounding }}px; } #input { @@ -106,7 +107,7 @@ slider, child { padding: 8px; - border-radius: 2px; + border-radius: {{ rounding }}px; } child:selected, @@ -153,7 +154,7 @@ child:hover { .aiItem { padding: 10px; - border-radius: 2px; + border-radius: {{ rounding }}px; color: @foreground; background: @background; } diff --git a/stow/.config/matugen/templates/zsh.sh b/stow/.config/matugen/templates/zsh.sh new file mode 100644 index 0000000..0de3aa2 --- /dev/null +++ b/stow/.config/matugen/templates/zsh.sh @@ -0,0 +1,2 @@ +PRIMARY_COLOUR="{#{{colors.primary.default.hex_stripped}}}" +SECONDARY_COLOUR="{#{{colors.secondary.default.hex_stripped}}}" diff --git a/stow/.config/npm/npmrc b/stow/.config/npm/npmrc new file mode 100644 index 0000000..b12cc98 --- /dev/null +++ b/stow/.config/npm/npmrc @@ -0,0 +1,4 @@ +prefix=${XDG_DATA_HOME}/npm +cache=${XDG_CACHE_HOME}/npm +init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js +logs-dir=${XDG_STATE_HOME}/npm/logs diff --git a/stow/.config/nvim/lazy-lock.json b/stow/.config/nvim/lazy-lock.json index 3b8a0ce..0e0d602 100644 --- a/stow/.config/nvim/lazy-lock.json +++ b/stow/.config/nvim/lazy-lock.json @@ -1,28 +1,21 @@ { - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, - "bullets.vim": { "branch": "master", "commit": "8f3259e807c40b91d247f612823295ab99777a65" }, - "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "fzf-lua": { "branch": "main", "commit": "8adf950093af5361621cf52208d64995b1af78b5" }, - "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, - "headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" }, - "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, - "lazy-lsp.nvim": { "branch": "master", "commit": "701893d2d60c7eff894324748073f682065999a2" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "mini.pick": { "branch": "main", "commit": "f02e64580a547346128799ba667dfc0e29737532" }, - "neogit": { "branch": "master", "commit": "7cec58c9272d61da5d77fe5869e3956b8a91f1eb" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lspconfig": { "branch": "master", "commit": "f610208989e9c03561f9f601db3133f6ae398fcd" }, - "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" } + "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "1ce96a464fdbc24208e24c117e2021794259005d" }, + "lazy-lsp.nvim": { "branch": "master", "commit": "aa96fb9f76f487522c5886d5a6752580b1cd0dd6" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" }, + "neogit": { "branch": "master", "commit": "73870229977fdd8747025820e15e98cfde787b9c" }, + "nvim-lspconfig": { "branch": "master", "commit": "66fd02ad1c7ea31616d3ca678fa04e6d0b360824" }, + "nvim-treesitter": { "branch": "main", "commit": "45a07f869b0cffba342276f2c77ba7c116d35db8" }, + "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, + "oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" }, + "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/stow/.config/nvim/lua/nico/lazy/blink.lua b/stow/.config/nvim/lua/nico/lazy/blink.lua new file mode 100644 index 0000000..29c79a9 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/blink.lua @@ -0,0 +1,29 @@ +return { + 'saghen/blink.cmp', + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = '1.*', + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + opts = { + keymap = { preset = 'default' }, + + appearance = { + nerd_font_variant = 'mono' + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + fuzzy = { implementation = "prefer_rust_with_warning" } + }, + opts_extend = { "sources.default" } +} diff --git a/stow/.config/nvim/lua/nico/lazy/bullets.lua b/stow/.config/nvim/lua/nico/lazy/bullets.lua deleted file mode 100644 index 476a27f..0000000 --- a/stow/.config/nvim/lua/nico/lazy/bullets.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "bullets-vim/bullets.vim", -} diff --git a/stow/.config/nvim/lua/nico/lazy/headlines.lua b/stow/.config/nvim/lua/nico/lazy/headlines.lua deleted file mode 100644 index 9a30354..0000000 --- a/stow/.config/nvim/lua/nico/lazy/headlines.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "lukas-reineke/headlines.nvim", - dependencies = "nvim-treesitter/nvim-treesitter", - config = true -} diff --git a/stow/.config/nvim/lua/nico/lazy/image.lua b/stow/.config/nvim/lua/nico/lazy/image.lua deleted file mode 100644 index eb568a5..0000000 --- a/stow/.config/nvim/lua/nico/lazy/image.lua +++ /dev/null @@ -1,43 +0,0 @@ -return { - "3rd/image.nvim", - build = false, - config = function() - require("image").setup({ - backend = "kitty", - processor = "magick_cli", -- or "magick_rock" - integrations = { - markdown = { - enabled = true, - clear_in_insert_mode = false, - download_remote_images = true, - only_render_image_at_cursor = false, - floating_windows = false, -- if true, images will be rendered in floating markdown windows - filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here - }, - neorg = { - enabled = true, - filetypes = { "norg" }, - }, - typst = { - enabled = true, - filetypes = { "typst" }, - }, - html = { - enabled = false, - }, - css = { - enabled = false, - }, - }, - max_width = nil, - max_height = nil, - max_width_window_percentage = nil, - max_height_window_percentage = 50, - window_overlap_clear_enabled = true, -- toggles images when windows are overlapped - window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, - editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus - tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) - hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened - }) - end -} diff --git a/stow/.config/nvim/lua/nico/lazy/lsp.lua b/stow/.config/nvim/lua/nico/lazy/lsp.lua index 6947078..234326d 100644 --- a/stow/.config/nvim/lua/nico/lazy/lsp.lua +++ b/stow/.config/nvim/lua/nico/lazy/lsp.lua @@ -1,102 +1,24 @@ return { - "neovim/nvim-lspconfig", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/nvim-cmp", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "j-hui/fidget.nvim", - "dundalek/lazy-lsp.nvim", - }, + "neovim/nvim-lspconfig", + dependencies = { + "j-hui/fidget.nvim", -- lsp status + "dundalek/lazy-lsp.nvim", -- load LSPs from nix + }, + config = function() + require("fidget").setup {} + require("lazy-lsp").setup { + use_vim_lsp_config = true + } - config = function() - local cmp = require('cmp') - local cmp_lsp = require("cmp_nvim_lsp") - local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - cmp_lsp.default_capabilities()) - - require("fidget").setup({}) - - require("lazy-lsp").setup { - -- By default all available servers are set up. Exclude unwanted or misbehaving servers. - excluded_servers = { - "ccls", "zk", "bufls", "ruff_lsp" - }, - -- Alternatively specify preferred servers for a filetype (others will be ignored). - preferred_servers = { - markdown = {}, - python = { "pyright" }, - nix = { "nil_ls" }, - rust = { "rust_analyzer" }, - go = { "gopls" }, - c = { "clangd" }, - }, - prefer_local = true, -- Prefer locally installed servers over nix-shell - -- Default config passed to all servers to specify on_attach callback and other options. - default_config = { - flags = { - debounce_text_changes = 150, - }, - -- on_attach = on_attach, - -- capabilities = capabilities, - }, - -- Override config for specific servers that will passed down to lspconfig setup. - -- Note that the default_config will be merged with this specific configuration so you don't need to specify everything twice. - configs = { - lua_ls = { - settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - }, - }, - }, - }, - } - - - local cmp_select = { behavior = cmp.SelectBehavior.Select } - - cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. - }, { - { name = 'buffer' }, - }) - }) - - vim.diagnostic.config({ - -- update_in_insert = true, - float = { - focusable = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, - }) - end + vim.lsp.enable({ + 'gopls', -- go + 'pyright', -- python + 'lua_ls', -- lua + 'rust-analyzer', -- rust + 'nil_ls', -- nix + 'bashls', -- bash + 'html', -- html + 'cssls', -- css + }) + end, } diff --git a/stow/.config/nvim/lua/nico/lazy/neogit.lua b/stow/.config/nvim/lua/nico/lazy/neogit.lua index 49a5a7f..17944e2 100644 --- a/stow/.config/nvim/lua/nico/lazy/neogit.lua +++ b/stow/.config/nvim/lua/nico/lazy/neogit.lua @@ -3,15 +3,11 @@ return { dependencies = { "nvim-lua/plenary.nvim", -- required "sindrets/diffview.nvim", -- optional - Diff integration - - -- Only one of these is needed. "nvim-telescope/telescope.nvim", -- optional - "ibhagwan/fzf-lua", -- optional - "echasnovski/mini.pick", -- optional }, - config = function(_, opts) - vim.keymap.set('n', 'g', 'Neogit') - require('neogit').setup(opts) -- this works idk how - end + cmd = "Neogit", + keys = { + { "g", "Neogit", desc = "Show Neogit UI" } + } } diff --git a/stow/.config/nvim/lua/nico/lazy/render-markdown.lua b/stow/.config/nvim/lua/nico/lazy/render-markdown.lua new file mode 100644 index 0000000..4a2769d --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/render-markdown.lua @@ -0,0 +1,8 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, +} diff --git a/stow/.config/nvim/lua/nico/lazy/telescope.lua b/stow/.config/nvim/lua/nico/lazy/telescope.lua index fcbe2e3..72fdde6 100644 --- a/stow/.config/nvim/lua/nico/lazy/telescope.lua +++ b/stow/.config/nvim/lua/nico/lazy/telescope.lua @@ -1,6 +1,6 @@ return { 'nvim-telescope/telescope.nvim', - tag = '0.1.8', + tag = 'v0.2.1', dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('telescope').setup({ @@ -18,6 +18,6 @@ return { vim.keymap.set('n', 'ff', builtin.find_files, {}) vim.keymap.set('n', 'fg', builtin.git_files, {}) - vim.keymap.set('n', 'fs', builtin.grep_string, {}) + vim.keymap.set('n', 'fs', builtin.live_grep, {}) end } diff --git a/stow/.config/nvim/lua/nico/lazy/treesitter.lua b/stow/.config/nvim/lua/nico/lazy/treesitter.lua index c86b91c..5be8b1b 100644 --- a/stow/.config/nvim/lua/nico/lazy/treesitter.lua +++ b/stow/.config/nvim/lua/nico/lazy/treesitter.lua @@ -1,14 +1,4 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", - config = function () - local configs = require("nvim-treesitter.configs") - - configs.setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html", "markdown", "go" }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - end } diff --git a/stow/.config/nvim/lua/nico/lazy/which-key.lua b/stow/.config/nvim/lua/nico/lazy/which-key.lua new file mode 100644 index 0000000..9fadb97 --- /dev/null +++ b/stow/.config/nvim/lua/nico/lazy/which-key.lua @@ -0,0 +1,18 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/stow/.config/nvim/lua/nico/opts.lua b/stow/.config/nvim/lua/nico/opts.lua index 665a425..5708e44 100644 --- a/stow/.config/nvim/lua/nico/opts.lua +++ b/stow/.config/nvim/lua/nico/opts.lua @@ -1,4 +1,5 @@ vim.opt.termguicolors = true +vim.o.winborder = 'rounded' vim.opt.number = true vim.opt.relativenumber = true diff --git a/stow/.config/nvim/lua/nico/txt/enter.lua b/stow/.config/nvim/lua/nico/txt/enter.lua deleted file mode 100644 index f181d9c..0000000 --- a/stow/.config/nvim/lua/nico/txt/enter.lua +++ /dev/null @@ -1,21 +0,0 @@ --- opts -vim.opt.wrap = true -vim.opt.linebreak = true -vim.opt.textwidth = 80 -vim.opt.formatoptions:append("t") - --- ai slop that gets the job done --- redo formatting when leaving the insert mode -vim.api.nvim_create_augroup("FormatText", { clear = true }) - -vim.api.nvim_create_autocmd("FileType", { - pattern = { "markdown", "txt" }, - callback = function() - vim.api.nvim_create_autocmd("InsertLeave", { - buffer = 0, - callback = function() - vim.cmd("normal! gggqG") - end, - }) - end, -}) diff --git a/stow/.config/nvim/lua/nico/txt/init.lua b/stow/.config/nvim/lua/nico/txt/init.lua deleted file mode 100644 index f83ccec..0000000 --- a/stow/.config/nvim/lua/nico/txt/init.lua +++ /dev/null @@ -1,16 +0,0 @@ --- another slopination by ai -vim.api.nvim_create_augroup("LoadLuaOnMarkdownOrTxt", { clear = true }) -vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { - pattern = {"*.md", "*.txt"}, - callback = function() - require("nico.txt.enter") - end -}) - -vim.api.nvim_create_autocmd("BufLeave", { - pattern = {"*.md", "*.txt"}, - callback = function() - require("nico.txt.leave") - require("nico.opts") - end -}) diff --git a/stow/.config/nvim/lua/nico/txt/leave.lua b/stow/.config/nvim/lua/nico/txt/leave.lua deleted file mode 100644 index e2bc41d..0000000 --- a/stow/.config/nvim/lua/nico/txt/leave.lua +++ /dev/null @@ -1,10 +0,0 @@ --- opts --- neovim defaults -vim.opt.wrap = true -vim.opt.linebreak = false -vim.opt.textwidth = 0 -vim.opt.formatoptions = "tcqj" - --- ai slop that gets the job done --- disables redo formatting when leaving the insert mode -vim.api.nvim_create_augroup("FormatText", { clear = true }) diff --git a/stow/.config/sketchybar/.gitignore b/stow/.config/sketchybar/.gitignore new file mode 100644 index 0000000..ea7df9d --- /dev/null +++ b/stow/.config/sketchybar/.gitignore @@ -0,0 +1 @@ +colours.sh diff --git a/stow/.config/sketchybar/plugins/aerospace.sh b/stow/.config/sketchybar/plugins/aerospace.sh new file mode 100755 index 0000000..d25758d --- /dev/null +++ b/stow/.config/sketchybar/plugins/aerospace.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# make sure it's executable with: +# chmod +x ~/.config/sketchybar/plugins/aerospace.sh +# +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/../colours.sh + +if [ "$1" = "$FOCUSED_WORKSPACE" ]; then + # If workspace is focused + sketchybar --set $NAME background.color=$PRIMARY_COLOUR label.color=$BACKGROUND_COLOUR +else + sketchybar --set $NAME background.color=$BACKGROUND_COLOUR label.color=$PRIMARY_COLOUR +fi diff --git a/stow/.config/sketchybar/plugins/clock.sh b/stow/.config/sketchybar/plugins/clock.sh index 2716ee4..2d6dbe4 100755 --- a/stow/.config/sketchybar/plugins/clock.sh +++ b/stow/.config/sketchybar/plugins/clock.sh @@ -4,12 +4,4 @@ # the item invoking this script: # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting -HOUR=$(date +%l) - -if (( $HOUR >= 10 )); then - sketchybar --set "$NAME" label.padding_right=10 -else - sketchybar --set "$NAME" label.padding_right=20 -fi - -sketchybar --set "$NAME" label=" $(date +'%a %d %b')  $(date +'%I:%M %p')" +sketchybar --set "$NAME" label="$(date +'%a %d %b%l:%M %p')" diff --git a/stow/.config/sketchybar/plugins/input-method.sh b/stow/.config/sketchybar/plugins/input-method.sh new file mode 100755 index 0000000..291ca22 --- /dev/null +++ b/stow/.config/sketchybar/plugins/input-method.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# from: https://apple.stackexchange.com/questions/251666/how-to-get-current-input-language-of-the-input-source + +#!/usr/local/bin/bash +# Checks current keyboard input source (aka language) + +#These are the strings that MacOS uses to identify the current input source +ENGLISH="Australian" +HIRIGANA="com.apple.inputmethod.Japanese" +KATANA="com.apple.inputmethod.Japanese.Katakana" + +WESTERN_LANGUAGE=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | grep 'KeyboardLayout Name' | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/') + +# If the current language is not western one, then check a different variable +EASTERN_LANGUAGE=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | grep -w 'Input Mode' | head -1 | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/') + +if [ "$WESTERN_LANGUAGE" = "$ENGLISH" ]; then + LABEL="English" + ICON="🇬🇧" +elif [ "$EASTERN_LANGUAGE" = "$HIRIGANA" ]; then + LABEL="Japanese" + ICON="🇯🇵" +elif [ "$EASTERN_LANGUAGE" = "$KATANA" ]; then + LABEL="Katakana" + ICON="🈴" +fi + +sketchybar --set "$NAME" label="$LABEL" icon="" diff --git a/stow/.config/sketchybar/plugins/music.sh b/stow/.config/sketchybar/plugins/music.sh new file mode 100755 index 0000000..664b84f --- /dev/null +++ b/stow/.config/sketchybar/plugins/music.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# sketchybar doesn't like it when the line doesn't end with a carriage return + +if pgrep "Music"; then + SONG="$(osascript -e 'tell application "Music" to if player state is playing then artist of current track & " - " & name of current track')" +fi + +if [[ "$(echo $SONG | wc -w | sed 's/ //g')" != "0" ]]; then + sketchybar --set "$NAME" label="${SONG}" drawing=true +else + sketchybar --set "$NAME" label="" drawing=false +fi diff --git a/stow/.config/sketchybar/plugins/space.sh b/stow/.config/sketchybar/plugins/space.sh index b9bf8f6..7614cf3 100755 --- a/stow/.config/sketchybar/plugins/space.sh +++ b/stow/.config/sketchybar/plugins/space.sh @@ -1,13 +1,10 @@ -#!/usr/local/bin/bash +#!/usr/bin/env bash -# The $SELECTED variable is available for space components and indicates if -# the space invoking this script (with name: $NAME) is currently selected: -# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item - -#sketchybar --set "$NAME" background.drawing="$SELECTED" +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/../colours.sh if [ $SELECTED = 'true' ]; then - sketchybar --set "$NAME" background.color=0xfff48fb1 + sketchybar --set $NAME background.color=$PRIMARY_CONTAINER_COLOUR label.color=$ON_PRIMARY_CONTAINER_COLOUR label.padding_left=15 label.padding_right=15 else - sketchybar --set "$NAME" background.color=0xffffffff + sketchybar --set $NAME background.color=$BACKGROUND_COLOUR label.color=$PRIMARY_COLOUR label.padding_left=7 label.padding_right=7 fi diff --git a/stow/.config/sketchybar/sketchybarrc b/stow/.config/sketchybar/sketchybarrc index 2b1366e..5f7d706 100755 --- a/stow/.config/sketchybar/sketchybarrc +++ b/stow/.config/sketchybar/sketchybarrc @@ -1,132 +1,124 @@ # vim: set filetype=sh : -# This is a demo config to showcase some of the most important commands. -# It is meant to be changed and configured, as it is intentionally kept sparse. -# For a (much) more advanced configuration example see my dotfiles: -# https://github.com/FelixKratz/dotfiles +PLUGIN_DIR="$HOME/dots/stow/.config/sketchybar/plugins" +source $PLUGIN_DIR/../colours.sh # bar colours -PLUGIN_DIR="$HOME/.config/sketchybar/plugins" - -##### Bar Appearance ##### -# Configuring the general appearance of the bar. -# These are only some of the options available. For all options see: -# https://felixkratz.github.io/SketchyBar/config/bar -# If you are looking for other colors, see the color picker: -# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker - -sketchybar --bar position=top \ - height=32 \ - blur_radius=30 \ - color=0x00000000 \ - padding_right=10 \ - padding_left=10 \ - y_offset=3 +sketchybar --bar \ + position=top \ + height=42 \ + blur_radius=0 \ + color=0x00000000 \ + padding_right=15 \ + padding_left=15 \ + y_offset=-2 \ + corner_radius=0 \ default=( - icon.font="ComicShannsMono Nerd Font:Regular:11.0" - label.font="ComicShannsMono Nerd Font:Bold:11.0" - - padding_left=1 - padding_right=1 - icon.color=$PRIMARY_COLOUR + icon.font="$MONOSPACE_FONT:Regular:16.0" + label.font="$FONT:Bold:12.0" label.color=$PRIMARY_COLOUR + icon.color=$SECONDARY_COLOUR + background.color=$BACKGROUND_COLOUR + background.corner_radius=$ROUNDING + background.border_color=0x00000000 + background.border_width=3 + + background.height=32 + background.padding_right=0 + background.padding_left=0 + icon.padding_left=10 icon.padding_right=1 - label.padding_left=5 - label.padding_right=10 - - background.padding_left=2 - background.padding_right=2 - background.corner_radius=10 + label.padding_left=7 + label.padding_right=7 ) - sketchybar --default "${default[@]}" -##### Adding Mission Control Space Indicators ##### -# Let's add some mission control spaces: -# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item -# to indicate active and available mission control spaces. +# +# Left Items +# -SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") +# Yabai Workspace Indictators +# +SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9") for i in "${!SPACE_ICONS[@]}" do sid="$(($i+1))" space=( - icon.color=$PRIMARY_COLOUR - background.color=$BACKGROUND_COLOUR - space="$sid" icon="${SPACE_ICONS[i]}" - icon.padding_left=12 - icon.padding_right=12 - background.height=32 - background.padding_left=0 - background.padding_right=0 - label.drawing=off + icon.drawing=false \ + background.height=29 \ + background.border_width=0 \ + background.padding_right=0 \ + background.padding_left=0 \ + label.color=$PRIMARY_COLOUR \ + label="$sid" \ script="$PLUGIN_DIR/space.sh" click_script="yabai -m space --focus $sid" ) sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" done -##### Adding Left Items ##### -# We add some regular items to the left side of the bar, where -# only the properties deviating from the current defaults need to be set +# put all spaces into a bracket so they share a background +# fixes an issue with rounding creating gaps between modules +# +# yes im doing this in a stupid way and its hard coded but like :3 +sketchybar --add bracket spaces space.1 space.2 space.3 space.4 space.5 space.6 space.7 space.8 space.9 \ + --set spaces \ + background.color=$BACKGROUND_COLOUR -#sketchybar --add item chevron left \ -# --set chevron icon= label.drawing=off \ -# --add item front_app left \ -# --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ -# --subscribe front_app front_app_switched +# Focused window title sketchybar --add item front_app left \ - --set front_app icon.drawing=off \ - label.color=$PRIMARY_COLOUR \ - padding_left=10 \ - label.padding_left=10 \ - background.color=$BACKGROUND_COLOUR \ - background.height=32 \ - script="$PLUGIN_DIR/front_app.sh" \ - --subscribe front_app front_app_switched \ - - + --set front_app icon="󱂬 " script="$PLUGIN_DIR/front_app.sh" \ + --subscribe front_app front_app_switched -##### Adding Right Items ##### +# Currently playing music status (only works for Music.app) +sketchybar --add item music left \ + --set music icon="󰎇 " update_freq=10 \ + script="$PLUGIN_DIR/music.sh" \ + click_script="osascript -e 'tell application \"Music\" to playpause'" \ + scroll_texts=1 \ + label.max_chars=50 \ + label.scroll_duration=500 \ + background.color=$PRIMARY_COLOUR \ + icon.color=$BACKGROUND_COLOUR \ + label.color=$BACKGROUND_COLOUR \ + drawing=false -sketchybar --add item clock right \ - --set clock \ - update_freq=10 \ - icon.color=$PRIMARY_COLOUR \ - label.color=$PRIMARY_COLOUR \ - background.color=$BACKGROUND_COLOUR \ - background.height=32 \ - label.padding_right=20 \ - script="$PLUGIN_DIR/clock.sh" +# +# Right Items +# -sketchybar --add item battery right \ - --set battery update_freq=10 \ - script="$PLUGIN_DIR/battery.sh" \ - icon.color=$SECONDARY_COLOUR \ - label.color=$SECONDARY_COLOUR \ - background.color=$BACKGROUND_COLOUR \ - background.height=32 \ +# Clock +sketchybar --add item clock right \ + --set clock icon=" " \ + update_freq=10 \ + label.padding_right=10 \ + script="$PLUGIN_DIR/clock.sh" -sketchybar --add item backlight right \ - --set backlight icon="" \ - icon.color=$TERTIARY_COLOUR \ - label.color=$TERTIARY_COLOUR \ - background.color=$BACKGROUND_COLOUR \ - background.height=32 \ - script="$PLUGIN_DIR/backlight.sh" \ - --subscribe backlight brightness_change \ +# Input Method +sketchybar --add item input-method right \ + --set input-method icon="" \ + update_freq=1 \ + script="$PLUGIN_DIR/input-method.sh" -sketchybar --add item audio right \ - --set audio icon = "" \ - icon.color=$TERTIARY_COLOUR \ - label.color=$TERTIARY_COLOUR \ - background.color=$BACKGROUND_COLOUR \ - background.height=32 \ - script="$PLUGIN_DIR/volume.sh" \ - --subscribe audio volume_change \ +# Battery +sketchybar --add item battery right \ + --set battery update_freq=10 \ + script="$PLUGIN_DIR/battery.sh" \ + +# Backlight +sketchybar --add item backlight right \ + --set backlight icon="" \ + script="$PLUGIN_DIR/backlight.sh" \ + --subscribe backlight brightness_change \ + +# Volume +sketchybar --add item audio right \ + --set audio \ + script="$PLUGIN_DIR/volume.sh" \ + --subscribe audio volume_change \ ##### Force all scripts to run the first time (never do this in a script) ##### sketchybar --update diff --git a/stow/.config/skhd/skhdrc b/stow/.config/skhd/skhdrc index 354f1a5..d6f2635 100644 --- a/stow/.config/skhd/skhdrc +++ b/stow/.config/skhd/skhdrc @@ -1,3 +1,56 @@ -alt + shift - q : open -n /Applications/Ghostty.app -alt + shift - b : /opt/homebrew/bin/firefox --new-window -alt + shift - f : open ~ +# +# Applications +# + +alt + shift - b : /Applications/Zen.app/Contents/MacOS/zen --new-window # new browser window +alt - s : screencapture -i -c # screenshot +alt + shift - f : open ~ # new finder window + +# +# Yabai +# + +# Workspaces +alt - 1 : yabai -m space --focus 1 +alt - 2 : yabai -m space --focus 2 +alt - 3 : yabai -m space --focus 3 +alt - 4 : yabai -m space --focus 4 +alt - 5 : yabai -m space --focus 5 +alt - 6 : yabai -m space --focus 6 +alt - 7 : yabai -m space --focus 7 +alt - 8 : yabai -m space --focus 8 +alt - 9 : yabai -m space --focus 9 + +alt + shift - 1 : yabai -m window --space 1 --focus +alt + shift - 2 : yabai -m window --space 2 --focus +alt + shift - 3 : yabai -m window --space 3 --focus +alt + shift - 4 : yabai -m window --space 4 --focus +alt + shift - 5 : yabai -m window --space 5 --focus +alt + shift - 6 : yabai -m window --space 6 --focus +alt + shift - 7 : yabai -m window --space 7 --focus +alt + shift - 8 : yabai -m window --space 8 --focus +alt + shift - 9 : yabai -m window --space 9 --focus + +# Focus next space by mission-control index if one exists, otherwise focus the first space +alt - home : yabai -m space --focus next || yabai -m space --focus first +# Focus previous space by mission-control index if one exists, otherwise focus the last space +alt - end : yabai -m space --focus prev || yabai -m space --focus last + +# Temporarily show menu bar +alt - m : sh -c 'if [ -f /opt/homebrew/bin/sketchybar ]; then yabai -m config menubar_opacity 1.0 && sleep 5 && yabai -m config menubar_opacity 0.0; fi' + +# Layout/Focus +alt - c : yabai -m space --rotate 90 +alt - f : yabai -m window --toggle zoom-fullscreen +alt - space : yabai -m window --toggle float +alt - y : yabai -m space --balance + +alt - h : yabai -m window --focus west +alt - j : yabai -m window --focus south +alt - k : yabai -m window --focus north +alt - l : yabai -m window --focus east + +alt + shift - h : yabai -m window --swap west +alt + shift - j : yabai -m window --swap south +alt + shift - k : yabai -m window --swap north +alt + shift - l : yabai -m window --swap east diff --git a/stow/.config/tmux/tmux.conf b/stow/.config/tmux/tmux.conf index e8290de..7722939 100644 --- a/stow/.config/tmux/tmux.conf +++ b/stow/.config/tmux/tmux.conf @@ -1,3 +1,7 @@ +# +# keybindings +# + # remap prefix from 'C-b' to 'C-a' unbind C-b set-option -g prefix C-a @@ -9,33 +13,57 @@ bind j select-pane -D bind k select-pane -U bind l select-pane -R +bind r source-file ~/.config/tmux/tmux.conf + # start ajacent terminals with same path bind c new-window -c "#{pane_current_path}" bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" +# +# options +# + # set variables set -g mouse on set -g history-limit 100000 +# start panes and windows at index 1 instead of 0 set -g base-index 1 setw -g pane-base-index 1 +set-option -g renumber-windows on # if win 2 get deleted, win 3 gets renamed to win 2 -set -gq allow-passthrough on set -g visual-activity off +set -g set-clipboard on +set -g focus-events on # lets programs know if they loose focus +set -g status-keys emacs # emacs bindings in tmux prompt ( prefix + :) +set -g default-terminal "screen-256color" # upgrade TERM variable to have more colours +set -g display-time 4000 # display tmux messages for 4s + +# +# status bar +# + +set -g status-style "bg=default" +set -g status-fg "white" +set -g status-left "#[bg=purple,fg=black]#{?client_prefix,#[reverse]#[bg=yellow]#[noreverse]} #S " +set -g status-right "%d/%m #[bg=purple,fg=black] #H " + +# max allowed lenth for statuses to flow into +set -g status-left-length 20 +set -g status-right-length 20 + +# tab bar +set -g window-status-format " #I #W " +set -g window-status-current-format " #I #W " +set -g window-status-current-style bg=black,fg=blue,bold # fix undercurls: https://github.com/folke/tokyonight.nvim#fix-undercurls-in-tmux set -g default-terminal "${TERM}" set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' +set -gq allow-passthrough on -# plugins -# got from: https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md, changed to a more sensible install dir -if "test ! -d ~/.local/share/tmux/plugins/tpm" \ - "run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm && ~/.local/share/tmux/plugins/tpm/bin/install_plugins'" - -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin "janoamaral/tokyo-night-tmux" - -run '~/.local/share/tmux/plugins/tpm/tpm' +# matugen +if "test -f ~/.cache/matugen/tmux.conf" \ + "source-file ~/.cache/matugen/tmux.conf" diff --git a/stow/.config/vicinae/vicinae.json b/stow/.config/vicinae/vicinae.json new file mode 100644 index 0000000..9ac9f69 --- /dev/null +++ b/stow/.config/vicinae/vicinae.json @@ -0,0 +1,25 @@ +{ + "closeOnFocusLoss": false, + "considerPreedit": false, + "faviconService": "twenty", + "font": { + "normal": "ComicShannsMono Nerd Font", + "size": 10.5 + }, + "keybinding": "emacs", + "keybinds": { + }, + "popToRootOnClose": true, + "rootSearch": { + "searchFiles": false + }, + "theme": { + "iconTheme": "Default", + "name": "matugen" + }, + "window": { + "csd": true, + "opacity": 0.98, + "rounding": 10 + } +} diff --git a/stow/.config/walker/config.toml b/stow/.config/walker/config.toml index 303a415..01bbe34 100644 --- a/stow/.config/walker/config.toml +++ b/stow/.config/walker/config.toml @@ -266,7 +266,7 @@ Terminal = false [[builtins.custom_commands.commands]] name = "Logout" -cmd = "uwsm stop" +cmd = "hyprctl dispatch exit" Terminal = false # hypr diff --git a/stow/.config/waybar/config.jsonc b/stow/.config/waybar/config.jsonc index d5bcc5e..0e4c2fe 100644 --- a/stow/.config/waybar/config.jsonc +++ b/stow/.config/waybar/config.jsonc @@ -1,45 +1,23 @@ -// MIT License -// Copyright (c) 2024 LightCrimson -// https://github.com/yurihikari/garuda-hyprdots -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - { "layer": "top", // Waybar at top layer - "position": "top", // Waybar position (top|bottom|left|right) - "height": 40, - "margin": "0 0 0 0", - //"width": 1350, // Waybar width + "position": "right", // Waybar position (top|bottom|left|right) + //"height": 40, + "margin": "5 5 5 5", + "width": 50, // Choose the order of the modules idle_inhibitor "modules-left": [ "hyprland/workspaces", "niri/workspaces", "tray", - "custom/media" + "custom/media", + "privacy" ], "modules-center": [], "modules-right": [ + "network", "wireplumber", "backlight", "battery", - "network", - "privacy", "clock", "custom/swaync" ], @@ -53,33 +31,45 @@ // "format": "< %g >", // "format_focused" : "< %g ● >", "format-icons": { - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "10": "10" + "1": "一", + "2": "二", + "3": "三", + "4": "四", + "5": "五", + "6": "六", + "7": "七", + "8": "八", + "9": "九", + "10": "十" } }, "niri/workspaces": { "disable-scroll": true, "all-outputs": true, - "format": "{icon}" - // "format": "< %g >", - // "format_focused" : "< %g ● >", + "format": "{icon}", + "format-icons": { + "1": "一", + "2": "二", + "3": "三", + "4": "四", + "5": "五", + "6": "六", + "7": "七", + "8": "八", + "9": "九", + "10": "十" + } }, "custom/media": { -// "format": "{format}", + "rotate": 270, + "format": "󰎇 {}", "max-length": 40, "escape": true, - "exec": "playerctl metadata title -F" + "exec": "playerctl metadata title -F", + "on-click": "playerctl play-pause" }, "tray": { - "icon-size": 14, + "icon-size": 22, "spacing": 5 }, "clock": { @@ -105,9 +95,11 @@ "on-scroll-up": "shift_up", "on-scroll-down": "shift_down" }, - "format": " {:%a %d %b  %I:%M %p}", //12 hour format + "format": " \n{:%I\n%M}", //12 hour format + //"format": " {:%a %d %b  %I:%M %p}", //12 hour format // "format": " {:%d %m %Y  %H:%M}", //24 hour format - "format-alt": " {:%d/%m/%Y  %H:%M:%S}", + "format-alt": "\n{:%d\n%m\n%y}", + //"format-alt": " {:%d/%m/%Y  %H:%M:%S}", // //"timezones": [ "Kolkata" ], // //"max-length": 200 "interval": 1 @@ -118,29 +110,29 @@ "warning": 30, "critical": 15 }, - "format": "{icon} {capacity: >3}%", + "format": "{icon}\n{capacity}", // "format-good": "", // An empty format will hide the module // "format-full": "", - "format-icons": ["", "", "", "", ""] + "format-icons": ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] //"format-icons": ["", "", "", "", "", "", "", "", "", ""] }, "backlight": { // "device": "acpi_video1", - "format": "{icon} {percent}%", + "format": "{icon}\n{percent}", "format-icons": ["", "", "", "", "", "", "", "", ""] }, "network": { // "interface": "wlp2s0", // (Optional) To force the use of this interface - "format": "⚠ Disabled", + "format": "⚠", //"format-wifi": " {essid}", - "format-wifi": " Connected", + "format-wifi": " ", // "format-ethernet": " {ifname}: {ipaddr}/{cidr}", - "format-ethernet": " Wired", - "format-disconnected": "⚠ Disconnected", + "format-ethernet": " ", + "format-disconnected": "⚠", "on-click": "ghostty --fullscreen=true -e 'sleep 0.05; nmtui'" }, "wireplumber": { - "format": "{icon} {volume}%", + "format": "{icon}\n{volume}", "format-muted": "", "on-click": "helvum", "format-icons": ["", "", ""] @@ -167,7 +159,7 @@ }, "privacy": { "icon-spacing": 4, - "icon-size": 18, + "icon-size": 24, "transition-duration": 250, "modules": [ { @@ -175,11 +167,6 @@ "tooltip": true, "tooltip-icon-size": 24 }, -// { -// "type": "audio-out", -// "tooltip": true, -// "tooltip-icon-size": 24 -// }, { "type": "audio-in", "tooltip": true, diff --git a/stow/.config/waybar/style.css b/stow/.config/waybar/style.css index 2c5700e..aa191de 100644 --- a/stow/.config/waybar/style.css +++ b/stow/.config/waybar/style.css @@ -1,289 +1,174 @@ @import "colors.css"; * { - /* `otf-font-awesome` is required to be installed for icons */ -/* font-family: ComicShannsMono Nerd Font, FontAwesome, Roboto, Helvetica, Arial, sans-serif;*/ - font-size: 13px; - border-radius: 10px; + font-size: 20px; transition-duration: 0.5s; -} - -.module { - margin-left: 5px; - margin-right: 5px; - margin-top: 10px; + /* `otf-font-awesome` is required to be installed for icons */ + /* font-family: ComicShannsMono Nerd Font, FontAwesome, Roboto, Helvetica, Arial, sans-serif;*/ + /* border-radius: 10px;*/ } window#waybar { color: @primary; background-color: transparent; - transition-property: background-color; - transition-duration: .5s; } -window#waybar.hidden { - opacity: 0.2; -} - -/* -window#waybar.empty { - background-color: transparent; -} -window#waybar.solo { - background-color: #FFFFFF; -} -*/ - -button { - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; -} - -#workspaces { - background-color: @background; - color: @primary; - border-radius: 10px; -} - -#workspaces button { - color: @primary; - padding: 0 5px; - border-radius: inherit; -} - -#workspaces button:hover { - color: @on_primary; - background: @on_primary_container; -} - -#workspaces button.urgent { - color: @error; - background-color: @error_container; +.module,#privacy-item { + margin-top: 5px; + margin-bottom: 5px; + padding: 10px 0px; } +#privacy-item, #clock, -#battery, -#cpu, -#memory, -#disk, #temperature, -#backlight, #network, #pulseaudio, -#wireplumber, #custom-media, #tray, #mode, #idle_inhibitor, -#scratchpad, -#power-profiles-daemon, -#mpd { - padding: 0 10px; - background-color: @background; - color: @primary; -} - -#window, +#privacy-item, +#mpd, #workspaces { -} - -#clock { - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; - margin-right: 0px; - - border-right: none; - - background-color: @background; color: @primary; -} - -#custom-swaync { - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; - margin-left: 0px; - - border-left: none; - - background-color: @primary; - color: @background; - padding: 10px; -} - -#battery { background-color: @background; - color: @secondary; -} - -#battery.charging, #battery.plugged { - color: #ffffff; - background-color: #26A65B; -} - -@keyframes blink { - to { - background-color: #ffffff; - color: #000000; - } -} - -/* Using steps() instead of linear as a timing function to limit cpu usage */ -#battery.critical:not(.charging) { - background-color: #f53c3c; - color: #ffffff; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: steps(12); - animation-iteration-count: infinite; - animation-direction: alternate; -} - -#cpu { - background-color: @primary; - color: #000000; -} - -#memory { - background-color: @background; - color: @secondary; -} - -#disk { - background-color: @background; - color: @tertiary; -} - -#backlight { - background-color: @background; - color: @tertiary; -} - -#network { - background-color: @background; - color: @secondary; -} - -#network.disconnected { - background-color: @background; - color: @error; } +#cpu, +#memory, +#disk, +#battery, +#backlight, #wireplumber { + color: @secondary; background-color: @background; - color: @tertiary; -/* color: @primary;*/ -} - -#wireplumber.muted { - background-color: @background; - color: @error; } +#network, #custom-media { - background-color: @background; color: @tertiary; - min-width: 100px; -} - -#tray { background-color: @background; - color: @primary; } -#tray > .passive { - -gtk-icon-effect: dim; +#network.disconnected, +#wireplumber.muted { + color: @error; + background-color: @error_container; } +/* + * hover variants + */ + +#privacy-item:hover, +#clock:hover, +#temperature:hover, +#network:hover, +#pulseaudio:hover, +#custom-media:hover, +#tray:hover, +#mode:hover, +#idle_inhibitor:hover, +#privacy-item:hover, +#mpd:hover, +#workspaces:hover { + color: @on_primary_container; + background-color: @primary_container; +} + +#cpu:hover, +#memory:hover, +#disk:hover, +#battery:hover, +#backlight:hover, +#wireplumber:hover { + color: @on_secondary_container; + background-color: @secondary_container; +} + +#network:hover, +#custom-media:hover { + color: @on_tertiary_container; + background-color: @tertiary_container; +} + +#network.disconnected:hover, +#wireplumber.muted:hover { + color: @on_error_container; + background-color: @error_container; +} + +/* + * module variations + */ + #tray > .needs-attention { -gtk-icon-effect: highlight; background-color: #eb4d4b; } -#privacy { - padding: 0; +#clock { + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; + margin-bottom: 0px; } -#privacy-item { - padding: 0 5px; - color: @primary; -} +#custom-swaync { + border-top-left-radius: 0px; + border-top-right-radius: 0px; + margin-top: 0px; + margin-bottom: 0px; - -/* - * hover variants - */ - -#clock:hover { - background-color: @primary; color: @background; + background-color: @primary; } #custom-swaync:hover { - background-color: @background; color: @primary; -} - -#battery:hover { - background-color: @secondary; - color: @background; -} - -#cpu:hover { - background-color: @primary; - color: @background; -} - -#memory:hover { - background-color: @secondary; - color: @background; -} - -#disk:hover { background-color: @background; - color: @tertiary; } -#backlight:hover { - background-color: @tertiary; - color: @background; + +#wireplumber { + margin-bottom: 0px; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; } -#network:hover { - background-color: @secondary; - color: @background; +#backlight { + margin-top: 0px; + margin-bottom: 0px; + border-radius: 0px; } -#network.disconnected:hover { - background-color: @error; - color: @background; +#battery { + margin-top: 0px; + border-top-left-radius: 0px; + border-top-right-radius: 0px; } -#wireplumber:hover { - background-color: @tertiary; - color: @background; +#battery.charging, #battery.plugged { + color: #26A65B; } -#wireplumber.muted:hover { - background-color: @error; - color: @background; +/* workspace indicator styles */ +#workspaces { + margin-top: 0px; + padding-top: 0px; + padding-bottom: 0px; } -#custom-media:hover { - background-color: @tertiary; - color: @background; +#workspaces button { + color: @primary; } -#tray:hover { - background-color: @primary; - color: @background; +#workspaces button.active { + color: @on_primary_container; + background-color: @primary_container; } -#privacy:hover { - padding: 0; -} - -#privacy-item:hover { - background-color: @primary; - color: @background; +#workspaces button.urgent { + color: @error; + background-color: @error_container; } diff --git a/stow/.config/yabai/toggle-tiling.sh b/stow/.config/yabai/toggle-tiling.sh new file mode 100755 index 0000000..5ef3618 --- /dev/null +++ b/stow/.config/yabai/toggle-tiling.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +disableTiling () { + defaults write com.apple.dock orientation bottom + defaults write com.apple.dock autohide -bool FALSE + + killall Finder Dock sketchybar borders + yabai -m config menubar_opacity 1.0 + + SPACES=("1" "2" "3" "4" "5" "6" "7" "8" "9") + for i in "${!SPACES[@]}"; do + yabai -m space $i --layout float + done + + osascript -e 'tell application "System Events" + tell dock preferences + set properties to {autohide menu bar:false, autohide:false} + end tell + end tell' +} + +enableTiling () { + defaults write com.apple.dock orientation right + defaults write com.apple.dock autohide -bool FALSE + killall Dock Finder + + sketchybar & + sh ~/.cache/matugen-jankyborders.sh & + yabai -m config menubar_opacity 0.0 + + SPACES=("1" "2" "3" "4" "5" "6" "7" "8" "9") + for i in "${!SPACES[@]}"; do + yabai -m space $i --layout bsp + done + + + osascript -e ' + tell application "System Events" + tell dock preferences + set properties to {autohide menu bar:true, autohide:true} + end tell + end tell +' +} + +if [ "$1" = "on" ]; then + enableTiling +elif [ "$1" = "off" ]; then + disableTiling +else + echo "$0: [on|off]" +fi diff --git a/stow/.config/yabai/yabairc b/stow/.config/yabai/yabairc new file mode 100644 index 0000000..62e506b --- /dev/null +++ b/stow/.config/yabai/yabairc @@ -0,0 +1,73 @@ +# Scripting Addon +# https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition + +yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" +sudo yabai --load-sa + +# Sketchybar Intergration +eval "$(/opt/homebrew/bin/brew shellenv)" +if command -v "sketchybar"; then + yabai -m config menubar_opacity 0.0 + sketchybar & + yabai -m signal --remove "sketchybar_space_change" 2>/dev/null + yabai -m signal --remove "sketchybar_front_app" 2>/dev/null + + # Remove existing signals (in case of restart) + yabai -m signal --add event=space_changed action="sketchybar --trigger space_change" label="sketchybar_space_change" + yabai -m signal --add event=window_focused action="sketchybar --trigger front_app_switched" label="sketchybar_front_app" +fi + +# autostart +borders active_color=0xfff74f9e inactive_color=0xffffa8f1 width=6.0 & +sh ~/.cache/matugen-jankyborders.sh & +skhd & + +# space labels +yabai -m space 1 --label browser +yabai -m space 2 --label terminal +yabai -m space 3 --label spare +yabai -m space 4 --label gaming +yabai -m space 5 --label social +yabai -m space 6 --label music + +yabai -m space 4 --layout float + +# layout +yabai -m config layout bsp +yabai -m config split_ratio 0.5 + +# padding +yabai -m config top_padding 4 \ + bottom_padding 8 \ + left_padding 8 \ + right_padding 8 \ + window_gap 8 \ + +# mouse support +yabai -m config mouse_modifier ctrl # set mouse interaction modifier key +yabai -m config mouse_action1 move # set modifier + left-click drag to move window +yabai -m config mouse_action2 resize # set modifier + right-click drag to resize window +yabai -m config focus_follows_mouse autofocus # disabled while holding mouse modifier (eg. for menubar) +yabai -m config mouse_follows_focus on + +# appearance +yabai -m config window_shadow float # window shadow only on floating windows + +yabai -m config window_opacity off +yabai -m config active_window_opacity 1.0 +yabai -m config normal_window_opacity 0.95 +yabai -m config window_opacity_duration 0.2 + +# window rules +yabai -m rule --add app="^(Calculator|System Preferences|System Settings|Archive Utility)$" manage=off +yabai -m rule --add title="^Preferences" manage=off +yabai -m rule --add title="^Settings" manage=off +yabai -m rule --add app="^Steam$" manage=off +yabai -m rule --add app="^IINA$" manage=off +yabai -m rule --add app="^Weather$" manage=off +yabai -m rule --add app="KeePassXC$" sticky=on mouse_follows_focus=off manage=off +yabai -m rule --add app="^Lulu$" sticky=no mouse_follows_focus=off manage=off +# Anki card preview & Anki browser +yabai -m rule --add title="^Preview" manage=off +yabai -m rule --add title="^Anki" manage=off +yabai -m rule --add title="^Browse" manage=off diff --git a/stow/.config/yazi/yazi.toml b/stow/.config/yazi/yazi.toml new file mode 100644 index 0000000..5c13a34 --- /dev/null +++ b/stow/.config/yazi/yazi.toml @@ -0,0 +1,56 @@ +[mgr] +show_hidden = true +show_symlink = true + +sort_by = "alphabetical" +sort_reverse = false +sort_dir_first = true + +linemode = "permissions" +scrolloff = 8 + +[preview] +wrap = "no" +tab_size = 2 + +[opener] +edit = [ + { run = "$EDITOR %s", block = true, desc = "Open in text editor"}, +] + +editimg = [ + { run = "gimp %s", block = false, desc = "Open in image editor" }, +] + +play = [ + { run = "mpv %s", block = false, for = "linux", desc = "Play video"}, + { run = "iina %s", block = false, for = "macos", desc = "Play video"}, +] + +open = [ + { run = "xdg-open %s", block = false, for = "linux", desc = "Open with default program"}, + { run = "open %s", block = false, for = "macos", desc = "Open with default program"}, +] + +setwallpaper = [ + { run = "matugen --config ~/.config/matugen/config.toml image %s", block = false, for = "macos", desc = "Set as wallpaper"}, + { run = "matugen image %s", block = false, for = "linux", desc = "Set as wallpaper"}, +] + +setwallpaperlight = [ + { run = "matugen --config ~/.config/matugen/config.toml image -m light %s", block = false, for = "macos", desc = "Set as wallpaper (light)"}, + { run = "matugen image -m light %s", block = false, for = "linux", desc = "Set as wallpaper (light)"}, +] + +[open] +rules = [ + { mime = "text/*", use = "edit" }, + { mime = "video/*", use = "play" }, + { mime = "image/*", use = [ "open", "setwallpaper", "setwallpaperlight", "editimg" ] }, + + { url = "*.html", use = [ "open", "edit" ] }, + { mime = "application/json", use = "edit" }, + + # Multiple openers for a single rule + { url = "*", use = "open" }, +] diff --git a/stow/.zshrc b/stow/.zshrc index 73d45aa..b893e40 100644 --- a/stow/.zshrc +++ b/stow/.zshrc @@ -1,56 +1,38 @@ # z shell configuration -OSICON="?" +# +# prompt +# -# set prompt icon -if [ -e /System ]; then +# set icon +if [ -f /etc/os-release ]; then + . /etc/os-release &> /dev/null +fi + +if [ "$ID" = "nixos" ]; then + OSICON="" +elif [ "$ID" = "debian" ]; then + OSICON="" +elif [ "$ID" = "arch" ]; then + OSICON="󰣇" +elif [ "$ID" = "fedora" ]; then + OSICON="" +elif [ -e /System ]; then OSICON="" eval "$(/opt/homebrew/bin/brew shellenv)" else - . /etc/os-release &> /dev/null - - if [ "$ID" = "nixos" ]; then - OSICON="" - elif [ "$ID" = "debian" ]; then - OSICON="" - elif [ "$ID" = "fedora" ]; then - OSICON="󰣇" - elif [ "$ID" = "arch" ]; then - OSICON="" - fi + OSICON="$" fi # set prompt colours -HOSTNAME="$(hostname)" - -if [ "$HOSTNAME" = "kita" ]; then - PRIMARY_COLOUR="{red}" - SECONDARY_COLOUR="{yellow}" - TEXT_COLOUR="{black}" - -elif [ "$HOSTNAME" = "bocchi" ]; then - PRIMARY_COLOUR="{magenta}" - SECONDARY_COLOUR="{white}" - TEXT_COLOUR="{black}" - -elif [ "$HOSTNAME" = "ryo" ]; then - PRIMARY_COLOUR="{cyan}" - SECONDARY_COLOUR="{blue}" - TEXT_COLOUR="{black}" - -elif [ "$HOSTNAME" = "nijika" ]; then - PRIMARY_COLOUR="{yellow}" - SECONDARY_COLOUR="{green}" - TEXT_COLOUR="{black}" - +if [ -f ~/.cache/zsh_colours.sh ]; then + source ~/.cache/zsh_colours.sh else PRIMARY_COLOUR="{blue}" - SECONDARY_COLOUR="{red}" - TEXT_COLOUR="{black}" + SECONDARY_COLOUR="{yellow}" fi -PROMPT="%K$PRIMARY_COLOUR%F$TEXT_COLOUR %~ %K$SECONDARY_COLOUR $OSICON %k%F{white} " -RPROMPT="%F{7}$HOSTNAME" +PROMPT="%F$PRIMARY_COLOUR%~ %F$SECONDARY_COLOUR$OSICON %k%F" bindkey -e @@ -59,7 +41,9 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' menu no -# hist +# +# history +# HISTFILE="$HOME/.local/share/zsh_hist" HISTSIZE=10000000 SAVEHIST=$HISTSIZE @@ -71,13 +55,19 @@ setopt hist_ignore_all_dups setopt hist_find_no_dups setopt hist_ignore_space +# # shell alias +# alias ls="ls -h --color=auto" alias la="ls -ah --color=auto" alias ll="ls -ahl --color=auto" alias cat="bat" alias rm="trash" +alias v="nvim" +alias vi="nvim" +alias vim="nvim" + alias ssh="TERM=xterm-256color ssh" # fix ssh not recognising terminal and remote shell being somewhat broken alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" # needed for osx systems for some reason @@ -87,35 +77,18 @@ export PATH="$PATH:$GOPATH/bin" export EDITOR="nvim" -# functions -func calc() { - # why isn't this in bash by default - # - if command -v python3 > /dev/null; then - python3 -c "print($1)" - else - echo "python3 needs to be installed for this to work!" - fi -} - -func 0x0() { - if [ -d "$1" ]; - then - TMPFILE="$(mktemp)" - tar cf "$TMPFILE" "$1" - curl -F file=@$TMPFILE -F expires=24 https://0x0.st - else - curl -F file=@$1 -F expires=24 https://0x0.st - fi -} - # plugins +# plugindir="$HOME/.local/share/zsh_plug" func plugInstall() { # clones a repo and then sources it. # first arg is git url, second is source # location + if [ ! command -v "git" &> /dev/null ]; then + exit 1 + fi + foldername=$(basename $1) clonepath="$plugindir/$foldername" sourcefile="$clonepath/$2" @@ -130,8 +103,15 @@ func plugInstall() { } plugInstall https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting.zsh -plugInstall https://github.com/Aloxaf/fzf-tab fzf-tab.zsh # load fzf and zoxide eval "$(fzf --zsh)" eval "$(zoxide init zsh)" + +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd" + command rm -f -- "$tmp" +}