diff --git a/alejandra.toml b/alejandra.toml index 840c791..581a5c4 100644 --- a/alejandra.toml +++ b/alejandra.toml @@ -1 +1 @@ -indentation = "TwoSpaces" +indentation = "Tabs" diff --git a/flake.nix b/flake.nix index b08756d..f2ca96d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,144 +1,148 @@ { - description = "Configuration for my macOS laptops and NixOS server"; + description = "Configuration for my macOS laptops and NixOS server"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-parts.url = "github:hercules-ci/flake-parts"; - sops-nix = { - url = "github:Mic92/sops-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - darwin = { - url = "github:LnL7/nix-darwin/master"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; - homebrew-core = { - url = "github:homebrew/homebrew-core"; - flake = false; - }; - homebrew-cask = { - url = "github:homebrew/homebrew-cask"; - flake = false; - }; - nixvim.url = "github:nix-community/nixvim"; - zjstatus.url = "github:dj95/zjstatus"; - nix-ai-tools.url = "github:numtide/nix-ai-tools"; - beads.url = "github:steveyegge/beads"; - tangled = { - url = "git+https://tangled.org/tangled.org/core"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + darwin = { + url = "github:LnL7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; + homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; + nixvim.url = "github:nix-community/nixvim"; + zjstatus.url = "github:dj95/zjstatus"; + nix-ai-tools.url = "github:numtide/nix-ai-tools"; + beads.url = "github:steveyegge/beads"; + tangled = { + url = "git+https://tangled.org/tangled.org/core"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; - outputs = inputs @ {flake-parts, ...}: - flake-parts.lib.mkFlake {inherit inputs;} ( - let - constants = import ./lib/constants.nix; - user = constants.user; - darwinHosts = ["chidi" "jason"]; - nixosHosts = ["michael" "tahani"]; - overlays = import ./overlays {inherit inputs;}; - in { - systems = [ - "x86_64-linux" - "aarch64-darwin" - ]; + outputs = inputs @ {flake-parts, ...}: + flake-parts.lib.mkFlake {inherit inputs;} ( + let + constants = import ./lib/constants.nix; + user = constants.user; + darwinHosts = ["chidi" "jason"]; + nixosHosts = ["michael" "tahani"]; + overlays = import ./overlays {inherit inputs;}; + in { + systems = [ + "x86_64-linux" + "aarch64-darwin" + ]; - flake.darwinConfigurations = inputs.nixpkgs.lib.genAttrs darwinHosts ( - hostname: - inputs.darwin.lib.darwinSystem { - system = "aarch64-darwin"; - specialArgs = { - inherit inputs user hostname constants; - }; - modules = [ - inputs.home-manager.darwinModules.home-manager - inputs.nix-homebrew.darwinModules.nix-homebrew - { - nixpkgs.overlays = overlays; + flake.darwinConfigurations = + inputs.nixpkgs.lib.genAttrs darwinHosts ( + hostname: + inputs.darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { + inherit inputs user hostname constants; + }; + modules = [ + inputs.home-manager.darwinModules.home-manager + inputs.nix-homebrew.darwinModules.nix-homebrew + { + nixpkgs.overlays = overlays; - nix-homebrew = { - inherit user; - enable = true; - taps = { - "homebrew/homebrew-core" = inputs.homebrew-core; - "homebrew/homebrew-cask" = inputs.homebrew-cask; - }; - mutableTaps = true; - }; - } - ./hosts/${hostname} - ]; - } - ); + nix-homebrew = { + inherit user; + enable = true; + taps = { + "homebrew/homebrew-core" = inputs.homebrew-core; + "homebrew/homebrew-cask" = inputs.homebrew-cask; + }; + mutableTaps = true; + }; + } + ./hosts/${hostname} + ]; + } + ); - flake.nixosConfigurations = inputs.nixpkgs.lib.genAttrs nixosHosts ( - hostname: - inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit inputs user hostname constants; - }; - modules = [ - inputs.home-manager.nixosModules.home-manager - { - nixpkgs.overlays = overlays; - } - ./hosts/${hostname} - ]; - } - ); + flake.nixosConfigurations = + inputs.nixpkgs.lib.genAttrs nixosHosts ( + hostname: + inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs user hostname constants; + }; + modules = [ + inputs.home-manager.nixosModules.home-manager + { + nixpkgs.overlays = overlays; + } + ./hosts/${hostname} + ]; + } + ); - perSystem = { - pkgs, - system, - inputs', - ... - }: let - mkApp = name: { - type = "app"; - program = "${(pkgs.writeShellScriptBin name '' - PATH=${pkgs.git}/bin:$PATH - echo "Running ${name} for ${system}" - exec ${inputs.self}/apps/${system}/${name} "$@" - '')}/bin/${name}"; - }; + perSystem = { + pkgs, + system, + inputs', + ... + }: let + mkApp = name: { + type = "app"; + program = "${(pkgs.writeShellScriptBin name '' + PATH=${pkgs.git}/bin:$PATH + echo "Running ${name} for ${system}" + exec ${inputs.self}/apps/${system}/${name} "$@" + '')}/bin/${name}"; + }; - appNames = [ - "apply" - "build" - "build-switch" - "rollback" - ]; - in { - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - bashInteractive - git - age - age-plugin-yubikey - ]; - shellHook = ''export EDITOR=nvim''; - }; + appNames = [ + "apply" + "build" + "build-switch" + "rollback" + ]; + in { + devShells.default = + pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + bashInteractive + git + age + age-plugin-yubikey + ]; + shellHook = ''export EDITOR=nvim''; + }; - apps = builtins.listToAttrs ( - map (n: { - name = n; - value = mkApp n; - }) - appNames - ); - }; - flake.overlays = overlays; - } - ); + apps = + builtins.listToAttrs ( + map (n: { + name = n; + value = mkApp n; + }) + appNames + ); + }; + flake.overlays = overlays; + } + ); } diff --git a/hosts/chidi/default.nix b/hosts/chidi/default.nix index 348a668..dbe4711 100644 --- a/hosts/chidi/default.nix +++ b/hosts/chidi/default.nix @@ -1,27 +1,27 @@ { - pkgs, - user, - ... + pkgs, + user, + ... }: { - imports = [ - ../../modules/darwin - ]; + imports = [ + ../../modules/darwin + ]; - networking.hostName = "chidi"; - networking.computerName = "Chidi"; + networking.hostName = "chidi"; + networking.computerName = "Chidi"; - services.syncthing.settings.folders = { - "Projects/Work" = { - path = "/Users/${user}/Projects/Work"; - devices = ["tahani" "chidi"]; - }; - }; + services.syncthing.settings.folders = { + "Projects/Work" = { + path = "/Users/${user}/Projects/Work"; + devices = ["tahani" "chidi"]; + }; + }; - home-manager.users.${user} = { - programs.git.settings.user.email = "christoph@tuist.dev"; - }; + home-manager.users.${user} = { + programs.git.settings.user.email = "christoph@tuist.dev"; + }; - environment.systemPackages = with pkgs; [ - slack - ]; + environment.systemPackages = with pkgs; [ + slack + ]; } diff --git a/hosts/jason/default.nix b/hosts/jason/default.nix index 149bf98..b9e3080 100644 --- a/hosts/jason/default.nix +++ b/hosts/jason/default.nix @@ -1,36 +1,36 @@ {user, ...}: { - imports = [ - ../../modules/darwin - ]; + imports = [ + ../../modules/darwin + ]; - networking.hostName = "jason"; - networking.computerName = "Jason"; + networking.hostName = "jason"; + networking.computerName = "Jason"; - services.syncthing.settings.folders = { - "Projects/Personal" = { - path = "/Users/${user}/Projects/Personal"; - devices = ["tahani" "jason"]; - }; - }; + services.syncthing.settings.folders = { + "Projects/Personal" = { + path = "/Users/${user}/Projects/Personal"; + devices = ["tahani" "jason"]; + }; + }; - sops.age.keyFile = "/Users/${user}/.config/sops/age/keys.txt"; + sops.age.keyFile = "/Users/${user}/.config/sops/age/keys.txt"; - sops.secrets = { - jason-syncthing-cert = { - sopsFile = ../../secrets/jason-syncthing-cert; - format = "binary"; - owner = user; - path = "/Users/${user}/.config/syncthing/cert.pem"; - }; - jason-syncthing-key = { - sopsFile = ../../secrets/jason-syncthing-key; - format = "binary"; - owner = user; - path = "/Users/${user}/.config/syncthing/key.pem"; - }; - }; + sops.secrets = { + jason-syncthing-cert = { + sopsFile = ../../secrets/jason-syncthing-cert; + format = "binary"; + owner = user; + path = "/Users/${user}/.config/syncthing/cert.pem"; + }; + jason-syncthing-key = { + sopsFile = ../../secrets/jason-syncthing-key; + format = "binary"; + owner = user; + path = "/Users/${user}/.config/syncthing/key.pem"; + }; + }; - home-manager.users.${user} = { - programs.git.settings.user.email = "christoph@schmatzler.com"; - }; + home-manager.users.${user} = { + programs.git.settings.user.email = "christoph@schmatzler.com"; + }; } diff --git a/hosts/michael/default.nix b/hosts/michael/default.nix index c2a871a..ca782a3 100644 --- a/hosts/michael/default.nix +++ b/hosts/michael/default.nix @@ -22,7 +22,7 @@ }; }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [80 443]; services.caddy = { enable = true; diff --git a/hosts/tahani/default.nix b/hosts/tahani/default.nix index 50676d2..3f47463 100644 --- a/hosts/tahani/default.nix +++ b/hosts/tahani/default.nix @@ -1,112 +1,112 @@ { - config, - hostname, - user, - ... + config, + hostname, + user, + ... }: { - imports = [ - ../../modules/nixos - ]; + imports = [ + ../../modules/nixos + ]; - services.adguardhome = { - enable = true; - port = 10000; - settings = { - dns = { - upstream_dns = [ - "1.1.1.1" - "1.0.0.1" - ]; - }; - filtering = { - protection_enabled = true; - filtering_enabled = true; - safe_search = { - enabled = false; - }; - }; - }; - }; + services.adguardhome = { + enable = true; + port = 10000; + settings = { + dns = { + upstream_dns = [ + "1.1.1.1" + "1.0.0.1" + ]; + }; + filtering = { + protection_enabled = true; + filtering_enabled = true; + safe_search = { + enabled = false; + }; + }; + }; + }; - virtualisation.docker = { - enable = true; - }; + virtualisation.docker = { + enable = true; + }; - services.openssh = { - enable = true; - settings = { - PermitRootLogin = "prohibit-password"; - PasswordAuthentication = false; - }; - }; + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "prohibit-password"; + PasswordAuthentication = false; + }; + }; - fileSystems."/" = { - device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; - networking = { - hostName = hostname; - useDHCP = false; - interfaces.eno1.ipv4.addresses = [ - { - address = "192.168.1.10"; - prefixLength = 24; - } - ]; - defaultGateway = "192.168.1.1"; - nameservers = ["1.1.1.1"]; - firewall = { - enable = true; - trustedInterfaces = ["eno1" "tailscale0"]; - allowedUDPPorts = [config.services.tailscale.port]; - allowedTCPPorts = [22 5555]; - checkReversePath = "loose"; - }; - }; + networking = { + hostName = hostname; + useDHCP = false; + interfaces.eno1.ipv4.addresses = [ + { + address = "192.168.1.10"; + prefixLength = 24; + } + ]; + defaultGateway = "192.168.1.1"; + nameservers = ["1.1.1.1"]; + firewall = { + enable = true; + trustedInterfaces = ["eno1" "tailscale0"]; + allowedUDPPorts = [config.services.tailscale.port]; + allowedTCPPorts = [22 5555]; + checkReversePath = "loose"; + }; + }; - sops.secrets = { - tahani-syncthing-cert = { - sopsFile = ../../secrets/tahani-syncthing-cert; - format = "binary"; - owner = user; - path = "/home/${user}/.config/syncthing/cert.pem"; - }; - tahani-syncthing-key = { - sopsFile = ../../secrets/tahani-syncthing-key; - format = "binary"; - owner = user; - path = "/home/${user}/.config/syncthing/key.pem"; - }; - }; + sops.secrets = { + tahani-syncthing-cert = { + sopsFile = ../../secrets/tahani-syncthing-cert; + format = "binary"; + owner = user; + path = "/home/${user}/.config/syncthing/cert.pem"; + }; + tahani-syncthing-key = { + sopsFile = ../../secrets/tahani-syncthing-key; + format = "binary"; + owner = user; + path = "/home/${user}/.config/syncthing/key.pem"; + }; + }; - services.syncthing.settings.folders = { - "Projects/Personal" = { - path = "/home/${user}/Projects/Personal"; - devices = ["tahani" "jason"]; - }; - "Projects/Work" = { - path = "/home/${user}/Projects/Work"; - devices = ["tahani" "chidi"]; - }; - }; + services.syncthing.settings.folders = { + "Projects/Personal" = { + path = "/home/${user}/Projects/Personal"; + devices = ["tahani" "jason"]; + }; + "Projects/Work" = { + path = "/home/${user}/Projects/Work"; + devices = ["tahani" "chidi"]; + }; + }; - services.gitea = { - enable = true; - settings = { - server = { - DOMAIN = "git.tahani"; - HTTP_PORT = 8380; - }; - }; - }; + services.gitea = { + enable = true; + settings = { + server = { + DOMAIN = "git.tahani"; + HTTP_PORT = 8380; + }; + }; + }; - home-manager.users.${user} = { - programs.git.settings.user.email = "christoph@schmatzler.com"; - }; + home-manager.users.${user} = { + programs.git.settings.user.email = "christoph@schmatzler.com"; + }; } diff --git a/lib/constants.nix b/lib/constants.nix index 6aa8fff..8495a95 100644 --- a/lib/constants.nix +++ b/lib/constants.nix @@ -1,14 +1,14 @@ { - user = "cschmatzler"; + user = "cschmatzler"; - sshKeys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHfRZQ+7ejD3YHbyMTrV0gN1Gc0DxtGgl5CVZSupo5ws" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL/I+/2QT47raegzMIyhwMEPKarJP/+Ox9ewA4ZFJwk/" - ]; + sshKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHfRZQ+7ejD3YHbyMTrV0gN1Gc0DxtGgl5CVZSupo5ws" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL/I+/2QT47raegzMIyhwMEPKarJP/+Ox9ewA4ZFJwk/" + ]; - stateVersions = { - darwin = 6; - nixos = "25.11"; - homeManager = "25.11"; - }; + stateVersions = { + darwin = 6; + nixos = "25.11"; + homeManager = "25.11"; + }; } diff --git a/modules/bin/open-project.nix b/modules/bin/open-project.nix index b3b76a9..79b9dd4 100644 --- a/modules/bin/open-project.nix +++ b/modules/bin/open-project.nix @@ -1,8 +1,8 @@ {pkgs}: pkgs.writeShellScriptBin "open-project" '' - TARGET=$(fd -t d --exact-depth 1 . $HOME/Projects | - sed "s~$HOME/Projects/~~" | - fzf --prompt "project > ") + TARGET=$(fd -t d --exact-depth 1 . $HOME/Projects | + sed "s~$HOME/Projects/~~" | + fzf --prompt "project > ") - zellij run -i -- /${pkgs.fish}/bin/fish -c "cd $HOME/Projects/$TARGET; fish" + zellij run -i -- /${pkgs.fish}/bin/fish -c "cd $HOME/Projects/$TARGET; fish" '' diff --git a/modules/core.nix b/modules/core.nix index 8708730..53a892f 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -1,33 +1,33 @@ {pkgs, ...}: { - programs.fish.enable = true; + programs.fish.enable = true; - nixpkgs = { - config = { - allowUnfree = true; - }; - }; + nixpkgs = { + config = { + allowUnfree = true; + }; + }; - nix = { - package = pkgs.nix; - settings = { - trusted-users = [ - "@admin" - ]; - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - gc = { - automatic = true; - options = "--delete-older-than 30d"; - }; - extraOptions = '' - experimental-features = nix-command flakes - ''; - }; + nix = { + package = pkgs.nix; + settings = { + trusted-users = [ + "@admin" + ]; + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + gc = { + automatic = true; + options = "--delete-older-than 30d"; + }; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; } diff --git a/modules/darwin/bin/wallpaper.nix b/modules/darwin/bin/wallpaper.nix index 5ceb6ef..17d6fde 100644 --- a/modules/darwin/bin/wallpaper.nix +++ b/modules/darwin/bin/wallpaper.nix @@ -1,10 +1,11 @@ {pkgs}: let - wallpaper = pkgs.fetchurl { - url = "https://misc-assets.raycast.com/wallpapers/bright-rain.png"; - sha256 = "sha256-wQT4I2X3gS6QFsEb7MdRsn4oX7FNkflukXPGMFbJZ10="; - }; + wallpaper = + pkgs.fetchurl { + url = "https://misc-assets.raycast.com/wallpapers/bright-rain.png"; + sha256 = "sha256-wQT4I2X3gS6QFsEb7MdRsn4oX7FNkflukXPGMFbJZ10="; + }; in - pkgs.writeShellScriptBin "set-wallpaper-script" '' - set -e - /usr/bin/osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"${wallpaper}\"" - '' + pkgs.writeShellScriptBin "set-wallpaper-script" '' + set -e + /usr/bin/osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"${wallpaper}\"" + '' diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index ea61302..6c55d7f 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -1,79 +1,79 @@ { - config, - constants, - inputs, - pkgs, - user, - ... + config, + constants, + inputs, + pkgs, + user, + ... }: { - imports = [ - ../core.nix - ../syncthing.nix - ../tailscale.nix - ./dock - ./homebrew.nix - ./syncthing.nix - ./system.nix - inputs.sops-nix.darwinModules.sops - ]; + imports = [ + ../core.nix + ../syncthing.nix + ../tailscale.nix + ./dock + ./homebrew.nix + ./syncthing.nix + ./system.nix + inputs.sops-nix.darwinModules.sops + ]; - system = { - primaryUser = user; - stateVersion = constants.stateVersions.darwin; - }; + system = { + primaryUser = user; + stateVersion = constants.stateVersions.darwin; + }; - nix = { - settings.trusted-users = ["@admin" "${user}"]; - gc.interval = { - Weekday = 0; - Hour = 2; - Minute = 0; - }; - }; + nix = { + settings.trusted-users = ["@admin" "${user}"]; + gc.interval = { + Weekday = 0; + Hour = 2; + Minute = 0; + }; + }; - users.users.${user} = { - name = "${user}"; - home = "/Users/${user}"; - isHidden = false; - shell = pkgs.fish; - }; + users.users.${user} = { + name = "${user}"; + home = "/Users/${user}"; + isHidden = false; + shell = pkgs.fish; + }; - home-manager = { - useGlobalPkgs = true; - users.${user} = { - pkgs, - config, - lib, - ... - }: { - _module.args = {inherit user constants inputs;}; - imports = [ - inputs.nixvim.homeModules.nixvim - ../home/default.nix - ./home/default.nix - ]; - fonts.fontconfig.enable = true; - }; - }; + home-manager = { + useGlobalPkgs = true; + users.${user} = { + pkgs, + config, + lib, + ... + }: { + _module.args = {inherit user constants inputs;}; + imports = [ + inputs.nixvim.homeModules.nixvim + ../home/default.nix + ./home/default.nix + ]; + fonts.fontconfig.enable = true; + }; + }; - local = { - dock = { - enable = true; - username = user; - entries = [ - {path = "/Applications/Helium.app/";} - {path = "${config.users.users.${user}.home}/Applications/Home Manager Apps/Ghostty.app/";} - {path = "/System/Applications/Calendar.app/";} - {path = "/System/Applications/Mail.app/";} - {path = "/System/Applications/Notes.app/";} - {path = "/System/Applications/Music.app/";} - {path = "/System/Applications/System Settings.app/";} - { - path = "${config.users.users.${user}.home}/Downloads"; - section = "others"; - options = "--sort name --view grid --display stack"; - } - ]; - }; - }; + local = { + dock = { + enable = true; + username = user; + entries = [ + {path = "/Applications/Helium.app/";} + {path = "${config.users.users.${user}.home}/Applications/Home Manager Apps/Ghostty.app/";} + {path = "/System/Applications/Calendar.app/";} + {path = "/System/Applications/Mail.app/";} + {path = "/System/Applications/Notes.app/";} + {path = "/System/Applications/Music.app/";} + {path = "/System/Applications/System Settings.app/";} + { + path = "${config.users.users.${user}.home}/Downloads"; + section = "others"; + options = "--sort name --view grid --display stack"; + } + ]; + }; + }; } diff --git a/modules/darwin/dock/default.nix b/modules/darwin/dock/default.nix index 2ad8c34..7b4bc77 100644 --- a/modules/darwin/dock/default.nix +++ b/modules/darwin/dock/default.nix @@ -1,104 +1,110 @@ { - config, - pkgs, - lib, - ... + config, + pkgs, + lib, + ... }: with lib; let - cfg = config.local.dock; - inherit (pkgs) stdenv dockutil; + cfg = config.local.dock; + inherit (pkgs) stdenv dockutil; in { - options = { - local.dock = { - enable = mkOption { - description = "Enable dock"; - default = stdenv.isDarwin; - example = false; - }; + options = { + local.dock = { + enable = + mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; - entries = mkOption { - description = "Entries on the Dock"; - type = with types; - listOf (submodule { - options = { - path = lib.mkOption {type = str;}; - section = lib.mkOption { - type = str; - default = "apps"; - }; - options = lib.mkOption { - type = str; - default = ""; - }; - }; - }); - readOnly = true; - }; + entries = + mkOption { + description = "Entries on the Dock"; + type = with types; + listOf (submodule { + options = { + path = lib.mkOption {type = str;}; + section = + lib.mkOption { + type = str; + default = "apps"; + }; + options = + lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; - username = mkOption { - description = "Username to apply the dock settings to"; - type = types.str; - }; - }; - }; + username = + mkOption { + description = "Username to apply the dock settings to"; + type = types.str; + }; + }; + }; - config = mkIf cfg.enable ( - let - normalize = path: - if hasSuffix ".app" path - then path + "/" - else path; - entryURI = path: - "file://" - + ( - builtins.replaceStrings - [ - " " - "!" - "\"" - "#" - "$" - "%" - "&" - "'" - "(" - ")" - ] - [ - "%20" - "%21" - "%22" - "%23" - "%24" - "%25" - "%26" - "%27" - "%28" - "%29" - ] - (normalize path) - ); - wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries; - createEntries = - concatMapStrings ( - entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n" - ) - cfg.entries; - in { - system.activationScripts.postActivation.text = '' - echo >&2 "Setting up the Dock for ${cfg.username}..." - su ${cfg.username} -s /bin/sh <<'USERBLOCK' - haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" - if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then - echo >&2 "Resetting Dock." - ${dockutil}/bin/dockutil --no-restart --remove all - ${createEntries} - killall Dock - else - echo >&2 "Dock setup complete." - fi - USERBLOCK - ''; - } - ); + config = + mkIf cfg.enable ( + let + normalize = path: + if hasSuffix ".app" path + then path + "/" + else path; + entryURI = path: + "file://" + + ( + builtins.replaceStrings + [ + " " + "!" + "\"" + "#" + "$" + "%" + "&" + "'" + "(" + ")" + ] + [ + "%20" + "%21" + "%22" + "%23" + "%24" + "%25" + "%26" + "%27" + "%28" + "%29" + ] + (normalize path) + ); + wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries; + createEntries = + concatMapStrings ( + entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n" + ) + cfg.entries; + in { + system.activationScripts.postActivation.text = '' + echo >&2 "Setting up the Dock for ${cfg.username}..." + su ${cfg.username} -s /bin/sh <<-'USERBLOCK' + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + USERBLOCK + ''; + } + ); } diff --git a/modules/darwin/home/default.nix b/modules/darwin/home/default.nix index 5fceea1..fd1c97f 100644 --- a/modules/darwin/home/default.nix +++ b/modules/darwin/home/default.nix @@ -1,21 +1,22 @@ { - pkgs, - lib, - ... + pkgs, + lib, + ... }: let - setWallpaperScript = import ../bin/wallpaper.nix {inherit pkgs;}; + setWallpaperScript = import ../bin/wallpaper.nix {inherit pkgs;}; in { - imports = [ - ./ghostty.nix - ]; + imports = [ + ./ghostty.nix + ]; - home = { - packages = pkgs.callPackage ../packages.nix {}; - activation = { - "setWallpaper" = lib.hm.dag.entryAfter ["revealHomeLibraryDirectory"] '' - echo "[+] Setting wallpaper" - ${setWallpaperScript}/bin/set-wallpaper-script - ''; - }; - }; + home = { + packages = pkgs.callPackage ../packages.nix {}; + activation = { + "setWallpaper" = + lib.hm.dag.entryAfter ["revealHomeLibraryDirectory"] '' + echo "[+] Setting wallpaper" + ${setWallpaperScript}/bin/set-wallpaper-script + ''; + }; + }; } diff --git a/modules/darwin/home/ghostty.nix b/modules/darwin/home/ghostty.nix index 1c78a70..6e1f7e3 100644 --- a/modules/darwin/home/ghostty.nix +++ b/modules/darwin/home/ghostty.nix @@ -1,22 +1,22 @@ {pkgs, ...}: { - programs.ghostty = { - enable = true; - package = pkgs.ghostty-bin; - settings = { - command = "${pkgs.fish}/bin/fish"; - theme = "Catppuccin Latte"; - window-padding-x = 12; - window-padding-y = 3; - window-padding-balance = true; - font-family = "TX-02 SemiCondensed"; - font-size = 16.5; - cursor-style = "block"; - mouse-hide-while-typing = true; - mouse-scroll-multiplier = 1.25; - shell-integration = "detect"; - shell-integration-features = "no-cursor"; - clipboard-read = "allow"; - clipboard-write = "allow"; - }; - }; + programs.ghostty = { + enable = true; + package = pkgs.ghostty-bin; + settings = { + command = "${pkgs.fish}/bin/fish"; + theme = "Catppuccin Latte"; + window-padding-x = 12; + window-padding-y = 3; + window-padding-balance = true; + font-family = "TX-02 SemiCondensed"; + font-size = 16.5; + cursor-style = "block"; + mouse-hide-while-typing = true; + mouse-scroll-multiplier = 1.25; + shell-integration = "detect"; + shell-integration-features = "no-cursor"; + clipboard-read = "allow"; + clipboard-write = "allow"; + }; + }; } diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix index e8369f2..a9a5a13 100644 --- a/modules/darwin/homebrew.nix +++ b/modules/darwin/homebrew.nix @@ -1,10 +1,10 @@ { - homebrew = { - enable = true; - casks = [ - "helium-browser" - "pearcleaner" - "tidal" - ]; - }; + homebrew = { + enable = true; + casks = [ + "helium-browser" + "pearcleaner" + "tidal" + ]; + }; } diff --git a/modules/darwin/packages.nix b/modules/darwin/packages.nix index 9d6da57..04923a9 100644 --- a/modules/darwin/packages.nix +++ b/modules/darwin/packages.nix @@ -1,10 +1,10 @@ {pkgs}: with pkgs; [ - _1password-gui - dockutil - mas - raycast - tailscale - # whatsapp-for-mac - xcodes + _1password-gui + dockutil + mas + raycast + tailscale + # whatsapp-for-mac + xcodes ] diff --git a/modules/darwin/syncthing.nix b/modules/darwin/syncthing.nix index 57c90d4..1679f55 100644 --- a/modules/darwin/syncthing.nix +++ b/modules/darwin/syncthing.nix @@ -1,396 +1,437 @@ { - config, - lib, - pkgs, - ... + config, + lib, + pkgs, + ... }: with lib; let - cfg = config.services.syncthing; - settingsFormat = pkgs.formats.json {}; - cleanedConfig = converge (filterAttrsRecursive (_: v: v != null && v != {})) cfg.settings; + cfg = config.services.syncthing; + settingsFormat = pkgs.formats.json {}; + cleanedConfig = converge (filterAttrsRecursive (_: v: v != null && v != {})) cfg.settings; - isUnixGui = (builtins.substring 0 1 cfg.guiAddress) == "/"; + isUnixGui = (builtins.substring 0 1 cfg.guiAddress) == "/"; - curlAddressArgs = path: - if isUnixGui - then "--unix-socket ${cfg.guiAddress} http://.${path}" - else "${cfg.guiAddress}${path}"; + curlAddressArgs = path: + if isUnixGui + then "--unix-socket ${cfg.guiAddress} http://.${path}" + else "${cfg.guiAddress}${path}"; - devices = mapAttrsToList (_: device: device // {deviceID = device.id;}) cfg.settings.devices; - anyAutoAccept = builtins.any (dev: dev.autoAcceptFolders) devices; + devices = mapAttrsToList (_: device: device // {deviceID = device.id;}) cfg.settings.devices; + anyAutoAccept = builtins.any (dev: dev.autoAcceptFolders) devices; - folders = mapAttrsToList (_: folder: - folder - // { - devices = let - folderDevices = folder.devices; - in - map ( - device: - if builtins.isString device - then {deviceId = cfg.settings.devices.${device}.id;} - else if builtins.isAttrs device - then {deviceId = cfg.settings.devices.${device.name}.id;} // device - else throw "Invalid type for devices in folder; expected list or attrset." - ) - folderDevices; - }) (filterAttrs (_: folder: folder.enable) cfg.settings.folders); + folders = + mapAttrsToList (_: folder: + folder + // { + devices = let + folderDevices = folder.devices; + in + map ( + device: + if builtins.isString device + then {deviceId = cfg.settings.devices.${device}.id;} + else if builtins.isAttrs device + then {deviceId = cfg.settings.devices.${device.name}.id;} // device + else throw "Invalid type for devices in folder; expected list or attrset." + ) + folderDevices; + }) (filterAttrs (_: folder: folder.enable) cfg.settings.folders); - jq = "${pkgs.jq}/bin/jq"; - updateConfig = pkgs.writers.writeBash "merge-syncthing-config" ( - '' - set -efu - umask 0077 + jq = "${pkgs.jq}/bin/jq"; + updateConfig = + pkgs.writers.writeBash "merge-syncthing-config" ( + '' + set -efu + umask 0077 - curl() { - while - ! ${pkgs.libxml2}/bin/xmllint \ - --xpath 'string(configuration/gui/apikey)' \ - ${cfg.configDir}/config.xml \ - >"$TMPDIR/api_key" - do sleep 1; done - (printf "X-API-Key: "; cat "$TMPDIR/api_key") >"$TMPDIR/headers" - ${pkgs.curl}/bin/curl -sSLk -H "@$TMPDIR/headers" \ - --retry 1000 --retry-delay 1 --retry-all-errors \ - "$@" - } - '' - + (lib.pipe { - devs = { - new_conf_IDs = map (v: v.id) devices; - GET_IdAttrName = "deviceID"; - override = cfg.overrideDevices; - conf = devices; - baseAddress = curlAddressArgs "/rest/config/devices"; - }; - dirs = { - new_conf_IDs = map (v: v.id) folders; - GET_IdAttrName = "id"; - override = cfg.overrideFolders; - conf = folders; - baseAddress = curlAddressArgs "/rest/config/folders"; - }; - } [ - (mapAttrs ( - conf_type: s: - lib.pipe s.conf [ - (map ( - new_cfg: let - jsonPreSecretsFile = pkgs.writeTextFile { - name = "${conf_type}-${new_cfg.id}-conf-pre-secrets.json"; - text = builtins.toJSON new_cfg; - }; - injectSecretsJqCmd = - { - "devs" = "${jq} ."; - "dirs" = let - folder = new_cfg; - devicesWithSecrets = lib.pipe folder.devices [ - (lib.filter (device: (builtins.isAttrs device) && device ? encryptionPasswordFile)) - (map (device: { - deviceId = device.deviceId; - variableName = "secret_${builtins.hashString "sha256" device.encryptionPasswordFile}"; - secretPath = device.encryptionPasswordFile; - })) - ]; - jqUpdates = - map (device: '' - .devices[] |= ( - if .deviceId == "${device.deviceId}" then - del(.encryptionPasswordFile) | - .encryptionPassword = ''$${device.variableName} - else - . - end - ) - '') - devicesWithSecrets; - jqRawFiles = map (device: "--rawfile ${device.variableName} ${lib.escapeShellArg device.secretPath}") devicesWithSecrets; - in "${jq} ${lib.concatStringsSep " " jqRawFiles} ${lib.escapeShellArg (lib.concatStringsSep "|" (["."] ++ jqUpdates))}"; - }.${ - conf_type - }; - in '' - ${injectSecretsJqCmd} ${jsonPreSecretsFile} | curl --json @- -X POST ${s.baseAddress} - '' - )) - (lib.concatStringsSep "\n") - ] - + lib.optionalString s.override '' - stale_${conf_type}_ids="$(curl -X GET ${s.baseAddress} | ${jq} \ - --argjson new_ids ${lib.escapeShellArg (builtins.toJSON s.new_conf_IDs)} \ - --raw-output \ - '[.[].${s.GET_IdAttrName}] - $new_ids | .[]' - )" - for id in ''${stale_${conf_type}_ids}; do - >&2 echo "Deleting stale device: $id" - curl -X DELETE ${s.baseAddress}/$id - done - '' - )) - builtins.attrValues - (lib.concatStringsSep "\n") - ]) - + (lib.pipe cleanedConfig [ - builtins.attrNames - (lib.subtractLists ["folders" "devices"]) - (map (subOption: '' - curl -X PUT -d ${lib.escapeShellArg (builtins.toJSON cleanedConfig.${subOption})} ${curlAddressArgs "/rest/config/${subOption}"} - '')) - (lib.concatStringsSep "\n") - ]) - + '' - if curl ${curlAddressArgs "/rest/config/restart-required"} | - ${jq} -e .requiresRestart > /dev/null; then - curl -X POST ${curlAddressArgs "/rest/system/restart"} - fi - '' - ); + curl() { + while + ! ${pkgs.libxml2}/bin/xmllint \ + --xpath 'string(configuration/gui/apikey)' \ + ${cfg.configDir}/config.xml \ + >"$TMPDIR/api_key" + do sleep 1; done + (printf "X-API-Key: "; cat "$TMPDIR/api_key") >"$TMPDIR/headers" + ${pkgs.curl}/bin/curl -sSLk -H "@$TMPDIR/headers" \ + --retry 1000 --retry-delay 1 --retry-all-errors \ + "$@" + } + '' + + (lib.pipe { + devs = { + new_conf_IDs = map (v: v.id) devices; + GET_IdAttrName = "deviceID"; + override = cfg.overrideDevices; + conf = devices; + baseAddress = curlAddressArgs "/rest/config/devices"; + }; + dirs = { + new_conf_IDs = map (v: v.id) folders; + GET_IdAttrName = "id"; + override = cfg.overrideFolders; + conf = folders; + baseAddress = curlAddressArgs "/rest/config/folders"; + }; + } [ + (mapAttrs ( + conf_type: s: + lib.pipe s.conf [ + (map ( + new_cfg: let + jsonPreSecretsFile = + pkgs.writeTextFile { + name = "${conf_type}-${new_cfg.id}-conf-pre-secrets.json"; + text = builtins.toJSON new_cfg; + }; + injectSecretsJqCmd = + { + "devs" = "${jq} ."; + "dirs" = let + folder = new_cfg; + devicesWithSecrets = + lib.pipe folder.devices [ + (lib.filter (device: (builtins.isAttrs device) && device ? encryptionPasswordFile)) + (map (device: { + deviceId = device.deviceId; + variableName = "secret_${builtins.hashString "sha256" device.encryptionPasswordFile}"; + secretPath = device.encryptionPasswordFile; + })) + ]; + jqUpdates = + map (device: '' + .devices[] |= ( + if .deviceId == "${device.deviceId}" then + del(.encryptionPasswordFile) | + .encryptionPassword = ''$${device.variableName} + else + . + end + ) + '') + devicesWithSecrets; + jqRawFiles = map (device: "--rawfile ${device.variableName} ${lib.escapeShellArg device.secretPath}") devicesWithSecrets; + in "${jq} ${lib.concatStringsSep " " jqRawFiles} ${lib.escapeShellArg (lib.concatStringsSep "|" (["."] ++ jqUpdates))}"; + }.${ + conf_type + }; + in '' + ${injectSecretsJqCmd} ${jsonPreSecretsFile} | curl --json @- -X POST ${s.baseAddress} + '' + )) + (lib.concatStringsSep "\n") + ] + + lib.optionalString s.override '' + stale_${conf_type}_ids="$(curl -X GET ${s.baseAddress} | ${jq} \ + --argjson new_ids ${lib.escapeShellArg (builtins.toJSON s.new_conf_IDs)} \ + --raw-output \ + '[.[].${s.GET_IdAttrName}] - $new_ids | .[]' + )" + for id in ''${stale_${conf_type}_ids}; do + >&2 echo "Deleting stale device: $id" + curl -X DELETE ${s.baseAddress}/$id + done + '' + )) + builtins.attrValues + (lib.concatStringsSep "\n") + ]) + + (lib.pipe cleanedConfig [ + builtins.attrNames + (lib.subtractLists ["folders" "devices"]) + (map (subOption: '' + curl -X PUT -d ${lib.escapeShellArg (builtins.toJSON cleanedConfig.${subOption})} ${curlAddressArgs "/rest/config/${subOption}"} + '')) + (lib.concatStringsSep "\n") + ]) + + '' + if curl ${curlAddressArgs "/rest/config/restart-required"} | + ${jq} -e .requiresRestart > /dev/null; then + curl -X POST ${curlAddressArgs "/rest/system/restart"} + fi + '' + ); in { - options = { - services.syncthing = { - enable = mkEnableOption "Syncthing, a self-hosted open-source alternative to Dropbox and Bittorrent Sync"; + options = { + services.syncthing = { + enable = mkEnableOption "Syncthing, a self-hosted open-source alternative to Dropbox and Bittorrent Sync"; - cert = mkOption { - type = types.nullOr types.str; - default = null; - description = "Path to the cert.pem file, which will be copied into Syncthing's configDir."; - }; + cert = + mkOption { + type = types.nullOr types.str; + default = null; + description = "Path to the cert.pem file, which will be copied into Syncthing's configDir."; + }; - key = mkOption { - type = types.nullOr types.str; - default = null; - description = "Path to the key.pem file, which will be copied into Syncthing's configDir."; - }; + key = + mkOption { + type = types.nullOr types.str; + default = null; + description = "Path to the key.pem file, which will be copied into Syncthing's configDir."; + }; - overrideDevices = mkOption { - type = types.bool; - default = true; - description = "Whether to delete the devices which are not configured via the devices option."; - }; + overrideDevices = + mkOption { + type = types.bool; + default = true; + description = "Whether to delete the devices which are not configured via the devices option."; + }; - overrideFolders = mkOption { - type = types.bool; - default = !anyAutoAccept; - description = "Whether to delete the folders which are not configured via the folders option."; - }; + overrideFolders = + mkOption { + type = types.bool; + default = !anyAutoAccept; + description = "Whether to delete the folders which are not configured via the folders option."; + }; - settings = mkOption { - type = types.submodule { - freeformType = settingsFormat.type; - options = { - options = mkOption { - default = {}; - description = "The options element contains all other global configuration options"; - type = types.submodule { - freeformType = settingsFormat.type; - options = { - localAnnounceEnabled = mkOption { - type = types.nullOr types.bool; - default = null; - description = "Whether to send announcements to the local LAN."; - }; - globalAnnounceEnabled = mkOption { - type = types.nullOr types.bool; - default = null; - description = "Whether to send announcements to the global discovery servers."; - }; - relaysEnabled = mkOption { - type = types.nullOr types.bool; - default = null; - description = "When true, relays will be connected to and potentially used for device to device connections."; - }; - urAccepted = mkOption { - type = types.nullOr types.int; - default = null; - description = "Whether the user has accepted to submit anonymous usage data."; - }; - }; - }; - }; + settings = + mkOption { + type = + types.submodule { + freeformType = settingsFormat.type; + options = { + options = + mkOption { + default = {}; + description = "The options element contains all other global configuration options"; + type = + types.submodule { + freeformType = settingsFormat.type; + options = { + localAnnounceEnabled = + mkOption { + type = types.nullOr types.bool; + default = null; + description = "Whether to send announcements to the local LAN."; + }; + globalAnnounceEnabled = + mkOption { + type = types.nullOr types.bool; + default = null; + description = "Whether to send announcements to the global discovery servers."; + }; + relaysEnabled = + mkOption { + type = types.nullOr types.bool; + default = null; + description = "When true, relays will be connected to and potentially used for device to device connections."; + }; + urAccepted = + mkOption { + type = types.nullOr types.int; + default = null; + description = "Whether the user has accepted to submit anonymous usage data."; + }; + }; + }; + }; - devices = mkOption { - default = {}; - description = "Peers/devices which Syncthing should communicate with."; - type = types.attrsOf (types.submodule ({name, ...}: { - freeformType = settingsFormat.type; - options = { - name = mkOption { - type = types.str; - default = name; - description = "The name of the device."; - }; - id = mkOption { - type = types.str; - description = "The device ID."; - }; - autoAcceptFolders = mkOption { - type = types.bool; - default = false; - description = "Automatically create or share folders that this device advertises at the default path."; - }; - }; - })); - }; + devices = + mkOption { + default = {}; + description = "Peers/devices which Syncthing should communicate with."; + type = + types.attrsOf (types.submodule ({name, ...}: { + freeformType = settingsFormat.type; + options = { + name = + mkOption { + type = types.str; + default = name; + description = "The name of the device."; + }; + id = + mkOption { + type = types.str; + description = "The device ID."; + }; + autoAcceptFolders = + mkOption { + type = types.bool; + default = false; + description = "Automatically create or share folders that this device advertises at the default path."; + }; + }; + })); + }; - folders = mkOption { - default = {}; - description = "Folders which should be shared by Syncthing."; - type = types.attrsOf (types.submodule ({name, ...}: { - freeformType = settingsFormat.type; - options = { - enable = mkOption { - type = types.bool; - default = true; - description = "Whether to share this folder."; - }; - path = mkOption { - type = types.str; - default = name; - description = "The path to the folder which should be shared."; - }; - id = mkOption { - type = types.str; - default = name; - description = "The ID of the folder. Must be the same on all devices."; - }; - label = mkOption { - type = types.str; - default = name; - description = "The label of the folder."; - }; - type = mkOption { - type = types.enum ["sendreceive" "sendonly" "receiveonly" "receiveencrypted"]; - default = "sendreceive"; - description = "Controls how the folder is handled by Syncthing."; - }; - devices = mkOption { - type = types.listOf (types.oneOf [ - types.str - (types.submodule { - freeformType = settingsFormat.type; - options = { - name = mkOption { - type = types.str; - description = "The name of a device defined in the devices option."; - }; - encryptionPasswordFile = mkOption { - type = types.nullOr types.path; - default = null; - description = "Path to encryption password file."; - }; - }; - }) - ]); - default = []; - description = "The devices this folder should be shared with."; - }; - }; - })); - }; - }; - }; - default = {}; - description = "Extra configuration options for Syncthing."; - }; + folders = + mkOption { + default = {}; + description = "Folders which should be shared by Syncthing."; + type = + types.attrsOf (types.submodule ({name, ...}: { + freeformType = settingsFormat.type; + options = { + enable = + mkOption { + type = types.bool; + default = true; + description = "Whether to share this folder."; + }; + path = + mkOption { + type = types.str; + default = name; + description = "The path to the folder which should be shared."; + }; + id = + mkOption { + type = types.str; + default = name; + description = "The ID of the folder. Must be the same on all devices."; + }; + label = + mkOption { + type = types.str; + default = name; + description = "The label of the folder."; + }; + type = + mkOption { + type = types.enum ["sendreceive" "sendonly" "receiveonly" "receiveencrypted"]; + default = "sendreceive"; + description = "Controls how the folder is handled by Syncthing."; + }; + devices = + mkOption { + type = + types.listOf (types.oneOf [ + types.str + (types.submodule { + freeformType = settingsFormat.type; + options = { + name = + mkOption { + type = types.str; + description = "The name of a device defined in the devices option."; + }; + encryptionPasswordFile = + mkOption { + type = types.nullOr types.path; + default = null; + description = "Path to encryption password file."; + }; + }; + }) + ]); + default = []; + description = "The devices this folder should be shared with."; + }; + }; + })); + }; + }; + }; + default = {}; + description = "Extra configuration options for Syncthing."; + }; - guiAddress = mkOption { - type = types.str; - default = "127.0.0.1:8384"; - description = "The address to serve the web interface at."; - }; + guiAddress = + mkOption { + type = types.str; + default = "127.0.0.1:8384"; + description = "The address to serve the web interface at."; + }; - user = mkOption { - type = types.str; - default = "syncthing"; - description = "The user to run Syncthing as."; - }; + user = + mkOption { + type = types.str; + default = "syncthing"; + description = "The user to run Syncthing as."; + }; - group = mkOption { - type = types.str; - default = "syncthing"; - description = "The group to run Syncthing under."; - }; + group = + mkOption { + type = types.str; + default = "syncthing"; + description = "The group to run Syncthing under."; + }; - dataDir = mkOption { - type = types.path; - default = "/var/lib/syncthing"; - description = "The path where synchronised directories will exist."; - }; + dataDir = + mkOption { + type = types.path; + default = "/var/lib/syncthing"; + description = "The path where synchronised directories will exist."; + }; - configDir = mkOption { - type = types.path; - default = cfg.dataDir + "/.config/syncthing"; - description = "The path where the settings and keys will exist."; - }; + configDir = + mkOption { + type = types.path; + default = cfg.dataDir + "/.config/syncthing"; + description = "The path where the settings and keys will exist."; + }; - openDefaultPorts = mkOption { - type = types.bool; - default = false; - description = "Whether to open the default ports in the firewall (not applicable on Darwin)."; - }; + openDefaultPorts = + mkOption { + type = types.bool; + default = false; + description = "Whether to open the default ports in the firewall (not applicable on Darwin)."; + }; - package = mkPackageOption pkgs "syncthing" {}; - }; - }; + package = mkPackageOption pkgs "syncthing" {}; + }; + }; - config = mkIf cfg.enable { - assertions = [ - { - assertion = !(cfg.overrideFolders && anyAutoAccept); - message = "services.syncthing.overrideFolders will delete auto-accepted folders from the configuration, creating path conflicts."; - } - ]; + config = + mkIf cfg.enable { + assertions = [ + { + assertion = !(cfg.overrideFolders && anyAutoAccept); + message = "services.syncthing.overrideFolders will delete auto-accepted folders from the configuration, creating path conflicts."; + } + ]; - environment.systemPackages = [cfg.package]; + environment.systemPackages = [cfg.package]; - launchd.user.agents.syncthing = { - serviceConfig = { - ProgramArguments = [ - "${cfg.package}/bin/syncthing" - "--no-browser" - "--gui-address=${ - if isUnixGui - then "unix://" - else "" - }${cfg.guiAddress}" - "--config=${cfg.configDir}" - "--data=${cfg.configDir}" - ]; - EnvironmentVariables = { - STNORESTART = "yes"; - STNOUPGRADE = "yes"; - }; - KeepAlive = true; - RunAtLoad = true; - ProcessType = "Background"; - StandardOutPath = "${cfg.configDir}/syncthing.log"; - StandardErrorPath = "${cfg.configDir}/syncthing.log"; - }; - }; + launchd.user.agents.syncthing = { + serviceConfig = { + ProgramArguments = [ + "${cfg.package}/bin/syncthing" + "--no-browser" + "--gui-address=${ + if isUnixGui + then "unix://" + else "" + }${cfg.guiAddress}" + "--config=${cfg.configDir}" + "--data=${cfg.configDir}" + ]; + EnvironmentVariables = { + STNORESTART = "yes"; + STNOUPGRADE = "yes"; + }; + KeepAlive = true; + RunAtLoad = true; + ProcessType = "Background"; + StandardOutPath = "${cfg.configDir}/syncthing.log"; + StandardErrorPath = "${cfg.configDir}/syncthing.log"; + }; + }; - launchd.user.agents.syncthing-init = mkIf (cleanedConfig != {}) { - serviceConfig = { - ProgramArguments = ["${updateConfig}"]; - RunAtLoad = true; - KeepAlive = false; - ProcessType = "Background"; - StandardOutPath = "${cfg.configDir}/syncthing-init.log"; - StandardErrorPath = "${cfg.configDir}/syncthing-init.log"; - }; - }; + launchd.user.agents.syncthing-init = + mkIf (cleanedConfig != {}) { + serviceConfig = { + ProgramArguments = ["${updateConfig}"]; + RunAtLoad = true; + KeepAlive = false; + ProcessType = "Background"; + StandardOutPath = "${cfg.configDir}/syncthing-init.log"; + StandardErrorPath = "${cfg.configDir}/syncthing-init.log"; + }; + }; - system.activationScripts.syncthing = mkIf (cfg.cert != null || cfg.key != null) '' - echo "Setting up Syncthing certificates..." - mkdir -p ${cfg.configDir} - ${optionalString (cfg.cert != null) '' - cp ${toString cfg.cert} ${cfg.configDir}/cert.pem - chmod 644 ${cfg.configDir}/cert.pem - ''} - ${optionalString (cfg.key != null) '' - cp ${toString cfg.key} ${cfg.configDir}/key.pem - chmod 600 ${cfg.configDir}/key.pem - ''} - ''; - }; + system.activationScripts.syncthing = + mkIf (cfg.cert != null || cfg.key != null) '' + echo "Setting up Syncthing certificates..." + mkdir -p ${cfg.configDir} + ${optionalString (cfg.cert != null) '' + cp ${toString cfg.cert} ${cfg.configDir}/cert.pem + chmod 644 ${cfg.configDir}/cert.pem + ''} + ${optionalString (cfg.key != null) '' + cp ${toString cfg.key} ${cfg.configDir}/key.pem + chmod 600 ${cfg.configDir}/key.pem + ''} + ''; + }; } diff --git a/modules/darwin/system.nix b/modules/darwin/system.nix index b03a211..01ba7d9 100644 --- a/modules/darwin/system.nix +++ b/modules/darwin/system.nix @@ -1,32 +1,32 @@ { - system.defaults = { - NSGlobalDomain = { - # null equals "Light" - AppleInterfaceStyle = null; - AppleShowAllExtensions = true; - ApplePressAndHoldEnabled = false; - KeyRepeat = 2; - InitialKeyRepeat = 15; - "com.apple.mouse.tapBehavior" = 1; - "com.apple.sound.beep.volume" = 0.0; - "com.apple.sound.beep.feedback" = 0; - }; + system.defaults = { + NSGlobalDomain = { + # null equals "Light" + AppleInterfaceStyle = null; + AppleShowAllExtensions = true; + ApplePressAndHoldEnabled = false; + KeyRepeat = 2; + InitialKeyRepeat = 15; + "com.apple.mouse.tapBehavior" = 1; + "com.apple.sound.beep.volume" = 0.0; + "com.apple.sound.beep.feedback" = 0; + }; - dock = { - autohide = true; - show-recents = false; - launchanim = true; - orientation = "bottom"; - tilesize = 60; - }; + dock = { + autohide = true; + show-recents = false; + launchanim = true; + orientation = "bottom"; + tilesize = 60; + }; - finder = { - _FXShowPosixPathInTitle = false; - }; + finder = { + _FXShowPosixPathInTitle = false; + }; - trackpad = { - Clicking = true; - TrackpadThreeFingerDrag = true; - }; - }; + trackpad = { + Clicking = true; + TrackpadThreeFingerDrag = true; + }; + }; } diff --git a/modules/home/atuin.nix b/modules/home/atuin.nix index 8356132..eb64000 100644 --- a/modules/home/atuin.nix +++ b/modules/home/atuin.nix @@ -1,15 +1,15 @@ { - programs.atuin = { - enable = true; - enableFishIntegration = true; - flags = [ - "--disable-up-arrow" - ]; - settings = { - style = "compact"; - inline_height = 0; - show_help = false; - show_tabs = false; - }; - }; + programs.atuin = { + enable = true; + enableFishIntegration = true; + flags = [ + "--disable-up-arrow" + ]; + settings = { + style = "compact"; + inline_height = 0; + show_help = false; + show_tabs = false; + }; + }; } diff --git a/modules/home/bash.nix b/modules/home/bash.nix index f5821ff..1d1eb69 100644 --- a/modules/home/bash.nix +++ b/modules/home/bash.nix @@ -1,5 +1,5 @@ { - programs.zsh = { - enable = true; - }; + programs.zsh = { + enable = true; + }; } diff --git a/modules/home/bat.nix b/modules/home/bat.nix index 1a05450..6054cc4 100644 --- a/modules/home/bat.nix +++ b/modules/home/bat.nix @@ -1,20 +1,21 @@ {pkgs, ...}: { - programs.bat = { - enable = true; - config = { - theme = "Catppuccin Latte"; - pager = "ov"; - }; - themes = { - "Catppuccin Latte" = { - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "bat"; - rev = "6810349b28055dce54076712fc05fc68da4b8ec0"; - sha256 = "lJapSgRVENTrbmpVyn+UQabC9fpV1G1e+CdlJ090uvg="; - }; - file = "themes/Catppuccin Latte.tmTheme"; - }; - }; - }; + programs.bat = { + enable = true; + config = { + theme = "Catppuccin Latte"; + pager = "ov"; + }; + themes = { + "Catppuccin Latte" = { + src = + pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "6810349b28055dce54076712fc05fc68da4b8ec0"; + sha256 = "lJapSgRVENTrbmpVyn+UQabC9fpV1G1e+CdlJ090uvg="; + }; + file = "themes/Catppuccin Latte.tmTheme"; + }; + }; + }; } diff --git a/modules/home/default.nix b/modules/home/default.nix index d8c2187..caf9c10 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,36 +1,36 @@ { - pkgs, - constants, - inputs, - ... + pkgs, + constants, + inputs, + ... }: { - imports = [ - ./atuin.nix - ./bash.nix - ./bat.nix - ./direnv.nix - ./eza.nix - ./fish.nix - ./fzf.nix - ./git.nix - ./jjui.nix - ./jujutsu.nix - ./lazygit.nix - ./mise.nix - ./neovim - ./opencode.nix - ./ripgrep.nix - ./ssh.nix - ./starship.nix - ./zellij.nix - ./zoxide.nix - ./zsh.nix - ]; + imports = [ + ./atuin.nix + ./bash.nix + ./bat.nix + ./direnv.nix + ./eza.nix + ./fish.nix + ./fzf.nix + ./git.nix + ./jjui.nix + ./jujutsu.nix + ./lazygit.nix + ./mise.nix + ./neovim + ./opencode.nix + ./ripgrep.nix + ./ssh.nix + ./starship.nix + ./zellij.nix + ./zoxide.nix + ./zsh.nix + ]; - programs.home-manager.enable = true; + programs.home-manager.enable = true; - home = { - packages = pkgs.callPackage ../packages.nix {inherit inputs;}; - stateVersion = constants.stateVersions.homeManager; - }; + home = { + packages = pkgs.callPackage ../packages.nix {inherit inputs;}; + stateVersion = constants.stateVersions.homeManager; + }; } diff --git a/modules/home/direnv.nix b/modules/home/direnv.nix index 2b51c9d..8b2a156 100644 --- a/modules/home/direnv.nix +++ b/modules/home/direnv.nix @@ -1,6 +1,6 @@ { - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; } diff --git a/modules/home/eza.nix b/modules/home/eza.nix index 8b6f9a6..bc6ce0c 100644 --- a/modules/home/eza.nix +++ b/modules/home/eza.nix @@ -1,6 +1,6 @@ { - programs.eza = { - enable = true; - enableFishIntegration = true; - }; + programs.eza = { + enable = true; + enableFishIntegration = true; + }; } diff --git a/modules/home/fish.nix b/modules/home/fish.nix index b5f1dc2..7c5b577 100644 --- a/modules/home/fish.nix +++ b/modules/home/fish.nix @@ -1,54 +1,54 @@ { - programs.fish = { - enable = true; - functions = { - open_project = '' - set -l base "$HOME/Projects" - set -l choice (fd -t d -d 1 -a . "$base/Personal" "$base/Work" \ - | string replace -r -- "^$base/" "" \ - | fzf --prompt "project > ") - test -n "$choice"; and cd "$base/$choice" - ''; - }; - interactiveShellInit = '' - set fish_greeting + programs.fish = { + enable = true; + functions = { + open_project = '' + set -l base "$HOME/Projects" + set -l choice (fd -t d -d 1 -a . "$base/Personal" "$base/Work" \ + | string replace -r -- "^$base/" "" \ + | fzf --prompt "project > ") + test -n "$choice"; and cd "$base/$choice" + ''; + }; + interactiveShellInit = '' + set fish_greeting - set fish_color_normal 4c4f69 - set fish_color_command 1e66f5 - set fish_color_param dd7878 - set fish_color_keyword d20f39 - set fish_color_quote 40a02b - set fish_color_redirection ea76cb - set fish_color_end fe640b - set fish_color_comment 8c8fa1 - set fish_color_error d20f39 - set fish_color_gray 9ca0b0 - set fish_color_selection --background=ccd0da - set fish_color_search_match --background=ccd0da - set fish_color_option 40a02b - set fish_color_operator ea76cb - set fish_color_escape e64553 - set fish_color_autosuggestion 9ca0b0 - set fish_color_cancel d20f39 - set fish_color_cwd df8e1d - set fish_color_user 179299 - set fish_color_host 1e66f5 - set fish_color_host_remote 40a02b - set fish_color_status d20f39 - set fish_pager_color_progress 9ca0b0 - set fish_pager_color_prefix ea76cb - set fish_pager_color_completion 4c4f69 - set fish_pager_color_description 9ca0b0 + set fish_color_normal 4c4f69 + set fish_color_command 1e66f5 + set fish_color_param dd7878 + set fish_color_keyword d20f39 + set fish_color_quote 40a02b + set fish_color_redirection ea76cb + set fish_color_end fe640b + set fish_color_comment 8c8fa1 + set fish_color_error d20f39 + set fish_color_gray 9ca0b0 + set fish_color_selection --background=ccd0da + set fish_color_search_match --background=ccd0da + set fish_color_option 40a02b + set fish_color_operator ea76cb + set fish_color_escape e64553 + set fish_color_autosuggestion 9ca0b0 + set fish_color_cancel d20f39 + set fish_color_cwd df8e1d + set fish_color_user 179299 + set fish_color_host 1e66f5 + set fish_color_host_remote 40a02b + set fish_color_status d20f39 + set fish_pager_color_progress 9ca0b0 + set fish_pager_color_prefix ea76cb + set fish_pager_color_completion 4c4f69 + set fish_pager_color_description 9ca0b0 - set -gx LS_COLORS "$(vivid generate catppuccin-latte)" + set -gx LS_COLORS "$(vivid generate catppuccin-latte)" - set -gx COLORTERM truecolor - set -gx COLORFGBG "15;0" - set -gx TERM_BACKGROUND light + set -gx COLORTERM truecolor + set -gx COLORFGBG "15;0" + set -gx TERM_BACKGROUND light - for mode in default insert - bind --mode $mode \cp open_project - end - ''; - }; + for mode in default insert + bind --mode $mode \cp open_project + end + ''; + }; } diff --git a/modules/home/fzf.nix b/modules/home/fzf.nix index a9763b1..bd517a3 100644 --- a/modules/home/fzf.nix +++ b/modules/home/fzf.nix @@ -1,24 +1,24 @@ { - programs.fzf = { - enable = true; - enableFishIntegration = true; - }; + programs.fzf = { + enable = true; + enableFishIntegration = true; + }; - home.sessionVariables = { - FZF_DEFAULT_OPTS = '' - --bind=alt-k:up,alt-j:down - --expect=tab,enter - --layout=reverse - --delimiter='\t' - --with-nth=1 - --preview-window='border-rounded' --prompt=' ' --marker=' ' --pointer=' ' - --separator='─' --scrollbar='┃' --layout='reverse' + home.sessionVariables = { + FZF_DEFAULT_OPTS = '' + --bind=alt-k:up,alt-j:down + --expect=tab,enter + --layout=reverse + --delimiter='\t' + --with-nth=1 + --preview-window='border-rounded' --prompt=' ' --marker=' ' --pointer=' ' + --separator='─' --scrollbar='┃' --layout='reverse' - --color=bg+:#CCD0DA,bg:#EFF1F5,spinner:#DC8A78,hl:#D20F39 - --color=fg:#4C4F69,header:#D20F39,info:#8839EF,pointer:#DC8A78 - --color=marker:#7287FD,fg+:#4C4F69,prompt:#8839EF,hl+:#D20F39 - --color=selected-bg:#BCC0CC - --color=border:#9CA0B0,label:#4C4F69 - ''; - }; + --color=bg+:#CCD0DA,bg:#EFF1F5,spinner:#DC8A78,hl:#D20F39 + --color=fg:#4C4F69,header:#D20F39,info:#8839EF,pointer:#DC8A78 + --color=marker:#7287FD,fg+:#4C4F69,prompt:#8839EF,hl+:#D20F39 + --color=selected-bg:#BCC0CC + --color=border:#9CA0B0,label:#4C4F69 + ''; + }; } diff --git a/modules/home/git.nix b/modules/home/git.nix index 127442e..ed7f8e4 100644 --- a/modules/home/git.nix +++ b/modules/home/git.nix @@ -1,211 +1,211 @@ {...}: let - name = "Christoph Schmatzler"; + name = "Christoph Schmatzler"; in { - programs.git = { - enable = true; - ignores = ["*.swp"]; - settings = { - user.name = name; - init.defaultBranch = "main"; - core = { - editor = "vim"; - autocrlf = "input"; - pager = "delta"; - }; - pull.rebase = true; - rebase.autoStash = true; - interactive.diffFilter = "delta --color-only"; - delta = { - navigate = true; - line-numbers = true; - syntax-theme = "GitHub"; - side-by-side = true; - pager = "less -FRX"; - }; - pager = { - diff = "delta"; - log = "delta"; - show = "delta"; - }; - }; - lfs = { - enable = true; - }; - }; + programs.git = { + enable = true; + ignores = ["*.swp"]; + settings = { + user.name = name; + init.defaultBranch = "main"; + core = { + editor = "vim"; + autocrlf = "input"; + pager = "delta"; + }; + pull.rebase = true; + rebase.autoStash = true; + interactive.diffFilter = "delta --color-only"; + delta = { + navigate = true; + line-numbers = true; + syntax-theme = "GitHub"; + side-by-side = true; + pager = "less -FRX"; + }; + pager = { + diff = "delta"; + log = "delta"; + show = "delta"; + }; + }; + lfs = { + enable = true; + }; + }; - home.shellAliases = { - g = "git"; - ga = "git add"; - gaa = "git add --all"; - gapa = "git add --patch"; - gau = "git add --update"; - gav = "git add --verbose"; - gap = "git apply"; - gapt = "git apply --3way"; - gb = "git branch"; - gba = "git branch --all"; - gbd = "git branch --delete"; - gbD = "git branch --delete --force"; - gbl = "git blame -w"; - gbnm = "git branch --no-merged"; - gbr = "git branch --remote"; - gbs = "git bisect"; - gbsb = "git bisect bad"; - gbsg = "git bisect good"; - gbsn = "git bisect new"; - gbso = "git bisect old"; - gbsr = "git bisect reset"; - gbss = "git bisect start"; - gc = "git commit --verbose"; - gca = "git commit --verbose --all"; - gcam = "git commit --all --message"; - gcas = "git commit --all --signoff"; - gcasm = "git commit --all --signoff --message"; - gcb = "git checkout -b"; - gcB = "git checkout -B"; - gcf = "git config --list"; - gclean = "git clean --interactive -d"; - gcl = "git clone --recurse-submodules"; - gclf = "git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules"; - gcm = "git checkout main"; - gcmsg = "git commit --message"; - gcn = "git commit --verbose --no-edit"; - gco = "git checkout"; - gcor = "git checkout --recurse-submodules"; - gcount = "git shortlog --summary --numbered"; - gcp = "git cherry-pick"; - gcpa = "git cherry-pick --abort"; - gcpc = "git cherry-pick --continue"; - gcs = "git commit --gpg-sign"; - gcss = "git commit --gpg-sign --signoff"; - gcssm = "git commit --gpg-sign --signoff --message"; - gcsm = "git commit --signoff --message"; - gd = "git diff"; - gdca = "git diff --cached"; - gdcw = "git diff --cached --word-diff"; - gds = "git diff --staged"; - gdw = "git diff --word-diff"; - gdt = "git diff-tree --no-commit-id --name-only -r"; - gdup = "git diff @{upstream}"; - gf = "git fetch"; - gfa = "git fetch --all --tags --prune"; - gfo = "git fetch origin"; - gfg = "git ls-files | grep"; - gg = "git gui citool"; - gga = "git gui citool --amend"; - ggpull = "git pull origin \"$(git branch --show-current)\""; - ggpush = "git push origin \"$(git branch --show-current)\""; - ggsup = "git branch --set-upstream-to=origin/$(git branch --show-current)"; - ghh = "git help"; - gignore = "git update-index --assume-unchanged"; - gignored = "git ls-files -v | grep \"^[[:lower:]]\""; - gl = "git pull"; - glg = "git log --stat"; - glgp = "git log --stat --patch"; - glgg = "git log --graph"; - glgga = "git log --graph --decorate --all"; - glgm = "git log --graph --max-count=10"; - glo = "git log --oneline --decorate"; - glog = "git log --oneline --decorate --graph"; - gloga = "git log --oneline --decorate --graph --all"; - glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\""; - glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all"; - glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat"; - glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\""; - glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short"; - gluc = "git pull upstream $(git branch --show-current)"; - glum = "git pull upstream main"; - gm = "git merge"; - gma = "git merge --abort"; - gmc = "git merge --continue"; - gms = "git merge --squash"; - gmff = "git merge --ff-only"; - gmtl = "git mergetool --no-prompt"; - gmtlvim = "git mergetool --no-prompt --tool=vimdiff"; - gmum = "git merge upstream/main"; - gmom = "git merge origin/main"; - gp = "git push"; - gpd = "git push --dry-run"; - gpf = "git push --force-with-lease"; - gpod = "git push origin --delete"; - gpoat = "git push origin --all && git push origin --tags"; - gpr = "git pull --rebase"; - gpra = "git pull --rebase --autostash"; - gprav = "git pull --rebase --autostash -v"; - gprom = "git pull --rebase origin main"; - gpromi = "git pull --rebase=interactive origin main"; - gprv = "git pull --rebase -v"; - gprum = "git pull --rebase upstream main"; - gprumi = "git pull --rebase=interactive upstream main"; - gpsup = "git push --set-upstream origin $(git branch --show-current)"; - gpsupf = "git push --set-upstream origin $(git branch --show-current) --force-with-lease"; - gpv = "git push --verbose"; - gpu = "git push upstream"; - gr = "git remote"; - gra = "git remote add"; - grb = "git rebase"; - grba = "git rebase --abort"; - grbc = "git rebase --continue"; - grbd = "git rebase develop"; - grbi = "git rebase --interactive"; - grbm = "git rebase main"; - grbo = "git rebase --onto"; - grbom = "git rebase origin/main"; - grbs = "git rebase --skip"; - grbum = "git rebase upstream/main"; - grev = "git revert"; - greva = "git revert --abort"; - grevc = "git revert --continue"; - grf = "git reflog"; - grh = "git reset"; - grhh = "git reset --hard"; - grhk = "git reset --keep"; - grhs = "git reset --soft"; - grm = "git rm"; - grmc = "git rm --cached"; - grmv = "git remote rename"; - groh = "git reset origin/$(git branch --show-current) --hard"; - grrm = "git remote remove"; - grs = "git restore"; - grset = "git remote set-url"; - grss = "git restore --source"; - grst = "git restore --staged"; - grt = "cd \"$(git rev-parse --show-toplevel || echo .)\""; - gru = "git reset --"; - grup = "git remote update"; - grv = "git remote --verbose"; - gsb = "git status --short --branch"; - gsh = "git show"; - gsi = "git submodule init"; - gsps = "git show --pretty=short --show-signature"; - gss = "git status --short"; - gst = "git status"; - gsta = "git stash push"; - gstaa = "git stash apply"; - gstall = "git stash --all"; - gstc = "git stash clear"; - gstd = "git stash drop"; - gstl = "git stash list"; - gstp = "git stash pop"; - gsts = "git stash show --patch"; - gstu = "git stash push --include-untracked"; - gsu = "git submodule update"; - gsw = "git switch"; - gswc = "git switch --create"; - gswd = "git switch develop"; - gswm = "git switch main"; - gta = "git tag --annotate"; - gts = "git tag --sign"; - gtv = "git tag | sort -V"; - gunignore = "git update-index --no-assume-unchanged"; - gunwip = "git rev-list --max-count=1 --format=\"%s\" HEAD | grep -q \"\\--wip--\" && git reset HEAD~1"; - gwch = "git whatchanged -p --abbrev-commit --pretty=medium"; - gwipe = "git reset --hard && git clean --force -df"; - gwt = "git worktree"; - gwta = "git worktree add"; - gwtls = "git worktree list"; - gwtmv = "git worktree move"; - gwtrm = "git worktree remove"; - gwip = "git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message \"--wip-- [skip ci]\""; - }; + home.shellAliases = { + g = "git"; + ga = "git add"; + gaa = "git add --all"; + gapa = "git add --patch"; + gau = "git add --update"; + gav = "git add --verbose"; + gap = "git apply"; + gapt = "git apply --3way"; + gb = "git branch"; + gba = "git branch --all"; + gbd = "git branch --delete"; + gbD = "git branch --delete --force"; + gbl = "git blame -w"; + gbnm = "git branch --no-merged"; + gbr = "git branch --remote"; + gbs = "git bisect"; + gbsb = "git bisect bad"; + gbsg = "git bisect good"; + gbsn = "git bisect new"; + gbso = "git bisect old"; + gbsr = "git bisect reset"; + gbss = "git bisect start"; + gc = "git commit --verbose"; + gca = "git commit --verbose --all"; + gcam = "git commit --all --message"; + gcas = "git commit --all --signoff"; + gcasm = "git commit --all --signoff --message"; + gcb = "git checkout -b"; + gcB = "git checkout -B"; + gcf = "git config --list"; + gclean = "git clean --interactive -d"; + gcl = "git clone --recurse-submodules"; + gclf = "git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules"; + gcm = "git checkout main"; + gcmsg = "git commit --message"; + gcn = "git commit --verbose --no-edit"; + gco = "git checkout"; + gcor = "git checkout --recurse-submodules"; + gcount = "git shortlog --summary --numbered"; + gcp = "git cherry-pick"; + gcpa = "git cherry-pick --abort"; + gcpc = "git cherry-pick --continue"; + gcs = "git commit --gpg-sign"; + gcss = "git commit --gpg-sign --signoff"; + gcssm = "git commit --gpg-sign --signoff --message"; + gcsm = "git commit --signoff --message"; + gd = "git diff"; + gdca = "git diff --cached"; + gdcw = "git diff --cached --word-diff"; + gds = "git diff --staged"; + gdw = "git diff --word-diff"; + gdt = "git diff-tree --no-commit-id --name-only -r"; + gdup = "git diff @{upstream}"; + gf = "git fetch"; + gfa = "git fetch --all --tags --prune"; + gfo = "git fetch origin"; + gfg = "git ls-files | grep"; + gg = "git gui citool"; + gga = "git gui citool --amend"; + ggpull = "git pull origin \"$(git branch --show-current)\""; + ggpush = "git push origin \"$(git branch --show-current)\""; + ggsup = "git branch --set-upstream-to=origin/$(git branch --show-current)"; + ghh = "git help"; + gignore = "git update-index --assume-unchanged"; + gignored = "git ls-files -v | grep \"^[[:lower:]]\""; + gl = "git pull"; + glg = "git log --stat"; + glgp = "git log --stat --patch"; + glgg = "git log --graph"; + glgga = "git log --graph --decorate --all"; + glgm = "git log --graph --max-count=10"; + glo = "git log --oneline --decorate"; + glog = "git log --oneline --decorate --graph"; + gloga = "git log --oneline --decorate --graph --all"; + glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\""; + glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all"; + glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat"; + glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\""; + glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short"; + gluc = "git pull upstream $(git branch --show-current)"; + glum = "git pull upstream main"; + gm = "git merge"; + gma = "git merge --abort"; + gmc = "git merge --continue"; + gms = "git merge --squash"; + gmff = "git merge --ff-only"; + gmtl = "git mergetool --no-prompt"; + gmtlvim = "git mergetool --no-prompt --tool=vimdiff"; + gmum = "git merge upstream/main"; + gmom = "git merge origin/main"; + gp = "git push"; + gpd = "git push --dry-run"; + gpf = "git push --force-with-lease"; + gpod = "git push origin --delete"; + gpoat = "git push origin --all && git push origin --tags"; + gpr = "git pull --rebase"; + gpra = "git pull --rebase --autostash"; + gprav = "git pull --rebase --autostash -v"; + gprom = "git pull --rebase origin main"; + gpromi = "git pull --rebase=interactive origin main"; + gprv = "git pull --rebase -v"; + gprum = "git pull --rebase upstream main"; + gprumi = "git pull --rebase=interactive upstream main"; + gpsup = "git push --set-upstream origin $(git branch --show-current)"; + gpsupf = "git push --set-upstream origin $(git branch --show-current) --force-with-lease"; + gpv = "git push --verbose"; + gpu = "git push upstream"; + gr = "git remote"; + gra = "git remote add"; + grb = "git rebase"; + grba = "git rebase --abort"; + grbc = "git rebase --continue"; + grbd = "git rebase develop"; + grbi = "git rebase --interactive"; + grbm = "git rebase main"; + grbo = "git rebase --onto"; + grbom = "git rebase origin/main"; + grbs = "git rebase --skip"; + grbum = "git rebase upstream/main"; + grev = "git revert"; + greva = "git revert --abort"; + grevc = "git revert --continue"; + grf = "git reflog"; + grh = "git reset"; + grhh = "git reset --hard"; + grhk = "git reset --keep"; + grhs = "git reset --soft"; + grm = "git rm"; + grmc = "git rm --cached"; + grmv = "git remote rename"; + groh = "git reset origin/$(git branch --show-current) --hard"; + grrm = "git remote remove"; + grs = "git restore"; + grset = "git remote set-url"; + grss = "git restore --source"; + grst = "git restore --staged"; + grt = "cd \"$(git rev-parse --show-toplevel || echo .)\""; + gru = "git reset --"; + grup = "git remote update"; + grv = "git remote --verbose"; + gsb = "git status --short --branch"; + gsh = "git show"; + gsi = "git submodule init"; + gsps = "git show --pretty=short --show-signature"; + gss = "git status --short"; + gst = "git status"; + gsta = "git stash push"; + gstaa = "git stash apply"; + gstall = "git stash --all"; + gstc = "git stash clear"; + gstd = "git stash drop"; + gstl = "git stash list"; + gstp = "git stash pop"; + gsts = "git stash show --patch"; + gstu = "git stash push --include-untracked"; + gsu = "git submodule update"; + gsw = "git switch"; + gswc = "git switch --create"; + gswd = "git switch develop"; + gswm = "git switch main"; + gta = "git tag --annotate"; + gts = "git tag --sign"; + gtv = "git tag | sort -V"; + gunignore = "git update-index --no-assume-unchanged"; + gunwip = "git rev-list --max-count=1 --format=\"%s\" HEAD | grep -q \"\\--wip--\" && git reset HEAD~1"; + gwch = "git whatchanged -p --abbrev-commit --pretty=medium"; + gwipe = "git reset --hard && git clean --force -df"; + gwt = "git worktree"; + gwta = "git worktree add"; + gwtls = "git worktree list"; + gwtmv = "git worktree move"; + gwtrm = "git worktree remove"; + gwip = "git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message \"--wip-- [skip ci]\""; + }; } diff --git a/modules/home/jjui.nix b/modules/home/jjui.nix index 056e1fc..5a6277d 100644 --- a/modules/home/jjui.nix +++ b/modules/home/jjui.nix @@ -1,5 +1,5 @@ { - programs.jjui = { - enable = true; - }; + programs.jjui = { + enable = true; + }; } diff --git a/modules/home/jujutsu.nix b/modules/home/jujutsu.nix index 5495228..c342647 100644 --- a/modules/home/jujutsu.nix +++ b/modules/home/jujutsu.nix @@ -1,27 +1,27 @@ { - programs.jujutsu = { - enable = true; - settings = { - user = { - name = "Christoph Schmatzler"; - email = "christoph@schmatzler.com"; - }; - diff = { - tool = "delta"; - }; - ui = { - default-command = "status"; - diff-formatter = ":git"; - pager = ["delta" "--pager" "less -FRX"]; - diff-editor = ["nvim" "-c" "DiffEditor $left $right $output"]; - }; - aliases = { - tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"]; - retrunk = ["rebase" "-d" "trunk()"]; - }; - revset-aliases = { - "closest_bookmark(to)" = "heads(::to & bookmarks())"; - }; - }; - }; + programs.jujutsu = { + enable = true; + settings = { + user = { + name = "Christoph Schmatzler"; + email = "christoph@schmatzler.com"; + }; + diff = { + tool = "delta"; + }; + ui = { + default-command = "status"; + diff-formatter = ":git"; + pager = ["delta" "--pager" "less -FRX"]; + diff-editor = ["nvim" "-c" "DiffEditor $left $right $output"]; + }; + aliases = { + tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"]; + retrunk = ["rebase" "-d" "trunk()"]; + }; + revset-aliases = { + "closest_bookmark(to)" = "heads(::to & bookmarks())"; + }; + }; + }; } diff --git a/modules/home/lazygit.nix b/modules/home/lazygit.nix index 7484873..f45fb7d 100644 --- a/modules/home/lazygit.nix +++ b/modules/home/lazygit.nix @@ -1,58 +1,58 @@ { - programs.lazygit = { - enable = true; - settings = { - git = { - commit.signOff = true; - pagers = [ - { - delta = { - colorArg = "always"; - pager = "DELTA_FEATURES=decorations delta --light --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format=\"lazygit-edit://{path}:{line}\""; - }; - } - ]; - }; + programs.lazygit = { + enable = true; + settings = { + git = { + commit.signOff = true; + pagers = [ + { + delta = { + colorArg = "always"; + pager = "DELTA_FEATURES=decorations delta --light --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format=\"lazygit-edit://{path}:{line}\""; + }; + } + ]; + }; - gui = { - authorColors = { - "*" = "#7287fd"; - }; - theme = { - activeBorderColor = [ - "#8839ef" - "bold" - ]; - inactiveBorderColor = [ - "#6c6f85" - ]; - optionsTextColor = [ - "#1e66f5" - ]; - selectedLineBgColor = [ - "#ccd0da" - ]; - cherryPickedCommitBgColor = [ - "#bcc0cc" - ]; - cherryPickedCommitFgColor = [ - "#8839ef" - ]; - defaultFgColor = [ - "#4c4f69" - ]; - searchingActiveBorderColor = [ - "#df8e1d" - ]; - unstagedChangesColor = [ - "#d20f39" - ]; - }; - }; - }; - }; + gui = { + authorColors = { + "*" = "#7287fd"; + }; + theme = { + activeBorderColor = [ + "#8839ef" + "bold" + ]; + inactiveBorderColor = [ + "#6c6f85" + ]; + optionsTextColor = [ + "#1e66f5" + ]; + selectedLineBgColor = [ + "#ccd0da" + ]; + cherryPickedCommitBgColor = [ + "#bcc0cc" + ]; + cherryPickedCommitFgColor = [ + "#8839ef" + ]; + defaultFgColor = [ + "#4c4f69" + ]; + searchingActiveBorderColor = [ + "#df8e1d" + ]; + unstagedChangesColor = [ + "#d20f39" + ]; + }; + }; + }; + }; - home.shellAliases = { - lg = "lazygit"; - }; + home.shellAliases = { + lg = "lazygit"; + }; } diff --git a/modules/home/mise.nix b/modules/home/mise.nix index bf450c9..c7548d0 100644 --- a/modules/home/mise.nix +++ b/modules/home/mise.nix @@ -1,10 +1,10 @@ { - programs.mise = { - enable = true; - enableFishIntegration = true; - enableZshIntegration = true; - settings = { - auto_install = false; - }; - }; + programs.mise = { + enable = true; + enableFishIntegration = true; + enableZshIntegration = true; + settings = { + auto_install = false; + }; + }; } diff --git a/modules/home/neovim/autocmd.nix b/modules/home/neovim/autocmd.nix index 991a8ce..3776458 100644 --- a/modules/home/neovim/autocmd.nix +++ b/modules/home/neovim/autocmd.nix @@ -1,34 +1,34 @@ { - programs.nixvim = { - autoGroups = { - Christoph = {}; - }; + programs.nixvim = { + autoGroups = { + Christoph = {}; + }; - autoCmd = [ - { - event = "BufWritePre"; - group = "Christoph"; - pattern = "*"; - command = "%s/\\s\\+$//e"; - } - { - event = "BufReadPost"; - group = "Christoph"; - pattern = "*"; - command = "normal zR"; - } - { - event = "FileReadPost"; - group = "Christoph"; - pattern = "*"; - command = "normal zR"; - } - { - event = "FileType"; - group = "Christoph"; - pattern = "*.ex,*.exs,*.heex"; - command = "setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2"; - } - ]; - }; + autoCmd = [ + { + event = "BufWritePre"; + group = "Christoph"; + pattern = "*"; + command = "%s/\\s\\+$//e"; + } + { + event = "BufReadPost"; + group = "Christoph"; + pattern = "*"; + command = "normal zR"; + } + { + event = "FileReadPost"; + group = "Christoph"; + pattern = "*"; + command = "normal zR"; + } + { + event = "FileType"; + group = "Christoph"; + pattern = "*.ex,*.exs,*.heex"; + command = "setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2"; + } + ]; + }; } diff --git a/modules/home/neovim/default.nix b/modules/home/neovim/default.nix index 3648b75..3750f89 100644 --- a/modules/home/neovim/default.nix +++ b/modules/home/neovim/default.nix @@ -1,37 +1,37 @@ { - imports = [ - ./autocmd.nix - ./mappings.nix - ./options.nix - ./plugins/blink-cmp.nix - ./plugins/conform.nix - ./plugins/copilot.nix - ./plugins/grug-far.nix - ./plugins/harpoon.nix - ./plugins/hunk.nix - ./plugins/lsp.nix - ./plugins/mini.nix - ./plugins/oil.nix - ./plugins/toggleterm.nix - ./plugins/treesitter.nix - ]; + imports = [ + ./autocmd.nix + ./mappings.nix + ./options.nix + ./plugins/blink-cmp.nix + ./plugins/conform.nix + ./plugins/copilot.nix + ./plugins/grug-far.nix + ./plugins/harpoon.nix + ./plugins/hunk.nix + ./plugins/lsp.nix + ./plugins/mini.nix + ./plugins/oil.nix + ./plugins/toggleterm.nix + ./plugins/treesitter.nix + ]; - programs.nixvim = { - enable = true; - defaultEditor = true; - luaLoader.enable = true; - colorschemes.catppuccin = { - enable = true; - settings = { - flavour = "latte"; - }; - }; - extraConfigLua = '' - vim.ui.select = MiniPick.ui_select - ''; - }; + programs.nixvim = { + enable = true; + defaultEditor = true; + luaLoader.enable = true; + colorschemes.catppuccin = { + enable = true; + settings = { + flavour = "latte"; + }; + }; + extraConfigLua = '' + vim.ui.select = MiniPick.ui_select + ''; + }; - home.shellAliases = { - v = "nvim"; - }; + home.shellAliases = { + v = "nvim"; + }; } diff --git a/modules/home/neovim/mappings.nix b/modules/home/neovim/mappings.nix index a274b87..23bf9b5 100644 --- a/modules/home/neovim/mappings.nix +++ b/modules/home/neovim/mappings.nix @@ -1,235 +1,235 @@ { - programs.nixvim.keymaps = [ - # clipboard - OSC52 yank and paste - { - mode = ["n" "v"]; - key = "y"; - action = ''"+y''; - options.desc = "Yank to system clipboard (OSC52)"; - } - # e - explore/edit - { - mode = "n"; - key = "ef"; - action = ":lua require('oil').open()"; - options.desc = "File directory"; - } - { - mode = "n"; - key = "er"; - action = ":lua require('grug-far').open()"; - options.desc = "Search and replace"; - } - # f - find - { - mode = "n"; - key = "f/"; - action = ":Pick history scope='/'"; - options.desc = "'/' history"; - } - { - mode = "n"; - key = "f:"; - action = ":Pick history scope=':'"; - options.desc = "':' history"; - } - { - mode = "n"; - key = "fa"; - action = ":Pick git_hunks scope='staged'"; - options.desc = "Added hunks (all)"; - } - { - mode = "n"; - key = "fA"; - action = ":Pick git_hunks path='%' scope='staged'"; - options.desc = "Added hunks (buffer)"; - } - { - mode = "n"; - key = "fb"; - action = ":Pick buffers"; - options.desc = "Buffers"; - } - { - mode = "n"; - key = "fd"; - action = ":Pick diagnostic scope='all'"; - options.desc = "Diagnostic (workspace)"; - } - { - mode = "n"; - key = "fD"; - action = ":Pick diagnostic scope='current'"; - options.desc = "Diagnostic (buffer)"; - } - { - mode = "n"; - key = "ff"; - action = ":Pick files"; - options.desc = "Search files"; - } - { - mode = "n"; - key = "fg"; - action = ":Pick grep_live"; - options.desc = "Grep"; - } - { - mode = "n"; - key = "fm"; - action = ":Pick git_hunks"; - options.desc = "Modified hunks (all)"; - } - { - mode = "n"; - key = "fM"; - action = ":Pick git_hunks path='%'"; - options.desc = "Modified hunks (buffer)"; - } - { - mode = "n"; - key = "fr"; - action = ":Pick lsp scope='references'"; - options.desc = "References (LSP)"; - } - { - mode = "n"; - key = "fs"; - action = ":Pick lsp scope='workspace_symbol'"; - options.desc = "Symbols (LSP, workspace)"; - } - { - mode = "n"; - key = "fS"; - action = ":Pick lsp scope='document_symbol'"; - options.desc = "Symbols (LSP, buffer)"; - } - { - mode = "n"; - key = "fv"; - action = ":Pick visit_paths cwd=\"\""; - options.desc = "Visit paths (all)"; - } - { - mode = "n"; - key = "fV"; - action = ":Pick visit_paths"; - options.desc = "Visit paths (cwd)"; - } - # g - git - { - mode = "n"; - key = "gd"; - action = ":DiffviewOpen"; - } - { - mode = "n"; - key = "gg"; - action.__raw = '' - function() - require('toggleterm.terminal').Terminal:new({ cmd = 'jjui', direction = 'float' }):toggle() - end - ''; - options.desc = "jjui"; - } - # l - lsp/formatter - { - mode = "n"; - key = "la"; - action = ":lua vim.lsp.buf.code_action()"; - options.desc = "Actions"; - } - { - mode = "n"; - key = "ld"; - action = ":lua vim.diagnostic.open_float({ severity = { min = vim.diagnostic.severity.HINT } })"; - options.desc = "Diagnostics popup"; - } - { - mode = "n"; - key = "lf"; - action = ":lua require('conform').format({ lsp_fallback = true })"; - options.desc = "Format"; - } - { - mode = "n"; - key = "li"; - action = ":lua vim.lsp.buf.hover()"; - options.desc = "Information"; - } - { - mode = "n"; - key = "lj"; - action = ":lua vim.diagnostic.goto_next()"; - options.desc = "Next diagnostic"; - } - { - mode = "n"; - key = "lk"; - action = ":lua vim.diagnostic.goto_prev()"; - options.desc = "Prev diagnostic"; - } - { - mode = "n"; - key = "lr"; - action = ":lua vim.lsp.buf.rename()"; - options.desc = "Rename"; - } - { - mode = "n"; - key = "lR"; - action = ":lua vim.lsp.buf.references()"; - options.desc = "References"; - } - { - mode = "n"; - key = "ls"; - action = ":lua vim.lsp.buf.definition()"; - options.desc = "Source definition"; - } - # other - { - mode = "n"; - key = "j"; - action = ":lua require('mini.jump2d').start(require('mini.jump2d').builtin_opts.query)"; - options.desc = "Jump to character"; - } - { - mode = "n"; - key = "a"; - action = ":lua require('harpoon'):list():add()"; - options.desc = "Add harpoon"; - } - { - mode = "n"; - key = ""; - action = ":lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())"; - options.desc = "Toggle harpoon quick menu"; - } - { - mode = "n"; - key = "1"; - action = ":lua require('harpoon'):list():select(1)"; - options.desc = "Go to harpoon 1"; - } - { - mode = "n"; - key = "2"; - action = ":lua require('harpoon'):list():select(2)"; - options.desc = "Go to harpoon 2"; - } - { - mode = "n"; - key = "3"; - action = ":lua require('harpoon'):list():select(3)"; - options.desc = "Go to harpoon 3"; - } - { - mode = "n"; - key = "4"; - action = ":lua require('harpoon'):list():select(4)"; - options.desc = "Go to harpoon 4"; - } - ]; + programs.nixvim.keymaps = [ + # clipboard - OSC52 yank and paste + { + mode = ["n" "v"]; + key = "y"; + action = ''"+y''; + options.desc = "Yank to system clipboard (OSC52)"; + } + # e - explore/edit + { + mode = "n"; + key = "ef"; + action = ":lua require('oil').open()"; + options.desc = "File directory"; + } + { + mode = "n"; + key = "er"; + action = ":lua require('grug-far').open()"; + options.desc = "Search and replace"; + } + # f - find + { + mode = "n"; + key = "f/"; + action = ":Pick history scope='/'"; + options.desc = "'/' history"; + } + { + mode = "n"; + key = "f:"; + action = ":Pick history scope=':'"; + options.desc = "':' history"; + } + { + mode = "n"; + key = "fa"; + action = ":Pick git_hunks scope='staged'"; + options.desc = "Added hunks (all)"; + } + { + mode = "n"; + key = "fA"; + action = ":Pick git_hunks path='%' scope='staged'"; + options.desc = "Added hunks (buffer)"; + } + { + mode = "n"; + key = "fb"; + action = ":Pick buffers"; + options.desc = "Buffers"; + } + { + mode = "n"; + key = "fd"; + action = ":Pick diagnostic scope='all'"; + options.desc = "Diagnostic (workspace)"; + } + { + mode = "n"; + key = "fD"; + action = ":Pick diagnostic scope='current'"; + options.desc = "Diagnostic (buffer)"; + } + { + mode = "n"; + key = "ff"; + action = ":Pick files"; + options.desc = "Search files"; + } + { + mode = "n"; + key = "fg"; + action = ":Pick grep_live"; + options.desc = "Grep"; + } + { + mode = "n"; + key = "fm"; + action = ":Pick git_hunks"; + options.desc = "Modified hunks (all)"; + } + { + mode = "n"; + key = "fM"; + action = ":Pick git_hunks path='%'"; + options.desc = "Modified hunks (buffer)"; + } + { + mode = "n"; + key = "fr"; + action = ":Pick lsp scope='references'"; + options.desc = "References (LSP)"; + } + { + mode = "n"; + key = "fs"; + action = ":Pick lsp scope='workspace_symbol'"; + options.desc = "Symbols (LSP, workspace)"; + } + { + mode = "n"; + key = "fS"; + action = ":Pick lsp scope='document_symbol'"; + options.desc = "Symbols (LSP, buffer)"; + } + { + mode = "n"; + key = "fv"; + action = ":Pick visit_paths cwd=\"\""; + options.desc = "Visit paths (all)"; + } + { + mode = "n"; + key = "fV"; + action = ":Pick visit_paths"; + options.desc = "Visit paths (cwd)"; + } + # g - git + { + mode = "n"; + key = "gd"; + action = ":DiffviewOpen"; + } + { + mode = "n"; + key = "gg"; + action.__raw = '' + function() + require('toggleterm.terminal').Terminal:new({ cmd = 'jjui', direction = 'float' }):toggle() + end + ''; + options.desc = "jjui"; + } + # l - lsp/formatter + { + mode = "n"; + key = "la"; + action = ":lua vim.lsp.buf.code_action()"; + options.desc = "Actions"; + } + { + mode = "n"; + key = "ld"; + action = ":lua vim.diagnostic.open_float({ severity = { min = vim.diagnostic.severity.HINT } })"; + options.desc = "Diagnostics popup"; + } + { + mode = "n"; + key = "lf"; + action = ":lua require('conform').format({ lsp_fallback = true })"; + options.desc = "Format"; + } + { + mode = "n"; + key = "li"; + action = ":lua vim.lsp.buf.hover()"; + options.desc = "Information"; + } + { + mode = "n"; + key = "lj"; + action = ":lua vim.diagnostic.goto_next()"; + options.desc = "Next diagnostic"; + } + { + mode = "n"; + key = "lk"; + action = ":lua vim.diagnostic.goto_prev()"; + options.desc = "Prev diagnostic"; + } + { + mode = "n"; + key = "lr"; + action = ":lua vim.lsp.buf.rename()"; + options.desc = "Rename"; + } + { + mode = "n"; + key = "lR"; + action = ":lua vim.lsp.buf.references()"; + options.desc = "References"; + } + { + mode = "n"; + key = "ls"; + action = ":lua vim.lsp.buf.definition()"; + options.desc = "Source definition"; + } + # other + { + mode = "n"; + key = "j"; + action = ":lua require('mini.jump2d').start(require('mini.jump2d').builtin_opts.query)"; + options.desc = "Jump to character"; + } + { + mode = "n"; + key = "a"; + action = ":lua require('harpoon'):list():add()"; + options.desc = "Add harpoon"; + } + { + mode = "n"; + key = ""; + action = ":lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())"; + options.desc = "Toggle harpoon quick menu"; + } + { + mode = "n"; + key = "1"; + action = ":lua require('harpoon'):list():select(1)"; + options.desc = "Go to harpoon 1"; + } + { + mode = "n"; + key = "2"; + action = ":lua require('harpoon'):list():select(2)"; + options.desc = "Go to harpoon 2"; + } + { + mode = "n"; + key = "3"; + action = ":lua require('harpoon'):list():select(3)"; + options.desc = "Go to harpoon 3"; + } + { + mode = "n"; + key = "4"; + action = ":lua require('harpoon'):list():select(4)"; + options.desc = "Go to harpoon 4"; + } + ]; } diff --git a/modules/home/neovim/options.nix b/modules/home/neovim/options.nix index fbf6e01..f6fabee 100644 --- a/modules/home/neovim/options.nix +++ b/modules/home/neovim/options.nix @@ -1,17 +1,17 @@ { - programs.nixvim = { - globals = { - clipboard = "osc52"; - }; - opts = { - expandtab = false; - tabstop = 2; - ignorecase = true; - list = false; - mouse = ""; - relativenumber = true; - shiftwidth = 2; - smartcase = true; - }; - }; + programs.nixvim = { + globals = { + clipboard = "osc52"; + }; + opts = { + expandtab = false; + tabstop = 2; + ignorecase = true; + list = false; + mouse = ""; + relativenumber = true; + shiftwidth = 2; + smartcase = true; + }; + }; } diff --git a/modules/home/neovim/plugins/blink-cmp.nix b/modules/home/neovim/plugins/blink-cmp.nix index 0a54073..333540d 100644 --- a/modules/home/neovim/plugins/blink-cmp.nix +++ b/modules/home/neovim/plugins/blink-cmp.nix @@ -1,17 +1,17 @@ { - programs.nixvim.plugins.blink-cmp = { - enable = true; - settings = { - signature.enabled = true; - completion = { - accept = { - auto_brackets = { - enabled = true; - semantic_token_resolution.enabled = false; - }; - }; - documentation.auto_show = true; - }; - }; - }; + programs.nixvim.plugins.blink-cmp = { + enable = true; + settings = { + signature.enabled = true; + completion = { + accept = { + auto_brackets = { + enabled = true; + semantic_token_resolution.enabled = false; + }; + }; + documentation.auto_show = true; + }; + }; + }; } diff --git a/modules/home/neovim/plugins/conform.nix b/modules/home/neovim/plugins/conform.nix index 6a8dd42..24c8ef7 100644 --- a/modules/home/neovim/plugins/conform.nix +++ b/modules/home/neovim/plugins/conform.nix @@ -1,14 +1,14 @@ { - programs.nixvim.plugins.conform-nvim = { - enable = true; - settings = { - format_on_save = {}; - formatters_by_ft = { - nix = ["alejandra"]; - javascript = ["prettier"]; - typescript = ["prettier"]; - vue = ["prettier"]; - }; - }; - }; + programs.nixvim.plugins.conform-nvim = { + enable = true; + settings = { + format_on_save = {}; + formatters_by_ft = { + nix = ["alejandra"]; + javascript = ["prettier"]; + typescript = ["prettier"]; + vue = ["prettier"]; + }; + }; + }; } diff --git a/modules/home/neovim/plugins/copilot.nix b/modules/home/neovim/plugins/copilot.nix index 2cfa8ce..8baf5d5 100644 --- a/modules/home/neovim/plugins/copilot.nix +++ b/modules/home/neovim/plugins/copilot.nix @@ -1,15 +1,15 @@ { - programs.nixvim.plugins.copilot-lua = { - enable = true; - settings = { - panel.enabled = false; - suggestion = { - enabled = true; - auto_trigger = true; - keymap = { - accept = ""; - }; - }; - }; - }; + programs.nixvim.plugins.copilot-lua = { + enable = true; + settings = { + panel.enabled = false; + suggestion = { + enabled = true; + auto_trigger = true; + keymap = { + accept = ""; + }; + }; + }; + }; } diff --git a/modules/home/neovim/plugins/grug-far.nix b/modules/home/neovim/plugins/grug-far.nix index 7859ca0..b4d6d2e 100644 --- a/modules/home/neovim/plugins/grug-far.nix +++ b/modules/home/neovim/plugins/grug-far.nix @@ -1,7 +1,7 @@ { - programs.nixvim.plugins = { - grug-far = { - enable = true; - }; - }; + programs.nixvim.plugins = { + grug-far = { + enable = true; + }; + }; } diff --git a/modules/home/neovim/plugins/harpoon.nix b/modules/home/neovim/plugins/harpoon.nix index 69bd017..5d2e514 100644 --- a/modules/home/neovim/plugins/harpoon.nix +++ b/modules/home/neovim/plugins/harpoon.nix @@ -1,7 +1,7 @@ { - programs.nixvim.plugins = { - harpoon = { - enable = true; - }; - }; + programs.nixvim.plugins = { + harpoon = { + enable = true; + }; + }; } diff --git a/modules/home/neovim/plugins/hunk.nix b/modules/home/neovim/plugins/hunk.nix index d6cfe60..c8727f9 100644 --- a/modules/home/neovim/plugins/hunk.nix +++ b/modules/home/neovim/plugins/hunk.nix @@ -1,7 +1,7 @@ { - programs.nixvim.plugins = { - hunk = { - enable = true; - }; - }; + programs.nixvim.plugins = { + hunk = { + enable = true; + }; + }; } diff --git a/modules/home/neovim/plugins/lsp.nix b/modules/home/neovim/plugins/lsp.nix index 0780d8e..48ad0fc 100644 --- a/modules/home/neovim/plugins/lsp.nix +++ b/modules/home/neovim/plugins/lsp.nix @@ -1,15 +1,15 @@ { - programs.nixvim.plugins = { - lsp = { - enable = true; - inlayHints = true; - servers = { - nil_ls.enable = true; - cssls.enable = true; - dockerls.enable = true; - yamlls.enable = true; - vtsls.enable = true; - }; - }; - }; + programs.nixvim.plugins = { + lsp = { + enable = true; + inlayHints = true; + servers = { + nil_ls.enable = true; + cssls.enable = true; + dockerls.enable = true; + yamlls.enable = true; + vtsls.enable = true; + }; + }; + }; } diff --git a/modules/home/neovim/plugins/mini.nix b/modules/home/neovim/plugins/mini.nix index be2f5e6..bc939e3 100644 --- a/modules/home/neovim/plugins/mini.nix +++ b/modules/home/neovim/plugins/mini.nix @@ -1,157 +1,157 @@ { - programs.nixvim.plugins.mini = { - enable = true; - modules = { - ai = { - custom_textobjects = { - B.__raw = "require('mini.extra').gen_ai_spec.buffer()"; - F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })"; - }; - }; - align = {}; - basics = { - options = { - basic = true; - extra_ui = true; - }; - mappings = { - basic = false; - }; - autocommands = { - basic = true; - }; - }; - bracketed = {}; - clue = { - clues.__raw = '' - { - { mode = 'n', keys = 'e', desc = '+Explore/+Edit' }, - { mode = 'n', keys = 'f', desc = '+Find' }, - { mode = 'n', keys = 'g', desc = '+Git' }, - { mode = 'n', keys = 'l', desc = '+LSP' }, - { mode = 'x', keys = 'l', desc = '+LSP' }, - require("mini.clue").gen_clues.builtin_completion(), - require("mini.clue").gen_clues.g(), - require("mini.clue").gen_clues.marks(), - require("mini.clue").gen_clues.registers(), - require("mini.clue").gen_clues.windows({ submode_resize = true }), - require("mini.clue").gen_clues.z(), - } - ''; - triggers = [ - { - mode = "n"; - keys = ""; - } - { - mode = "x"; - keys = ""; - } - { - mode = "n"; - keys = "["; - } - { - mode = "n"; - keys = "]"; - } - { - mode = "x"; - keys = "["; - } - { - mode = "x"; - keys = "]"; - } - { - mode = "i"; - keys = ""; - } - { - mode = "n"; - keys = "g"; - } - { - mode = "x"; - keys = "g"; - } + programs.nixvim.plugins.mini = { + enable = true; + modules = { + ai = { + custom_textobjects = { + B.__raw = "require('mini.extra').gen_ai_spec.buffer()"; + F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })"; + }; + }; + align = {}; + basics = { + options = { + basic = true; + extra_ui = true; + }; + mappings = { + basic = false; + }; + autocommands = { + basic = true; + }; + }; + bracketed = {}; + clue = { + clues.__raw = '' + { + { mode = 'n', keys = 'e', desc = '+Explore/+Edit' }, + { mode = 'n', keys = 'f', desc = '+Find' }, + { mode = 'n', keys = 'g', desc = '+Git' }, + { mode = 'n', keys = 'l', desc = '+LSP' }, + { mode = 'x', keys = 'l', desc = '+LSP' }, + require("mini.clue").gen_clues.builtin_completion(), + require("mini.clue").gen_clues.g(), + require("mini.clue").gen_clues.marks(), + require("mini.clue").gen_clues.registers(), + require("mini.clue").gen_clues.windows({ submode_resize = true }), + require("mini.clue").gen_clues.z(), + } + ''; + triggers = [ + { + mode = "n"; + keys = ""; + } + { + mode = "x"; + keys = ""; + } + { + mode = "n"; + keys = "["; + } + { + mode = "n"; + keys = "]"; + } + { + mode = "x"; + keys = "["; + } + { + mode = "x"; + keys = "]"; + } + { + mode = "i"; + keys = ""; + } + { + mode = "n"; + keys = "g"; + } + { + mode = "x"; + keys = "g"; + } - { - mode = "n"; - keys = "\""; - } - { - mode = "x"; - keys = "\""; - } - { - mode = "i"; - keys = ""; - } - { - mode = "c"; - keys = ""; - } - { - mode = "n"; - keys = ""; - } - { - mode = "n"; - keys = "z"; - } - { - mode = "x"; - keys = "z"; - } - { - mode = "n"; - keys = "'"; - } - { - mode = "n"; - keys = "`"; - } - { - mode = "x"; - keys = "'"; - } - { - mode = "x"; - keys = "`"; - } - ]; - }; - comment = {}; - diff = {}; - extra = {}; - git = {}; - icons = {}; - indentscope = { - settings = { - symbol = "|"; - }; - }; - jump = {}; - jump2d = { - settings = { - spotter.__raw = "require('mini.jump2d').gen_spotter.pattern('[^%s%p]+')"; - labels = "asdfghjkl"; - view = { - dim = true; - n_steps_ahead = 2; - }; - }; - }; - move = {}; - pairs = {}; - pick = {}; - starter = {}; - statusline = {}; - surround = {}; - trailspace = {}; - visits = {}; - }; - mockDevIcons = true; - }; + { + mode = "n"; + keys = "\""; + } + { + mode = "x"; + keys = "\""; + } + { + mode = "i"; + keys = ""; + } + { + mode = "c"; + keys = ""; + } + { + mode = "n"; + keys = ""; + } + { + mode = "n"; + keys = "z"; + } + { + mode = "x"; + keys = "z"; + } + { + mode = "n"; + keys = "'"; + } + { + mode = "n"; + keys = "`"; + } + { + mode = "x"; + keys = "'"; + } + { + mode = "x"; + keys = "`"; + } + ]; + }; + comment = {}; + diff = {}; + extra = {}; + git = {}; + icons = {}; + indentscope = { + settings = { + symbol = "|"; + }; + }; + jump = {}; + jump2d = { + settings = { + spotter.__raw = "require('mini.jump2d').gen_spotter.pattern('[^%s%p]+')"; + labels = "asdfghjkl"; + view = { + dim = true; + n_steps_ahead = 2; + }; + }; + }; + move = {}; + pairs = {}; + pick = {}; + starter = {}; + statusline = {}; + surround = {}; + trailspace = {}; + visits = {}; + }; + mockDevIcons = true; + }; } diff --git a/modules/home/neovim/plugins/oil.nix b/modules/home/neovim/plugins/oil.nix index 21af23f..83ae4fa 100644 --- a/modules/home/neovim/plugins/oil.nix +++ b/modules/home/neovim/plugins/oil.nix @@ -1,27 +1,27 @@ { - programs.nixvim.plugins.oil = { - enable = true; - settings = { - keymaps = { - "" = "actions.refresh"; - "qq" = "actions.close"; - }; - skip_confirm_for_simple_edits = true; - constrain_cursor = "editable"; - default_file_explorer = true; - view_options = { - show_hidden = true; - }; - win_options = { - concealcursor = "ncv"; - conceallevel = 3; - cursorcolumn = false; - foldcolumn = "0"; - list = false; - signcolumn = "no"; - spell = false; - wrap = false; - }; - }; - }; + programs.nixvim.plugins.oil = { + enable = true; + settings = { + keymaps = { + "" = "actions.refresh"; + "qq" = "actions.close"; + }; + skip_confirm_for_simple_edits = true; + constrain_cursor = "editable"; + default_file_explorer = true; + view_options = { + show_hidden = true; + }; + win_options = { + concealcursor = "ncv"; + conceallevel = 3; + cursorcolumn = false; + foldcolumn = "0"; + list = false; + signcolumn = "no"; + spell = false; + wrap = false; + }; + }; + }; } diff --git a/modules/home/neovim/plugins/toggleterm.nix b/modules/home/neovim/plugins/toggleterm.nix index 7ccd20a..9854aec 100644 --- a/modules/home/neovim/plugins/toggleterm.nix +++ b/modules/home/neovim/plugins/toggleterm.nix @@ -1,20 +1,20 @@ { - programs.nixvim.plugins.toggleterm = { - enable = true; - settings = { - open_mapping = null; - direction = "float"; - float_opts = { - border = "curved"; - winblend = 3; - }; - size = 20; - hide_numbers = true; - shade_terminals = true; - shading_factor = 2; - start_in_insert = true; - close_on_exit = true; - shell = "fish"; - }; - }; + programs.nixvim.plugins.toggleterm = { + enable = true; + settings = { + open_mapping = null; + direction = "float"; + float_opts = { + border = "curved"; + winblend = 3; + }; + size = 20; + hide_numbers = true; + shade_terminals = true; + shading_factor = 2; + start_in_insert = true; + close_on_exit = true; + shell = "fish"; + }; + }; } diff --git a/modules/home/neovim/plugins/treesitter.nix b/modules/home/neovim/plugins/treesitter.nix index 31225ad..4ab907c 100644 --- a/modules/home/neovim/plugins/treesitter.nix +++ b/modules/home/neovim/plugins/treesitter.nix @@ -1,21 +1,21 @@ {pkgs, ...}: { - programs.nixvim.plugins.treesitter = { - enable = true; - settings = { - highlight.enable = true; - indent.enable = true; - }; - grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ - bash - elixir - fish - heex - json - nix - toml - typescript - vue - yaml - ]; - }; + programs.nixvim.plugins.treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + }; + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + elixir + fish + heex + json + nix + toml + typescript + vue + yaml + ]; + }; } diff --git a/modules/home/opencode.nix b/modules/home/opencode.nix index 5832c8f..5b7751a 100644 --- a/modules/home/opencode.nix +++ b/modules/home/opencode.nix @@ -1,23 +1,23 @@ { - inputs, - pkgs, - ... + inputs, + pkgs, + ... }: { - programs.opencode = { - enable = true; - package = inputs.nix-ai-tools.packages.${pkgs.system}.opencode; - settings = { - theme = "catppuccin"; - instructions = [ - "CLAUDE.md" - "AGENT.md" - "AGENTS.md" - ]; - formatter = { - mix = { - disabled = true; - }; - }; - }; - }; + programs.opencode = { + enable = true; + package = inputs.nix-ai-tools.packages.${pkgs.system}.opencode; + settings = { + theme = "catppuccin"; + instructions = [ + "CLAUDE.md" + "AGENT.md" + "AGENTS.md" + ]; + formatter = { + mix = { + disabled = true; + }; + }; + }; + }; } diff --git a/modules/home/ripgrep.nix b/modules/home/ripgrep.nix index ddf30ff..776cf7f 100644 --- a/modules/home/ripgrep.nix +++ b/modules/home/ripgrep.nix @@ -1,21 +1,21 @@ { - programs.ripgrep = { - enable = true; - arguments = [ - "--max-columns=150" - "--max-columns-preview" - "--smart-case" - "--colors=column:none" - "--colors=column:fg:4" - "--colors=column:style:underline" - "--colors=line:none" - "--colors=line:fg:4" - "--colors=match:none" - "--colors=match:bg:0" - "--colors=match:fg:6" - "--colors=path:none" - "--colors=path:fg:14" - "--colors=path:style:bold" - ]; - }; + programs.ripgrep = { + enable = true; + arguments = [ + "--max-columns=150" + "--max-columns-preview" + "--smart-case" + "--colors=column:none" + "--colors=column:fg:4" + "--colors=column:style:underline" + "--colors=line:none" + "--colors=line:fg:4" + "--colors=match:none" + "--colors=match:bg:0" + "--colors=match:fg:6" + "--colors=path:none" + "--colors=path:fg:14" + "--colors=path:style:bold" + ]; + }; } diff --git a/modules/home/ssh.nix b/modules/home/ssh.nix index 5ae4361..bedca11 100644 --- a/modules/home/ssh.nix +++ b/modules/home/ssh.nix @@ -1,25 +1,25 @@ { - pkgs, - lib, - user, - ... + pkgs, + lib, + user, + ... }: { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - includes = [ - (lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/config_external") - (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/config_external") - ]; - matchBlocks = { - "*" = {}; - "github.com" = { - identitiesOnly = true; - identityFile = [ - (lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/id_ed25519") - (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/id_ed25519") - ]; - }; - }; - }; + programs.ssh = { + enable = true; + enableDefaultConfig = false; + includes = [ + (lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/config_external") + (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/config_external") + ]; + matchBlocks = { + "*" = {}; + "github.com" = { + identitiesOnly = true; + identityFile = [ + (lib.mkIf pkgs.stdenv.hostPlatform.isLinux "/home/${user}/.ssh/id_ed25519") + (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin "/Users/${user}/.ssh/id_ed25519") + ]; + }; + }; + }; } diff --git a/modules/home/starship.nix b/modules/home/starship.nix index 98eed3a..e052dca 100644 --- a/modules/home/starship.nix +++ b/modules/home/starship.nix @@ -1,45 +1,45 @@ { - programs.starship = { - enable = true; - enableFishIntegration = true; - settings = { - add_newline = true; - command_timeout = 2000; - format = "[$directory$\{custom.jj}]($style)$character"; - character = { - error_symbol = "[✗ ](bold #e64553)"; - success_symbol = "[❯](bold #40a02b)[❯](bold #df8e1d)[❯](bold #dc8a78)"; - }; - directory = { - truncation_length = 2; - truncation_symbol = "…/"; - repo_root_style = "bold cyan"; - repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) "; - }; - custom.jj = { - command = '' - jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' - separate(" ", - change_id.shortest(4), - bookmarks, - "|", - concat( - if(conflict, "💥"), - if(divergent, "🚧"), - if(hidden, "👻"), - if(immutable, "🔒"), - ), - raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), - raw_escape_sequence("\x1b[1;32m") ++ coalesce( - truncate_end(29, description.first_line(), "…"), - "(no description set)", - ) ++ raw_escape_sequence("\x1b[0m"), - ) - ' - ''; - when = "jj --ignore-working-copy root"; - symbol = "🥋"; - }; - }; - }; + programs.starship = { + enable = true; + enableFishIntegration = true; + settings = { + add_newline = true; + command_timeout = 2000; + format = "[$directory$\{custom.jj}]($style)$character"; + character = { + error_symbol = "[✗ ](bold #e64553)"; + success_symbol = "[❯](bold #40a02b)[❯](bold #df8e1d)[❯](bold #dc8a78)"; + }; + directory = { + truncation_length = 2; + truncation_symbol = "…/"; + repo_root_style = "bold cyan"; + repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) "; + }; + custom.jj = { + command = '' + jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' + separate(" ", + change_id.shortest(4), + bookmarks, + "|", + concat( + if(conflict, "💥"), + if(divergent, "🚧"), + if(hidden, "👻"), + if(immutable, "🔒"), + ), + raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), + raw_escape_sequence("\x1b[1;32m") ++ coalesce( + truncate_end(29, description.first_line(), "…"), + "(no description set)", + ) ++ raw_escape_sequence("\x1b[0m"), + ) + ' + ''; + when = "jj --ignore-working-copy root"; + symbol = "🥋"; + }; + }; + }; } diff --git a/modules/home/zellij.nix b/modules/home/zellij.nix index 8a8b789..7dcb9ee 100644 --- a/modules/home/zellij.nix +++ b/modules/home/zellij.nix @@ -1,60 +1,60 @@ { - lib, - pkgs, - ... + lib, + pkgs, + ... }: { - programs.zellij = - { - enable = true; - settings = { - theme = "catppuccin-latte"; - default_layout = "default"; - default_shell = "${pkgs.fish}/bin/fish"; - pane_frames = false; - show_startup_tips = false; - show_release_notes = false; - }; - } - // lib.optionalAttrs pkgs.stdenv.isLinux { - enableFishIntegration = true; - }; + programs.zellij = + { + enable = true; + settings = { + theme = "catppuccin-latte"; + default_layout = "default"; + default_shell = "${pkgs.fish}/bin/fish"; + pane_frames = false; + show_startup_tips = false; + show_release_notes = false; + }; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + enableFishIntegration = true; + }; - xdg.configFile."zellij/layouts/default.kdl".text = '' - layout { - default_tab_template { - pane split_direction="vertical" { - pane - } + xdg.configFile."zellij/layouts/default.kdl".text = '' + layout { + default_tab_template { + pane split_direction="vertical" { + pane + } - pane size=1 borderless=true { - plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" { - hide_frame_for_single_pane "true" + pane size=1 borderless=true { + plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" { + hide_frame_for_single_pane "true" - format_left "{mode}#[fg=#1e66f5,bg=#eff1f5,bold] {session}#[bg=#eff1f5] {tabs}" - format_right "{datetime}" - format_space "#[bg=#eff1f5]" + format_left "{mode}#[fg=#1e66f5,bg=#eff1f5,bold] {session}#[bg=#eff1f5] {tabs}" + format_right "{datetime}" + format_space "#[bg=#eff1f5]" - mode_normal "#[fg=#eff1f5,bg=#1e66f5] " - mode_locked "#[fg=#eff1f5,bg=#fe640b] L " - mode_tab "#[fg=#eff1f5,bg=#40a02b] T " - mode_pane "#[fg=#eff1f5,bg=#8839ef] P " - mode_session "#[fg=#eff1f5,bg=#04a5e5] S " - mode_resize "#[fg=#eff1f5,bg=#df8e1d] R " - mode_move "#[fg=#eff1f5,bg=#ea76cb] M " - mode_search "#[fg=#eff1f5,bg=#d20f39] S " + mode_normal "#[fg=#eff1f5,bg=#1e66f5] " + mode_locked "#[fg=#eff1f5,bg=#fe640b] L " + mode_tab "#[fg=#eff1f5,bg=#40a02b] T " + mode_pane "#[fg=#eff1f5,bg=#8839ef] P " + mode_session "#[fg=#eff1f5,bg=#04a5e5] S " + mode_resize "#[fg=#eff1f5,bg=#df8e1d] R " + mode_move "#[fg=#eff1f5,bg=#ea76cb] M " + mode_search "#[fg=#eff1f5,bg=#d20f39] S " - tab_normal "#[fg=#acb0be,bg=#eff1f5] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" - tab_active "#[fg=#eff1f5,bg=#1e66f5,bold,underline] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" - tab_fullscreen_indicator "□ " - tab_sync_indicator " " - tab_floating_indicator "󰉈 " + tab_normal "#[fg=#acb0be,bg=#eff1f5] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" + tab_active "#[fg=#eff1f5,bg=#1e66f5,bold,underline] {index} {name} {fullscreen_indicator}{sync_indicator}{floating_indicator}" + tab_fullscreen_indicator "□ " + tab_sync_indicator " " + tab_floating_indicator "󰉈 " - datetime "#[fg=#4c4f69,bg=#eff1f5] {format} " - datetime_format "%A, %d %b %Y %H:%M" - datetime_timezone "Europe/Berlin" - } - } - } - } - ''; + datetime "#[fg=#4c4f69,bg=#eff1f5] {format} " + datetime_format "%A, %d %b %Y %H:%M" + datetime_timezone "Europe/Berlin" + } + } + } + } + ''; } diff --git a/modules/home/zoxide.nix b/modules/home/zoxide.nix index 1c20b97..14961ed 100644 --- a/modules/home/zoxide.nix +++ b/modules/home/zoxide.nix @@ -1,6 +1,6 @@ { - programs.zoxide = { - enable = true; - enableFishIntegration = true; - }; + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; } diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index f5821ff..1d1eb69 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -1,5 +1,5 @@ { - programs.zsh = { - enable = true; - }; + programs.zsh = { + enable = true; + }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 3102d25..e58042d 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,81 +1,81 @@ { - pkgs, - inputs, - user, - constants, - ... + pkgs, + inputs, + user, + constants, + ... }: { - imports = [ - ../core.nix - ../syncthing.nix - ../tailscale.nix - inputs.sops-nix.nixosModules.sops - ]; + imports = [ + ../core.nix + ../syncthing.nix + ../tailscale.nix + inputs.sops-nix.nixosModules.sops + ]; - security.sudo.enable = true; + security.sudo.enable = true; - system.stateVersion = constants.stateVersions.nixos; - time.timeZone = "UTC"; + system.stateVersion = constants.stateVersions.nixos; + time.timeZone = "UTC"; - nix = { - settings.trusted-users = ["${user}"]; - gc.dates = "weekly"; - nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"]; - }; + nix = { + settings.trusted-users = ["${user}"]; + gc.dates = "weekly"; + nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"]; + }; - boot = { - loader = { - systemd-boot = { - enable = true; - configurationLimit = 42; - }; - efi.canTouchEfiVariables = true; - }; - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usbhid" - "usb_storage" - "sd_mod" - ]; - kernelPackages = pkgs.linuxPackages_latest; - }; + boot = { + loader = { + systemd-boot = { + enable = true; + configurationLimit = 42; + }; + efi.canTouchEfiVariables = true; + }; + initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + kernelPackages = pkgs.linuxPackages_latest; + }; - users.users = { - ${user} = { - isNormalUser = true; - home = "/home/${user}"; - extraGroups = [ - "wheel" - "sudo" - "network" - "systemd-journal" - "docker" - ]; - shell = pkgs.fish; - openssh.authorizedKeys.keys = constants.sshKeys; - }; + users.users = { + ${user} = { + isNormalUser = true; + home = "/home/${user}"; + extraGroups = [ + "wheel" + "sudo" + "network" + "systemd-journal" + "docker" + ]; + shell = pkgs.fish; + openssh.authorizedKeys.keys = constants.sshKeys; + }; - root = { - openssh.authorizedKeys.keys = constants.sshKeys; - }; - }; + root = { + openssh.authorizedKeys.keys = constants.sshKeys; + }; + }; - home-manager = { - useGlobalPkgs = true; - users.${user} = { - pkgs, - config, - lib, - ... - }: { - _module.args = {inherit user constants inputs;}; - imports = [ - inputs.nixvim.homeModules.nixvim - ../home/default.nix - ./home/default.nix - ]; - }; - }; + home-manager = { + useGlobalPkgs = true; + users.${user} = { + pkgs, + config, + lib, + ... + }: { + _module.args = {inherit user constants inputs;}; + imports = [ + inputs.nixvim.homeModules.nixvim + ../home/default.nix + ./home/default.nix + ]; + }; + }; } diff --git a/modules/nixos/home/default.nix b/modules/nixos/home/default.nix index 630ffef..baff4cc 100644 --- a/modules/nixos/home/default.nix +++ b/modules/nixos/home/default.nix @@ -1,5 +1,5 @@ {pkgs, ...}: { - home = { - packages = pkgs.callPackage ../packages.nix {}; - }; + home = { + packages = pkgs.callPackage ../packages.nix {}; + }; } diff --git a/modules/nixos/packages.nix b/modules/nixos/packages.nix index 97af32b..3601623 100644 --- a/modules/nixos/packages.nix +++ b/modules/nixos/packages.nix @@ -1,6 +1,6 @@ {pkgs}: with pkgs; [ - gcc15 - lm_sensors - ghostty.terminfo + gcc15 + lm_sensors + ghostty.terminfo ] diff --git a/modules/packages.nix b/modules/packages.nix index 8d7b624..8fad44c 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,43 +1,43 @@ { - pkgs, - inputs, - ... + pkgs, + inputs, + ... }: with pkgs; [ - inputs.beads.packages.${pkgs.system}.default - inputs.nix-ai-tools.packages.${pkgs.system}.amp - (callPackage ./bin/open-project.nix {}) - age - alejandra - ast-grep - bun - delta - devenv - dig - docker - docker-compose - fastfetch - fd - gh - git - gnumake - gnupg - hledger - htop - hyperfine - jq - killall - lsof - nurl - openssh - postgresql_17 - sd - sops - sqlite - tokei - tree - tree-sitter - unzip - vivid - zip + inputs.beads.packages.${pkgs.system}.default + inputs.nix-ai-tools.packages.${pkgs.system}.amp + (callPackage ./bin/open-project.nix {}) + age + alejandra + ast-grep + bun + delta + devenv + dig + docker + docker-compose + fastfetch + fd + gh + git + gnumake + gnupg + hledger + htop + hyperfine + jq + killall + lsof + nurl + openssh + postgresql_17 + sd + sops + sqlite + tokei + tree + tree-sitter + unzip + vivid + zip ] diff --git a/modules/packages.sync-conflict-20251207-174329-6B7OZZF.nix b/modules/packages.sync-conflict-20251207-174329-6B7OZZF.nix index c87465c..43a0dcc 100644 --- a/modules/packages.sync-conflict-20251207-174329-6B7OZZF.nix +++ b/modules/packages.sync-conflict-20251207-174329-6B7OZZF.nix @@ -1,43 +1,43 @@ { - pkgs, - inputs, - ... + pkgs, + inputs, + ... }: with pkgs; [ - inputs.beads.packages.${pkgs.system}.default - inputs.nix-ai-tools.packages.${pkgs.system}.amp - (callPackage ./bin/open-project.nix {}) - age - alejandra - ast-grep - bun - delta - devenv - dig - docker - docker-compose - hledger - fastfetch - fd - gh - git - gnumake - gnupg - htop - hyperfine - jq - killall - lsof - nurl - openssh - postgresql_17 - sd - sops - sqlite - tokei - tree - tree-sitter - unzip - vivid - zip + inputs.beads.packages.${pkgs.system}.default + inputs.nix-ai-tools.packages.${pkgs.system}.amp + (callPackage ./bin/open-project.nix {}) + age + alejandra + ast-grep + bun + delta + devenv + dig + docker + docker-compose + hledger + fastfetch + fd + gh + git + gnumake + gnupg + htop + hyperfine + jq + killall + lsof + nurl + openssh + postgresql_17 + sd + sops + sqlite + tokei + tree + tree-sitter + unzip + vivid + zip ] diff --git a/modules/syncthing.nix b/modules/syncthing.nix index 852cd12..92f135e 100644 --- a/modules/syncthing.nix +++ b/modules/syncthing.nix @@ -1,53 +1,53 @@ { - user, - pkgs, - ... + user, + pkgs, + ... }: let - isDarwin = pkgs.stdenv.isDarwin; - homeDir = - if isDarwin - then "/Users/${user}" - else "/home/${user}"; - group = - if isDarwin - then "staff" - else "users"; + isDarwin = pkgs.stdenv.isDarwin; + homeDir = + if isDarwin + then "/Users/${user}" + else "/home/${user}"; + group = + if isDarwin + then "staff" + else "users"; in { - services.syncthing = { - enable = true; - openDefaultPorts = !isDarwin; - dataDir = "${homeDir}/.local/share/syncthing"; - configDir = "${homeDir}/.config/syncthing"; - user = "${user}"; - group = group; - guiAddress = "0.0.0.0:8384"; - overrideFolders = true; - overrideDevices = true; + services.syncthing = { + enable = true; + openDefaultPorts = !isDarwin; + dataDir = "${homeDir}/.local/share/syncthing"; + configDir = "${homeDir}/.config/syncthing"; + user = "${user}"; + group = group; + guiAddress = "0.0.0.0:8384"; + overrideFolders = true; + overrideDevices = true; - settings = { - devices = { - "tahani" = { - id = "6B7OZZF-TEAMUGO-FBOELXP-Z4OY7EU-5ZHLB5T-V6Z3UDB-Q2DYR43-QBYW6QM"; - addresses = ["tcp://tahani:22000"]; - }; - "jason" = { - id = "42II2VO-QYPJG26-ZS3MB2I-AOPVZ67-JJNSE76-U54CO5Y-634A5OG-ECU4YQA"; - addresses = ["tcp://jason:22000"]; - }; - "chidi" = { - id = "N7W6SUT-QO6J4BE-T3Y65SM-OFGYGNV-TGYBJPX-JVN4Z72-AENZ247-KWXOQA6"; - addresses = ["tcp://chidi:22000"]; - }; - }; + settings = { + devices = { + "tahani" = { + id = "6B7OZZF-TEAMUGO-FBOELXP-Z4OY7EU-5ZHLB5T-V6Z3UDB-Q2DYR43-QBYW6QM"; + addresses = ["tcp://tahani:22000"]; + }; + "jason" = { + id = "42II2VO-QYPJG26-ZS3MB2I-AOPVZ67-JJNSE76-U54CO5Y-634A5OG-ECU4YQA"; + addresses = ["tcp://jason:22000"]; + }; + "chidi" = { + id = "N7W6SUT-QO6J4BE-T3Y65SM-OFGYGNV-TGYBJPX-JVN4Z72-AENZ247-KWXOQA6"; + addresses = ["tcp://chidi:22000"]; + }; + }; - folders = { - "nixos-config" = { - path = "${homeDir}/nixos-config"; - devices = ["tahani" "jason" "chidi"]; - }; - }; + folders = { + "nixos-config" = { + path = "${homeDir}/nixos-config"; + devices = ["tahani" "jason" "chidi"]; + }; + }; - options.globalAnnounceEnabled = false; - }; - }; + options.globalAnnounceEnabled = false; + }; + }; } diff --git a/modules/tailscale.nix b/modules/tailscale.nix index a405505..2e118ae 100644 --- a/modules/tailscale.nix +++ b/modules/tailscale.nix @@ -1,14 +1,14 @@ { - lib, - pkgs, - ... + lib, + pkgs, + ... }: { - services.tailscale = - { - enable = true; - } - // lib.optionalAttrs pkgs.stdenv.isLinux { - openFirewall = true; - useRoutingFeatures = "server"; - }; + services.tailscale = + { + enable = true; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + openFirewall = true; + useRoutingFeatures = "server"; + }; } diff --git a/overlays/default.nix b/overlays/default.nix index 3bc05b9..e558b49 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,17 +1,18 @@ {inputs}: let - dir = builtins.readDir ./.; - overlayNames = builtins.sort builtins.lessThan (builtins.filter ( - name: - name - != "default.nix" - && dir.${name} == "regular" - && builtins.match ".*\\.nix" name != null - ) (builtins.attrNames dir)); - overlayPath = name: - builtins.toPath "${builtins.toString ./.}/${name}"; - loadOverlay = name: let - overlayModule = import (overlayPath name); - in - overlayModule {inherit inputs;}; + dir = builtins.readDir ./.; + overlayNames = + builtins.sort builtins.lessThan (builtins.filter ( + name: + name + != "default.nix" + && dir.${name} == "regular" + && builtins.match ".*\\.nix" name != null + ) (builtins.attrNames dir)); + overlayPath = name: + builtins.toPath "${builtins.toString ./.}/${name}"; + loadOverlay = name: let + overlayModule = import (overlayPath name); + in + overlayModule {inherit inputs;}; in - map loadOverlay overlayNames + map loadOverlay overlayNames diff --git a/overlays/zjstatus.nix b/overlays/zjstatus.nix index d306436..7d14460 100644 --- a/overlays/zjstatus.nix +++ b/overlays/zjstatus.nix @@ -1,3 +1,3 @@ {inputs}: final: prev: { - zjstatus = inputs.zjstatus.packages.${prev.system}.default; + zjstatus = inputs.zjstatus.packages.${prev.system}.default; }