From 406fe351167328074706f39d382280e6d1f51ba8 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sat, 11 Feb 2023 01:08:58 +0200 Subject: [PATCH] feat!(flake): add `NixOS` config for `homix` Copy and impove `home-manager` module integration from `nix-on-darwin` for `nixos` Add `homix` *server* with NVIDIA drivers, `wayland` + `river`, Jellyfin, etc. --- flake.nix | 32 ++- .../x86_64-linux/homix/configuration.nix | 219 +++++++++++++++ .../homix/hardware-configuration.nix | 37 +++ .../nixos/x86_64-linux/homix/home/reo101.nix | 106 ++++++++ machines/nixos/x86_64-linux/homix/river | 158 +++++++++++ modules/home-manager/default.nix | 1 + modules/home-manager/reo101-shell.nix | 256 ++++++++++++++++++ 7 files changed, 806 insertions(+), 3 deletions(-) create mode 100644 machines/nixos/x86_64-linux/homix/configuration.nix create mode 100644 machines/nixos/x86_64-linux/homix/hardware-configuration.nix create mode 100644 machines/nixos/x86_64-linux/homix/home/reo101.nix create mode 100644 machines/nixos/x86_64-linux/homix/river create mode 100644 modules/home-manager/reo101-shell.nix diff --git a/flake.nix b/flake.nix index 2aa460a..8ed8451 100644 --- a/flake.nix +++ b/flake.nix @@ -105,9 +105,28 @@ nixosMachines = machines.nixos or {}; # mkHost helpers - mkNixosHost = system: hostname: nixpkgs.lib.nixosSystem { + mkNixosHost = system: hostname: users: nixpkgs.lib.nixosSystem { + inherit system; + modules = [ ./machines/nixos/${system}/${hostname}/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = false; + useUserPackages = true; + users = nixpkgs.lib.attrsets.genAttrs + users + (user: import ./machines/nixos/${system}/${hostname}/home/${user}.nix); + # (user: args: + # let home = import ./machines/nixos/${system}/${hostname}/home/${user}.nix args; + # in home // { imports = (home.imports or []) ++ homeManagerModules; }); + + extraSpecialArgs = { + inherit inputs outputs; + }; + }; + } ] ++ (builtins.attrValues nixosModules); specialArgs = { @@ -139,6 +158,7 @@ mkNixDarwinHost = system: hostname: users: nix-darwin.lib.darwinSystem { inherit system; + modules = [ ./machines/nix-darwin/${system}/${hostname}/configuration.nix home-manager.darwinModules.home-manager @@ -150,18 +170,21 @@ users (user: import ./machines/nix-darwin/${system}/${hostname}/home/${user}.nix); - extraSpecialArgs = { inherit inputs; }; + extraSpecialArgs = { inherit inputs outputs; }; }; } ] ++ (builtins.attrValues nixDarwinModules); + inputs = { inherit inputs outputs nix-darwin nixpkgs; }; }; mkHomeManagerHost = system: hostname: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; + modules = [ ./machines/home-manager/${system}/${hostname}/home.nix ] ++ (builtins.attrValues homeManagerModules); + extraSpecialArgs = { inherit inputs outputs; }; }; @@ -194,7 +217,10 @@ (system: host: config: mkNixosHost system - host) + host + (builtins.map + (nixpkgs.lib.strings.removeSuffix ".nix") + (builtins.attrNames (config."home" or {})))) nixosMachines; nixOnDroidConfigurations = diff --git a/machines/nixos/x86_64-linux/homix/configuration.nix b/machines/nixos/x86_64-linux/homix/configuration.nix new file mode 100644 index 0000000..2aa53c2 --- /dev/null +++ b/machines/nixos/x86_64-linux/homix/configuration.nix @@ -0,0 +1,219 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ inputs, outputs, config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ]; + + ### Set boot options + boot = { + # Use the systemd-boot boot loader. + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + # Enable running aarch64 binaries using qemu + binfmt = { + emulatedSystems = [ + "aarch64-linux" + "wasm32-wasi" + "x86_64-windows" + ]; + }; + + # Clean temporary directory on boot + cleanTmpDir = true; + + # Enable support for nfs and ntfs + supportedFilesystems = [ + "cifs" + "ntfs" + "nfs" + ]; + }; + + networking.hostName = "homix"; # Define your hostname. + ### Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + ### Set your time zone. + time.timeZone = "Europe/Sofia"; + + ### Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + ### Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + # }; + + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes repl-flake + ''; + settings = { + trusted-users = [ + "root" + "reo101" + ]; + substituters = [ + "https://rix101.cachix.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "rix101.cachix.org-1:2u9ZGi93zY3hJXQyoHkNBZpJK+GiXQyYf9J5TLzCpFY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + }; + + nixpkgs.config.allowUnfree = true; + + ### NVIDIA + services.xserver = { + videoDrivers = [ "nvidia" ]; + }; + hardware.opengl.enable = true; + hardware.nvidia = { + open = true; + # powerManagement.enable = true; + modesetting.enable = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + # package = config.boot.kernelPackages.nvidiaPackages.beta; + }; + environment.sessionVariables = { + "_JAVA_AWT_WM_NONREPARENTING" = "1"; + "LIBVA_DRIVER_NAME" = "nvidia"; + "XDG_SESSION_TYPE" = "wayland"; + "GBM_BACKEND" = "nvidia-drm"; + "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + "WLR_NO_HARDWARE_CURSORS" = "1"; + "MOZ_DISABLE_RDD_SANDBOX" = "1"; + "EGL_PLATFORM" = "wayland"; + }; + + ### Wayland specific + services.xserver = { + enable = true; + displayManager = { + defaultSession = "river"; + sessionPackages = with pkgs; [ + river + ]; + gdm = { + enable = true; + wayland = true; + }; + }; + }; + + ## X11 specific + services.xserver = { + layout = "us,bg"; + xkbVariant = ",phonetic"; + xkbOptions = "grp:lalt_lshift_toggle"; + }; + + ### Enable the OpenSSH daemon. + services.openssh.enable = true; + + ### Enable CUPS to print documents. + # services.printing.enable = true; + + ### Enable sound. + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse = { + enable = true; + }; + jack = { + enable = true; + }; + }; + services.dbus.enable = true; + + ### Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + ### Define a user account. Don't forget to set a password with `passwd`. + users.users.reo101 = { + isNormalUser = true; + shell = pkgs.zsh; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + }; + + home-manager = { + backupFileExtension = "hm-bak"; + useUserPackages = true; + useGlobalPkgs = false; + + extraSpecialArgs = { inherit inputs outputs; } ; + }; + + ### Enable plymouth (bootscreen customizations) + boot.plymouth.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + river + xdg-desktop-portal + neovim + wget + git + ]; + + ### Jellyfin + virtualisation.oci-containers.containers."jellyfin" = { + autoStart = true; + image = "docker.io/jellyfin/jellyfin:latest"; + volumes = [ + "/var/cache/jellyfin/config:/config" + "/var/cache/jellyfin/cache:/cache" + "/var/log/jellyfin:/log" + "/media:/media:ro" + ]; + ports = [ "8096:8096" ]; + environment = { + JELLYFIN_LOG_DIR = "/log"; + }; + }; + + ### Transmission + services.transmission = { + enable = true; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? + +} diff --git a/machines/nixos/x86_64-linux/homix/hardware-configuration.nix b/machines/nixos/x86_64-linux/homix/hardware-configuration.nix new file mode 100644 index 0000000..37b4356 --- /dev/null +++ b/machines/nixos/x86_64-linux/homix/hardware-configuration.nix @@ -0,0 +1,37 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/7f720420-41d8-4efd-bdf2-f445e52db998"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/5BF4-74EF"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/nixos/x86_64-linux/homix/home/reo101.nix b/machines/nixos/x86_64-linux/homix/home/reo101.nix new file mode 100644 index 0000000..247e6c3 --- /dev/null +++ b/machines/nixos/x86_64-linux/homix/home/reo101.nix @@ -0,0 +1,106 @@ +{ inputs, outputs, lib, config, pkgs, ... }: + +{ + imports = builtins.attrValues outputs.homeManagerModules; + + home = { + username = "reo101"; + homeDirectory = "/home/reo101"; + stateVersion = "22.11"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + # WM + river + + # Terminals + wezterm + foot + + # Core + neovim + git + firefox + discord + vifm + + # Shell + zsh + starship + zoxide + + # Dhall + dhall + dhall-lsp-server + + # Nix + rnix-lsp + nil + direnv + + # Torrents + tremc + + # Zig + # zigpkgs."0.10.1" + zigpkgs.master + # inputs.zls-overlay.packages.x86_64-linux.default + ]; + + nixpkgs = { + overlays = [ + # inputs.neovim-nightly-overlay.overlay + inputs.zig-overlay.overlays.default + ]; + + config.allowUnfree = true; + }; + + # Enable the GPG Agent daemon. + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; + + programs.git = { + enable = true; + userName = "reo101"; + userEmail = "pavel.atanasov2001@gmail.com"; + # signing = { + # signByDefault = true; + # key = "0x52F3E1D376F692C0"; + # }; + }; + + reo101.shell = { + enable = true; + }; + + home.file = { + ".config/nvim" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/src/reovim"; + }; + }; + + home.file.".config/river/init" = { + executable = true; + source = ./../river; + }; + + # home.file.".stack/config.yaml".text = lib.generators.toYAML {} { + # templates = { + # scm-init = "git"; + # params = with config.programs.git; { + # author-name = userName; + # author-email = userEmail; + # github-username = userName; + # }; + # }; + # nix.enable = true; + # }; + +} diff --git a/machines/nixos/x86_64-linux/homix/river b/machines/nixos/x86_64-linux/homix/river new file mode 100644 index 0000000..1a4f2c3 --- /dev/null +++ b/machines/nixos/x86_64-linux/homix/river @@ -0,0 +1,158 @@ +#!/usr/bin/env sh + +# Super+Return to start an instance of foot (https://codeberg.org/dnkl/foot) +riverctl map normal Super Return spawn foot + +# Super+Q to close the focused view +riverctl map normal Super Q close + +# Super+Shift+Q to exit river +riverctl map normal Super+Shift Q exit + +# export PATH="${HOME}/.local/bin:${PATH}" +riverctl map normal Super D PATH="${HOME}/.local/bin:${PATH}" dmenu_run + +# Super+J and Super+K to focus the next/previous view in the layout stack +riverctl map normal Super J focus-view next +riverctl map normal Super K focus-view previous + +# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal Super+Shift J swap next +riverctl map normal Super+Shift K swap previous + +# Super+Period and Super+Comma to focus the next/previous output +riverctl map normal Super Period focus-output next +riverctl map normal Super Comma focus-output previous + +# Super+Shift+{Period,Comma} to send the focused view to the next/previous output +riverctl map normal Super+Shift Period send-to-output next +riverctl map normal Super+Shift Comma send-to-output previous + +# Super+Space to bump the focused view to the top of the layout stack +riverctl map normal Super Space zoom + +# Super+H and Super+L to decrease/increase the main ratio of rivertile(1) +riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" +riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05" + +# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1) +riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1" +riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1" + +# Super+Alt+{H,J,K,L} to move views +riverctl map normal Super+Alt H move left 100 +riverctl map normal Super+Alt J move down 100 +riverctl map normal Super+Alt K move up 100 +riverctl map normal Super+Alt L move right 100 + +# Super+Alt+Control+{H,J,K,L} to snap views to screen edges +riverctl map normal Super+Alt+Control H snap left +riverctl map normal Super+Alt+Control J snap down +riverctl map normal Super+Alt+Control K snap up +riverctl map normal Super+Alt+Control L snap right + +# Super+Alt+Shif+{H,J,K,L} to resize views +riverctl map normal Super+Alt+Shift H resize horizontal "-100" +riverctl map normal Super+Alt+Shift J resize vertical "100" +riverctl map normal Super+Alt+Shift K resize vertical "-100" +riverctl map normal Super+Alt+Shift L resize horizontal "100" + +# Super + Left Mouse Button to move views +riverctl map-pointer normal Super BTN_LEFT move-view + +# Super + Right Mouse Button to resize views +riverctl map-pointer normal Super BTN_RIGHT resize-view + +for i in $(seq 1 9); do + tags=$((1 << (i - 1))) + + # Super+[1-9] to focus tag [0-8] + riverctl map normal Super "${i}" set-focused-tags $tags + + # Super+Shift+[1-9] to tag focused view with tag [0-8] + riverctl map normal Super+Shift "${i}" set-view-tags $tags + + # Super+Ctrl+[1-9] to toggle focus of tag [0-8] + riverctl map normal Super+Control "${i}" toggle-focused-tags $tags + + # Super+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view + riverctl map normal Super+Shift+Control "${i}" toggle-view-tags $tags +done + +# Super+0 to focus all tags +# Super+Shift+0 to tag focused view with all tags +all_tags=$(((1 << 32) - 1)) +riverctl map normal Super 0 set-focused-tags "${all_tags}" +riverctl map normal Super+Shift 0 set-view-tags "${all_tags}" + +# Super+Shift+Space to toggle float +riverctl map normal Super+Shift Space toggle-float + +# Super+F to toggle fullscreen +riverctl map normal Super F toggle-fullscreen + +# Super+{Up,Right,Down,Left} to change layout orientation +riverctl map normal Super Up send-layout-cmd rivertile "main-location top" +riverctl map normal Super Right send-layout-cmd rivertile "main-location right" +riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" +riverctl map normal Super Left send-layout-cmd rivertile "main-location left" + +# Declare a passthrough mode. This mode has only a single mapping to return to +# normal mode. This makes it useful for testing a nested wayland compositor +riverctl declare-mode passthrough + +# Super+F11 to enter passthrough mode +riverctl map normal Super F11 enter-mode passthrough + +# Super+F11 to return to normal mode +riverctl map passthrough Super F11 enter-mode normal + +# Various media key mapping examples for both normal and locked mode which do +# not have a modifier +for mode in normal locked +do + # Eject the optical drive (well if you still have one that is) + riverctl map "${mode}" None XF86Eject spawn "eject -T" + + # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer) + riverctl map "${mode}" None XF86AudioRaiseVolume spawn "pamixer -i 5" + riverctl map "${mode}" None XF86AudioLowerVolume spawn "pamixer -d 5" + riverctl map "${mode}" None XF86AudioMute spawn "pamixer --toggle-mute" + + # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) + riverctl map "${mode}" None XF86AudioMedia spawn "playerctl play-pause" + riverctl map "${mode}" None XF86AudioPlay spawn "playerctl play-pause" + riverctl map "${mode}" None XF86AudioPrev spawn "playerctl previous" + riverctl map "${mode}" None XF86AudioNext spawn "playerctl next" + + # Control screen backlight brighness with light (https://github.com/haikarainen/light) + riverctl map "${mode}" None XF86MonBrightnessUp spawn "light -A 5" + riverctl map "${mode}" None XF86MonBrightnessDown spawn "light -U 5" +done + +# Set background and border color +riverctl background-color 0x002b36 +riverctl border-color-focused 0x93a1a1 +riverctl border-color-unfocused 0x586e75 + +# Set keyboard repeat rate +riverctl set-repeat 50 300 + +# Make certain views start floating +riverctl float-filter-add app-id float +riverctl float-filter-add title "popup title with spaces" + +# Set app-ids and titles of views which should use client side decorations +riverctl csd-filter-add app-id "tapy" + +# Set and exec into the default layout generator, rivertile. +# River will send the process group of the init executable SIGTERM on exit. +riverctl default-layout rivertile + +pipewire & +wireplumber & + +waybar & + +exec rivertile -view-padding 6 -outer-padding 6 diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index e41f7d9..ab1798f 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -4,4 +4,5 @@ { # List your module files here # my-module = import ./my-module.nix; + reo101-shell = import ./reo101-shell.nix; } diff --git a/modules/home-manager/reo101-shell.nix b/modules/home-manager/reo101-shell.nix new file mode 100644 index 0000000..d343e3d --- /dev/null +++ b/modules/home-manager/reo101-shell.nix @@ -0,0 +1,256 @@ +{ lib, pkgs, config, ... }: +with lib; +let + cfg = config.reo101.shell; +in { + imports = [ + ]; + + options = { + reo101.shell = { + enable = mkEnableOption "reo101 zsh config"; + # ... + }; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + # Shell + zsh + starship + zoxide + ]; + + programs.zsh = { + enable = true; + enableCompletion = true; + # defaultKeymap = "viins"; + + shellAliases = { + # ll = "ls -l"; + # update = "sudo nixos-rebuild switch"; + }; + + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + initExtra = '' + eval "$(zoxide init zsh)" + eval "$(direnv hook zsh)" + ''; + + plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.5.0"; + sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91"; + }; + } + { + name = "fast-syntax-highlighting"; + file = "F-Sy-H.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "zdharma"; + repo = "fast-syntax-highlighting"; + rev = "285d6ce8e1d9c7a70b427c46a4030d43e7a6406b"; + sha256 = "4kma7Sx2RGWa9J4gr+U89ArxpM2/b8H9ytQ2pNCv6is="; + }; + } + ]; + }; + + programs.starship = { + enable = true; + + settings = { + # Get editor completions based on the config schema + "$schema" = "https://starship.rs/config-schema.json"; + + # Use custom format + format = '' + [╭───────┨](bold green)[reo101](bright-white)[@](bold yellow)$hostname[┠───────>](bold green)$status$cmd_duration$git_branch$git_status$git_state$git_commit + [│](bold green)$time$jobs: $directory$package + [╰─](bold green)$character + ''; + + # ${custom.local}\ + # ${custom.local_root}\ + # ${custom.ssh}\ + # ${custom.ssh_root}\ + + add_newline = true; + + character = { + success_symbol = "[→](bold green)"; + error_symbol = "[→](red)"; + }; + + git_branch = { + symbol = "🌱 "; + truncation_length = 15; + truncation_symbol = "…"; # … + }; + + git_commit = { + commit_hash_length = 6; + tag_symbol = "🔖 "; + }; + + git_state = { + format = "[\($state( $progress_current of $progress_total)\)]($style) "; + cherry_pick = "[🍒 PICKING](bold red)"; + }; + + git_status = { + # conflicted = "🏳"; + # ahead = "🏎💨"; + # behind = "😰"; + # diverged = "😵"; + # untracked = "🤷‍"; + # stashed = "📦"; + # modified = "📝"; + # staged = '[++\($count\)](green)'; + # renamed = "👅"; + # deleted = "🗑"; + format = "[\\[$all_status$ahead_behind\\]]($style) "; + conflicted = "=[\($count\)](green) "; + ahead = "⇡[\($count\)](green) "; + behind = "⇣[\($count\)](green) "; + diverged = "⇕[\($count\)](green) "; + untracked = "?[\($count\)](green) "; + stashed = "$[\($count\)](green) "; + modified = "![\($count\)](green) "; + staged = "+[\($count\)](green) "; + renamed = "»[\($count\)](green) "; + deleted = "✘[\($count\)](green) "; + }; + + status = { + style = "bg:blue fg:red"; + symbol = "🔴"; + format = "[\[$symbol $common_meaning$signal_name$maybe_int\]]($style) "; + map_symbol = true; + disabled = false; + }; + + time = { + disabled = false; + format = "🕙[$time]($style) "; + # format = '🕙[\[ $time \]]($style) '; + time_format = "%T"; + utc_time_offset = "+3"; + # time_range = "10:00:00-14:00:00"; + }; + + cmd_duration = { + min_time = 2000; # miliseconds + # show_notifications = true; + min_time_to_notify = 45000; # miliseconds + format = "took [$duration](bold yellow) "; + }; + + hostname = { + ssh_only = false; + format = "[$hostname](bold fg:#CC59B0)"; + disabled = false; + }; + + username = { + disabled = false; + style_user = "white bold"; + style_root = "red bold"; + format = "[$user]($style)[@](bold yellow)"; + show_always = true; + }; + + directory = { + read_only = "🔒"; + read_only_style = "bold white"; + style = "fg:#A7F3E4"; + truncate_to_repo = false; + truncation_length = 5; + truncation_symbol = "…/"; + home_symbol = "🏡"; + format = "[$read_only]($read_only_style)[$path]($style) "; + }; + + directory.substitutions = { + ".config" = " "; + "nvim" = ""; + "emacs" = "𝓔"; + "doom" = "𝓔"; + "Projects" = "💻"; + "FMI" = "🏫"; + "Home" = "🏠"; + "CPP" = ""; + "Java" = ""; + "Python" = ""; + }; + + # Language Environments + package = { + style = "bold fg:#5E5E5E"; + }; + + python = { + style = "bold fg:#5E5E5E"; + symbol = "[](bold yellow) "; + }; + + nodejs = { + style = "bold fg:#5E5E5E"; + symbol = "[⬢](bold green) "; + }; + + # Custom + jobs = { + format = "[ $symbol$number ]($style)"; + style = "bg:#587744 fg:bright-white"; + symbol = "⚙"; + }; + + custom.local = { + shell = ["zsh" "-d" "-f"]; + when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; + format = "[$symbol$output]($style)[@](bold yellow)"; + command = "whoami"; + style = "fg:bright-white"; + symbol = ""; + }; + + custom.local_root = { + shell = ["zsh" "-d" "-f"]; + when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; + format = "[ $output ]($style)[@](bold yellow)"; + command = "whoami"; + style = "bg:red fg:bright-white"; + }; + + custom.ssh = { + shell = ["zsh" "-d" "-f"]; + when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; + format = "[ $symbol$output ]($style)[@](bold yellow)"; + command = "whoami"; + style = "bg:blue fg:bright-white"; + # style = "bg:#FD7208 fg:bright-white"; + symbol = "⌁"; + }; + + custom.ssh_root = { + shell = ["zsh" "-d" "-f"]; + when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; + format = "[ $symbol$output ]($style)[@](bold yellow)"; + command = "whoami"; + style = "bg:red fg:bright-white"; + symbol = "⌁"; + }; + }; + }; + }; +}