diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/.gitignore b/.gitignore index 7d161dc..734c056 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,5 @@ .DS_Store -newsboat.configlink/history.search -newsboat.configlink/urls -nvim.configlink/dirs/* -nvim.configlink/.netrwhist -nvim.configlink/plugin/** -nvim.configlink/plugged/** -nvim.configlink/autoload/** -fish.configlink/config.fish.bac -fish.configlink/functions/vim.fish -fish_variables -homebrew/*.lock.json *.bak *.db **/.direnv/** +result diff --git a/Makefile b/Makefile deleted file mode 100644 index e9d4af2..0000000 --- a/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -bootstrap: - ./scripts/bootstrap - ./scripts/setup_symlinks - -all: - ./scripts/bootstrap - ./scripts/setup_symlinks - ./scripts/setup_fish - ./scripts/brews - ./scripts/update_rust_analyzer - ./scripts/rust - ./scripts/cargos - ./scripts/setup_cheatsheet - ./scripts/setup_ytfzf - -fish: bootstrap - ./scripts/setup_fish - -macos: bootstrap - ./scripts/configure_macos - -brews: bootstrap - ./scripts/brews - -casks: bootstrap - ./scripts/casks - -rust: - ./scripts/update_rust_analyzer - ./scripts/rust - -cargos: rust - ./scripts/rust - -programs: - ./scripts/setup_cheatsheet - ./scripts/setup_ytfzf - -python: brews - npm install -g pyright diff --git a/alacritty.configlink/alacritty.yml b/alacritty.configlink/alacritty.yml deleted file mode 100644 index d6e9988..0000000 --- a/alacritty.configlink/alacritty.yml +++ /dev/null @@ -1,840 +0,0 @@ -# Configuration for Alacritty, the GPU enhanced terminal emulator. - -# Any items in the `env` entry below will be added as -# environment variables. Some entries may override variables -# set by alacritty itself. -#env: - # TERM variable - # - # This value is used to set the `$TERM` environment variable for - # each instance of Alacritty. If it is not present, alacritty will - # check the local terminfo database and use `alacritty` if it is - # available, otherwise `xterm-256color` is used. - #TERM: alacritty - #TERM: xterm-256color - -window: - # Window dimensions (changes require restart) - # - # Specified in number of columns/lines, not pixels. - # If both are `0`, this setting is ignored. - dimensions: - columns: 130 - lines: 50 - - # Window position (changes require restart) - # - # Specified in number of pixels. - # If the position is not set, the window manager will handle the placement. - #position: - # x: 0 - # y: 0 - - # Window padding (changes require restart) - # - # Blank space added around the window in pixels. This padding is scaled - # by DPI and the specified value is always added at both opposing sides. - padding: - x: 20 - y: 20 - - # Spread additional padding evenly around the terminal content. - #dynamic_padding: false - - # Window decorations - # - # Values for `decorations`: - # - full: Borders and title bar - # - none: Neither borders nor title bar - # - # Values for `decorations` (macOS only): - # - transparent: Title bar, transparent background and title bar buttons - # - buttonless: Title bar, transparent background, but no title bar buttons - decorations: full - - # Startup Mode (changes require restart) - # - # Values for `startup_mode`: - # - Windowed - # - Maximized - # - Fullscreen - # - # Values for `startup_mode` (macOS only): - # - SimpleFullscreen - startup_mode: SimpleFullscreen - - # Window title - #title: Alacritty - - # Window class (Linux/BSD only): - #class: - # Application instance name - #instance: Alacritty - # General application class - #general: Alacritty - - # GTK theme variant (Linux/BSD only) - # - # Override the variant of the GTK theme. Commonly supported values are `dark` and `light`. - # Set this to `None` to use the default theme variant. - #gtk_theme_variant: None - -scrolling: - # Maximum number of lines in the scrollback buffer. - # Specifying '0' will disable scrolling. - history: 10000 - - # Scrolling distance multiplier. - #multiplier: 3 - -# Font configuration -font: - # Normal (roman) font face - normal: - # Font family - # - # Default: - # - (macOS) Menlo - # - (Linux/BSD) monospace - # - (Windows) Consolas - #family: Fira Code - #family: Noto Sans Mono - # family: Fira Mono for Powerline - family: FiraMono Nerd Font - - # The `style` can be specified to pick a specific face. - #style: Regular - - # Bold font face - #bold: - # Font family - # - # If the bold family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Bold - - # Italic font face - #italic: - # Font family - # - # If the italic family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Italic - - # Bold italic font face - #bold_italic: - # Font family - # - # If the bold italic family is not specified, it will fall back to the - # value specified for the normal font. - #family: monospace - - # The `style` can be specified to pick a specific face. - #style: Bold Italic - - # Point size - size: 17.0 - - # Offset is the extra space around each character. `offset.y` can be thought of - # as modifying the line spacing, and `offset.x` as modifying the letter spacing. - #offset: - # x: 0 - # y: 0 - - # Glyph offset determines the locations of the glyphs within their cells with - # the default being at the bottom. Increasing `x` moves the glyph to the right, - # increasing `y` moves the glyph upward. - #glyph_offset: - # x: 0 - # y: 0 - - # Thin stroke font rendering (macOS only) - # - # Thin strokes are suitable for retina displays, but for non-retina screens - # it is recommended to set `use_thin_strokes` to `false`. - #use_thin_strokes: true - -# If `true`, bold text is drawn using the bright color variants. -#draw_bold_text_with_bright_colors: false - -# Colors (Tomorrow Night) -#colors: - # Default colors - #primary: - # background: '#1d1f21' - # foreground: '#c5c8c6' - - # Bright and dim foreground colors - # - # The dimmed foreground color is calculated automatically if it is not present. - # If the bright foreground color is not set, or `draw_bold_text_with_bright_colors` - # is `false`, the normal foreground color will be used. - #dim_foreground: '#828482' - #bright_foreground: '#eaeaea' - - # Cursor colors - # - # Colors which should be used to draw the terminal cursor. - # - # Allowed values are CellForeground and CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #cursor: - # text: CellBackground - # cursor: CellForeground - - # Vi mode cursor colors - # - # Colors for the cursor when the vi mode is active. - # - # Allowed values are CellForeground and CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #vi_mode_cursor: - # text: CellBackground - # cursor: CellForeground - - # Selection colors - # - # Colors which should be used to draw the selection area. - # - # Allowed values are CellForeground and CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #selection: - # text: CellBackground - # background: CellForeground - - # Search colors - # - # Colors used for the search bar and match highlighting. - # - # Allowed values are CellForeground and CellBackground, which reference the - # affected cell, or hexadecimal colors like #ff00ff. - #search: - # matches: - # foreground: '#000000' - # background: '#ffffff' - # - # bar: - # background: CellForeground - # foreground: CellBackground - - # Normal colors - #normal: - # black: '#1d1f21' - # red: '#cc6666' - # green: '#b5bd68' - # yellow: '#f0c674' - # blue: '#81a2be' - # magenta: '#b294bb' - # cyan: '#8abeb7' - # white: '#c5c8c6' - - # Bright colors - #bright: - # black: '#666666' - # red: '#d54e53' - # green: '#b9ca4a' - # yellow: '#e7c547' - # blue: '#7aa6da' - # magenta: '#c397d8' - # cyan: '#70c0b1' - # white: '#eaeaea' - - # Dim colors - # - # If the dim colors are not set, they will be calculated automatically based - # on the `normal` colors. - #dim: - # black: '#131415' - # red: '#864343' - # green: '#777c44' - # yellow: '#9e824c' - # blue: '#556a7d' - # magenta: '#75617b' - # cyan: '#5b7d78' - # white: '#828482' - - # Indexed Colors - # - # The indexed colors include all colors from 16 to 256. - # When these are not set, they're filled with sensible defaults. - # - # Example: - # `- { index: 16, color: '#ff00ff' }` - # - #indexed_colors: [] - -# Bell -# -# The bell is rung every time the BEL control character is received. -#bell: - # Visual Bell Animation - # - # Animation effect for flashing the screen when the visual bell is rung. - # - # Values for `animation`: - # - Ease - # - EaseOut - # - EaseOutSine - # - EaseOutQuad - # - EaseOutCubic - # - EaseOutQuart - # - EaseOutQuint - # - EaseOutExpo - # - EaseOutCirc - # - Linear - #animation: EaseOutExpo - - # Duration of the visual bell flash. A `duration` of `0` will disable the - # visual bell animation. - #duration: 0 - - # Visual bell animation color. - #color: '#ffffff' - - # Bell Command - # - # This program is executed whenever the bell is rung. - # - # When set to `command: None`, no command will be executed. - # - # Example: - # command: - # program: notify-send - # args: ["Hello, World!"] - # - #command: None - -# Background opacity -# -# Window opacity as a floating point number from `0.0` to `1.0`. -# The value `0.0` is completely transparent and `1.0` is opaque. -#background_opacity: 1.0 - -#selection: - #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" - - # When set to `true`, selected text will be copied to the primary clipboard. - #save_to_clipboard: false - -# Allow terminal applications to change Alacritty's window title. -#dynamic_title: true - -#cursor: - # Cursor style - # - # Values for `style`: - # - ▇ Block - # - _ Underline - # - | Beam - #style: Block - - # Vi mode cursor style - # - # If the vi mode cursor style is `None` or not specified, it will fall back to - # the style of the active value of the normal cursor. - # - # See `cursor.style` for available options. - #vi_mode_style: Block - - # If this is `true`, the cursor will be rendered as a hollow box when the - # window is not focused. - #unfocused_hollow: true - - # Thickness of the cursor relative to the cell width as floating point number - # from `0.0` to `1.0`. - #thickness: 0.15 - -# Live config reload (changes require restart) -#live_config_reload: true - -# Shell -# -# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`. -# Entries in `shell.args` are passed unmodified as arguments to the shell. -# -# Default: -# - (macOS) /bin/bash --login -# - (Linux/BSD) user login shell -# - (Windows) powershell -shell: - program: /usr/local/bin/fish - args: - - --login - - --init-command - - tmux a -t noah || tmux new -s noah - -# Startup directory -# -# Directory the shell is started in. If this is unset, or `None`, the working -# directory of the parent process will be used. -#working_directory: None - -# WinPTY backend (Windows only) -# -# Alacritty defaults to using the newer ConPTY backend if it is available, -# since it resolves a lot of bugs and is quite a bit faster. If it is not -# available, the WinPTY backend will be used instead. -# -# Setting this option to `true` makes Alacritty use the legacy WinPTY backend, -# even if the ConPTY backend is available. -#winpty_backend: false - -# Send ESC (\x1b) before characters when alt is pressed. -#alt_send_esc: true - -#mouse: - # Click settings - # - # The `double_click` and `triple_click` settings control the time - # alacritty should wait for accepting multiple clicks as one double - # or triple click. - #double_click: { threshold: 300 } - #triple_click: { threshold: 300 } - - # If this is `true`, the cursor is temporarily hidden when typing. - #hide_when_typing: false - - #url: - # URL launcher - # - # This program is executed when clicking on a text which is recognized as a URL. - # The URL is always added to the command as the last parameter. - # - # When set to `launcher: None`, URL launching will be disabled completely. - # - # Default: - # - (macOS) open - # - (Linux/BSD) xdg-open - # - (Windows) explorer - #launcher: - # program: xdg-open - # args: [] - - # URL modifiers - # - # These are the modifiers that need to be held down for opening URLs when clicking - # on them. The available modifiers are documented in the key binding section. - #modifiers: None - -# Mouse bindings -# -# Mouse bindings are specified as a list of objects, much like the key -# bindings further below. -# -# To trigger mouse bindings when an application running within Alacritty captures the mouse, the -# `Shift` modifier is automatically added as a requirement. -# -# Each mouse binding will specify a: -# -# - `mouse`: -# -# - Middle -# - Left -# - Right -# - Numeric identifier such as `5` -# -# - `action` (see key bindings) -# -# And optionally: -# -# - `mods` (see key bindings) -#mouse_bindings: -# - { mouse: Middle, action: PasteSelection } - -# Key bindings -# -# Key bindings are specified as a list of objects. For example, this is the -# default paste binding: -# -# `- { key: V, mods: Control|Shift, action: Paste }` -# -# Each key binding will specify a: -# -# - `key`: Identifier of the key pressed -# -# - A-Z -# - F1-F24 -# - Key0-Key9 -# -# A full list with available key codes can be found here: -# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants -# -# Instead of using the name of the keys, the `key` field also supports using -# the scancode of the desired key. Scancodes have to be specified as a -# decimal number. This command will allow you to display the hex scancodes -# for certain keys: -# -# `showkey --scancodes`. -# -# Then exactly one of: -# -# - `chars`: Send a byte sequence to the running application -# -# The `chars` field writes the specified string to the terminal. This makes -# it possible to pass escape sequences. To find escape codes for bindings -# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside -# of tmux. Note that applications use terminfo to map escape sequences back -# to keys. It is therefore required to update the terminfo when changing an -# escape sequence. -# -# - `action`: Execute a predefined action -# -# - ToggleViMode -# - SearchForward -# - SearchBackward -# - Copy -# - Paste -# - PasteSelection -# - IncreaseFontSize -# - DecreaseFontSize -# - ResetFontSize -# - ScrollPageUp -# - ScrollPageDown -# - ScrollHalfPageUp -# - ScrollHalfPageDown -# - ScrollLineUp -# - ScrollLineDown -# - ScrollToTop -# - ScrollToBottom -# - ClearHistory -# - Hide -# - Minimize -# - Quit -# - ToggleFullscreen -# - SpawnNewInstance -# - ClearLogNotice -# - ClearSelection -# - ReceiveChar -# - None -# -# (`mode: Vi` only): -# - Open -# - Up -# - Down -# - Left -# - Right -# - First -# - Last -# - FirstOccupied -# - High -# - Middle -# - Low -# - SemanticLeft -# - SemanticRight -# - SemanticLeftEnd -# - SemanticRightEnd -# - WordRight -# - WordLeft -# - WordRightEnd -# - WordLeftEnd -# - Bracket -# - ToggleNormalSelection -# - ToggleLineSelection -# - ToggleBlockSelection -# - ToggleSemanticSelection -# - SearchNext -# - SearchPrevious -# - SearchStart -# - SearchEnd -# -# (macOS only): -# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space -# -# (Linux/BSD only): -# - CopySelection: Copies into selection buffer -# -# - `command`: Fork and execute a specified command plus arguments -# -# The `command` field must be a map containing a `program` string and an -# `args` array of command line parameter strings. For example: -# `{ program: "alacritty", args: ["-e", "vttest"] }` -# -# And optionally: -# -# - `mods`: Key modifiers to filter binding actions -# -# - Command -# - Control -# - Option -# - Super -# - Shift -# - Alt -# -# Multiple `mods` can be combined using `|` like this: -# `mods: Control|Shift`. -# Whitespace and capitalization are relevant and must match the example. -# -# - `mode`: Indicate a binding for only specific terminal reported modes -# -# This is mainly used to send applications the correct escape sequences -# when in different modes. -# -# - AppCursor -# - AppKeypad -# - Alt -# -# A `~` operator can be used before a mode to apply the binding whenever -# the mode is *not* active, e.g. `~Alt`. -# -# Bindings are always filled by default, but will be replaced when a new -# binding with the same triggers is defined. To unset a default binding, it can -# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for -# a no-op if you do not wish to receive input characters for that binding. -# -# If the same trigger is assigned to multiple actions, all of them are executed -# in the order they were defined in. -key_bindings: - - { key: F, mods: Super, action: ToggleSimpleFullscreen } - - # Reference for escape codes: https://www.gaijin.at/en/infos/ascii-ansi-character-table - - - { key: L, mods : Super, chars: "\x1F" } # CMD-L sends null key for fish - - { key: H, mods : Super|Shift, chars: "\x02p" } # CMD-SHIFT-H previous tmux window - - { key: L, mods : Super|Shift, chars: "\x02n" } # CMD-SHIFT-L next tmux window - - - { key: Return, mods : Shift, chars: "\x1b[13;2u" } - - { key: Return, mods : Control, chars: "\x1b[13;5u" } - - { key: Return, mods : Control|Shift, chars: "\x1b[13;6u" } - - - { key: N, mods: Command, action: SpawnNewInstance } - - { key: PageUp, action: ScrollPageUp } - - { key: PageUp, mode: Alt, chars: "\x1B[5~" } - - { key: PageUp, mods: Shift, chars: "\x1B[5~" } - - { key: PageDown, action: ScrollPageDown } - - { key: PageDown, mode: Alt, chars: "\x1B[6~" } - - { key: PageDown, mods: Shift, chars: "\x1B[6~" } - - { key: Home, action: ScrollToTop } - - { key: Home, mode: Alt, chars: "\x1BOH" } - - { key: Home, mods: Shift, chars: "\x1B[H" } - - { key: End, action: ScrollToBottom } - - { key: End, mode: Alt, chars: "\x1BOF" } - - { key: End, mods: Shift, chars: "\x1B[F" } - - { key: Tab, mods: Alt, chars: "\x1B\t" } - - { key: Tab, mods: Alt|Shift, chars: "\x1B\x1B[Z" } - - { key: Back, chars: "\x7F" } - - { key: Back, mods: Alt, chars: "\x1B\x7F" } - - { key: Back, mods: Alt|Shift, chars: "\x1B\x08" } - - { key: Space, mods: Control, chars: "\x00" } - - { key: Space, mods: Alt, chars: "\x20" } - - { key: Left, mods: Alt, chars: "\x1Bb" } - - { key: Left, mods: Alt|Shift, chars: "\x1B\x1B[D" } - - { key: Right, mods: Alt, chars: "\x1Bf" } - - { key: Right, mods: Alt|Shift, chars: "\x1B\x1B[C" } - - { key: Down, mods: Alt, chars: "\x1B\x1B[B" } - - { key: Down, mods: Alt|Shift, chars: "\x1B\x1B[B" } - - { key: Up, mods: Alt, chars: "\x1B\x1B[A" } - - { key: Up, mods: Alt|Shift, chars: "\x1B\x1B[A" } - - { key: A, mods: Alt, chars: "\x1Ba" } - - { key: A, mods: Alt|Shift, chars: "\x1BA" } - - { key: B, mods: Alt, chars: "\x1Bb" } - - { key: B, mods: Alt|Shift, chars: "\x1BB" } - - { key: C, mods: Alt, chars: "\x1Bc" } - - { key: C, mods: Alt|Shift, chars: "\x1BC" } - - { key: D, mods: Alt, chars: "\x1Bd" } - - { key: D, mods: Alt|Shift, chars: "\x1BD" } - - { key: E, mods: Alt, chars: "\x1Be" } - - { key: E, mods: Alt|Shift, chars: "\x1BE" } - - { key: F, mods: Alt, chars: "\x1Bf" } - - { key: F, mods: Alt|Shift, chars: "\x1BF" } - - { key: G, mods: Alt, chars: "\x1Bg" } - - { key: G, mods: Alt|Shift, chars: "\x1BG" } - - { key: H, mods: Alt, chars: "\x1Bh" } - - { key: H, mods: Alt|Shift, chars: "\x1BH" } - - { key: I, mods: Alt, chars: "\x1Bi" } - - { key: I, mods: Alt|Shift, chars: "\x1BI" } - - { key: J, mods: Alt, chars: "\x1Bj" } - - { key: J, mods: Alt|Shift, chars: "\x1BJ" } - - { key: K, mods: Alt, chars: "\x1Bk" } - - { key: K, mods: Alt|Shift, chars: "\x1BK" } - - { key: L, mods: Alt, chars: "\x1Bl" } - - { key: L, mods: Alt|Shift, chars: "\x1BL" } - - { key: M, mods: Alt, chars: "\x1Bm" } - - { key: M, mods: Alt|Shift, chars: "\x1BM" } - - { key: N, mods: Alt, chars: "\x1Bn" } - - { key: N, mods: Alt|Shift, chars: "\x1BN" } - - { key: O, mods: Alt, chars: "\x1Bo" } - - { key: O, mods: Alt|Shift, chars: "\x1BO" } - - { key: P, mods: Alt, chars: "\x1Bp" } - - { key: P, mods: Alt|Shift, chars: "\x1BP" } - - { key: Q, mods: Alt, chars: "\x1Bq" } - - { key: Q, mods: Alt|Shift, chars: "\x1BQ" } - - { key: R, mods: Alt, chars: "\x1Br" } - - { key: R, mods: Alt|Shift, chars: "\x1BR" } - - { key: S, mods: Alt, chars: "\x1Bs" } - - { key: S, mods: Alt|Shift, chars: "\x1BS" } - - { key: T, mods: Alt, chars: "\x1Bt" } - - { key: T, mods: Alt|Shift, chars: "\x1BT" } - - { key: U, mods: Alt, chars: "\x1Bu" } - - { key: U, mods: Alt|Shift, chars: "\x1BU" } - - { key: V, mods: Alt, chars: "\x1Bv" } - - { key: V, mods: Alt|Shift, chars: "\x1BV" } - - { key: W, mods: Alt, chars: "\x1Bw" } - - { key: W, mods: Alt|Shift, chars: "\x1BW" } - - { key: X, mods: Alt, chars: "\x1Bx" } - - { key: X, mods: Alt|Shift, chars: "\x1BX" } - - { key: Y, mods: Alt, chars: "\x1By" } - - { key: Y, mods: Alt|Shift, chars: "\x1BY" } - - { key: Z, mods: Alt, chars: "\x1Bz" } - - { key: Z, mods: Alt|Shift, chars: "\x1BZ" } - - { key: Key1, mods: Alt, chars: "\x1B1" } - - { key: Key1, mods: Alt|Shift, chars: "\x1B!" } - - { key: Key2, mods: Alt, chars: "\x1B2" } - - { key: Key2, mods: Alt|Shift, chars: "\x1B#" } - - { key: Key3, mods: Alt, chars: "\x1B3" } - - { key: Key3, mods: Alt|Shift, chars: "\x1B#" } - - { key: Key4, mods: Alt, chars: "\x1B4" } - - { key: Key4, mods: Alt|Shift, chars: "\x1B$" } - - { key: Key5, mods: Alt, chars: "\x1B5" } - - { key: Key5, mods: Alt|Shift, chars: "\x1B%" } - - { key: Key6, mods: Alt, chars: "\x1B6" } - - { key: Key6, mods: Alt|Shift, chars: "\x1B^" } - - { key: Key7, mods: Alt, chars: "\x1B7" } - - { key: Key7, mods: Alt|Shift, chars: "\x1B&" } - - { key: Key8, mods: Alt, chars: "\x1B8" } - - { key: Key8, mods: Alt|Shift, chars: "\x1B*" } - - { key: Key9, mods: Alt, chars: "\x1B9" } - - { key: Key9, mods: Alt|Shift, chars: "\x1B(" } - - { key: Key0, mods: Alt, chars: "\x1B0" } - - { key: Key0, mods: Alt|Shift, chars: "\x1B)" } - - { key: Minus, mods: Alt, chars: "\x1B-" } - - { key: Minus, mods: Alt|Shift, chars: "\x1B_" } - - { key: Equals, mods: Alt, chars: "\x1B=" } - - { key: Equals, mods: Alt|Shift, chars: "\x1B+" } - - { key: LBracket, mods: Alt, chars: "\x1B[" } - - { key: LBracket, mods: Alt|Shift, chars: "\x1B{" } - - { key: RBracket, mods: Alt, chars: "\x1B]" } - - { key: RBracket, mods: Alt|Shift, chars: "\x1B}" } - - { key: Backslash, mods: Alt, chars: "\x1B\\" } - - { key: Backslash, mods: Alt|Shift, chars: "\x1B|" } - - { key: Semicolon, mods: Alt, chars: "\x1B;" } - - { key: Semicolon, mods: Alt|Shift, chars: "\x1B:" } - - { key: Apostrophe, mods: Alt, chars: "\x1B'" } - - { key: Apostrophe, mods: Alt|Shift, chars: "\x1B\"" } - - { key: Comma, mods: Alt, chars: "\x1B," } - - { key: Comma, mods: Alt|Shift, chars: "\x1B<" } - - { key: Period, mods: Alt, chars: "\x1B." } - - { key: Period, mods: Alt|Shift, chars: "\x1B>" } - - { key: Slash, mods: Alt, chars: "\x1B/" } - - { key: Slash, mods: Alt|Shift, chars: "\x1B?" } - - { key: Grave, mods: Alt, chars: "\x1B`" } - - { key: Grave, mods: Alt|Shift, chars: "\x1B~" } - # - { key: E, mods: Alt, chars: "\x1be" } # Send ALT-E for fish - - #- { key: Paste, action: Paste } - #- { key: Copy, action: Copy } - #- { key: L, mods: Control, action: ClearLogNotice } - #- { key: L, mods: Control, mode: ~Vi, chars: "\x0c" } - #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, } - #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } - #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, } - #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } - - # Vi Mode - #- { key: Space, mods: Shift|Control, mode: Vi, action: ScrollToBottom } - #- { key: Space, mods: Shift|Control, action: ToggleViMode } - #- { key: Escape, mode: Vi, action: ClearSelection } - #- { key: I, mode: Vi, action: ScrollToBottom } - #- { key: I, mode: Vi, action: ToggleViMode } - #- { key: Y, mods: Control, mode: Vi, action: ScrollLineUp } - #- { key: E, mods: Control, mode: Vi, action: ScrollLineDown } - #- { key: G, mode: Vi, action: ScrollToTop } - #- { key: G, mods: Shift, mode: Vi, action: ScrollToBottom } - #- { key: B, mods: Control, mode: Vi, action: ScrollPageUp } - #- { key: F, mods: Control, mode: Vi, action: ScrollPageDown } - #- { key: U, mods: Control, mode: Vi, action: ScrollHalfPageUp } - #- { key: D, mods: Control, mode: Vi, action: ScrollHalfPageDown } - #- { key: Y, mode: Vi, action: Copy } - #- { key: Y, mode: Vi, action: ClearSelection } - #- { key: Copy, mode: Vi, action: ClearSelection } - #- { key: V, mode: Vi, action: ToggleNormalSelection } - #- { key: V, mods: Shift, mode: Vi, action: ToggleLineSelection } - #- { key: V, mods: Control, mode: Vi, action: ToggleBlockSelection } - #- { key: V, mods: Alt, mode: Vi, action: ToggleSemanticSelection } - #- { key: Return, mode: Vi, action: Open } - #- { key: K, mode: Vi, action: Up } - #- { key: J, mode: Vi, action: Down } - #- { key: H, mode: Vi, action: Left } - #- { key: L, mode: Vi, action: Right } - #- { key: Up, mode: Vi, action: Up } - #- { key: Down, mode: Vi, action: Down } - #- { key: Left, mode: Vi, action: Left } - #- { key: Right, mode: Vi, action: Right } - #- { key: Key0, mode: Vi, action: First } - #- { key: Key4, mods: Shift, mode: Vi, action: Last } - #- { key: Key6, mods: Shift, mode: Vi, action: FirstOccupied } - #- { key: H, mods: Shift, mode: Vi, action: High } - #- { key: M, mods: Shift, mode: Vi, action: Middle } - #- { key: L, mods: Shift, mode: Vi, action: Low } - #- { key: B, mode: Vi, action: SemanticLeft } - #- { key: W, mode: Vi, action: SemanticRight } - #- { key: E, mode: Vi, action: SemanticRightEnd } - #- { key: B, mods: Shift, mode: Vi, action: WordLeft } - #- { key: W, mods: Shift, mode: Vi, action: WordRight } - #- { key: E, mods: Shift, mode: Vi, action: WordRightEnd } - #- { key: Key5, mods: Shift, mode: Vi, action: Bracket } - #- { key: Slash, mode: Vi, action: SearchForward } - #- { key: Slash, mods: Shift, mode: Vi, action: SearchBackward } - #- { key: N, mode: Vi, action: SearchNext } - #- { key: N, mods: Shift, mode: Vi, action: SearchPrevious } - - # (Windows, Linux, and BSD only) - #- { key: V, mods: Control|Shift, action: Paste } - #- { key: C, mods: Control|Shift, action: Copy } - #- { key: F, mods: Control|Shift, action: SearchForward } - #- { key: B, mods: Control|Shift, action: SearchBackward } - #- { key: C, mods: Control|Shift, mode: Vi, action: ClearSelection } - #- { key: Insert, mods: Shift, action: PasteSelection } - #- { key: Key0, mods: Control, action: ResetFontSize } - #- { key: Equals, mods: Control, action: IncreaseFontSize } - #- { key: Add, mods: Control, action: IncreaseFontSize } - #- { key: Subtract, mods: Control, action: DecreaseFontSize } - #- { key: Minus, mods: Control, action: DecreaseFontSize } - - # (Windows only) - #- { key: Return, mods: Alt, action: ToggleFullscreen } - - # (macOS only) - #- { key: K, mods: Command, mode: ~Vi, chars: "\x0c" } - #- { key: Key0, mods: Command, action: ResetFontSize } - #- { key: Equals, mods: Command, action: IncreaseFontSize } - #- { key: Add, mods: Command, action: IncreaseFontSize } - #- { key: Minus, mods: Command, action: DecreaseFontSize } - #- { key: K, mods: Command, action: ClearHistory } - #- { key: V, mods: Command, action: Paste } - #- { key: C, mods: Command, action: Copy } - #- { key: C, mods: Command, mode: Vi, action: ClearSelection } - #- { key: H, mods: Command, action: Hide } - #- { key: M, mods: Command, action: Minimize } - #- { key: Q, mods: Command, action: Quit } - #- { key: W, mods: Command, action: Quit } - #- { key: N, mods: Command, action: SpawnNewInstance } - #- { key: F, mods: Command|Control, action: ToggleFullscreen } - #- { key: F, mods: Command, action: SearchForward } - #- { key: B, mods: Command, action: SearchBackward } - -#debug: - # Display the time it takes to redraw each frame. - #render_timer: false - - # Keep the log file after quitting Alacritty. - #persistent_logging: false - - # Log level - # - # Values for `log_level`: - # - None - # - Error - # - Warn - # - Info - # - Debug - # - Trace - #log_level: Warn - - # Print all received window events. - #print_events: false diff --git a/bin/bookmark b/bin/bookmark deleted file mode 100755 index 9fb38bf..0000000 --- a/bin/bookmark +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -URL=$1 -TITLE=$2 -DESCRIPTION=$3 -FEED=$4 - -printf "\n\n## [%s](%s)\n%s\nFrom %s: added on [%s](%s.md).\n\n---\n" \ - "$TITLE" \ - "$URL" \ - "$DESCRIPTION" \ - "$FEED" \ - "$TODAY_NOTE" \ - "$TODAY_NOTE" \ - >>"$NOTES_PATH/bookmarks.md" diff --git a/bin/calc b/bin/calc deleted file mode 100755 index 57b551c..0000000 --- a/bin/calc +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env ruby -# -# Run a quick calculation with Ruby -# -# Usage: calc "1/2" - -class Integer - def /(other) - fdiv(other) - end -end - -puts eval(ARGV.join("")) diff --git a/bin/nixos-fix-timezones b/bin/nixos-fix-timezones deleted file mode 100755 index aa330ec..0000000 --- a/bin/nixos-fix-timezones +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -doas -u localtimed localtimed diff --git a/bin/nixos-rebuild b/bin/nixos-rebuild deleted file mode 100755 index d979b88..0000000 --- a/bin/nixos-rebuild +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -nixos-rebuild switch -I nixos-config="/home/noah/dev/personal/dotfiles/nixos/configuration.nix" diff --git a/bin/nixos-rebuild-home b/bin/nixos-rebuild-home deleted file mode 100755 index 702ae0d..0000000 --- a/bin/nixos-rebuild-home +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -home-manager switch -f "/home/noah/dev/personal/dotfiles/nixos/home.nix" diff --git a/bin/nuke b/bin/nuke deleted file mode 100755 index 51d438d..0000000 --- a/bin/nuke +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -nuke() { - local pid - pid=$(ps -ef | grep -v ^root | sed 1d | fzf -m | awk '{print $2}') - - if [ "x$pid" != "x" ] - then - echo $pid | xargs kill -${1:-9} - fi -} - -nuke diff --git a/bin/reset_1p b/bin/reset_1p deleted file mode 100755 index 84c976c..0000000 --- a/bin/reset_1p +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -security find-generic-password -s 1Password -w | op signin enterprise_console --output=raw > $HOME/.op_tmux_token_tmp - diff --git a/bin/vimv b/bin/vimv deleted file mode 100755 index 74844fc..0000000 --- a/bin/vimv +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -set -eu - -# Lists the current directory's files in Vim, so you can edit it and save to rename them -# USAGE: vimv [file1 file2] -# https://github.com/thameera/vimv - -declare -r FILENAMES_FILE=$(mktemp "${TMPDIR:-/tmp}/vimv.XXX") - -trap '{ rm -f "${FILENAMES_FILE}" ; }' EXIT - -if [ $# -ne 0 ]; then - src=( "$@" ) -else - IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))' -fi - -for ((i=0;i<${#src[@]};++i)); do - echo "${src[i]}" >> "${FILENAMES_FILE}" -done - -${EDITOR:-vi} "${FILENAMES_FILE}" - -IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))' - -if (( ${#src[@]} != ${#dest[@]} )); then - echo "WARN: Number of files changed. Did you delete a line by accident? Aborting.." >&2 - exit 1 -fi - -declare -i count=0 -for ((i=0;i<${#src[@]};++i)); do - if [ "${src[i]}" != "${dest[i]}" ]; then - mkdir -p "$(dirname "${dest[i]}")" - if git ls-files --error-unmatch "${src[i]}" > /dev/null 2>&1; then - git mv "${src[i]}" "${dest[i]}" - else - mv "${src[i]}" "${dest[i]}" - fi - ((++count)) - fi -done - -echo "$count" files renamed. diff --git a/cargo/Cargofile b/cargo/Cargofile deleted file mode 100644 index be20472..0000000 --- a/cargo/Cargofile +++ /dev/null @@ -1,6 +0,0 @@ -# Packages to install with Cargo - -toml-cli # Parse TOML from the command line -rates # See exchange rates -wrangler # Cloudflare Workers CLI -csview # Quick display CSV as tables diff --git a/darwin_setup.sh b/darwin_setup.sh new file mode 100755 index 0000000..9ae3a38 --- /dev/null +++ b/darwin_setup.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# List brews +brew list --formula + +# List dependencies +brew list -1 | while read -r cask; do + echo -ne "\x1B[1;34m $cask \x1B[0m" + brew uses "$cask" --installed | awk '{printf(" %s ", $0)}' + echo "" +done + +# Uninstall brews +brew remove --force "$(brew list --formula)" +brew remove --force sd +brew remove --force zoxide +brew remove --force bat +brew remove --force fzf +brew remove --force tealdeer +brew remove --force glow +brew remove --force dos2unix +brew remove --force tree +brew remove --force wget +brew remove --force telnet +brew remove --force prettyping +brew remove --force httpie +brew remove --force gpg +brew remove --force qrencode +brew remove --force mpv +brew remove --force youtube-dl +brew remove --force pandoc +brew remove --force saulpw/vd/visidata +brew remove --force mdp +brew remove --force ansible +brew remove --force terraform +brew remove --force packer +brew remove --force awscli +brew remove --force kubectl +brew remove --force k9s +brew remove --force nmasur/repo/drips +brew remove --force hashicorp/tap/terraform-ls +brew remove --force tflint +brew remove --force noti +brew remove --force awslogs +brew remove --force shellcheck +brew remove --force shfmt +brew remove --force stylua +brew remove --force python +brew remove --force ipython +brew remove --force poetry +brew remove --force ruby +brew remove --force node +brew remove --force jq +brew remove --force gh +brew remove --force direnv +brew remove --force git +brew remove --force ripgrep +brew remove --force fd +brew remove --force neovim +brew remove --force exa +brew remove --force starship +brew remove --force tmux +brew remove --force fish +# brew remove --force trash + +# Uninstall casks +brew remove --force keybase +brew remove --force discord +brew remove --force obsidian +brew remove --force dropbox +brew remove --force 1password +brew remove --force firefox +brew remove --force font-fira-mono-nerd-font +brew remove --force alacritty +# brew remove --force scroll-reverser +# brew remove --force meetingbar +# brew remove --force gitify +# brew remove --force hammerspoon +# brew remove --force logitech-g-hub + +# Uninstall homebrew +bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" + +# Install Nix +sh -c "$(curl -L https://nixos.org/nix/install)" + +# Install nix-darwin +nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer +./result/bin/darwin-installer + +# Use with flake (requires installing first) +darwin-rebuild switch --flake . +darwin-rebuild switch --flake .#macbook # not sure if required diff --git a/digrc.symlink b/digrc.symlink deleted file mode 100644 index 0eac377..0000000 --- a/digrc.symlink +++ /dev/null @@ -1 +0,0 @@ -+noall +answer diff --git a/direnvrc.symlink b/direnvrc.symlink deleted file mode 100644 index 878c1ca..0000000 --- a/direnvrc.symlink +++ /dev/null @@ -1,13 +0,0 @@ -layout_poetry() { - if [[ ! -f pyproject.toml ]]; then - log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.' - exit 2 - fi - - # create venv if it doesn't exist - poetry run true - - export VIRTUAL_ENV=$(poetry env info --path) - export POETRY_ACTIVE=1 - PATH_add "$VIRTUAL_ENV/bin" -} diff --git a/fd/fdignore.symlink b/fd/fdignore.symlink deleted file mode 100644 index f385e61..0000000 --- a/fd/fdignore.symlink +++ /dev/null @@ -1,8 +0,0 @@ -!.env* -!.github/ -!.gitignore -!*.tfvars -.terraform/ -.target/ -/Library/ -target diff --git a/fish.configlink/completions/nomad.fish b/fish.configlink/completions/nomad.fish deleted file mode 100644 index e1e3da1..0000000 --- a/fish.configlink/completions/nomad.fish +++ /dev/null @@ -1,9 +0,0 @@ - -function __complete_nomad - set -lx COMP_LINE (commandline -cp) - test -z (commandline -ct) - and set COMP_LINE "$COMP_LINE " - /usr/local/bin/nomad -end -complete -f -c nomad -a "(__complete_nomad)" - diff --git a/fish.configlink/config.fish b/fish.configlink/config.fish deleted file mode 100644 index 529e662..0000000 --- a/fish.configlink/config.fish +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/local/bin/fish - -if status --is-interactive - - # Add directories to path - set PATH $PATH \ - /usr/local/bin \ - ~/.local/bin \ - $DOTS/bin \ - ~/.cargo/bin - - # Use `vi` in the shell with cursor shapes - fish_vi_key_bindings - bind yy fish_clipboard_copy - bind Y fish_clipboard_copy - bind -M visual y fish_clipboard_copy - bind p fish_clipboard_paste - set -g fish_vi_force_cursor - set -g fish_cursor_default block - set -g fish_cursor_insert line - set -g fish_cursor_visual block - set -g fish_cursor_replace_one underscore - fish_vi_cursor - - # Autojump - zoxide init fish | source - - # Colors - if test -e $DOTS/fish.configlink/fish_colors - command cat $DOTS/fish.configlink/fish_colors - end - - # Fuzzy finder - fzf_key_bindings - set -gx FZF_DEFAULT_COMMAND 'fd --type file' - set -g FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND" - set -g FZF_DEFAULT_OPTS '-m --height 50% --border' - - # Use `starship` prompt - starship init fish | source - - # Hook into direnv - direnv hook fish | source -end diff --git a/fish.configlink/fish_colors b/fish.configlink/fish_colors deleted file mode 100644 index 3cf7658..0000000 --- a/fish.configlink/fish_colors +++ /dev/null @@ -1 +0,0 @@ -]4;1;rgb:cc/24/1d]4;2;rgb:98/97/1a]4;3;rgb:d7/99/21]4;4;rgb:45/85/88]4;5;rgb:b1/62/86]4;6;rgb:68/9d/6a]11;rgb:28/28/28]10;rgb:eb/db/b2]4;0;rgb:28/28/28]4;7;rgb:a8/99/84]4;8;rgb:92/83/74]4;9;rgb:fb/59/34]4;10;rgb:b8/bb/26]4;11;rgb:fa/bd/2f]4;12;rgb:83/a5/98]4;13;rgb:d3/86/9b]4;14;rgb:8e/c0/7c]4;15;rgb:eb/db/b2]4;236;rgb:32/30/2f]4;234;rgb:1d/20/21]4;235;rgb:28/28/28]4;237;rgb:3c/38/36]4;239;rgb:50/49/45]4;241;rgb:66/5c/54]4;243;rgb:7c/6f/64]4;244;rgb:92/83/74]4;245;rgb:92/83/74]4;228;rgb:f2/e5/bc]4;230;rgb:f9/f5/d7]4;229;rgb:fb/f1/c7]4;223;rgb:eb/db/b2]4;250;rgb:d5/c4/a1]4;248;rgb:bd/ae/93]4;246;rgb:a8/99/84]4;167;rgb:fb/49/34]4;142;rgb:b8/bb/26]4;214;rgb:fa/bd/2f]4;109;rgb:83/a5/98]4;175;rgb:d3/86/9b]4;108;rgb:8e/c0/7c]4;208;rgb:fe/80/19]4;88;rgb:9d/00/06]4;100;rgb:79/74/0e]4;136;rgb:b5/76/14]4;24;rgb:07/66/78]4;96;rgb:8f/3f/71]4;66;rgb:42/7b/58]4;130;rgb:af/3a/03 \ No newline at end of file diff --git a/fish.configlink/functions/abbrs.fish b/fish.configlink/functions/abbrs.fish deleted file mode 100644 index b77cc39..0000000 --- a/fish.configlink/functions/abbrs.fish +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/local/bin/fish - -function abbrs --description 'All abbreviations' - - # Directory aliases - abbr -a l ls - abbr -a lh 'ls -lh' - abbr -a ll 'ls -alhF' - abbr -a lf 'ls -lh | fzf' - abbr -a c cd - abbr -a -- - 'cd -' - abbr -a proj 'cd $PROJ' - abbr -a mkd 'mkdir -pv' - - # Tmux - abbr -a ta 'tmux attach-session' - abbr -a tan 'tmux attach-session -t noah' - abbr -a tnn 'tmux new-session -s noah' - - # Git - abbr -a g git - abbr -a gs 'git status' - abbr -a gd 'git diff' - abbr -a gds 'git diff --staged' - abbr -a gdp 'git diff HEAD^' - abbr -a ga 'git add' - abbr -a gaa 'git add -A' - abbr -a gac 'git commit -am' - abbr -a gc 'git commit -m' - abbr -a gca 'git commit --amend --no-edit' - abbr -a gcae 'git commit --amend' - abbr -a gu 'git pull' - abbr -a gp 'git push' - abbr -a gpp git-push-upstream - abbr -a gl 'git log --graph --decorate --oneline -20' - abbr -a gll 'git log --graph --decorate --oneline' - abbr -a gco 'git checkout' - abbr -a gcom 'git checkout (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)' - abbr -a gcob 'git checkout -b' - abbr -a gb 'git branch' - abbr -a gbd 'git branch -d' - abbr -a gbD 'git branch -D' - abbr -a gr 'git reset' - abbr -a grh 'git reset --hard' - abbr -a gm 'git merge' - abbr -a gcp 'git cherry-pick' - abbr -a cdg 'cd (git rev-parse --show-toplevel)' - - # GitHub - abbr -a ghr 'gh repo view -w' - abbr -a gha 'gh run list | head -1 | awk \'{ print $(NF-2) }\' | xargs gh run view' - abbr -a grw 'noti gh run watch' - abbr -a grf 'gh run view --log-failed' - abbr -a grl 'gh run view --log' - abbr -a ghpr 'gh pr create && sleep 3 && noti gh run watch' - abbr -a ghm 'gh pr merge -s -d && git pull' - - # Vim - if command -v nvim >/dev/null - alias --save vim='nvim' - abbr -a vimrc 'vim $HOME/.config/nvim/init.lua' - else - alias --save vim='vim' - abbr -a vimrc 'vim $HOME/.vimrc' - end - abbr -a v vim - abbr -a vl 'vim -c "normal! `0"' - abbr -a vll 'vim -c "Telescope oldfiles"' - abbr -a vh 'vim -c "Telescope oldfiles"' - - # Notes - abbr -a qn quicknote - abbr -a sn syncnotes - abbr -a to today - abbr -a work 'vim $NOTES_PATH/work.md' - - # RSS - abbr -a nb newsboat - - # Improved CLI Tools - abbr -a cat bat # Swap cat with bat - abbr -a h 'http -Fh --all' # Curl site for headers - abbr -a j just - abbr -a scim sc-im - - # Fun CLI Tools - abbr weather 'curl wttr.in/$WEATHER_CITY' - abbr moon 'curl wttr.in/Moon' - - # Dotfile and config shortcuts - abbr -a s sudo - abbr -a boot '$DOTS/scripts/bootstrap' - abbr -a sshc 'vim ~/.ssh/config' - abbr -a hosts 'sudo nvim /etc/hosts' - abbr -a frc 'vim $HOME/.config/fish/config.fish' - abbr -a falias 'vim $HOME/.config/fish/functions/abbrs.fish' - - # Cheat Sheets - abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \ - '-keyout server.key -out server.csr' - abbr -a fingerprint 'ssh-keyscan myhost.com | ssh-keygen -lf -' - abbr -a publickey 'ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub' - abbr -a forloop 'for i in (seq 1 100)' - abbr -a gatekeeper 'sudo spctl --master-disable' - abbr -a flushdns 'sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder' - - # Docker - abbr -a dc '$DOTS/bin/docker_cleanup' - abbr -a dr 'docker run --rm -it' - abbr -a db 'docker build . -t' - abbr -a ds 'docker ps -a' - abbr -a de 'docker exec -it' - abbr -a dpy 'docker run --rm -it -v $PWD:/project python:alpine python' - abbr -a alp 'docker run --rm -it -v $PWD:/project alpine sh' - - # Terraform - abbr -a te terraform - abbr -a tap 'terraform apply' - - # Kubernetes - abbr -a k kubectl - abbr -a pods 'kubectl get pods -A' - abbr -a nodes 'kubectl get nodes' - abbr -a deploys 'kubectl get deployments -A' - abbr -a dash kube-dashboard - abbr -a ks k9s - - # Cloud - abbr -a awsc 'vim ~/.aws/credentials' - - # Python - abbr -a py python - abbr -a po poetry - abbr -a pr 'poetry run python' - abbr -a pl 'poetry run pylint *' - abbr -a black 'poetry run black --target-version py38 .' - abbr -a bl 'poetry run black --target-version py38 .' - - # Rust - abbr -a ca cargo - - # macOS - abbr -a casks 'vim $DOTS/homebrew/Caskfile' - abbr -a t trash - - # Linux - if [ (uname) = Linux ] - linux - end - - -end diff --git a/fish.configlink/functions/brews.fish b/fish.configlink/functions/brews.fish deleted file mode 100644 index f1d573a..0000000 --- a/fish.configlink/functions/brews.fish +++ /dev/null @@ -1,10 +0,0 @@ -function brews --description "Open Homebrew bundles file" - set -lx brewdir $DOTS/homebrew - set -l brewfile (basename $brewdir/*.Brewfile \ - | fzf \ - --height 70% \ - --preview-window right:70% \ - --preview 'bat --color=always $brewdir/{}' \ - ) - and vim $brewdir/$brewfile -end diff --git a/fish.configlink/functions/brewsearch.fish b/fish.configlink/functions/brewsearch.fish deleted file mode 100644 index c716297..0000000 --- a/fish.configlink/functions/brewsearch.fish +++ /dev/null @@ -1,9 +0,0 @@ -function brewsearch --description "Install brew plugins" - set -l inst (brew formulae | eval "fzf $FZF_DEFAULT_OPTS -m --header='[press ctrl-i for info, enter to install]' --bind 'ctrl-i:preview(brew info {})'") - - if not test (count $inst) = 0 - for prog in $inst - brew install "$prog" - end - end -end diff --git a/fish.configlink/functions/commandline-git-commits.fish b/fish.configlink/functions/commandline-git-commits.fish deleted file mode 100644 index e579742..0000000 --- a/fish.configlink/functions/commandline-git-commits.fish +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/local/bin/fish - -function commandline-git-commits - set commit (git-commits) - if [ $commit ] - commandline -i "$commit" - else - commandline -i "HEAD" - end -end diff --git a/fish.configlink/functions/copy.fish b/fish.configlink/functions/copy.fish deleted file mode 100644 index 0f8f037..0000000 --- a/fish.configlink/functions/copy.fish +++ /dev/null @@ -1,3 +0,0 @@ -function copy --description 'Copy file contents into clipboard' - cat $argv | pbcopy -end diff --git a/fish.configlink/functions/edit.fish b/fish.configlink/functions/edit.fish deleted file mode 100644 index f86daee..0000000 --- a/fish.configlink/functions/edit.fish +++ /dev/null @@ -1,6 +0,0 @@ -function edit --description "Open a file in Vim" - set vimfile (fzf) - and set vimfile (echo $vimfile | tr -d '\r') - and commandline -r "vim $vimfile" - and commandline -f execute -end diff --git a/fish.configlink/functions/envs.fish b/fish.configlink/functions/envs.fish deleted file mode 100644 index d5b6e79..0000000 --- a/fish.configlink/functions/envs.fish +++ /dev/null @@ -1,3 +0,0 @@ -function envs --description 'Set from a bash environment variables file' - set -gx (cat $argv | tr "=" " " | string split ' ') -end diff --git a/fish.configlink/functions/fcd.fish b/fish.configlink/functions/fcd.fish deleted file mode 100644 index a99d734..0000000 --- a/fish.configlink/functions/fcd.fish +++ /dev/null @@ -1,12 +0,0 @@ -function fcd --description 'Jump to directory' -a 'directory' - if test -z $directory - set directory "$HOME" - end - if ! test -d $directory - echo "Directory not found: $directory" - return 1 - end - set jump (fd -t d . $directory | fzf) - and cd $jump $argv; - and commandline -f execute; -end diff --git a/fish.configlink/functions/fish_user_key_bindings.fish b/fish.configlink/functions/fish_user_key_bindings.fish deleted file mode 100644 index 78d73ee..0000000 --- a/fish.configlink/functions/fish_user_key_bindings.fish +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/local/bin/fish - -function fish_user_key_bindings - bind -M insert \co 'edit' - bind -M default \co 'edit' - bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute' - bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute' - bind -M insert \ce 'recent' - bind -M default \ce 'recent' - bind -M insert \cg 'commandline-git-commits' - bind -M insert \cf 'fcd' - bind -M default \cf 'fcd' - bind -M insert \cp 'prj' - bind -M default \cp 'prj' - bind -M insert \x1F accept-autosuggestion - bind -M default \x1F accept-autosuggestion -end diff --git a/fish.configlink/functions/fzf_key_bindings.fish b/fish.configlink/functions/fzf_key_bindings.fish deleted file mode 120000 index a66a998..0000000 --- a/fish.configlink/functions/fzf_key_bindings.fish +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/fzf/shell/key-bindings.fish \ No newline at end of file diff --git a/fish.configlink/functions/generate_fish_colors.fish b/fish.configlink/functions/generate_fish_colors.fish deleted file mode 100644 index f6f2581..0000000 --- a/fish.configlink/functions/generate_fish_colors.fish +++ /dev/null @@ -1,8 +0,0 @@ -# This function creates an output file of just the printf values for -# modifying the shell colors. This output file is used to load the -# current colors into my shell much faster than running the function on -# prompt. - -function generate_fish_colors --description "Create fish colors file" - theme_gruvbox dark > $DOTS/fish.configlink/fish_colors -end diff --git a/fish.configlink/functions/git-add-fuzzy.fish b/fish.configlink/functions/git-add-fuzzy.fish deleted file mode 100644 index ac2b8d5..0000000 --- a/fish.configlink/functions/git-add-fuzzy.fish +++ /dev/null @@ -1,16 +0,0 @@ -function git-add-fuzzy - set gitfile (git status -s \ - | fzf \ - --height 50% \ - -m \ - --preview-window right:70% \ - --layout reverse \ - --preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end') - and for gf in $gitfile - set gf (echo $gf \ - | awk '{$1=$1};1' \ - | cut -d' ' -f2 \ - ) - and git add $gf - end -end diff --git a/fish.configlink/functions/git-checkout-fuzzy.fish b/fish.configlink/functions/git-checkout-fuzzy.fish deleted file mode 100644 index 1b47663..0000000 --- a/fish.configlink/functions/git-checkout-fuzzy.fish +++ /dev/null @@ -1,4 +0,0 @@ -function git-checkout-fuzzy - set branch (git-fuzzy-branch "checkout branch...") - and git checkout $branch -end diff --git a/fish.configlink/functions/git-commits.fish b/fish.configlink/functions/git-commits.fish deleted file mode 100644 index 03c3613..0000000 --- a/fish.configlink/functions/git-commits.fish +++ /dev/null @@ -1,10 +0,0 @@ -function git-commits - set commitline (git log \ - --pretty="format:%C(auto)%ar %h%d %s" \ - | fzf \ - --height 50% \ - --preview 'git show --color=always (echo {} | cut -d" " -f4)' \ - ) - and set commit (echo $commitline | cut -d" " -f4) - and echo $commit -end diff --git a/fish.configlink/functions/git-delete-fuzzy.fish b/fish.configlink/functions/git-delete-fuzzy.fish deleted file mode 100644 index 82cd5e7..0000000 --- a/fish.configlink/functions/git-delete-fuzzy.fish +++ /dev/null @@ -1,4 +0,0 @@ -function git-delete-fuzzy - set branch (git-fuzzy-branch "delete branch...") - and git branch -d $branch -end diff --git a/fish.configlink/functions/git-force-delete-fuzzy.fish b/fish.configlink/functions/git-force-delete-fuzzy.fish deleted file mode 100644 index 119b5f0..0000000 --- a/fish.configlink/functions/git-force-delete-fuzzy.fish +++ /dev/null @@ -1,4 +0,0 @@ -function git-force-delete-fuzzy - set branch (git-fuzzy-branch "force delete branch...") - and git branch -D $branch -end diff --git a/fish.configlink/functions/git-fuzzy-branch.fish b/fish.configlink/functions/git-fuzzy-branch.fish deleted file mode 100644 index f60acaf..0000000 --- a/fish.configlink/functions/git-fuzzy-branch.fish +++ /dev/null @@ -1,12 +0,0 @@ -function git-fuzzy-branch -a header - set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n') - set -l branch (git branch \ - --format "%(refname:short)" \ - | fzf \ - --height 50% \ - --header="On $current, $header" \ - --preview-window right:70% \ - --preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \ - ) - and echo $branch -end diff --git a/fish.configlink/functions/git-history.fish b/fish.configlink/functions/git-history.fish deleted file mode 100644 index 1865a54..0000000 --- a/fish.configlink/functions/git-history.fish +++ /dev/null @@ -1,16 +0,0 @@ -function git-history - if not count $argv > /dev/null - echo "Must provide filename." - return 1 - end - set commitline ( git log \ - --follow \ - --pretty="format:%C(auto)%ar %h%d %s" \ - -- ./$argv \ - | fzf \ - --height 100% \ - --preview "git diff --color=always (echo {} | cut -d' ' -f4)^1..(echo {} | cut -d' ' -f4) -- ./$argv" \ - ) - and set commit (echo $commitline | cut -d" " -f4) - and echo $commit -end diff --git a/fish.configlink/functions/git-merge-fuzzy.fish b/fish.configlink/functions/git-merge-fuzzy.fish deleted file mode 100644 index 82fb7e9..0000000 --- a/fish.configlink/functions/git-merge-fuzzy.fish +++ /dev/null @@ -1,4 +0,0 @@ -function git-merge-fuzzy - set branch (git-fuzzy-branch "merge from...") - and git merge $branch -end diff --git a/fish.configlink/functions/git-push-upstream.fish b/fish.configlink/functions/git-push-upstream.fish deleted file mode 100644 index 06c8250..0000000 --- a/fish.configlink/functions/git-push-upstream.fish +++ /dev/null @@ -1,6 +0,0 @@ -function git-push-upstream --description "Create upstream branch" - set -l branch (git branch 2>/dev/null | grep '^\*' | colrm 1 2) - set -l command "git push --set-upstream origin $branch" - commandline -r $command - commandline -f execute -end diff --git a/fish.configlink/functions/git-show-fuzzy.fish b/fish.configlink/functions/git-show-fuzzy.fish deleted file mode 100644 index 0e6cbaa..0000000 --- a/fish.configlink/functions/git-show-fuzzy.fish +++ /dev/null @@ -1,8 +0,0 @@ -function git-show-fuzzy - set commitline (git log \ - --pretty="format:%C(auto)%ar %h%d %s" \ - | fzf \ - ) - and set commit (echo $commitline | cut -d" " -f4 ) - and git show $commit -end diff --git a/fish.configlink/functions/git.fish b/fish.configlink/functions/git.fish deleted file mode 100644 index 19e1b73..0000000 --- a/fish.configlink/functions/git.fish +++ /dev/null @@ -1,39 +0,0 @@ -function git - if contains f $argv - switch $argv[1] - case "checkout" - git-checkout-fuzzy - case "add" - git-add-fuzzy - case "show" - git-show-fuzzy - case "merge" - git-merge-fuzzy - case "branch" - if test "$argv[2]" = "-d" - git-delete-fuzzy - else if test "$argv[2]" = "-D" - git-force-delete-fuzzy - else - echo "Not a fuzzy option." - return 1 - end - case "reset" - set commit (git-commits) - and if test "$argv[2]" = "--hard" - git reset --hard $commit - else - git reset $commit - end - case "*" - echo "No fuzzy option." - return 1 - end - else - if count $argv > /dev/null - command git $argv - else - command git status -sb - end - end -end diff --git a/fish.configlink/functions/ip.fish b/fish.configlink/functions/ip.fish deleted file mode 100644 index 2da35a7..0000000 --- a/fish.configlink/functions/ip.fish +++ /dev/null @@ -1,7 +0,0 @@ -function ip - if count $argv > /dev/null - curl ipinfo.io/$argv - else - curl checkip.amazonaws.com - end -end diff --git a/fish.configlink/functions/journal.fish b/fish.configlink/functions/journal.fish deleted file mode 100644 index c5a94c6..0000000 --- a/fish.configlink/functions/journal.fish +++ /dev/null @@ -1,10 +0,0 @@ -function journal --description "Create today's journal" - note-dates - if [ -f $TODAY_NOTE_FILE ] - echo "Already exists." - else - note-header - printf $JOURNAL_HEADER > $TODAY_NOTE_FILE - echo "New journal added." - end -end diff --git a/fish.configlink/functions/json.fish b/fish.configlink/functions/json.fish deleted file mode 100644 index 89643db..0000000 --- a/fish.configlink/functions/json.fish +++ /dev/null @@ -1,3 +0,0 @@ -function json --description "Tidy up JSON with jq" - pbpaste | jq '.' | pbcopy -end diff --git a/fish.configlink/functions/linux.fish b/fish.configlink/functions/linux.fish deleted file mode 100644 index b5fe2ef..0000000 --- a/fish.configlink/functions/linux.fish +++ /dev/null @@ -1,4 +0,0 @@ -function linux --description "Load only on Linux" - alias pbcopy='xclip -selection clipboard -in' - alias pbpaste='xclip -selection clipboard -out' -end diff --git a/fish.configlink/functions/ls.fish b/fish.configlink/functions/ls.fish deleted file mode 100644 index 6eeff32..0000000 --- a/fish.configlink/functions/ls.fish +++ /dev/null @@ -1,3 +0,0 @@ -function ls --description "Use exa to list files" - exa $argv -end diff --git a/fish.configlink/functions/meeting.fish b/fish.configlink/functions/meeting.fish deleted file mode 100644 index 98f1f1d..0000000 --- a/fish.configlink/functions/meeting.fish +++ /dev/null @@ -1,11 +0,0 @@ -function meeting --description "Describe a meeting" -a "name" - note-dates - set today_date (date -j +"%Y-%m-%d") - set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]') - set meeting_name (echo $name | tr ' ' '-' | tr '[:upper:]' '[:lower:]') - set meeting_note $today_date-$meeting_name - set meeting_file meetings/$meeting_note.md - printf "[$TODAY_NOTE](../journal/$TODAY_NOTE.md) | #meeting\n\n# $name\n\n---\n\n" > $NOTES_PATH/$meeting_file - printf "\n\n---\n\n$time - [$name](../$meeting_file)\n\n---\n\n" >> $TODAY_NOTE_FILE - vim $NOTES_PATH/$meeting_file -end diff --git a/fish.configlink/functions/note-dates.fish b/fish.configlink/functions/note-dates.fish deleted file mode 100644 index f4e4c6b..0000000 --- a/fish.configlink/functions/note-dates.fish +++ /dev/null @@ -1,7 +0,0 @@ -function note-dates - set -g TODAY_NOTE (date +"%Y-%m-%d_%a") - set -g YESTERDAY_NOTE (date -jv "-1d" +"%Y-%m-%d_%a") - set -g TOMORROW_NOTE (date -jv "+1d" +"%Y-%m-%d_%a") - set -g LONG_DATE (date +"%A, %B %e, %Y" | sed 's/ */ /g') - set -g TODAY_NOTE_FILE $NOTES_PATH/journal/$TODAY_NOTE.md -end diff --git a/fish.configlink/functions/note-header.fish b/fish.configlink/functions/note-header.fish deleted file mode 100644 index 6dd8408..0000000 --- a/fish.configlink/functions/note-header.fish +++ /dev/null @@ -1,4 +0,0 @@ -function note-header - set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1") - set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](../home.md) | [Today](obsidian://advanced-uri?daily=true) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n" -end diff --git a/fish.configlink/functions/note.fish b/fish.configlink/functions/note.fish deleted file mode 100644 index 42df0f4..0000000 --- a/fish.configlink/functions/note.fish +++ /dev/null @@ -1,10 +0,0 @@ -function note --description "Edit or create a note" -a "filename" - if test -n "$filename" - vim $NOTES_PATH/$filename.md - else - set file (ls $NOTES_PATH | fzf) - if [ $status -eq 0 ] - vim $NOTES_PATH/$file - end - end -end diff --git a/fish.configlink/functions/ping.fish b/fish.configlink/functions/ping.fish deleted file mode 100644 index 730e2c2..0000000 --- a/fish.configlink/functions/ping.fish +++ /dev/null @@ -1,3 +0,0 @@ -function ping --description "Improved ping" -a "target" - prettyping --nolegend $target -end diff --git a/fish.configlink/functions/prj.fish b/fish.configlink/functions/prj.fish deleted file mode 100644 index a19bb37..0000000 --- a/fish.configlink/functions/prj.fish +++ /dev/null @@ -1,5 +0,0 @@ -function prj --description "cd to a project" - set projdir (ls $PROJ | fzf) - and cd $PROJ/$projdir - and commandline -f execute -end diff --git a/fish.configlink/functions/psf.fish b/fish.configlink/functions/psf.fish deleted file mode 100644 index 95c1f2c..0000000 --- a/fish.configlink/functions/psf.fish +++ /dev/null @@ -1,3 +0,0 @@ -function psf --description "Search for open process" -a "process" - ps aux | rg -v "$USER.*rg $argv" | rg $argv -end diff --git a/fish.configlink/functions/qr.fish b/fish.configlink/functions/qr.fish deleted file mode 100644 index e84946f..0000000 --- a/fish.configlink/functions/qr.fish +++ /dev/null @@ -1,3 +0,0 @@ -function qr - qrencode $argv[1] -o /tmp/qr.png | open /tmp/qr.png -end diff --git a/fish.configlink/functions/quicknote.fish b/fish.configlink/functions/quicknote.fish deleted file mode 100644 index 40a955d..0000000 --- a/fish.configlink/functions/quicknote.fish +++ /dev/null @@ -1,5 +0,0 @@ -function quicknote --description "Write a quick note" -a "note" - note-dates - set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]') - printf "\n\n---\n\n#### $time\n$note\n" >> $TODAY_NOTE_FILE -end diff --git a/fish.configlink/functions/recent.fish b/fish.configlink/functions/recent.fish deleted file mode 100644 index b717f88..0000000 --- a/fish.configlink/functions/recent.fish +++ /dev/null @@ -1,6 +0,0 @@ -function recent --description "Open a recent file in Vim" - set vimfile (fd -t f --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf) - and set vimfile (echo $vimfile | tr -d '\r') - and commandline -r "vim $vimfile" - and commandline -f execute -end diff --git a/fish.configlink/functions/reload.fish b/fish.configlink/functions/reload.fish deleted file mode 100644 index 736e594..0000000 --- a/fish.configlink/functions/reload.fish +++ /dev/null @@ -1,3 +0,0 @@ -function reload --description "Reload fish configuration" - source $DOTS/fish.configlink/config.fish -end diff --git a/fish.configlink/functions/repos.fish b/fish.configlink/functions/repos.fish deleted file mode 100755 index f1d9b3e..0000000 --- a/fish.configlink/functions/repos.fish +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/local/bin/fish - -function repos --description 'Clone GitHub repositories' -a 'organization' - set directory (gh-repos $organization) - and cd $directory -end - #switch $organization - # case t2; set organization "take-two" - # case d2c; set organization "take-two-t2gp" - # case t2gp; set organization "take-two-t2gp" - # case pd; set organization "private-division" - # case dots; set organization "playdots" - # case '*'; set organization "nmasur" - #end - - #set selected (gh repo list "$organization" \ - # --limit 50 \ - # --no-archived \ - # --json=name,description,isPrivate,updatedAt,primaryLanguage \ - # | jq -r '.[] | .name + "," + if .description == "" then "-" else .description end + "," + .updatedAt + "," + .primaryLanguage.name' \ - # | begin - # echo "REPO,DESCRIPTION,UPDATED,LANGUAGE" - # cat - - # end | column -s , -t - # | fzf \ - # --header-lines=1 \ - # --layout=reverse - #--bind "ctrl-o:execute:gh repo view -w $organization/{1}" \ - #--preview "GH_FORCE_TTY=49% gh repo view $organization/{1} | glow -" \ - #--preview-window up -#) - #if test -n (echo $selected | tr -d '\r') - # set directory "$HOME/dev/work" - # if test $organization = "nmasur" - # set directory "$HOME/dev/personal" - # end - # set repo (echo $selected | awk '{print $1}') - # set repo_full "$organization/$repo" - # gh repo clone "$repo_full" "$directory/$repo" - # cd "$directory/$repo" - #end -#end diff --git a/fish.configlink/functions/syncnotes.fish b/fish.configlink/functions/syncnotes.fish deleted file mode 100644 index 98924cb..0000000 --- a/fish.configlink/functions/syncnotes.fish +++ /dev/null @@ -1,9 +0,0 @@ -function syncnotes --description "Full git commit on notes" - set current_dir $PWD - cd $NOTES_PATH - git pull - git add -A - git commit -m "autosync" - git push - cd $current_dir -end diff --git a/fish.configlink/functions/theme_gruvbox.fish b/fish.configlink/functions/theme_gruvbox.fish deleted file mode 100644 index 58a3cf2..0000000 --- a/fish.configlink/functions/theme_gruvbox.fish +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/fish -function theme_gruvbox --description 'Apply gruvbox theme' - set -l mode 'light' - if test (count $argv) -gt 0 - set mode $argv[1] - end - - set -g contrast 'medium' - if test (count $argv) -gt 1 - set contrast $argv[2] - end - - switch $contrast - case 'soft' - case 'medium' - case 'hard' - case '*' - set_color $fish_color_error - echo 'Unknown contrast $contrast, choose soft, medium or hard' - set_color $fish_color_normal - return 1 - end - - switch $mode - case 'light' - __theme_gruvbox_base - __theme_gruvbox_light - case 'dark' - __theme_gruvbox_base - __theme_gruvbox_dark - case '*' - set_color $fish_color_error - echo 'Unknown mode $mode, choose light or dark' - set_color $fish_color_normal - return 1 - end - __theme_gruvbox_palette - return 0 -end - -function __theme_gruvbox_base - __printf_color 1 'cc/24/1d' - __printf_color 2 '98/97/1a' - __printf_color 3 'd7/99/21' - __printf_color 4 '45/85/88' - __printf_color 5 'b1/62/86' - __printf_color 6 '68/9d/6a' -end - -function __theme_gruvbox_light - set -l bg 'fb/f1/c7' - switch $contrast - case "soft" - set bg 'f2/e5/bc' - case "hard" - set bg 'f9/f5/d7' - end - command printf "\033]11;rgb:$bg\007" - - set -l fg '3c/38/36' - command printf "\033]10;rgb:$fg\007" - - __printf_color 0 $bg - __printf_color 7 '7c/6f/64' - __printf_color 8 '92/83/74' - __printf_color 9 '9d/00/06' - __printf_color 10 '79/74/0e' - __printf_color 11 'b5/76/14' - __printf_color 12 '07/66/78' - __printf_color 13 '8f/3f/71' - __printf_color 14 '42/7b/58' - __printf_color 15 $fg -end - -function __theme_gruvbox_dark - set -l bg '28/28/28' - switch $contrast - case "soft" - set bg '32/30/2f' - case "hard" - set bg '1d/20/21' - end - command printf "\033]11;rgb:$bg\007" - - set -l fg 'eb/db/b2' - command printf "\033]10;rgb:$fg\007" - - __printf_color 0 $bg - __printf_color 7 'a8/99/84' - __printf_color 8 '92/83/74' - __printf_color 9 'fb/59/34' - __printf_color 10 'b8/bb/26' - __printf_color 11 'fa/bd/2f' - __printf_color 12 '83/a5/98' - __printf_color 13 'd3/86/9b' - __printf_color 14 '8e/c0/7c' - __printf_color 15 $fg -end - -function __theme_gruvbox_palette - __printf_color 236 '32/30/2f' - __printf_color 234 '1d/20/21' - - __printf_color 235 '28/28/28' - __printf_color 237 '3c/38/36' - __printf_color 239 '50/49/45' - __printf_color 241 '66/5c/54' - __printf_color 243 '7c/6f/64' - - __printf_color 244 '92/83/74' - __printf_color 245 '92/83/74' - - __printf_color 228 'f2/e5/bc' - __printf_color 230 'f9/f5/d7' - - __printf_color 229 'fb/f1/c7' - __printf_color 223 'eb/db/b2' - __printf_color 250 'd5/c4/a1' - __printf_color 248 'bd/ae/93' - __printf_color 246 'a8/99/84' - - __printf_color 167 'fb/49/34' - __printf_color 142 'b8/bb/26' - __printf_color 214 'fa/bd/2f' - __printf_color 109 '83/a5/98' - __printf_color 175 'd3/86/9b' - __printf_color 108 '8e/c0/7c' - __printf_color 208 'fe/80/19' - - __printf_color 88 '9d/00/06' - __printf_color 100 '79/74/0e' - __printf_color 136 'b5/76/14' - __printf_color 24 '07/66/78' - __printf_color 96 '8f/3f/71' - __printf_color 66 '42/7b/58' - __printf_color 130 'af/3a/03' -end - -function __printf_color - command printf "\033]4;$argv[1];rgb:$argv[2]\007" -end diff --git a/fish.configlink/functions/tickers.fish b/fish.configlink/functions/tickers.fish deleted file mode 100644 index 34d6d36..0000000 --- a/fish.configlink/functions/tickers.fish +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/local/bin/fish - -function tickers --description "Stock and money tickers" - abbr -a tk 'tickrs -s' - abbr -a vt 'tickrs -s vt' - abbr -a vti 'tickrs -s vti' - abbr -a vxus 'tickrs -s vxus' - abbr -a btc 'rates btc usd' - abbr -a ada 'rates ada usd' - abbr -a eth 'rates eth usd' -end diff --git a/fish.configlink/functions/today.fish b/fish.configlink/functions/today.fish deleted file mode 100644 index 5f5c411..0000000 --- a/fish.configlink/functions/today.fish +++ /dev/null @@ -1,11 +0,0 @@ -function today --description "Open today's journal" - note-dates - if [ -f $TODAY_NOTE_FILE ] - vim $TODAY_NOTE_FILE - else - note-header - printf $JOURNAL_HEADER > $TODAY_NOTE_FILE - echo "New journal added." - vim $TODAY_NOTE_FILE - end -end diff --git a/fish.configlink/functions/uncommitted.fish b/fish.configlink/functions/uncommitted.fish deleted file mode 100755 index 824adc6..0000000 --- a/fish.configlink/functions/uncommitted.fish +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/local/bin/fish - -function uncommitted --description "Find uncommitted git repos" - set current_dir (pwd) - cd $HOME/dev - find . -type d -name '.git' | \ - while read dir - cd $dir/../ - and if test -n (echo (git status -s)) - pwd - git status -s - end - cd - - end - cd $current_dir -end diff --git a/fish.configlink/functions/unsetaws.fish b/fish.configlink/functions/unsetaws.fish deleted file mode 100644 index 6d6ad47..0000000 --- a/fish.configlink/functions/unsetaws.fish +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/local/fish - -function unsetaws --description "Clear AWS credentials environment variables" - set -e AWS_ACCESS_KEY_ID - set -e AWS_SECRET_ACCESS_KEY -end diff --git a/fish.configlink/functions/up-or-search.fish b/fish.configlink/functions/up-or-search.fish deleted file mode 100644 index 502c8ce..0000000 --- a/fish.configlink/functions/up-or-search.fish +++ /dev/null @@ -1,29 +0,0 @@ -# by @farcaller from https://github.com/fish-shell/fish-shell/issues/825#issuecomment-440286038 - -function up-or-search -d "Depending on cursor position and current mode, either search backward or move up one line" - # If we are already in search mode, continue - if commandline --search-mode - commandline -f history-search-backward - return - end - - # If we are navigating the pager, then up always navigates - if commandline --paging-mode - commandline -f up-line - return - end - - # We are not already in search mode. - # If we are on the top line, start search mode, - # otherwise move up - set lineno (commandline -L) - - switch $lineno - case 1 - commandline -f history-search-backward - history merge # <-- ADDED THIS - - case '*' - commandline -f up-line - end -end diff --git a/fish.configlink/functions/worldmap.fish b/fish.configlink/functions/worldmap.fish deleted file mode 100644 index 8778b08..0000000 --- a/fish.configlink/functions/worldmap.fish +++ /dev/null @@ -1,3 +0,0 @@ -function worldmap --description "Terminal atlas" - telnet mapscii.me -end diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e905901 --- /dev/null +++ b/flake.lock @@ -0,0 +1,104 @@ +{ + "nodes": { + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1651916036, + "narHash": "sha256-UuD9keUGm4IuVEV6wdSYbuRm7CwfXE63hVkzKDjVsh4=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "2f2bdf658d2b79bada78dc914af99c53cad37cba", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1654422613, + "narHash": "sha256-ZxkMM13AnrMwYOV99ohzcqeTkAOqD9Q2SBdZ9WoFE9Y=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "20703892473d01c70fb10248442231fe94f4ceb4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1654230545, + "narHash": "sha256-8Vlwf0x8ow6pPOK2a04bT+pxIeRnM1+O0Xv9/CuDzRs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "236cc2971ac72acd90f0ae3a797f9f83098b17ec", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1654429664, + "narHash": "sha256-rQe6/72yWA78RzWogM8ZT++XYoYrZJdF/T6mjcCqsfU=", + "owner": "nix-community", + "repo": "nur", + "rev": "18fa7520a7ca968eb74b46036329f3f7606bd541", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nur", + "type": "github" + } + }, + "root": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nur": "nur", + "wallpapers": "wallpapers" + } + }, + "wallpapers": { + "flake": false, + "locked": { + "lastModified": 1653239252, + "narHash": "sha256-Fiw5P+XULgqlLRGf+GKaRZ+Nw0UIx5TaYa7ipiA0+X4=", + "owner": "exorcist365", + "repo": "wallpapers", + "rev": "4e0a72a8d67264e58fa0424693fd93cb24bc527c", + "type": "gitlab" + }, + "original": { + "owner": "exorcist365", + "repo": "wallpapers", + "type": "gitlab" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6208616 --- /dev/null +++ b/flake.nix @@ -0,0 +1,91 @@ +{ + description = "My system"; + + # Other flakes that we want to pull from + inputs = { + + # Used for system packages + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + # Used for MacOS system config + darwin = { + url = "github:/lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Used for user packages + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = + "nixpkgs"; # Use system packages list where available + }; + + # Community packages; used for Firefox extensions + nur.url = "github:nix-community/nur"; + + # Wallpapers + wallpapers = { + url = "gitlab:exorcist365/wallpapers"; + flake = false; + }; + + }; + + outputs = { self, nixpkgs, darwin, home-manager, nur, wallpapers }: + + let + + # Global configuration for my systems + globals = { + user = "noah"; + fullName = "Noah Masur"; + gitEmail = "7386960+nmasur@users.noreply.github.com"; + mailServer = "noahmasur.com"; + dotfilesRepo = "https://github.com/nmasur/dotfiles"; + }; + + # System types to support. + supportedSystems = + [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + in { + + # You can load it from any NixOS system with: + # nix-shell -p nixFlakes + # sudo nixos-rebuild switch --flake github:nmasur/dotfiles#desktop + nixosConfigurations = { + desktop = import ./hosts/desktop { + inherit nixpkgs home-manager nur globals wallpapers; + }; + }; + + darwinConfigurations = { + macbook = import ./hosts/macbook { + inherit nixpkgs darwin home-manager nur globals; + }; + }; + + # You can partition, format, and install from a live disk with: + # nix-shell -p nixFlakes + # nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop + # Will erase drives; use at your own risk! + apps = forAllSystems (system: + let pkgs = import nixpkgs { inherit system; }; + in { + installer = import ./modules/system/installer.nix { inherit pkgs; }; + }); + + # Used to run commands and edit files in this repo + devShells = forAllSystems (system: + let pkgs = import nixpkgs { inherit system; }; + in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ]; + }; + }); + + }; +} diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink deleted file mode 100644 index de9f053..0000000 --- a/git/gitconfig.symlink +++ /dev/null @@ -1,18 +0,0 @@ -[filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - required = true -[user] - name = Noah Masur - email = 7386960+nmasur@users.noreply.github.com -[hub] - host = github.take2games.com -[pager] - branch = false -[core] - editor = nvim -[pull] - ff = only -[credential] - helper = osxkeychain diff --git a/hosts/common.nix b/hosts/common.nix new file mode 100644 index 0000000..72a04ec --- /dev/null +++ b/hosts/common.nix @@ -0,0 +1,79 @@ +{ config, lib, pkgs, ... }: { + + imports = [ ../modules/shell ../modules/editor ../modules/mail/himalaya.nix ]; + + options = with lib; { + user = mkOption { + type = types.str; + description = "Primary user of the system"; + }; + userDirs = { + # Required to prevent infinite recursion when referenced by himalaya + download = lib.mkOption { + type = lib.types.str; + description = "XDG directory for downloads"; + default = + if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads"; + }; + }; + gui = { + enable = mkEnableOption { + description = "Enable graphics"; + default = false; + }; + colorscheme = mkOption { + type = types.attrs; + description = "Base16 color scheme"; + }; + }; + homePath = mkOption { + type = types.path; + description = "Path of user's home directory."; + default = builtins.toPath (if pkgs.stdenv.isDarwin then + "/Users/${config.user}" + else + "/home/${config.user}"); + }; + dotfilesPath = mkOption { + type = types.path; + description = "Path of dotfiles repository."; + default = config.homePath + "/dev/personal/dotfiles"; + }; + dotfilesRepo = mkOption { + type = types.str; + description = "Link to dotfiles repository."; + }; + unfreePackages = mkOption { + type = types.listOf types.str; + description = "List of unfree packages to allow."; + default = [ ]; + }; + }; + + config = { + + # Enable features in Nix commands + nix.extraOptions = "experimental-features = nix-command flakes"; + + # Basic common system packages for all devices + environment.systemPackages = with pkgs; [ git vim wget curl ]; + + # Use the system-level nixpkgs instead of Home Manager's + home-manager.useGlobalPkgs = true; + + # Install packages to /etc/profiles instead of ~/.nix-profile, useful when + # using multiple profiles for one user + home-manager.useUserPackages = true; + + # Allow specified unfree packages (identified elsewhere) + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) config.unfreePackages; + + # Set a variable for dotfiles repo, not necessary but convenient + home-manager.users.${config.user} = { + home.sessionVariables = { DOTS = config.dotfilesPath; }; + }; + + }; + +} diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix new file mode 100644 index 0000000..70f27f4 --- /dev/null +++ b/hosts/desktop/default.nix @@ -0,0 +1,38 @@ +{ nixpkgs, home-manager, nur, globals, wallpapers, ... }: + +# System configuration for my desktop +nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { }; + modules = [ + globals + home-manager.nixosModules.home-manager + { + networking.hostName = "desktop"; + nixpkgs.overlays = [ nur.overlay ]; + gaming.steam = true; + gaming.leagueoflegends = true; + gaming.legendary = true; + gui = { + enable = true; + compositor.enable = true; + colorscheme = (import ../../modules/colorscheme/gruvbox); + wallpaper = "${wallpapers}/gruvbox/road.jpg"; + gtk.theme = { name = "Adwaita-dark"; }; + }; + passwordHash = + "$6$PZYiMGmJIIHAepTM$Wx5EqTQ5GApzXx58nvi8azh16pdxrN6Qrv1wunDlzveOgawitWzcIxuj76X9V868fsPi/NOIEO8yVXqwzS9UF."; + } + + ./hardware-configuration.nix + ../common.nix + ../../modules/hardware + ../../modules/system + ../../modules/graphical + ../../modules/gaming + ../../modules/applications + ../../modules/services/keybase.nix + ../../modules/services/gnupg.nix + ../../modules/services/mullvad.nix + ]; +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..af59134 --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,30 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = + [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/macbook/default.nix b/hosts/macbook/default.nix new file mode 100644 index 0000000..3fdf8a0 --- /dev/null +++ b/hosts/macbook/default.nix @@ -0,0 +1,21 @@ +{ nixpkgs, darwin, home-manager, nur, globals, ... }: + +# System configuration for my MacBook +darwin.lib.darwinSystem { + system = "x86_64-darwin"; + specialArgs = { }; + modules = [ + globals + home-manager.darwinModules.home-manager + { + user = "Noah.Masur"; + gui.enable = true; + gui.colorscheme = (import ../modules/colorscheme/gruvbox); + nixpkgs.overlays = [ nur.overlay ]; + } + ../common.nix + ../../modules/darwin + ../../modules/applications/alacritty.nix + ../../modules/applications/discord.nix + ]; +} diff --git a/bin/biggest b/legacy/bin/biggest similarity index 100% rename from bin/biggest rename to legacy/bin/biggest diff --git a/bin/biggest-files b/legacy/bin/biggest-files similarity index 100% rename from bin/biggest-files rename to legacy/bin/biggest-files diff --git a/bin/connect_aws/Dockerfile b/legacy/bin/connect_aws/Dockerfile similarity index 100% rename from bin/connect_aws/Dockerfile rename to legacy/bin/connect_aws/Dockerfile diff --git a/bin/connect_aws/connect_cloud.py b/legacy/bin/connect_aws/connect_cloud.py similarity index 100% rename from bin/connect_aws/connect_cloud.py rename to legacy/bin/connect_aws/connect_cloud.py diff --git a/bin/connect_aws/connect_cloud.sh b/legacy/bin/connect_aws/connect_cloud.sh similarity index 100% rename from bin/connect_aws/connect_cloud.sh rename to legacy/bin/connect_aws/connect_cloud.sh diff --git a/bin/connect_aws/requirements.txt b/legacy/bin/connect_aws/requirements.txt similarity index 100% rename from bin/connect_aws/requirements.txt rename to legacy/bin/connect_aws/requirements.txt diff --git a/bin/docker_cleanup b/legacy/bin/docker_cleanup similarity index 100% rename from bin/docker_cleanup rename to legacy/bin/docker_cleanup diff --git a/bin/gh-repos b/legacy/bin/gh-repos similarity index 100% rename from bin/gh-repos rename to legacy/bin/gh-repos diff --git a/bin/jira-checkout b/legacy/bin/jira-checkout similarity index 100% rename from bin/jira-checkout rename to legacy/bin/jira-checkout diff --git a/bin/jira-details b/legacy/bin/jira-details similarity index 100% rename from bin/jira-details rename to legacy/bin/jira-details diff --git a/bin/kube-dashboard b/legacy/bin/kube-dashboard similarity index 100% rename from bin/kube-dashboard rename to legacy/bin/kube-dashboard diff --git a/bin/newest b/legacy/bin/newest similarity index 100% rename from bin/newest rename to legacy/bin/newest diff --git a/bin/ocr b/legacy/bin/ocr similarity index 100% rename from bin/ocr rename to legacy/bin/ocr diff --git a/bin/oldest b/legacy/bin/oldest similarity index 100% rename from bin/oldest rename to legacy/bin/oldest diff --git a/bin/pod b/legacy/bin/pod similarity index 100% rename from bin/pod rename to legacy/bin/pod diff --git a/bin/quick-edit b/legacy/bin/quick-edit similarity index 100% rename from bin/quick-edit rename to legacy/bin/quick-edit diff --git a/bin/symlinks b/legacy/bin/symlinks similarity index 100% rename from bin/symlinks rename to legacy/bin/symlinks diff --git a/bin/uplink-delete-bucket b/legacy/bin/uplink-delete-bucket similarity index 100% rename from bin/uplink-delete-bucket rename to legacy/bin/uplink-delete-bucket diff --git a/bin/url-decode b/legacy/bin/url-decode similarity index 100% rename from bin/url-decode rename to legacy/bin/url-decode diff --git a/bin/weather_cached b/legacy/bin/weather_cached similarity index 100% rename from bin/weather_cached rename to legacy/bin/weather_cached diff --git a/homebrew/Caskfile b/legacy/homebrew/Caskfile similarity index 100% rename from homebrew/Caskfile rename to legacy/homebrew/Caskfile diff --git a/homebrew/core.Brewfile b/legacy/homebrew/core.Brewfile similarity index 100% rename from homebrew/core.Brewfile rename to legacy/homebrew/core.Brewfile diff --git a/homebrew/devops.Brewfile b/legacy/homebrew/devops.Brewfile similarity index 100% rename from homebrew/devops.Brewfile rename to legacy/homebrew/devops.Brewfile diff --git a/homebrew/fun.Brewfile b/legacy/homebrew/fun.Brewfile similarity index 100% rename from homebrew/fun.Brewfile rename to legacy/homebrew/fun.Brewfile diff --git a/homebrew/learning.Brewfile b/legacy/homebrew/learning.Brewfile similarity index 100% rename from homebrew/learning.Brewfile rename to legacy/homebrew/learning.Brewfile diff --git a/homebrew/programming.Brewfile b/legacy/homebrew/programming.Brewfile similarity index 100% rename from homebrew/programming.Brewfile rename to legacy/homebrew/programming.Brewfile diff --git a/homebrew/utils.Brewfile b/legacy/homebrew/utils.Brewfile similarity index 100% rename from homebrew/utils.Brewfile rename to legacy/homebrew/utils.Brewfile diff --git a/mail/backup/rclone.cronjob b/legacy/mail/backup/rclone.cronjob similarity index 100% rename from mail/backup/rclone.cronjob rename to legacy/mail/backup/rclone.cronjob diff --git a/mail/backup/setup_uplink b/legacy/mail/backup/setup_uplink similarity index 100% rename from mail/backup/setup_uplink rename to legacy/mail/backup/setup_uplink diff --git a/newsboat.configlink/com.noah.newsboat.plist b/legacy/newsboat/com.noah.newsboat.plist similarity index 100% rename from newsboat.configlink/com.noah.newsboat.plist rename to legacy/newsboat/com.noah.newsboat.plist diff --git a/newsboat.configlink/config b/legacy/newsboat/config similarity index 100% rename from newsboat.configlink/config rename to legacy/newsboat/config diff --git a/fish.configlink/conf.d/nix-env.fish b/legacy/nix-env.fish similarity index 100% rename from fish.configlink/conf.d/nix-env.fish rename to legacy/nix-env.fish diff --git a/scripts/bootstrap b/legacy/scripts/bootstrap similarity index 100% rename from scripts/bootstrap rename to legacy/scripts/bootstrap diff --git a/scripts/brews b/legacy/scripts/brews similarity index 100% rename from scripts/brews rename to legacy/scripts/brews diff --git a/scripts/cargos b/legacy/scripts/cargos similarity index 100% rename from scripts/cargos rename to legacy/scripts/cargos diff --git a/scripts/casks b/legacy/scripts/casks similarity index 100% rename from scripts/casks rename to legacy/scripts/casks diff --git a/scripts/configure_macos b/legacy/scripts/configure_macos similarity index 100% rename from scripts/configure_macos rename to legacy/scripts/configure_macos diff --git a/scripts/npm b/legacy/scripts/npm similarity index 100% rename from scripts/npm rename to legacy/scripts/npm diff --git a/scripts/rust b/legacy/scripts/rust similarity index 100% rename from scripts/rust rename to legacy/scripts/rust diff --git a/scripts/setup_cheatsheet b/legacy/scripts/setup_cheatsheet similarity index 100% rename from scripts/setup_cheatsheet rename to legacy/scripts/setup_cheatsheet diff --git a/scripts/setup_fish b/legacy/scripts/setup_fish similarity index 100% rename from scripts/setup_fish rename to legacy/scripts/setup_fish diff --git a/scripts/setup_symlinks b/legacy/scripts/setup_symlinks similarity index 100% rename from scripts/setup_symlinks rename to legacy/scripts/setup_symlinks diff --git a/scripts/setup_ytfzf b/legacy/scripts/setup_ytfzf similarity index 100% rename from scripts/setup_ytfzf rename to legacy/scripts/setup_ytfzf diff --git a/scripts/update_rust_analyzer b/legacy/scripts/update_rust_analyzer similarity index 100% rename from scripts/update_rust_analyzer rename to legacy/scripts/update_rust_analyzer diff --git a/templates/kubernetes/clusterrole.yaml b/legacy/templates/kubernetes/clusterrole.yaml similarity index 100% rename from templates/kubernetes/clusterrole.yaml rename to legacy/templates/kubernetes/clusterrole.yaml diff --git a/templates/kubernetes/clusterrolebinding.yaml b/legacy/templates/kubernetes/clusterrolebinding.yaml similarity index 100% rename from templates/kubernetes/clusterrolebinding.yaml rename to legacy/templates/kubernetes/clusterrolebinding.yaml diff --git a/templates/kubernetes/configmap.yaml b/legacy/templates/kubernetes/configmap.yaml similarity index 100% rename from templates/kubernetes/configmap.yaml rename to legacy/templates/kubernetes/configmap.yaml diff --git a/templates/kubernetes/deployment.yaml b/legacy/templates/kubernetes/deployment.yaml similarity index 100% rename from templates/kubernetes/deployment.yaml rename to legacy/templates/kubernetes/deployment.yaml diff --git a/templates/kubernetes/ingress.yaml b/legacy/templates/kubernetes/ingress.yaml similarity index 100% rename from templates/kubernetes/ingress.yaml rename to legacy/templates/kubernetes/ingress.yaml diff --git a/templates/kubernetes/role.yaml b/legacy/templates/kubernetes/role.yaml similarity index 100% rename from templates/kubernetes/role.yaml rename to legacy/templates/kubernetes/role.yaml diff --git a/templates/kubernetes/rolebinding.yaml b/legacy/templates/kubernetes/rolebinding.yaml similarity index 100% rename from templates/kubernetes/rolebinding.yaml rename to legacy/templates/kubernetes/rolebinding.yaml diff --git a/templates/kubernetes/secret.yaml b/legacy/templates/kubernetes/secret.yaml similarity index 100% rename from templates/kubernetes/secret.yaml rename to legacy/templates/kubernetes/secret.yaml diff --git a/templates/kubernetes/service.yaml b/legacy/templates/kubernetes/service.yaml similarity index 100% rename from templates/kubernetes/service.yaml rename to legacy/templates/kubernetes/service.yaml diff --git a/templates/kubernetes/serviceaccount.yaml b/legacy/templates/kubernetes/serviceaccount.yaml similarity index 100% rename from templates/kubernetes/serviceaccount.yaml rename to legacy/templates/kubernetes/serviceaccount.yaml diff --git a/templates/programs/skeleton.py b/legacy/templates/programs/skeleton.py similarity index 100% rename from templates/programs/skeleton.py rename to legacy/templates/programs/skeleton.py diff --git a/templates/programs/skeleton.sh b/legacy/templates/programs/skeleton.sh similarity index 100% rename from templates/programs/skeleton.sh rename to legacy/templates/programs/skeleton.sh diff --git a/tmux/tmux.conf.symlink b/legacy/tmux/tmux.conf.symlink similarity index 100% rename from tmux/tmux.conf.symlink rename to legacy/tmux/tmux.conf.symlink diff --git a/modules/applications/1password.nix b/modules/applications/1password.nix new file mode 100644 index 0000000..e57f90b --- /dev/null +++ b/modules/applications/1password.nix @@ -0,0 +1,10 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + unfreePackages = [ "1password" "_1password-gui" ]; + home-manager.users.${config.user} = { + home.packages = with pkgs; [ _1password-gui ]; + }; + }; + +} diff --git a/modules/applications/alacritty.nix b/modules/applications/alacritty.nix new file mode 100644 index 0000000..77f6daf --- /dev/null +++ b/modules/applications/alacritty.nix @@ -0,0 +1,83 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + home-manager.users.${config.user} = { + xsession.windowManager.i3.config.terminal = "alacritty"; + programs.rofi.terminal = "${pkgs.alacritty}/bin/alacritty"; + programs.alacritty = { + enable = true; + settings = { + window = { + dimensions = { + columns = 85; + lines = 30; + }; + padding = { + x = 20; + y = 20; + }; + opacity = 1.0; + }; + scrolling.history = 10000; + font = { size = 14.0; }; + key_bindings = [ + { + key = "L"; + mods = "Control|Shift"; + chars = "\\x1F"; + } + { + key = "K"; + mods = "Control"; + mode = "~Vi"; + action = "ToggleViMode"; + } + { + key = "Return"; + mode = "Vi"; + action = "ToggleViMode"; + } + # Used to enable $ keybind in Vi mode + { + key = 5; # Scancode for key4 + mods = "Shift"; + mode = "Vi|~Search"; + action = "Last"; + } + ]; + colors = { + primary = { + background = config.gui.colorscheme.base00; + foreground = config.gui.colorscheme.base05; + }; + cursor = { + text = "#1d2021"; + cursor = config.gui.colorscheme.base05; + }; + normal = { + black = "#1d2021"; + red = config.gui.colorscheme.base08; + green = config.gui.colorscheme.base0B; + yellow = config.gui.colorscheme.base0A; + blue = config.gui.colorscheme.base0D; + magenta = config.gui.colorscheme.base0E; + cyan = config.gui.colorscheme.base0C; + white = config.gui.colorscheme.base05; + }; + bright = { + black = config.gui.colorscheme.base03; + red = config.gui.colorscheme.base09; + green = config.gui.colorscheme.base01; + yellow = config.gui.colorscheme.base02; + blue = config.gui.colorscheme.base04; + magenta = config.gui.colorscheme.base06; + cyan = config.gui.colorscheme.base0F; + white = config.gui.colorscheme.base07; + }; + }; + draw_bold_text_with_bright_colors = false; + }; + }; + }; + }; +} diff --git a/modules/applications/calibre.nix b/modules/applications/calibre.nix new file mode 100644 index 0000000..09e643a --- /dev/null +++ b/modules/applications/calibre.nix @@ -0,0 +1,10 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + home-manager.users.${config.user} = { + home.packages = with pkgs; [ calibre ]; + # home.sessionVariables = { CALIBRE_USE_DARK_PALETTE = 1; }; + }; + environment.sessionVariables = { CALIBRE_USE_DARK_PALETTE = "1"; }; + }; +} diff --git a/modules/applications/default.nix b/modules/applications/default.nix new file mode 100644 index 0000000..6d0ca0a --- /dev/null +++ b/modules/applications/default.nix @@ -0,0 +1,15 @@ +{ ... }: { + + imports = [ + ./1password.nix + ./alacritty.nix + ./calibre.nix + ./discord.nix + ./firefox.nix + ./media.nix + ./obsidian.nix + ./qbittorrent.nix + ./nautilus.nix + ]; + +} diff --git a/modules/applications/discord.nix b/modules/applications/discord.nix new file mode 100644 index 0000000..91d7783 --- /dev/null +++ b/modules/applications/discord.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + unfreePackages = [ "discord" ]; + home-manager.users.${config.user} = { + home.packages = with pkgs; [ discord ]; + xdg.configFile."discord/settings.json".text = '' + { + "BACKGROUND_COLOR": "#202225", + "IS_MAXIMIZED": false, + "IS_MINIMIZED": false, + "OPEN_ON_STARTUP": false, + "MINIMIZE_TO_TRAY": false, + "SKIP_HOST_UPDATE": true + } + ''; + }; + }; +} diff --git a/modules/applications/firefox.nix b/modules/applications/firefox.nix new file mode 100644 index 0000000..0efbd7c --- /dev/null +++ b/modules/applications/firefox.nix @@ -0,0 +1,121 @@ +{ config, pkgs, lib, ... }: + +{ + config = lib.mkIf config.gui.enable { + + unfreePackages = [ "onepassword-password-manager" "okta-browser-plugin" ]; + + home-manager.users.${config.user} = { + + programs.firefox = { + enable = true; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + vimium + multi-account-containers + facebook-container + temporary-containers + onepassword-password-manager + okta-browser-plugin + sponsorblock + reddit-enhancement-suite + bypass-paywalls-clean + markdownload + darkreader + snowflake + don-t-fuck-with-paste + i-dont-care-about-cookies + ]; + profiles.Profile0 = { + id = 0; + name = "default"; + isDefault = true; + settings = { + "browser.aboutConfig.showWarning" = false; + "browser.warnOnQuit" = false; + "browser.theme.dark-private-windows" = true; + "browser.toolbars.bookmarks.visibility" = "newtab"; + "browser.startup.page" = 3; # Restore previous session + "browser.newtabpage.enabled" = false; # Make new tabs blank + "general.autoScroll" = true; # Drag middle-mouse to scroll + "services.sync.prefs.sync.general.autoScroll" = + false; # Prevent disabling autoscroll + "extensions.pocket.enabled" = false; + "toolkit.legacyUserProfileCustomizations.stylesheets" = + true; # Allow userChrome.css + "layout.css.color-mix.enabled" = true; + }; + userChrome = '' + :root { + --focus-outline-color: ${config.gui.colorscheme.base04} !important; + --toolbar-color: ${config.gui.colorscheme.base07} !important; + --tab-min-height: 30px !important; + } + /* Background of tab bar */ + .toolbar-items { + background-color: ${config.gui.colorscheme.base00} !important; + } + /* Tabs themselves */ + .tabbrowser-tab .tab-stack { + border-radius: 5px 5px 0 0; + overflow: hidden; + background-color: ${config.gui.colorscheme.base00}; + color: ${config.gui.colorscheme.base06} !important; + } + .tab-content { + border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 40%, transparent); + border-radius: 5px 5px 0 0; + background-color: ${config.gui.colorscheme.base00}; + color: ${config.gui.colorscheme.base06} !important; + } + .tab-content[selected=true] { + border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent); + background-color: ${config.gui.colorscheme.base01} !important; + color: ${config.gui.colorscheme.base07} !important; + } + /* Below tab bar */ + #nav-bar { + background: ${config.gui.colorscheme.base01} !important; + } + /* URL bar in nav bar */ + #urlbar[focused=true] { + color: ${config.gui.colorscheme.base07} !important; + background: ${config.gui.colorscheme.base02} !important; + caret-color: ${config.gui.colorscheme.base05} !important; + } + #urlbar:not([focused=true]) { + color: ${config.gui.colorscheme.base04} !important; + background: ${config.gui.colorscheme.base02} !important; + } + #urlbar ::-moz-selection { + color: ${config.gui.colorscheme.base07} !important; + background: ${config.gui.colorscheme.base02} !important; + } + #urlbar-input-container { + border: 1px solid ${config.gui.colorscheme.base01} !important; + } + #urlbar-background { + background: ${config.gui.colorscheme.base01} !important; + } + /* Text in URL bar */ + #urlbar-input, #urlbar-scheme, .searchbar-textbox { + color: ${config.gui.colorscheme.base07} !important; + } + ''; + userContent = '' + @-moz-document url-prefix(about:blank) { + * { + background-color:${config.gui.colorscheme.base01} !important; + } + } + ''; + + extraConfig = ""; + }; + + }; + }; + + }; + +} diff --git a/modules/applications/keybase.nix b/modules/applications/keybase.nix deleted file mode 100644 index ea8fda7..0000000 --- a/modules/applications/keybase.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, ... }: { - config = { - services.keybase.enable = true; - services.kbfs.enable = true; - }; -} diff --git a/modules/applications/media.nix b/modules/applications/media.nix new file mode 100644 index 0000000..1c8eb7a --- /dev/null +++ b/modules/applications/media.nix @@ -0,0 +1,11 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + home-manager.users.${config.user}.home.packages = with pkgs; [ + mpv # Video viewer + sxiv # Image viewer + mupdf # PDF viewer + ]; + }; + +} diff --git a/modules/applications/nautilus.nix b/modules/applications/nautilus.nix new file mode 100644 index 0000000..28cfb3a --- /dev/null +++ b/modules/applications/nautilus.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: { + + # Install Nautilus file manager + config = lib.mkIf config.gui.enable { + home-manager.users.${config.user} = { + home.packages = with pkgs; [ + gnome.nautilus + gnome.sushi # Quick preview with spacebar + ]; + }; + }; + +} diff --git a/modules/applications/obsidian.nix b/modules/applications/obsidian.nix new file mode 100644 index 0000000..7f18e12 --- /dev/null +++ b/modules/applications/obsidian.nix @@ -0,0 +1,10 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + unfreePackages = [ "obsidian" ]; + home-manager.users.${config.user} = { + home.packages = with pkgs; [ obsidian ]; + }; + }; + +} diff --git a/modules/applications/qbittorrent.nix b/modules/applications/qbittorrent.nix new file mode 100644 index 0000000..4447bb8 --- /dev/null +++ b/modules/applications/qbittorrent.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; [ qbittorrent ]; + + }; + }; + +} diff --git a/modules/colorscheme/everforest/default.nix b/modules/colorscheme/everforest/default.nix new file mode 100644 index 0000000..9048323 --- /dev/null +++ b/modules/colorscheme/everforest/default.nix @@ -0,0 +1,20 @@ +{ + name = "everforest"; # dark, hard + author = "Sainnhe Park"; + base00 = "#2b3339"; # Default Background + base01 = "#323c41"; # Lighter Background + base02 = "#503946"; # Selection Background + base03 = "#868d80"; # Comments, Invisibles, Line Highlighting + base04 = "#d3c6aa"; # Dark Foreground (Used for status bars) + base05 = "#d3c6aa"; # Default Foreground, Caret, Delimiters, Operators + base06 = "#e9e8d2"; # Light Foreground (Not often used) + base07 = "#fff9e8"; # Light Background (Not often used) + base08 = "#7fbbb3"; # Variables, XML Tags, Markup Link Text, ... + base09 = "#d699b6"; # Integers, Boolean, Constants, ... + base0A = "#83c092"; # Classes, Markup Bold, Search Text Background + base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted + base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ... + base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings + base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed + base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ... +} diff --git a/modules/colorscheme/gruvbox/default.nix b/modules/colorscheme/gruvbox/default.nix new file mode 100644 index 0000000..45ffb32 --- /dev/null +++ b/modules/colorscheme/gruvbox/default.nix @@ -0,0 +1,21 @@ +{ + name = "gruvbox"; # Dark, Medium + author = + "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)"; + base00 = "#282828"; # ---- + base01 = "#3c3836"; # --- + base02 = "#504945"; # -- + base03 = "#665c54"; # - + base04 = "#bdae93"; # + + base05 = "#d5c4a1"; # ++ + base06 = "#ebdbb2"; # +++ + base07 = "#fbf1c7"; # ++++ + base08 = "#fb4934"; # red + base09 = "#fe8019"; # orange + base0A = "#fabd2f"; # yellow + base0B = "#b8bb26"; # green + base0C = "#8ec07c"; # aqua/cyan + base0D = "#83a598"; # blue + base0E = "#d3869b"; # purple + base0F = "#d65d0e"; # brown +} diff --git a/modules/colorscheme/nord/default.nix b/modules/colorscheme/nord/default.nix new file mode 100644 index 0000000..a7b7a15 --- /dev/null +++ b/modules/colorscheme/nord/default.nix @@ -0,0 +1,20 @@ +{ + name = "nord"; + author = "arcticicestudio"; + base00 = "#2E3440"; + base01 = "#3B4252"; + base02 = "#434C5E"; + base03 = "#4C566A"; + base04 = "#D8DEE9"; + base05 = "#E5E9F0"; + base06 = "#ECEFF4"; + base07 = "#8FBCBB"; + base08 = "#88C0D0"; + base09 = "#81A1C1"; + base0A = "#5E81AC"; + base0B = "#BF616A"; + base0C = "#D08770"; + base0D = "#EBCB8B"; + base0E = "#A3BE8C"; + base0F = "#B48EAD"; +} diff --git a/modules/darwin/alacritty.nix b/modules/darwin/alacritty.nix new file mode 100644 index 0000000..3424797 --- /dev/null +++ b/modules/darwin/alacritty.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: { + + # MacOS-specific settings for Alacritty + home-manager.users.${config.user} = { + programs.alacritty.settings = { + font.size = lib.mkForce 20.0; + shell.program = "${pkgs.fish}/bin/fish"; + key_bindings = [ + { + key = "F"; + mods = "Super"; + action = "ToggleSimpleFullscreen"; + } + { + key = "L"; + mods = "Super"; + chars = "\\x1F"; + } + ]; + }; + }; + +} diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix new file mode 100644 index 0000000..16ed22f --- /dev/null +++ b/modules/darwin/default.nix @@ -0,0 +1,15 @@ +{ ... }: { + + imports = [ + ./alacritty.nix + ./dotfiles.nix + ./fonts.nix + ./hammerspoon.nix + ./homebrew.nix + ./system.nix + ./tmux.nix + ./user.nix + ./utilities.nix + ]; + +} diff --git a/modules/darwin/dotfiles.nix b/modules/darwin/dotfiles.nix new file mode 100644 index 0000000..2c86300 --- /dev/null +++ b/modules/darwin/dotfiles.nix @@ -0,0 +1,28 @@ +{ config, ... }: { + + home-manager.users.${config.user} = { + + programs.fish = { + shellAbbrs = { + nr = lib.mkForce "rebuild-darwin"; + nro = lib.mkForce "rebuild-darwin offline"; + }; + functions = { + rebuild-darwin = { + body = '' + if test "$argv[1]" = "offline" + set option "--option substitute false" + end + pushd ${config.dotfilesPath} + git add --all + popd + commandline -r "darwin-rebuild switch $option --flake ${config.dotfilesPath}#macbook" + commandline -f execute + ''; + }; + }; + }; + + }; + +} diff --git a/modules/darwin/fonts.nix b/modules/darwin/fonts.nix new file mode 100644 index 0000000..20ea0dc --- /dev/null +++ b/modules/darwin/fonts.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; + [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) ]; + + programs.alacritty.settings = { + font.normal.family = "FiraCode Nerd Font Mono"; + }; + + }; + +} diff --git a/modules/darwin/hammerspoon.nix b/modules/darwin/hammerspoon.nix new file mode 100644 index 0000000..0de0817 --- /dev/null +++ b/modules/darwin/hammerspoon.nix @@ -0,0 +1,15 @@ +{ config, ... }: { + + # Hammerspoon - MacOS custom automation scripting + + home-manager.users.${config.user} = { + xdg.configFile.hammerspoon = { source = ./hammerspoon; }; + }; + + homebrew.casks = [ "hammerspoon" ]; + + system.activationScripts.hammerspoon.text = '' + defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua" + ''; + +} diff --git a/hammerspoon.symlink/Spoons/ControlEscape.spoon/init.lua b/modules/darwin/hammerspoon/Spoons/ControlEscape.spoon/init.lua similarity index 100% rename from hammerspoon.symlink/Spoons/ControlEscape.spoon/init.lua rename to modules/darwin/hammerspoon/Spoons/ControlEscape.spoon/init.lua diff --git a/hammerspoon.symlink/Spoons/DismissAlerts.spoon/close_notifications_applescript.js b/modules/darwin/hammerspoon/Spoons/DismissAlerts.spoon/close_notifications_applescript.js similarity index 100% rename from hammerspoon.symlink/Spoons/DismissAlerts.spoon/close_notifications_applescript.js rename to modules/darwin/hammerspoon/Spoons/DismissAlerts.spoon/close_notifications_applescript.js diff --git a/hammerspoon.symlink/Spoons/DismissAlerts.spoon/init.lua b/modules/darwin/hammerspoon/Spoons/DismissAlerts.spoon/init.lua similarity index 100% rename from hammerspoon.symlink/Spoons/DismissAlerts.spoon/init.lua rename to modules/darwin/hammerspoon/Spoons/DismissAlerts.spoon/init.lua diff --git a/hammerspoon.symlink/Spoons/Launcher.spoon/init.lua b/modules/darwin/hammerspoon/Spoons/Launcher.spoon/init.lua similarity index 100% rename from hammerspoon.symlink/Spoons/Launcher.spoon/init.lua rename to modules/darwin/hammerspoon/Spoons/Launcher.spoon/init.lua diff --git a/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua b/modules/darwin/hammerspoon/Spoons/MoveWindow.spoon/init.lua similarity index 88% rename from hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua rename to modules/darwin/hammerspoon/Spoons/MoveWindow.spoon/init.lua index c2922f1..7150cf4 100644 --- a/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua +++ b/modules/darwin/hammerspoon/Spoons/MoveWindow.spoon/init.lua @@ -18,7 +18,6 @@ function obj:init() -- local nextScreen = screen:next() -- compute the unitRect of the focused window relative to the current screen -- and move the window to the next screen setting the same unitRect - -- win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) win:moveToScreen(screen:next(), true, true, 0) end) @@ -32,9 +31,9 @@ function obj:init() -- get the focused window local win = hs.window.focusedWindow() -- maximize if possible - win:maximize() - win:maximize() - win:maximize() + for i = 1, 8 do + win:maximize() + end end) end diff --git a/hammerspoon.symlink/init.lua b/modules/darwin/hammerspoon/init.lua similarity index 100% rename from hammerspoon.symlink/init.lua rename to modules/darwin/hammerspoon/init.lua diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix new file mode 100644 index 0000000..7824f66 --- /dev/null +++ b/modules/darwin/homebrew.nix @@ -0,0 +1,51 @@ +{ config, ... }: { + + # Homebrew - Mac-specific packages that aren't in Nix + # Requires Homebrew to be installed (works if you rebuild twice) + + homebrew = { + enable = true; + autoUpdate = false; # Don't update during rebuild + cleanup = "zap"; # Uninstall all programs not declared + taps = [ + "homebrew/cask" # Required for casks + "homebrew/cask-drivers" # Used for Logitech G-Hub + ]; + brews = [ + "trash" # Delete files and folders to trash instead of rm + ]; + casks = [ + "firefox" # Firefox packaging on Nix is broken for MacOS + "1password" # 1Password packaging on Nix is broken for MacOS + "scroll-reverser" # Different scroll style for mouse vs. trackpad + "meetingbar" # Show meetings in menu bar + "gitify" # Git notifications in menu bar + "logitech-g-hub" # Mouse and keyboard management + "mimestream" # Gmail client + "obsidian" # Obsidian packaging on Nix is not available for MacOS + ]; + global.brewfile = true; # Run brew bundle from anywhere + global.noLock = true; # Don't save lockfile (since running from anywhere) + }; + + home-manager.users.${config.user} = { + + home.activation = { + + # Always install homebrew if it doesn't exist + installHomeBrew = + config.home-manager.users.${config.user}.lib.dag.entryAfter + [ "writeBoundary" ] '' + if ! xcode-select --version 2>/dev/null; then + $DRY_RUN_CMD xcode-select --install + fi + if ! /usr/local/bin/brew --version 2>/dev/null; then + $DRY_RUN_CMD /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + ''; + + }; + + }; + +} diff --git a/modules/darwin/networking.nix b/modules/darwin/networking.nix new file mode 100644 index 0000000..319f49b --- /dev/null +++ b/modules/darwin/networking.nix @@ -0,0 +1,8 @@ +{ ... }: { + + networking = { + computerName = "MacBook"; # Host name + hostName = "MacBook"; + }; + +} diff --git a/modules/darwin/system.nix b/modules/darwin/system.nix new file mode 100644 index 0000000..666dabc --- /dev/null +++ b/modules/darwin/system.nix @@ -0,0 +1,175 @@ +{ ... }: { + + services.nix-daemon.enable = true; + + system = { + + keyboard = { + remapCapsLockToControl = true; + enableKeyMapping = true; # Allows for skhd + }; + + defaults = { + NSGlobalDomain = { + + # Set to dark mode + AppleInterfaceStyle = "Dark"; + + # Don't change from dark to light automatically + # AppleInterfaceSwitchesAutomatically = false; + + # Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs) + AppleKeyboardUIMode = 3; + + # Automatically show and hide the menu bar + _HIHideMenuBar = true; + + # Expand save panel by default + NSNavPanelExpandedStateForSaveMode = true; + + # Expand print panel by default + PMPrintingExpandedStateForPrint = true; + + # Replace press-and-hold with key repeat + ApplePressAndHoldEnabled = false; + + # Set a fast key repeat rate + KeyRepeat = 2; + + # Shorten delay before key repeat begins + InitialKeyRepeat = 12; + + # Save to local disk by default, not iCloud + NSDocumentSaveNewDocumentsToCloud = false; + + # Disable autocorrect capitalization + NSAutomaticCapitalizationEnabled = false; + + # Disable autocorrect smart dashes + NSAutomaticDashSubstitutionEnabled = false; + + # Disable autocorrect adding periods + NSAutomaticPeriodSubstitutionEnabled = false; + + # Disable autocorrect smart quotation marks + NSAutomaticQuoteSubstitutionEnabled = false; + + # Disable autocorrect spellcheck + NSAutomaticSpellingCorrectionEnabled = false; + }; + + dock = { + # Automatically show and hide the dock + autohide = true; + + # Add translucency in dock for hidden applications + showhidden = true; + + # Enable spring loading on all dock items + enable-spring-load-actions-on-all-items = true; + + # Highlight hover effect in dock stack grid view + mouse-over-hilite-stack = true; + + mineffect = "genie"; + orientation = "bottom"; + show-recents = false; + tilesize = 44; + }; + + finder = { + + # Default Finder window set to column view + FXPreferredViewStyle = "clmv"; + + # Finder search in current folder by default + FXDefaultSearchScope = "SCcf"; + + # Disable warning when changing file extension + FXEnableExtensionChangeWarning = false; + + # Allow quitting of Finder application + QuitMenuItem = true; + + }; + + # Disable "Are you sure you want to open" dialog + LaunchServices.LSQuarantine = false; + + # Disable trackpad tap to click + trackpad.Clicking = false; + + # universalaccess = { + + # # Zoom in with Control + Scroll Wheel + # closeViewScrollWheelToggle = true; + # closeViewZoomFollowsFocus = true; + # }; + + # Where to save screenshots + screencapture.location = "~/Downloads"; + + }; + + # Settings that don't have an option in nix-darwin + activationScripts.postActivation.text = '' + echo "Disable disk image verification" + defaults write com.apple.frameworks.diskimages skip-verify -bool true + defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true + defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true + + echo "Avoid creating .DS_Store files on network volumes" + defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + + echo "Disable the warning before emptying the Trash" + defaults write com.apple.finder WarnOnEmptyTrash -bool false + + echo "Require password immediately after sleep or screen saver begins" + defaults write com.apple.screensaver askForPassword -int 1 + defaults write com.apple.screensaver askForPasswordDelay -int 0 + + echo "Show the ~/Library folder" + chflags nohidden ~/Library + + echo "Enable dock magnification" + defaults write com.apple.dock magnification -bool true + + echo "Set dock magnification size" + defaults write com.apple.dock largesize -int 48 + + echo "Choose and order dock icons" + __dock_item() { + printf '%s%s%s%s%s' \ + 'tile-datafile-data' \ + '_CFURLString' \ + "$1" \ + '_CFURLStringType0' \ + '' + } + + defaults write com.apple.dock persistent-apps -array \ + "$(__dock_item /Applications/1Password.app)" \ + "$(__dock_item /Applications/Slack.app)" \ + "$(__dock_item /System/Applications/Calendar.app)" \ + "$(__dock_item /Applications/Firefox.app)" \ + "$(__dock_item /System/Applications/Messages.app)" \ + "$(__dock_item /System/Applications/Mail.app)" \ + "$(__dock_item /Applications/Mimestream.app)" \ + "$(__dock_item /Applications/zoom.us.app)" \ + "$(__dock_item /Applications/Obsidian.app)" \ + "$(__dock_item /Applications/Alacritty.app)" \ + "$(__dock_item /System/Applications/System\ Preferences.app)" + + echo "Allow apps from anywhere" + SPCTL=$(spctl --status) + if ! [ "$SPCTL" = "assessments disabled" ] + then + sudo spctl --master-disable + fi + + echo "Show the ~/Library folder" + chflags nohidden ~/Library + ''; + }; + +} diff --git a/modules/darwin/tmux.nix b/modules/darwin/tmux.nix new file mode 100644 index 0000000..0f3d2ae --- /dev/null +++ b/modules/darwin/tmux.nix @@ -0,0 +1,125 @@ +{ config, pkgs, ... }: { + + home-manager.users.${config.user} = { + + programs.tmux = { + enable = true; + baseIndex = 1; # Start windows and panes at 1 + escapeTime = 0; # Wait time after escape is input + historyLimit = 100000; + keyMode = "vi"; + newSession = true; # Automatically spawn new session + plugins = [ ]; + resizeAmount = 10; + shell = "${pkgs.fish}/bin/fish"; + terminal = "screen-256color"; + extraConfig = '' + # Horizontal and vertical splits + bind \\ split-window -h -c '#{pane_current_path}' + bind - split-window -v -c '#{pane_current_path}' + + # Move between panes with vi keys + bind h select-pane -L + bind j select-pane -D + bind K select-pane -U + bind l select-pane -R + + # Split out pane + bind b break-pane + + # Synchronize panes + bind S set-window-option synchronize-panes + + # Copy mode works as Vim + bind Escape copy-mode + bind k copy-mode + bind C-[ copy-mode + + # Use v to trigger selection + bind-key -T copy-mode-vi v send-keys -X begin-selection + + # Use y to yank current selection + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + # Enable mouse mode + set -g mouse on + + # Status bar + set -g status-interval 60 # Seconds between refreshes + set -g renumber-windows on + set-option -g status-position bottom + + ## COLORSCHEME: gruvbox dark + set-option -g status "on" + + # Default statusbar color + set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1 + + # Default window title colors + set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1 + + # Default window with an activity alert + set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3 + + # Active window title colors + set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1 + + # Pane border + set-option -g pane-active-border-style fg=colour250 #fg2 + set-option -g pane-border-style fg=colour237 #bg1 + + # Message infos + set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1 + + # Writing commands inactive + set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1 + + # Pane number display + set-option -g display-panes-active-colour colour250 #fg2 + set-option -g display-panes-colour colour237 #bg1 + + # Clock + set-window-option -g clock-mode-colour colour109 #blue + + # Bell + set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg + + # Theme settings mixed with colors (unfortunately, but there is no cleaner way) + set-option -g status-justify "left" + set-option -g status-left-style none + set-option -g status-left-length "80" + set-option -g status-right-style none + set-option -g status-right-length "80" + set-window-option -g window-status-separator "" + + set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]" + set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]" + + set-window-option -g window-status-current-format "#[fg=colour237, bg=colour214, nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]" + set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]" + ''; + }; + + programs.alacritty.settings = { + shell.args = [ + "--login" + "--init-command" + "tmux attach-session -t noah || tmux new-session -s noah" + ]; + key_bindings = [ + { + key = "H"; + mods = "Super|Shift"; + chars = "\\x02p"; # Previous tmux window + } + { + key = "L"; + mods = "Super|Shift"; + chars = "\\x02n"; # Next tmux window + } + ]; + }; + + }; + +} diff --git a/modules/darwin/user.nix b/modules/darwin/user.nix new file mode 100644 index 0000000..278325f --- /dev/null +++ b/modules/darwin/user.nix @@ -0,0 +1,8 @@ +{ config, pkgs, lib, ... }: { + + users.users."${config.user}" = { # macOS user + home = config.homePath; + shell = pkgs.zsh; # Default shell + }; + +} diff --git a/modules/darwin/utilities.nix b/modules/darwin/utilities.nix new file mode 100644 index 0000000..b082145 --- /dev/null +++ b/modules/darwin/utilities.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; [ + visidata # CSV inspector + dos2unix # Convert Windows text files + inetutils # Includes telnet + youtube-dl # Convert web videos + pandoc # Convert text documents + mpd # TUI slideshows + awscli2 + awslogs + kubectl + k9s + noti # Create notifications programmatically + ]; + + }; + +} diff --git a/modules/editor/default.nix b/modules/editor/default.nix new file mode 100644 index 0000000..3362213 --- /dev/null +++ b/modules/editor/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + + imports = [ ./neovim ./notes.nix ./dotfiles.nix ]; + +} diff --git a/modules/editor/dotfiles.nix b/modules/editor/dotfiles.nix new file mode 100644 index 0000000..04d086e --- /dev/null +++ b/modules/editor/dotfiles.nix @@ -0,0 +1,42 @@ +{ config, pkgs, lib, ... }: { + + home-manager.users.${config.user} = { + + home.activation = { + + # Always clone dotfiles repository if it doesn't exist + cloneDotfiles = + config.home-manager.users.${config.user}.lib.dag.entryAfter + [ "writeBoundary" ] '' + if [ ! -d "${config.dotfilesPath}" ]; then + $DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}") + $DRY_RUN_CMD ${pkgs.git}/bin/git clone ${config.dotfilesRepo} "${config.dotfilesPath}" + fi + ''; + + }; + + programs.fish = { + shellAbbrs = { + nr = "rebuild-nixos"; + nro = "rebuild-nixos offline"; + }; + functions = { + rebuild-nixos = { + body = '' + if test "$argv[1]" = "offline" + set option "--option substitute false" + end + pushd ${config.dotfilesPath} + git add --all + popd + commandline -r "doas nixos-rebuild switch $option --flake ${config.dotfilesPath}" + commandline -f execute + ''; + }; + }; + }; + + }; + +} diff --git a/modules/editor/neovim/bootstrap.lua b/modules/editor/neovim/bootstrap.lua new file mode 100644 index 0000000..6567171 --- /dev/null +++ b/modules/editor/neovim/bootstrap.lua @@ -0,0 +1,13 @@ +-- Bootstrap the Packer plugin manager +local fn = vim.fn +local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +if fn.empty(fn.glob(install_path)) > 0 then + packer_bootstrap = fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) +end diff --git a/modules/editor/neovim/colors.lua b/modules/editor/neovim/colors.lua new file mode 100644 index 0000000..75d3600 --- /dev/null +++ b/modules/editor/neovim/colors.lua @@ -0,0 +1,11 @@ +-- Colorscheme +use({ + "morhetz/gruvbox", + config = function() + vim.g.gruvbox_italic = 1 + vim.cmd([[ + autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE + colorscheme gruvbox + ]]) + end, +}) diff --git a/modules/editor/neovim/completion.lua b/modules/editor/neovim/completion.lua new file mode 100644 index 0000000..8fecdeb --- /dev/null +++ b/modules/editor/neovim/completion.lua @@ -0,0 +1,87 @@ +-- ======================================================================= +-- Completion System +-- ======================================================================= + +-- Completion sources +use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin +use("hrsh7th/cmp-buffer") --- Generic text completion +use("hrsh7th/cmp-path") --- Local file completion +use("hrsh7th/cmp-cmdline") --- Command line completion +use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion +use("saadparwaiz1/cmp_luasnip") --- Luasnip completion +use("lukas-reineke/cmp-rg") --- Ripgrep completion + +-- Completion engine +use({ + "hrsh7th/nvim-cmp", + requires = { "L3MON4D3/LuaSnip" }, + config = function() + local cmp = require("cmp") + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), + [""] = function(fallback) + cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }) + vim.cmd("stopinsert") --- Abort and leave insert mode + end, + -- [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), + -- [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").expand_or_jumpable() then + require("luasnip").expand_or_jump() + end + end, { "i", "s" }), + }, + sources = { + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "path" }, + { name = "luasnip" }, + { name = "buffer", keyword_length = 3, max_item_count = 10 }, + { + name = "rg", + keyword_length = 6, + max_item_count = 10, + option = { additional_arguments = "--ignore-case" }, + }, + }, + experimental = { + native_menu = false, --- Use cmp menu instead of Vim menu + ghost_text = true, --- Show preview auto-completion + }, + }) + + -- Use buffer source for `/` + cmp.setup.cmdline("/", { + sources = { + { name = "buffer", keyword_length = 5 }, + }, + }) + + -- Use cmdline & path source for ':' + cmp.setup.cmdline(":", { + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, +}) diff --git a/modules/editor/neovim/default.nix b/modules/editor/neovim/default.nix new file mode 100644 index 0000000..2ebec2c --- /dev/null +++ b/modules/editor/neovim/default.nix @@ -0,0 +1,63 @@ +{ config, pkgs, lib, ... }: { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; [ + neovim + gcc # for tree-sitter + ]; + + xdg.configFile = { + "nvim/init.lua".text = lib.mkMerge [ + (lib.mkOrder 100 '' + ${builtins.readFile ./bootstrap.lua} + require("packer").startup(function(use) + ${builtins.readFile ./packer-basics.lua} + '') + (lib.mkOrder 200 '' + ${builtins.readFile ./colors.lua} + '') + (lib.mkOrder 300 '' + ${builtins.readFile ./lsp.lua} + '') + (lib.mkOrder 400 '' + ${builtins.readFile ./completion.lua} + '') + (lib.mkOrder 500 '' + ${builtins.readFile ./syntax.lua} + '') + (lib.mkOrder 600 '' + ${builtins.readFile ./telescope.lua} + '') + (lib.mkOrder 700 '' + ${builtins.readFile ./packer-sync.lua} + end) + '') + (lib.mkOrder 800 '' + ${builtins.readFile ./settings.lua} + ${builtins.readFile ./functions.lua} + ${builtins.readFile ./keybinds.lua} + '') + ]; + }; + + programs.git.extraConfig.core.editor = "nvim"; + home.sessionVariables = { + EDITOR = "nvim"; + MANPAGER = "nvim +Man!"; + }; + programs.fish = { + shellAliases = { vim = "nvim"; }; + shellAbbrs = { + v = lib.mkForce "nvim"; + vl = lib.mkForce "nvim -c 'normal! `0'"; + vll = "nvim -c 'Telescope oldfiles'"; + }; + }; + + }; + + # Used for icons in Vim + fonts.fonts = with pkgs; [ nerdfonts ]; + +} diff --git a/modules/editor/neovim/functions.lua b/modules/editor/neovim/functions.lua new file mode 100644 index 0000000..4aa4082 --- /dev/null +++ b/modules/editor/neovim/functions.lua @@ -0,0 +1,49 @@ +-- =========================================================================== +-- Custom Functions +-- =========================================================================== + +grep_notes = function() + local opts = { + prompt_title = "Search Notes", + cwd = "$NOTES_PATH", + } + require("telescope.builtin").live_grep(opts) +end + +find_notes = function() + local opts = { + prompt_title = "Find Notes", + cwd = "$NOTES_PATH", + } + require("telescope.builtin").find_files(opts) +end + +find_downloads = function() + local opts = { + prompt_title = "Find Downloads", + cwd = "~/downloads", + } + require("telescope").extensions.file_browser.file_browser(opts) +end + +choose_project = function() + local opts = require("telescope.themes").get_ivy({ + layout_config = { + bottom_pane = { + height = 10, + }, + }, + }) + require("telescope").extensions.project.project(opts) +end + +command_history = function() + local opts = require("telescope.themes").get_ivy({ + layout_config = { + bottom_pane = { + height = 15, + }, + }, + }) + require("telescope.builtin").command_history(opts) +end diff --git a/modules/editor/neovim/keybinds.lua b/modules/editor/neovim/keybinds.lua new file mode 100644 index 0000000..f430972 --- /dev/null +++ b/modules/editor/neovim/keybinds.lua @@ -0,0 +1,121 @@ +-- =========================================================================== +-- Key Mapping +-- =========================================================================== + +-- Function to cut down config boilerplate +local key = function(mode, key_sequence, action, params) + params = params or {} + params["noremap"] = true + vim.api.nvim_set_keymap(mode, key_sequence, action, params) +end + +-- Remap space as leader key +key("", "", "", { silent = true }) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Keep selection when changing indentation +key("v", "<", "", ">gv") + +-- Clear search register +key("n", "", ":noh", { silent = true }) + +-- Shuffle lines around +key("n", "", ":m .+1==") +key("n", "", ":m .-2==") +key("i", "", ":m .+1==gi") +key("i", "", ":m .-2==gi") +key("v", "", ":m '>+1gv=gv") +key("v", "", ":m '<-2gv=gv") + +-- Telescope (fuzzy finder) +key("n", "k", ":Telescope keymaps") +key("n", "/", ":Telescope live_grep") +key("n", "ff", ":Telescope find_files") +key("n", "fp", ":Telescope git_files") +key("n", "fN", "lua find_notes()") +key("n", "N", "lua grep_notes()") +key("n", "fD", "lua find_downloads()") +key("n", "fa", ":Telescope file_browser") +key("n", "fw", ":Telescope grep_string") +key("n", "wt", ":Telescope tmux sessions") +key("n", "ww", ":Telescope tmux windows") +key("n", "w/", ":Telescope tmux pane_contents") +key("n", "fz", ":Telescope zoxide list") +key("n", "b", ":Telescope buffers") +key("n", "hh", ":Telescope help_tags") +key("n", "fr", ":Telescope oldfiles") +key("n", "cc", ":Telescope commands") +key("n", "cr", "lua command_history()") +key("n", "y", "lua clipboard_history()") +key("i", "", "lua clipboard_history()") +key("n", "s", ":Telescope current_buffer_fuzzy_find") +key("n", "gc", ":Telescope git_commits") +key("n", "gf", ":Telescope git_bcommits") +key("n", "gb", ":Telescope git_branches") +key("n", "gs", ":Telescope git_status") +key("n", "", "lua choose_project()") + +-- Buffer tabs (tmux interferes) +-- key("n", "", "gt") +-- key("i", "", "gt") +-- key("n", "", "gT") +-- key("i", "", "gT") + +-- LSP +key("n", "gd", "lua vim.lsp.buf.definition()", { silent = true }) +key("n", "gT", "lua vim.lsp.buf.type_definition()", { silent = true }) +key("n", "gi", "lua vim.lsp.buf.implementation()", { silent = true }) +key("n", "gh", "lua vim.lsp.buf.hover()", { silent = true }) +key("n", "gr", "Telescope lsp_references", { silent = true }) +key("n", "R", "lua vim.lsp.buf.rename()", { silent = true }) +key("n", "]e", "lua vim.diagnostic.goto_next()", { silent = true }) +key("n", "[e", "lua vim.diagnostic.goto_prev()", { silent = true }) +key("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", { silent = true }) +key("n", "E", "lua vim.lsp.buf.code_action()", { silent = true }) + +-- File commands +key("n", "q", ":quit") +key("n", "Q", ":quitall") +key("n", "fs", ":write") +key("n", "fd", ":lcd %:p:h", { silent = true }) +key("n", "fu", ":lcd ..", { silent = true }) +key("n", "", ":b#", { silent = true }) +key("n", "gr", ":!gh repo view -w", { silent = true }) +key("n", "tt", [[exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md']]) +key("n", "jj", ":!journal:e") + +-- Window commands +key("n", "wv", ":vsplit") +key("n", "wh", ":split") +key("n", "wm", ":only") + +-- Tabularize +key("", "ta", ":Tabularize /") +key("", "t#", ":Tabularize /#") +key("", "tl", ":Tabularize /---") + +-- Vimrc editing +key("n", "fv", ":edit $DOTS/nvim.configlink/init.lua") +key("n", "rr", ":luafile $MYVIMRC") +key("n", "rp", ":luafile $MYVIMRC:PackerInstall:") +key("n", "rc", ":luafile $MYVIMRC:PackerCompile") + +-- Keep cursor in place +key("n", "n", "nzz") +key("n", "N", "Nzz") +key("n", "J", "mzJ`z") --- Mark and jump back to it + +-- Add undo breakpoints +key("i", ",", ",u") +key("i", ".", ".u") +key("i", "!", "!u") +key("i", "?", "?u") + +-- Other +key("t", "", "") --- Exit terminal mode +key("n", "", ":noh", { silent = true }) --- Clear search in VimWiki +key("n", "Y", "y$") --- Copy to end of line +key("v", "", "y:%s/+//gc") --- Substitute selected +key("v", "D", "y'>gp") --- Duplicate selected diff --git a/modules/editor/neovim/lsp.lua b/modules/editor/neovim/lsp.lua new file mode 100644 index 0000000..10e859b --- /dev/null +++ b/modules/editor/neovim/lsp.lua @@ -0,0 +1,65 @@ +-- ======================================================================= +-- Language Server +-- ======================================================================= + +-- Language server engine +use({ + "neovim/nvim-lspconfig", + requires = { "hrsh7th/cmp-nvim-lsp" }, + config = function() + local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) + require("lspconfig").rust_analyzer.setup({ capabilities = capabilities }) + require("lspconfig").tflint.setup({ capabilities = capabilities }) + require("lspconfig").terraformls.setup({ capabilities = capabilities }) + require("lspconfig").pyright.setup({ + on_attach = function() + -- set keymaps (requires 0.7.0) + -- vim.keymap.set("n", "", "", {buffer=0}) + end, + capabilities = capabilities, + }) + end, +}) + +-- Pretty highlights +use("folke/lsp-colors.nvim") + +-- Linting +use({ + "jose-elias-alvarez/null-ls.nvim", + branch = "main", + requires = { + "nvim-lua/plenary.nvim", + "neovim/nvim-lspconfig", + }, + config = function() + require("null-ls").setup({ + sources = { + require("null-ls").builtins.formatting.stylua, + require("null-ls").builtins.formatting.black, + require("null-ls").builtins.formatting.fish_indent, + require("null-ls").builtins.formatting.nixfmt, + require("null-ls").builtins.formatting.rustfmt, + require("null-ls").builtins.diagnostics.shellcheck, + require("null-ls").builtins.formatting.shfmt.with({ + extra_args = { "-i", "4", "-ci" }, + }), + require("null-ls").builtins.formatting.terraform_fmt, + -- require("null-ls").builtins.diagnostics.luacheck, + -- require("null-ls").builtins.diagnostics.markdownlint, + -- require("null-ls").builtins.diagnostics.pylint, + }, + -- Format on save + on_attach = function(client) + if client.resolved_capabilities.document_formatting then + vim.cmd([[ + augroup LspFormatting + autocmd! * + autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync() + augroup END + ]]) + end + end, + }) + end, +}) diff --git a/modules/editor/neovim/packer-basics.lua b/modules/editor/neovim/packer-basics.lua new file mode 100644 index 0000000..5264234 --- /dev/null +++ b/modules/editor/neovim/packer-basics.lua @@ -0,0 +1,112 @@ +-- Maintain plugin manager +use("wbthomason/packer.nvim") + +-- Startup speed hacks +use({ + "lewis6991/impatient.nvim", + config = function() + require("impatient") + end, +}) + +-- Important tweaks +use("tpope/vim-surround") --- Manipulate parentheses + +-- Convenience tweaks +use("tpope/vim-eunuch") --- File manipulation in Vim +use("tpope/vim-vinegar") --- Fixes netrw file explorer +use("tpope/vim-fugitive") --- Git commands and syntax +use("tpope/vim-repeat") --- Actually repeat using . +use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes + +-- Use gc or gcc to add comments +use({ + "numToStr/Comment.nvim", + config = function() + require("Comment").setup() + end, +}) + +-- Git next to line numbers +use({ + "lewis6991/gitsigns.nvim", + branch = "main", + requires = { "nvim-lua/plenary.nvim" }, + config = function() + require("gitsigns").setup() + end, +}) + +-- Status bar +use({ + "hoob3rt/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, + config = function() + require("lualine").setup({ + options = { + theme = "gruvbox", + icons_enabled = true, + }, + }) + end, +}) + +-- Improve speed and filetype detection +use({ + "nathom/filetype.nvim", + config = function() + -- Filetype for .env files + local envfiletype = function() + vim.bo.filetype = "text" + vim.bo.syntax = "sh" + end + -- Force filetype patterns that Vim doesn't know about + require("filetype").setup({ + overrides = { + extensions = { + Brewfile = "brewfile", + muttrc = "muttrc", + tfvars = "terraform", + tf = "terraform", + }, + literal = { + Caskfile = "brewfile", + [".gitignore"] = "gitignore", + config = "config", + }, + complex = { + [".*git/config"] = "gitconfig", + ["tmux.conf%..*link"] = "tmux", + ["gitconfig%..*link"] = "gitconfig", + [".*ignore%..*link"] = "gitignore", + [".*%.toml%..*link"] = "toml", + }, + function_extensions = {}, + function_literal = { + [".envrc"] = envfiletype, + [".env"] = envfiletype, + [".env.dev"] = envfiletype, + [".env.prod"] = envfiletype, + [".env.example"] = envfiletype, + }, + }, + }) + end, +}) + +-- Alignment tool +use("godlygeek/tabular") + +-- Markdown renderer / wiki notes +use("vimwiki/vimwiki") + +-- Markdown pretty view +use("ellisonleao/glow.nvim") + +-- Hex color previews +use({ + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup() + end, +}) diff --git a/modules/editor/neovim/packer-sync.lua b/modules/editor/neovim/packer-sync.lua new file mode 100644 index 0000000..64a7da6 --- /dev/null +++ b/modules/editor/neovim/packer-sync.lua @@ -0,0 +1,6 @@ +-- ======================================================================= + +-- Install on initial bootstrap +if packer_bootstrap then + require("packer").sync() +end diff --git a/modules/editor/neovim/settings.lua b/modules/editor/neovim/settings.lua new file mode 100644 index 0000000..913be33 --- /dev/null +++ b/modules/editor/neovim/settings.lua @@ -0,0 +1,116 @@ +-- =========================================================================== +-- Settings +-- =========================================================================== + +vim.o.termguicolors = true --- Set to truecolor +vim.o.hidden = true --- Don't unload buffers when leaving them +vim.wo.number = true --- Show line numbers +vim.wo.relativenumber = true --- Relative numbers instead of absolute +vim.o.list = true --- Reveal whitespace with dashes +vim.o.expandtab = true --- Tabs into spaces +vim.o.shiftwidth = 4 --- Amount to shift with > key +vim.o.softtabstop = 4 --- Amount to shift with key +vim.o.ignorecase = true --- Ignore case when searching +vim.o.smartcase = true --- Check case when using capitals in search +vim.o.infercase = true --- Don't match cases when completing suggestions +vim.o.incsearch = true --- Search while typing +vim.o.visualbell = true --- No sounds +vim.o.scrolljump = 1 --- Number of lines to scroll +vim.o.scrolloff = 3 --- Margin of lines to see while scrolling +vim.o.splitright = true --- Vertical splits on the right side +vim.o.splitbelow = true --- Horizontal splits on the bottom side +vim.o.pastetoggle = "" --- Use F3 to enter raw paste mode +vim.o.clipboard = "unnamedplus" --- Uses system clipboard for yanking +vim.o.updatetime = 300 --- Faster diagnostics +vim.o.mouse = "nv" --- Mouse interaction / scrolling + +-- Neovim features +vim.o.inccommand = "split" --- Live preview search and replace +--- Required for nvim-cmp completion +vim.opt.completeopt = { + "menu", + "menuone", + "noselect", +} +-- Required until 0.6.0: do not source the default filetype.vim +vim.g.did_load_filetypes = 1 + +-- Remember last position when reopening file +vim.api.nvim_exec( + [[ + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif +]], + false +) + +-- Better backup, swap and undo storage +vim.o.backup = true --- Easier to recover and more secure +vim.bo.swapfile = false --- Instead of swaps, create backups +vim.bo.undofile = true --- Keeps undos after quit + +-- Create backup directories if they don't exist +-- Should be fixed in 0.6 by https://github.com/neovim/neovim/pull/15433 +vim.o.backupdir = vim.fn.stdpath("cache") .. "/backup" +vim.api.nvim_exec( + [[ + if !isdirectory(&backupdir) + call mkdir(&backupdir, "p") + endif +]], + false +) + +-- LaTeX options +vim.api.nvim_exec( + [[ + au FileType tex inoremap ;bf \textbf{}i + au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw! +]], + false +) + +-- Highlight when yanking +vim.api.nvim_exec( + [[ + au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } +]], + false +) + +-- Netrw +vim.g.netrw_liststyle = 3 -- Change style to 'tree' view +vim.g.netrw_banner = 0 -- Remove useless banner +vim.g.netrw_winsize = 15 -- Explore window takes % of page +vim.g.netrw_browse_split = 4 -- Open in previous window +vim.g.netrw_altv = 1 -- Always split left + +-- VimWiki +vim.g.vimwiki_list = { + { + ["path"] = "$NOTES_PATH", + ["syntax"] = "markdown", + ["index"] = "home", + ["ext"] = ".md", + }, +} +vim.g.vimwiki_key_mappings = { + ["all_maps"] = 1, + ["mouse"] = 1, +} +vim.g.vimwiki_auto_chdir = 1 -- Set local dir to Wiki when open +vim.g.vimwiki_create_link = 0 -- Don't automatically create new links +vim.g.vimwiki_listsyms = " x" -- Set checkbox symbol progression +vim.g.vimwiki_table_mappings = 0 -- VimWiki table keybinds interfere with tab completion +vim.api.nvim_exec( + [[ + au FileType markdown inoremap ;tt :AddTag + + function! PInsert(item) + let @z=a:item + norm "zpx + endfunction + + command! AddTag call fzf#run({'source': 'rg "#[A-Za-z/]+[ |\$]" -o --no-filename --no-line-number | sort | uniq', 'sink': function('PInsert')}) +]], + false +) diff --git a/modules/editor/neovim/syntax.lua b/modules/editor/neovim/syntax.lua new file mode 100644 index 0000000..1e25f8d --- /dev/null +++ b/modules/editor/neovim/syntax.lua @@ -0,0 +1,31 @@ +-- ======================================================================= +-- Syntax +-- ======================================================================= + +-- Syntax engine +use({ + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "hcl", + "python", + "lua", + "nix", + "fish", + "toml", + "yaml", + "json", + }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +}) + +-- Additional syntax sources +use("bfontaine/Brewfile.vim") --- Brewfile syntax +use("chr4/nginx.vim") --- Nginx syntax +use("towolf/vim-helm") --- Helm syntax +use("rodjek/vim-puppet") --- Puppet syntax diff --git a/modules/editor/neovim/telescope.lua b/modules/editor/neovim/telescope.lua new file mode 100644 index 0000000..c81d568 --- /dev/null +++ b/modules/editor/neovim/telescope.lua @@ -0,0 +1,67 @@ +-- ======================================================================= +-- Fuzzy Launcher +-- ======================================================================= + +use({ + "nvim-telescope/telescope.nvim", + branch = "master", + requires = { "nvim-lua/plenary.nvim" }, + config = function() + -- Telescope: quit instantly with escape + local actions = require("telescope.actions") + require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = actions.close, + [""] = "which_key", + }, + }, + }, + pickers = { + find_files = { theme = "ivy" }, + oldfiles = { theme = "ivy" }, + buffers = { theme = "dropdown" }, + }, + extensions = { + fzy_native = {}, + tmux = {}, + zoxide = {}, + --neoclip = {}, + project = { + base_dirs = { "~/dev" }, + }, + }, + }) + end, +}) + +-- Faster sorting +use("nvim-telescope/telescope-fzy-native.nvim") + +-- Jump around tmux sessions +use("camgraff/telescope-tmux.nvim") + +-- Jump directories +use({ + "jvgrootveld/telescope-zoxide", + requires = { "nvim-lua/popup.nvim" }, +}) + +-- Jump projects +use({ + "nvim-telescope/telescope-project.nvim", + requires = { "nvim-telescope/telescope.nvim" }, + config = function() + require("telescope").load_extension("project") + end, +}) + +-- File browser +use({ + "nvim-telescope/telescope-file-browser.nvim", + requires = { "nvim-telescope/telescope.nvim" }, + config = function() + require("telescope").load_extension("file_browser") + end, +}) diff --git a/modules/editor/notes.nix b/modules/editor/notes.nix new file mode 100644 index 0000000..c357723 --- /dev/null +++ b/modules/editor/notes.nix @@ -0,0 +1,11 @@ +{ config, ... }: { + + home-manager.users.${config.user} = { + + home.sessionVariables = { + NOTES_PATH = "${config.homePath}/dev/personal/notes"; + }; + + }; + +} diff --git a/modules/gaming/common.nix b/modules/gaming/default.nix similarity index 60% rename from modules/gaming/common.nix rename to modules/gaming/default.nix index e074730..7b26dc6 100644 --- a/modules/gaming/common.nix +++ b/modules/gaming/default.nix @@ -1,5 +1,7 @@ { config, ... }: { + imports = [ ./leagueoflegends.nix ./lutris.nix ./steam.nix ./legendary.nix ]; + config = { hardware.opengl = { enable = true; diff --git a/modules/gaming/leagueoflegends.nix b/modules/gaming/leagueoflegends.nix index 84d068f..3121923 100644 --- a/modules/gaming/leagueoflegends.nix +++ b/modules/gaming/leagueoflegends.nix @@ -1,14 +1,30 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { -{ - imports = [ ./common.nix ./lutris.nix ]; + options.gaming.leagueoflegends = lib.mkEnableOption "League of Legends"; - config = { + config = lib.mkIf config.gaming.leagueoflegends { - # League of Legends anti-cheat + # League of Legends anti-cheat requirement boot.kernel.sysctl = { "abi.vsyscall32" = 0; }; - environment.systemPackages = with pkgs; [ openssl dconf ]; + environment.systemPackages = with pkgs; [ + + # Lutris requirement to install the game + lutris + amdvlk + wineWowPackages.stable + # vulkan-tools + + # Required according to https://lutris.net/games/league-of-legends/ + openssl + gnome.zenity + + # Don't remember if this is required + dconf + + ]; + + environment.sessionVariables = { QT_X11_NO_MITSHM = "1"; }; }; } diff --git a/modules/gaming/legendary.nix b/modules/gaming/legendary.nix new file mode 100644 index 0000000..11269bc --- /dev/null +++ b/modules/gaming/legendary.nix @@ -0,0 +1,56 @@ +{ config, pkgs, lib, ... }: + +let home-packages = config.home-manager.users.${config.user}.home.packages; + +in { + + options.gaming.legendary = + lib.mkEnableOption "Legendary - Epic Games Launcher"; + + config = lib.mkIf config.gaming.legendary { + environment.systemPackages = with pkgs; [ + legendary-gl + rare # GUI for Legendary (not working) + wineWowPackages.stable # 32-bit and 64-bit wineWowPackages, see https://nixos.wiki/wiki/Wine + ]; + + home-manager.users.${config.user} = { + + xdg.configFile."legendary/config.ini".text = '' + [Legendary] + ; Disables the automatic update check + disable_update_check = false + ; Disables the notice about an available update on exit + disable_update_notice = true + ; Set install directory + install_dir = ${config.homePath}/media/games + ; Make output quiet + log_level = error + ''; + + home.file = let + ignorePatterns = '' + .wine/ + drive_c/''; + in { + ".rgignore".text = ignorePatterns; + ".fdignore".text = ignorePatterns; + }; + + programs.fish.functions = + lib.mkIf (builtins.elem pkgs.fzf home-packages) { + epic-games = { + body = '' + set game (legendary list 2>/dev/null \ + | awk '/^ \* / { print $0; }' \ + | sed -e 's/ (.*)$//' -e 's/ \* //' \ + | fzf) + and legendary launch "$game" &> /dev/null + ''; + }; + }; + + }; + }; + +} diff --git a/modules/gaming/lutris.nix b/modules/gaming/lutris.nix index 8ecf177..a8cac00 100644 --- a/modules/gaming/lutris.nix +++ b/modules/gaming/lutris.nix @@ -1,9 +1,13 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { -{ + options.gaming.lutris = lib.mkEnableOption "Lutris"; - imports = [ ./common.nix ]; - - config = { environment.systemPackages = with pkgs; [ lutris amdvlk wine ]; }; + config = lib.mkIf config.gaming.lutris { + environment.systemPackages = with pkgs; [ + lutris + amdvlk # Vulkan drivers (probably already installed) + wineWowPackages.stable # 32-bit and 64-bit wineWowPackages + ]; + }; } diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix index 38c4bab..b23bd7c 100644 --- a/modules/gaming/steam.nix +++ b/modules/gaming/steam.nix @@ -1,10 +1,19 @@ -{ config, pkgs, ... }: { +{ config, pkgs, lib, ... }: { - imports = [ ./common.nix ]; + options.gaming.steam = lib.mkEnableOption "Steam"; - config = { + config = lib.mkIf config.gaming.steam { hardware.steam-hardware.enable = true; - environment.systemPackages = with pkgs; [ steam ]; + unfreePackages = [ "steam" "steam-original" "steamcmd" ]; + environment.systemPackages = with pkgs; [ + + steam + + # Enable terminal interaction + steamPackages.steamcmd + steam-tui + + ]; }; } diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix new file mode 100644 index 0000000..ea6a7a8 --- /dev/null +++ b/modules/graphical/default.nix @@ -0,0 +1,55 @@ +{ lib, ... }: { + + imports = [ + ./xorg.nix + ./fonts.nix + ./i3.nix + ./polybar.nix + ./picom.nix + # ./dmenu.nix + ./rofi.nix + ]; + + options = with lib; { + + gui = { + compositor.enable = mkEnableOption { + description = "Enable transparency, blur, shadows"; + default = false; + }; + launcherCommand = mkOption { + type = types.str; + description = "Command to use for launching"; + }; + systemdSearch = mkOption { + type = types.str; + description = "Command to use for interacting with systemd"; + }; + altTabCommand = mkOption { + type = types.str; + description = "Command to use for choosing windows"; + }; + toggleBarCommand = lib.mkOption { + type = lib.types.str; + description = "Command to hide and show the status bar."; + }; + gtk.theme = { + name = mkOption { + type = types.str; + description = "Theme name for GTK applications"; + }; + package = mkOption { + type = types.str; + description = "Theme package name for GTK applications"; + default = "gnome-themes-extra"; + }; + }; + wallpaper = mkOption { + type = types.path; + description = "Wallpaper background image file"; + }; + }; + + }; + +} diff --git a/modules/graphical/dmenu.nix b/modules/graphical/dmenu.nix new file mode 100644 index 0000000..9ada181 --- /dev/null +++ b/modules/graphical/dmenu.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + + config = lib.mkIf config.services.xserver.enable { + + home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ]; + gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run"; + + }; + +} diff --git a/modules/graphical/fonts.nix b/modules/graphical/fonts.nix new file mode 100644 index 0000000..ae81955 --- /dev/null +++ b/modules/graphical/fonts.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, ... }: + +let fontName = "Victor Mono"; + +in { + + config = lib.mkIf config.gui.enable { + + fonts.fonts = with pkgs; [ + victor-mono # Used for Vim and Terminal + (nerdfonts.override { fonts = [ "Hack" ]; }) # For Polybar, Rofi + ]; + fonts.fontconfig.defaultFonts.monospace = [ fontName ]; + + home-manager.users.${config.user} = { + xsession.windowManager.i3.config.fonts = { + names = [ "pango:${fontName}" ]; + # style = "Regular"; + # size = 11.0; + }; + services.polybar.config."bar/main".font-0 = "Hack Nerd Font:size=10;2"; + programs.rofi.font = "Hack Nerd Font 14"; + programs.alacritty.settings.font.normal.family = fontName; + }; + + }; + +} diff --git a/modules/graphical/i3.nix b/modules/graphical/i3.nix new file mode 100644 index 0000000..2a22d2e --- /dev/null +++ b/modules/graphical/i3.nix @@ -0,0 +1,276 @@ +{ config, pkgs, lib, ... }: + +let + + lockCmd = + "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span"; + lockUpdate = + "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.gui.wallpaper} --display 1 --span"; + +in { + + config = lib.mkIf config.services.xserver.enable { + + services.xserver.windowManager = { + i3 = { + enable = true; + package = pkgs.i3-gaps; + }; + }; + + environment.systemPackages = with pkgs; [ + feh # Wallpaper + playerctl # Media control + ]; + + home-manager.users.${config.user} = { + xsession.windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + config = let + modifier = "Mod4"; # Super key + ws1 = "1:I"; + ws2 = "2:II"; + ws3 = "3:III"; + ws4 = "4:IV"; + ws5 = "5:V"; + ws6 = "6:VI"; + ws7 = "7:VII"; + ws8 = "8:VIII"; + ws9 = "9:IX"; + ws10 = "10:X"; + in { + modifier = modifier; + assigns = { + "${ws1}" = [{ class = "Firefox"; }]; + "${ws2}" = [{ class = "Alacritty"; }]; + "${ws3}" = [{ class = "discord"; }]; + "${ws4}" = [{ class = "Steam"; }]; + }; + bars = [{ command = "echo"; }]; # Disable i3bar + colors = let + background = config.gui.colorscheme.base00; + inactiveBackground = config.gui.colorscheme.base01; + border = config.gui.colorscheme.base01; + inactiveBorder = config.gui.colorscheme.base01; + text = config.gui.colorscheme.base07; + inactiveText = config.gui.colorscheme.base04; + urgentBackground = config.gui.colorscheme.base08; + indicator = "#00000000"; + in { + background = config.gui.colorscheme.base00; + focused = { + inherit background indicator text border; + childBorder = background; + }; + focusedInactive = { + inherit indicator; + background = inactiveBackground; + border = inactiveBorder; + childBorder = inactiveBackground; + text = inactiveText; + }; + # placeholder = { }; + unfocused = { + inherit indicator; + background = inactiveBackground; + border = inactiveBorder; + childBorder = inactiveBackground; + text = inactiveText; + }; + urgent = { + inherit text indicator; + background = urgentBackground; + border = urgentBackground; + childBorder = urgentBackground; + }; + }; + floating.modifier = modifier; + focus = { + mouseWarping = true; + newWindow = "urgent"; + followMouse = false; + }; + keybindings = { + + # Adjust screen brightness + "Shift+F12" = + "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30"; + "Shift+F11" = + "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30"; + "XF86MonBrightnessUp" = + "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30"; + "XF86MonBrightnessDown" = + "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30"; + + # Media player controls + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + + # Launchers + "${modifier}+Return" = + "exec --no-startup-id alacritty; workspace ${ws2}; layout tabbed"; + "${modifier}+space" = + "exec --no-startup-id ${config.gui.launcherCommand}"; + "${modifier}+Shift+s" = + "exec --no-startup-id ${config.gui.systemdSearch}"; + "Mod1+Tab" = "exec --no-startup-id ${config.gui.altTabCommand}"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+r" = "restart"; + "${modifier}+Shift+q" = '' + exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"''; + "${modifier}+Shift+x" = "exec ${lockCmd}"; + + # Window options + "${modifier}+q" = "kill"; + "${modifier}+b" = "exec ${config.gui.toggleBarCommand}"; + "${modifier}+f" = "fullscreen toggle"; + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + "${modifier}+Shift+h" = "move left"; + "${modifier}+Shift+j" = "move down"; + "${modifier}+Shift+k" = "move up"; + "${modifier}+Shift+l" = "move right"; + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + + # Tiling + "${modifier}+i" = "split h"; + "${modifier}+v" = "split v"; + "${modifier}+s" = "layout stacking"; + "${modifier}+t" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+Control+space" = "focus mode_toggle"; + "${modifier}+a" = "focus parent"; + + # Workspaces + "${modifier}+1" = "workspace ${ws1}"; + "${modifier}+2" = "workspace ${ws2}"; + "${modifier}+3" = "workspace ${ws3}"; + "${modifier}+4" = "workspace ${ws4}"; + "${modifier}+5" = "workspace ${ws5}"; + "${modifier}+6" = "workspace ${ws6}"; + "${modifier}+7" = "workspace ${ws7}"; + "${modifier}+8" = "workspace ${ws8}"; + "${modifier}+9" = "workspace ${ws9}"; + "${modifier}+0" = "workspace ${ws10}"; + + # Move windows + "${modifier}+Shift+1" = + "move container to workspace ${ws1}; workspace ${ws1}"; + "${modifier}+Shift+2" = + "move container to workspace ${ws2}; workspace ${ws2}"; + "${modifier}+Shift+3" = + "move container to workspace ${ws3}; workspace ${ws3}"; + "${modifier}+Shift+4" = + "move container to workspace ${ws4}; workspace ${ws4}"; + "${modifier}+Shift+5" = + "move container to workspace ${ws5}; workspace ${ws5}"; + "${modifier}+Shift+6" = + "move container to workspace ${ws6}; workspace ${ws6}"; + "${modifier}+Shift+7" = + "move container to workspace ${ws7}; workspace ${ws7}"; + "${modifier}+Shift+8" = + "move container to workspace ${ws8}; workspace ${ws8}"; + "${modifier}+Shift+9" = + "move container to workspace ${ws9}; workspace ${ws9}"; + "${modifier}+Shift+0" = + "move container to workspace ${ws10}; workspace ${ws10}"; + + # Move screens + "${modifier}+Control+l" = "move workspace to output right"; + "${modifier}+Control+h" = "move workspace to output left"; + + # Resizing + "${modifier}+r" = ''mode "resize"''; + "${modifier}+Control+Shift+h" = + "resize shrink width 10 px or 10 ppt"; + "${modifier}+Control+Shift+j" = + "resize grow height 10 px or 10 ppt"; + "${modifier}+Control+Shift+k" = + "resize shrink height 10 px or 10 ppt"; + "${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt"; + }; + modes = { }; + startup = [ + { + command = "feh --bg-fill ${config.gui.wallpaper}"; + always = true; + notification = false; + } + { + command = "i3-msg workspace ${ws1}"; + notification = false; + } + ]; + window = { + border = 0; + hideEdgeBorders = "smart"; + titlebar = false; + }; + workspaceAutoBackAndForth = false; + workspaceOutputAssign = [ ]; + # gaps = { + # bottom = 8; + # top = 8; + # left = 8; + # right = 8; + # horizontal = 15; + # vertical = 15; + # inner = 15; + # outer = 0; + # smartBorders = "off"; + # smartGaps = false; + # }; + }; + extraConfig = ""; + }; + + programs.fish.functions = { + update-lock-screen = { + description = "Update lockscreen with wallpaper"; + body = lockUpdate; + }; + }; + + # Update lock screen cache only if cache is empty + home.activation.updateLockScreenCache = + let cacheDir = "${config.homePath}/.cache/betterlockscreen/current"; + in config.home-manager.users.${config.user}.lib.dag.entryAfter + [ "writeBoundary" ] '' + if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then + $DRY_RUN_CMD ${lockUpdate} + fi + ''; + + }; + + # Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service + systemd.services.lock = { + description = "Lock the screen on resume from suspend"; + before = [ "sleep.target" "suspend.target" ]; + serviceConfig = { + User = config.user; + Type = "simple"; + Environment = "DISPLAY=:0"; + TimeoutSec = "infinity"; + ExecStart = lockCmd; + ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1"; + }; + wantedBy = [ "sleep.target" "suspend.target" ]; + }; + + }; + +} diff --git a/modules/graphical/picom.nix b/modules/graphical/picom.nix new file mode 100644 index 0000000..d3bc782 --- /dev/null +++ b/modules/graphical/picom.nix @@ -0,0 +1,49 @@ +{ config, lib, ... }: { + + config = + lib.mkIf (config.services.xserver.enable && config.gui.compositor.enable) { + home-manager.users.${config.user} = { + + services.picom = { + enable = true; + blur = false; + blurExclude = [ ]; + # extraOptions = '' + # shadow-radius = 20 + # ''; + # extraOptions = '' + # shadow-radius = 20 + # corner-radius = 10 + # blur-size = 20 + # rounded-corners-exclude = [ + # "window_type = 'dock'", + # "class_g = 'i3-frame'" + # ] + # ''; + fade = false; + experimentalBackends = true; + inactiveDim = "0.05"; + inactiveOpacity = "1.0"; + menuOpacity = "1.0"; + noDNDShadow = false; + noDockShadow = false; + opacityRule = [ + "0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows + ]; + shadow = false; + shadowExclude = [ ]; + shadowOffsets = [ (-10) (-10) ]; + shadowOpacity = "0.5"; + vSync = true; + }; + + xsession.windowManager.i3.config.startup = [{ + command = "systemctl --user restart picom"; + always = true; + notification = false; + }]; + + }; + }; + +} diff --git a/modules/graphical/polybar.nix b/modules/graphical/polybar.nix new file mode 100644 index 0000000..324bef8 --- /dev/null +++ b/modules/graphical/polybar.nix @@ -0,0 +1,185 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.services.xserver.enable { + + gui.toggleBarCommand = "polybar-msg cmd toggle"; + + home-manager.users.${config.user} = { + + services.polybar = { + enable = true; + package = pkgs.polybar.override { + i3GapsSupport = true; + pulseSupport = true; + githubSupport = true; + }; + script = "polybar &"; + config = { + "bar/main" = { + bottom = false; + width = "100%"; + height = "22pt"; + radius = 0; + # offset-y = -5; + # offset-y = "5%"; + # dpi = 96; + background = config.gui.colorscheme.base01; + foreground = config.gui.colorscheme.base05; + line-size = "3pt"; + border-top-size = 0; + border-right-size = 0; + border-left-size = 0; + border-bottom-size = "4pt"; + border-color = config.gui.colorscheme.base00; + padding-left = 2; + padding-right = 2; + module-margin = 1; + modules-left = "i3"; + modules-center = "xwindow"; + modules-right = "pulseaudio date"; + cursor-click = "pointer"; + cursor-scroll = "ns-resize"; + enable-ipc = true; + tray-position = "right"; + # wm-restack = "generic"; + # wm-restack = "bspwm"; + # wm-restack = "i3"; + # override-redirect = true; + }; + "module/i3" = let padding = 2; + in { + type = "internal/i3"; + pin-workspaces = false; + show-urgent = true; + strip-wsnumbers = true; + index-sort = true; + enable-click = true; + wrapping-scroll = true; + fuzzy-match = true; + format = " "; + label-focused = "%name%"; + label-focused-foreground = config.gui.colorscheme.base01; + label-focused-background = config.gui.colorscheme.base05; + label-focused-underline = config.gui.colorscheme.base03; + label-focused-padding = padding; + label-unfocused = "%name%"; + label-unfocused-padding = padding; + label-visible = "%name%"; + label-visible-underline = config.gui.colorscheme.base01; + label-visible-padding = padding; + label-urgent = "%name%"; + label-urgent-foreground = config.gui.colorscheme.base00; + label-urgent-background = config.gui.colorscheme.base08; + label-urgent-underline = config.gui.colorscheme.base0F; + label-urgent-padding = padding; + }; + "module/xworkspaces" = { + type = "internal/xworkspaces"; + label-active = "%name%"; + label-active-background = config.gui.colorscheme.base05; + label-active-foreground = config.gui.colorscheme.base01; + label-active-underline = config.gui.colorscheme.base03; + label-active-padding = 1; + label-occupied = "%name%"; + label-occupied-padding = 1; + label-urgent = "%name%"; + label-urgent-background = config.gui.colorscheme.base08; + label-urgent-padding = 1; + label-empty = "%name%"; + label-empty-foreground = config.gui.colorscheme.base06; + label-empty-padding = 1; + }; + "module/xwindow" = { + type = "internal/xwindow"; + label = "%title:0:60:...%"; + }; + # "module/filesystem" = { + # type = "internal/fs"; + # interval = 25; + # mount-0 = "/"; + # label-mounted = "%{F#F0C674}%mountpoint%%{F-} %percentage_used%%"; + # label-unmounted = "%mountpoint% not mounted"; + # label-unmounted-foreground = colors.disabled; + # }; + "module/pulseaudio" = { + type = "internal/pulseaudio"; + # format-volume-prefix = "VOL "; + # format-volume-prefix-foreground = colors.primary; + format-volume = " "; + # format-volume-background = colors.background; + # label-volume-background = colors.background; + format-volume-foreground = config.gui.colorscheme.base0B; + label-volume = "%percentage%%"; + label-muted = "ﱝ ---"; + label-muted-foreground = config.gui.colorscheme.base03; + ramp-volume-0 = ""; + ramp-volume-1 = "墳"; + ramp-volume-2 = ""; + }; + # "module/xkeyboard" = { + # type = "internal/xkeyboard"; + # blacklist-0 = "num lock"; + # label-layout = "%layout%"; + # label-layout-foreground = colors.primary; + # label-indicator-padding = 2; + # label-indicator-margin = 1; + # label-indicator-foreground = colors.background; + # label-indicator-background = colors.secondary; + # }; + # "module/memory" = { + # type = "internal/memory"; + # interval = 2; + # format-prefix = "RAM "; + # format-prefix-foreground = colors.primary; + # label = "%percentage_used:2%%"; + # }; + # "module/cpu" = { + # type = "internal/cpu"; + # interval = 2; + # format-prefix = "CPU "; + # format-prefix-foreground = colors.primary; + # label = "%percentage:2%%"; + # }; + # "network-base" = { + # type = "internal/network"; + # interval = 5; + # format-connected = ""; + # format-disconnected = ""; + # label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected"; + # }; + # "module/wlan" = { + # "inherit" = "network-base"; + # interface-type = "wireless"; + # label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%"; + # }; + # "module/eth" = { + # "inherit" = "network-base"; + # interface-type = "wired"; + # label-connected = "%{F#F0C674}%ifname%%{F-} %local_ip%"; + # }; + "module/date" = { + type = "internal/date"; + interval = 1; + date = "%d %b %l:%M %p"; + date-alt = "%Y-%m-%d %H:%M:%S"; + label = "%date%"; + label-foreground = config.gui.colorscheme.base0A; + # format-background = colors.background; + }; + "settings" = { + screenchange-reload = true; + pseudo-transparency = false; + }; + }; + }; + + xsession.windowManager.i3.config.startup = [{ + command = "systemctl --user restart polybar"; + always = true; + notification = false; + }]; + + }; + }; + +} diff --git a/modules/graphical/rofi.nix b/modules/graphical/rofi.nix new file mode 100644 index 0000000..d82e015 --- /dev/null +++ b/modules/graphical/rofi.nix @@ -0,0 +1,153 @@ +{ config, pkgs, lib, ... }: + +{ + + config = lib.mkIf config.services.xserver.enable { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; + [ + jq # Required for rofi-systemd + ]; + + programs.rofi = { + enable = true; + cycle = true; + location = "center"; + pass = { }; + plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ]; + theme = let + inherit (config.home-manager.users.${config.user}.lib.formats.rasi) + mkLiteral; + in { + + # Inspired by https://github.com/sherubthakur/dotfiles/blob/master/users/modules/desktop-environment/rofi/launcher.rasi + + "*" = { + background-color = mkLiteral config.gui.colorscheme.base00; + foreground-color = mkLiteral config.gui.colorscheme.base07; + text-color = mkLiteral config.gui.colorscheme.base07; + border-color = mkLiteral config.gui.colorscheme.base04; + }; + + # Holds the entire window + "#window" = { + transparency = "real"; + background-color = mkLiteral config.gui.colorscheme.base00; + text-color = mkLiteral config.gui.colorscheme.base07; + border = mkLiteral "4px"; + border-color = mkLiteral config.gui.colorscheme.base04; + border-radius = mkLiteral "4px"; + width = mkLiteral "850px"; + padding = mkLiteral "15px"; + }; + + # Wrapper around bar and results + "#mainbox" = { + background-color = mkLiteral config.gui.colorscheme.base00; + border = mkLiteral "0px"; + border-radius = mkLiteral "0px"; + border-color = mkLiteral config.gui.colorscheme.base04; + children = map mkLiteral [ "inputbar" "listview" ]; + spacing = mkLiteral "10px"; + padding = mkLiteral "10px"; + }; + + # Unknown + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral config.gui.colorscheme.base07; + }; + + # Command prompt left of the input + "#prompt" = { enabled = false; }; + + # Actual text box + "#entry" = { + placeholder-color = mkLiteral config.gui.colorscheme.base03; + expand = true; + horizontal-align = "0"; + placeholder = "Launch Program"; + padding = mkLiteral "0px 0px 0px 5px"; + blink = true; + }; + + # Top bar + "#inputbar" = { + children = map mkLiteral [ "prompt" "entry" ]; + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + padding = mkLiteral "6px"; + }; + + # Results + "#listview" = { + background-color = mkLiteral config.gui.colorscheme.base00; + padding = mkLiteral "0px"; + columns = 1; + lines = 12; + spacing = "5px"; + cycle = true; + dynamic = true; + layout = "vertical"; + }; + + # Each result + "#element" = { + orientation = "vertical"; + border-radius = mkLiteral "0px"; + padding = mkLiteral "5px 0px 5px 5px"; + }; + "#element.selected" = { + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + border-color = mkLiteral config.gui.colorscheme.base07; + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + "#element-text" = { + expand = true; + # horizontal-align = mkLiteral "0.5"; + vertical-align = mkLiteral "0.5"; + margin = mkLiteral "0px 2.5px 0px 2.5px"; + }; + "#element-text.selected" = { + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + # Not sure how to get icons + "#element-icon" = { + size = mkLiteral "18px"; + border = mkLiteral "0px"; + padding = mkLiteral "2px 5px 2px 2px"; + background-color = mkLiteral config.gui.colorscheme.base00; + }; + "#element-icon.selected" = { + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + }; + xoffset = 0; + yoffset = -20; + extraConfig = { + show-icons = true; + kb-cancel = "Escape,Super+space"; + modi = "window,run,ssh,emoji,calc,systemd"; + }; + }; + + }; + + gui.launcherCommand = "${pkgs.rofi}/bin/rofi -show run -modi run"; + gui.systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd"; + gui.altTabCommand = "${pkgs.rofi}/bin/rofi -show window -modi window"; + + }; + +} diff --git a/modules/graphical/rofi/brightness.sh b/modules/graphical/rofi/brightness.sh new file mode 100755 index 0000000..977f433 --- /dev/null +++ b/modules/graphical/rofi/brightness.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# THEME="$HOME/.config/rofi/config.rasi" + +ICON_UP="" +ICON_DOWN="" +ICON_OPT="" +options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN" +chosen="$(echo -e "$options" | rofi -theme-str 'listview { layout:horizontal; }' -dmenu)" +echo "$chosen" diff --git a/modules/graphical/xorg.nix b/modules/graphical/xorg.nix new file mode 100644 index 0000000..cf3c070 --- /dev/null +++ b/modules/graphical/xorg.nix @@ -0,0 +1,65 @@ +{ config, pkgs, lib, ... }: + +let + + gtkTheme = { + name = config.gui.gtk.theme.name; + package = pkgs.${config.gui.gtk.theme.package}; + }; + +in { + + config = lib.mkIf config.gui.enable { + + # Enable the X11 windowing system. + services.xserver = { + enable = config.gui.enable; + + # Enable touchpad support + libinput.enable = true; + + # Login screen + displayManager = { + lightdm = { + enable = config.services.xserver.enable; + background = config.gui.wallpaper; + + # Make the login screen dark + greeters.gtk.theme = gtkTheme; + + }; + }; + + }; + + environment.systemPackages = with pkgs; + [ + xclip # Clipboard + ]; + + # Required for setting GTK theme (for preferred-color-scheme in browser) + services.dbus.packages = [ pkgs.dconf ]; + programs.dconf.enable = true; + + environment.sessionVariables = { GTK_THEME = config.gui.gtk.theme.name; }; + + home-manager.users.${config.user} = { + + programs.fish.shellAliases = { + pbcopy = "xclip -selection clipboard -in"; + pbpaste = "xclip -selection clipboard -out"; + }; + + gtk = let gtkExtraConfig = { gtk-application-prefer-dark-theme = true; }; + in { + enable = true; + theme = gtkTheme; + gtk3.extraConfig = gtkExtraConfig; + gtk4.extraConfig = gtkExtraConfig; + }; + + }; + + }; + +} diff --git a/modules/hardware/audio.nix b/modules/hardware/audio.nix new file mode 100644 index 0000000..31b036b --- /dev/null +++ b/modules/hardware/audio.nix @@ -0,0 +1,77 @@ +{ config, pkgs, lib, ... }: + +let + + # These micro-scripts change the volume while also triggering the volume + # notification widget + + increaseVolume = pkgs.writeShellScriptBin "increaseVolume" '' + ${pkgs.pamixer}/bin/pamixer -i 2 + volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) + ${pkgs.volnoti}/bin/volnoti-show $volume + ''; + + decreaseVolume = pkgs.writeShellScriptBin "decreaseVolume" '' + ${pkgs.pamixer}/bin/pamixer -d 2 + volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) + ${pkgs.volnoti}/bin/volnoti-show $volume + ''; + + toggleMute = pkgs.writeShellScriptBin "toggleMute" '' + ${pkgs.pamixer}/bin/pamixer --toggle-mute + mute=$(${pkgs.pamixer}/bin/pamixer --get-mute) + if [ "$mute" == "true" ]; then + ${pkgs.volnoti}/bin/volnoti-show --mute + else + volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) + ${pkgs.volnoti}/bin/volnoti-show $volume + fi + ''; + +in { + + config = lib.mkIf config.gui.enable { + sound.enable = true; + + # Enable PulseAudio + hardware.pulseaudio.enable = true; + + # These aren't necessary, but helpful for the user + environment.systemPackages = with pkgs; [ + pamixer # Audio control + volnoti # Volume notifications + ]; + + home-manager.users.${config.user} = { + + # Graphical volume notifications + services.volnoti.enable = true; + + xsession.windowManager.i3.config = { + + # Make sure that Volnoti actually starts (home-manager doesn't start + # user daemon's automatically) + startup = [{ + command = "systemctl --user restart volnoti"; + always = true; + notification = false; + }]; + + # i3 keybinds for changing the volume + keybindings = { + "XF86AudioRaiseVolume" = + "exec --no-startup-id ${increaseVolume}/bin/increaseVolume"; + "XF86AudioLowerVolume" = + "exec --no-startup-id ${decreaseVolume}/bin/decreaseVolume"; + "XF86AudioMute" = "exec --no-startup-id ${toggleMute}/bin/toggleMute"; + # We can mute the mic by adding "--default-source" + "XF86AudioMicMute" = + "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute"; + }; + + }; + + }; + }; + +} diff --git a/modules/hardware/boot.nix b/modules/hardware/boot.nix new file mode 100644 index 0000000..7d5a852 --- /dev/null +++ b/modules/hardware/boot.nix @@ -0,0 +1,35 @@ +{ config, ... }: { + + boot.loader = { + grub = { + enable = true; + + # Not sure what this does, but it involves the UEFI/BIOS + efiSupport = true; + + # Check for other OSes and make them available + useOSProber = true; + + # Install GRUB onto the boot disk + # device = config.fileSystems."/boot".device; + + # Don't install GRUB, required for UEFI? + device = "nodev"; + + # Display menu indefinitely if holding shift key + extraConfig = '' + if keystatus --shift ; then + set timeout=-1 + else + set timeout=0 + fi + ''; + }; + + # Always display menu indefinitely; default is 5 seconds + # timeout = null; + + # Allows GRUB to interact with the UEFI/BIOS I guess + efi.canTouchEfiVariables = true; + }; +} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix new file mode 100644 index 0000000..fd15c7e --- /dev/null +++ b/modules/hardware/default.nix @@ -0,0 +1,14 @@ +{ ... }: { + + imports = [ + ./audio.nix + ./boot.nix + ./keyboard.nix + ./monitors.nix + ./mouse.nix + ./networking.nix + ./sleep.nix + ./wifi.nix + ]; + +} diff --git a/modules/hardware/keyboard.nix b/modules/hardware/keyboard.nix new file mode 100644 index 0000000..e5eee1b --- /dev/null +++ b/modules/hardware/keyboard.nix @@ -0,0 +1,16 @@ +{ ... }: { + + services.xserver = { + + layout = "us"; + + # Keyboard responsiveness + autoRepeatDelay = 250; + autoRepeatInterval = 40; + + # Swap escape key with caps lock key + xkbOptions = "eurosign:e,caps:swapescape"; + + }; + +} diff --git a/modules/hardware/monitors.nix b/modules/hardware/monitors.nix new file mode 100644 index 0000000..156848b --- /dev/null +++ b/modules/hardware/monitors.nix @@ -0,0 +1,53 @@ +{ config, pkgs, lib, ... }: { + + # Timezone required for Redshift schedule + imports = [ ../system/timezone.nix ]; + + config = lib.mkIf config.gui.enable { + + environment.systemPackages = with pkgs; + [ + ddcutil # Monitor brightness control + ]; + + # Reduce blue light at night + services.redshift = { + enable = true; + brightness = { + day = "1.0"; + night = "1.0"; + }; + }; + + # Detect monitors (brightness) for ddcutil + hardware.i2c.enable = true; + + # Grant main user access to external monitors + users.users.${config.user}.extraGroups = [ "i2c" ]; + + services.xserver.displayManager = { + + # Put the login screen on the left monitor + lightdm.greeters.gtk.extraConfig = '' + active-monitor=0 + ''; + + # Set up screen position and rotation + setupCommands = '' + ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 \ + --mode 1920x1200 \ + --pos 1920x0 \ + --rotate left \ + --output HDMI-0 \ + --primary \ + --mode 1920x1080 \ + --pos 0x560 \ + --rotate normal \ + --output DVI-0 --off \ + --output DVI-1 --off \ + ''; + }; + + }; + +} diff --git a/modules/hardware/mouse.nix b/modules/hardware/mouse.nix new file mode 100644 index 0000000..cb3d7f5 --- /dev/null +++ b/modules/hardware/mouse.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: { + + config = lib.mkIf config.gui.enable { + + # Mouse customization + services.ratbagd.enable = true; + + environment.systemPackages = with pkgs; [ + libratbag # Mouse adjustments + piper # Mouse adjustments GUI + ]; + + services.xserver.libinput.mouse = { + # Disable mouse acceleration + accelProfile = "flat"; + accelSpeed = "1.15"; + }; + + }; + +} diff --git a/modules/hardware/networking.nix b/modules/hardware/networking.nix new file mode 100644 index 0000000..4fb79a6 --- /dev/null +++ b/modules/hardware/networking.nix @@ -0,0 +1,10 @@ +{ ... }: { + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + networking.interfaces.enp0s31f6.useDHCP = true; + networking.interfaces.wlp3s0.useDHCP = true; + +} diff --git a/modules/hardware/sleep.nix b/modules/hardware/sleep.nix new file mode 100644 index 0000000..3b7d4bb --- /dev/null +++ b/modules/hardware/sleep.nix @@ -0,0 +1,8 @@ +{ ... }: { + + # Prevent wake from keyboard + powerManagement.powerDownCommands = '' + for wakeup in /sys/bus/usb/devices/1-*/power/wakeup; do echo disabled > $wakeup; done + ''; + +} diff --git a/modules/hardware/wifi.nix b/modules/hardware/wifi.nix new file mode 100644 index 0000000..290044e --- /dev/null +++ b/modules/hardware/wifi.nix @@ -0,0 +1,9 @@ +{ ... }: { + + # Enables wireless support via wpa_supplicant. + networking.wireless.enable = true; + + # Allows the user to control the WiFi settings. + networking.wireless.userControlled.enable = true; + +} diff --git a/modules/mail/himalaya.nix b/modules/mail/himalaya.nix new file mode 100644 index 0000000..f8e7475 --- /dev/null +++ b/modules/mail/himalaya.nix @@ -0,0 +1,88 @@ +{ config, pkgs, lib, ... }: { + + options = { + mailServer = lib.mkOption { + type = lib.types.str; + description = "Server name for the email address."; + }; + }; + + config = { + + home-manager.users.${config.user} = { + + programs.himalaya = { enable = true; }; + programs.mbsync = { enable = true; }; + services.mbsync = lib.mkIf pkgs.stdenv.isLinux { + enable = true; + frequency = "*:0/5"; + }; + + accounts.email = { + maildirBasePath = "$HOME/mail"; + accounts = { + home = let address = "${config.user}@${config.mailServer}"; + in { + userName = address; + realName = config.fullName; + primary = true; + inherit address; + aliases = map (mailUser: "${mailUser}@${config.mailServer}") [ + "me" + "hey" + "admin" + ]; + alot = { }; + flavor = "plain"; + folders = { }; + getmail = { }; + himalaya = { + enable = true; + settings = { + downloads-dir = config.userDirs.download; + smtp-insecure = true; + }; + }; + imap = { + host = "imap.purelymail.com"; + port = 993; + tls.enable = true; + }; + imapnotify = { + enable = false; + boxes = [ ]; + onNotify = ""; + onNotifyPost = ""; + }; + maildir = { path = "main"; }; + mbsync = { + enable = true; + create = "maildir"; + expunge = "none"; + remove = "none"; + patterns = [ "*" ]; + extraConfig.channel = { + CopyArrivalDate = "yes"; # Sync time of original message + }; + }; + mu.enable = false; + notmuch.enable = false; + passwordCommand = + "${pkgs.age}/bin/age --decrypt --identity ${config.homePath}/.ssh/id_ed25519 ${ + builtins.toString ./mailpass.age + }"; + smtp = { + host = "smtp.purelymail.com"; + port = 465; + tls.enable = true; + }; + }; + }; + }; + + programs.fish.shellAbbrs = { hi = "himalaya"; }; + + }; + + }; +} diff --git a/modules/mail/mailpass.age b/modules/mail/mailpass.age new file mode 100644 index 0000000..d422efa --- /dev/null +++ b/modules/mail/mailpass.age @@ -0,0 +1,5 @@ +age-encryption.org/v1 +-> ssh-ed25519 MgHaOw 8h/ESNjn0gknNXoHM34UobHzPgmRunoP97H+KHOuGQM +qowH+6TlCRECGCscRgKx6kswY+PZezYUD6E+x9e+5pM +--- kFj1JzRdh/D13Uq9aNTzMJIFysEE+kzzthjewOIR2+o +Ȳ6}rCz >&=jW ^Wl!"}MS8=xm =ЇL \ No newline at end of file diff --git a/modules/services/gnupg.nix b/modules/services/gnupg.nix new file mode 100644 index 0000000..d36f262 --- /dev/null +++ b/modules/services/gnupg.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: { + + home-manager.users.${config.user} = { + programs.gpg.enable = true; + services.gpg-agent = { + enable = true; + defaultCacheTtl = 86400; # Resets when used + defaultCacheTtlSsh = 86400; # Resets when used + maxCacheTtl = 34560000; # Can never reset + maxCacheTtlSsh = 34560000; # Can never reset + pinentryFlavor = "tty"; + }; + home = lib.mkIf config.gui.enable { packages = with pkgs; [ pinentry ]; }; + }; + +} diff --git a/modules/services/keybase.nix b/modules/services/keybase.nix new file mode 100644 index 0000000..a30fc70 --- /dev/null +++ b/modules/services/keybase.nix @@ -0,0 +1,28 @@ +{ config, pkgs, lib, ... }: { + + services.keybase.enable = true; + services.kbfs = { + enable = true; + # enableRedirector = true; + mountPoint = "/run/user/1000/keybase/kbfs"; + }; + security.wrappers.keybase-redirector = { + setuid = true; + owner = "root"; + group = "root"; + source = "${pkgs.kbfs}/bin/redirector"; + }; + + home-manager.users.${config.user} = { + home.packages = [ (lib.mkIf config.gui.enable pkgs.keybase-gui) ]; + home.file = let + ignorePatterns = '' + keybase/ + kbfs/''; + in { + ".rgignore".text = ignorePatterns; + ".fdignore".text = ignorePatterns; + }; + }; + +} diff --git a/modules/services/mullvad.nix b/modules/services/mullvad.nix new file mode 100644 index 0000000..bdf844e --- /dev/null +++ b/modules/services/mullvad.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + + services.mullvad-vpn.enable = true; + environment.systemPackages = [ pkgs.mullvad-vpn ]; + +} diff --git a/modules/services/wireguard.nix b/modules/services/wireguard.nix new file mode 100644 index 0000000..34af565 --- /dev/null +++ b/modules/services/wireguard.nix @@ -0,0 +1,18 @@ +{ ... }: { + networking.wireguard = { + enable = true; + interfaces = { + wg0 = { + ips = [ "10.66.127.235/32" "fc00:bbbb:bbbb:bb01::3:7fea/128" ]; + generatePrivateKeyFile = true; + privateKeyFile = "/private/wireguard/wg0"; + peers = [{ + publicKey = "cVDIYPzNChIeANp+0jE12kWM5Ga1MbmNErT1Pmaf12A="; + allowedIPs = [ "0.0.0.0/0" "::0/0" ]; + endpoint = "89.46.62.197:51820"; + persistentKeepalive = 25; + }]; + }; + }; + }; +} diff --git a/modules/shell/age.nix b/modules/shell/age.nix new file mode 100644 index 0000000..338be8e --- /dev/null +++ b/modules/shell/age.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: { + + home-manager.users.${config.user}.home.packages = with pkgs; [ age ]; + +} diff --git a/modules/shell/default.nix b/modules/shell/default.nix new file mode 100644 index 0000000..ad74629 --- /dev/null +++ b/modules/shell/default.nix @@ -0,0 +1,12 @@ +{ ... }: { + imports = [ + ./age.nix + ./direnv.nix + ./fish + ./fzf.nix + ./git.nix + ./github.nix + ./starship.nix + ./utilities.nix + ]; +} diff --git a/modules/shell/direnv.nix b/modules/shell/direnv.nix new file mode 100644 index 0000000..90d06ea --- /dev/null +++ b/modules/shell/direnv.nix @@ -0,0 +1,9 @@ +{ config, ... }: { + + home-manager.users.${config.user}.programs.direnv = { + enable = true; + nix-direnv.enable = true; + config = { whitelist = { prefix = [ config.dotfilesPath ]; }; }; + }; + +} diff --git a/modules/shell/fish/default.nix b/modules/shell/fish/default.nix new file mode 100644 index 0000000..c81d49f --- /dev/null +++ b/modules/shell/fish/default.nix @@ -0,0 +1,155 @@ +{ config, pkgs, lib, ... }: { + + users.users.${config.user}.shell = pkgs.fish; + programs.fish.enable = + true; # Needed for LightDM to remember username (TODO: fix) + + home-manager.users.${config.user} = { + + # Packages used in abbreviations and aliases + home.packages = with pkgs; [ curl ]; + + programs.fish = { + enable = true; + functions = { + commandline-git-commits = { + description = "Insert commit into commandline"; + body = builtins.readFile ./functions/commandline-git-commits.fish; + }; + copy = { + description = "Copy file contents into clipboard"; + body = "cat $argv | pbcopy"; # Need to fix for non-macOS + }; + edit = { + description = "Open a file in Vim"; + body = builtins.readFile ./functions/edit.fish; + }; + envs = { + description = "Evaluate a bash-like environment variables file"; + body = ''set -gx (cat $argv | tr "=" " " | string split ' ')''; + }; + fcd = { + description = "Jump to directory"; + argumentNames = "directory"; + body = builtins.readFile ./functions/fcd.fish; + }; + fish_user_key_bindings = { + body = builtins.readFile ./functions/fish_user_key_bindings.fish; + }; + ip = { body = builtins.readFile ./functions/ip.fish; }; + json = { + description = "Tidy up JSON using jq"; + body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS + }; + ls = { body = "${pkgs.exa}/bin/exa $argv"; }; + note = { + description = "Edit or create a note"; + argumentNames = "filename"; + body = builtins.readFile ./functions/note.fish; + }; + recent = { + description = "Open a recent file in Vim"; + body = builtins.readFile ./functions/recent.fish; + }; + syncnotes = { + description = "Full git commit on notes"; + body = builtins.readFile ./functions/syncnotes.fish; + }; + }; + interactiveShellInit = '' + fish_vi_key_bindings + bind yy fish_clipboard_copy + bind Y fish_clipboard_copy + bind -M visual y fish_clipboard_copy + bind -M default p fish_clipboard_paste + set -g fish_vi_force_cursor + set -g fish_cursor_default block + set -g fish_cursor_insert line + set -g fish_cursor_visual block + set -g fish_cursor_replace_one underscore + ''; + loginShellInit = ""; + shellAliases = { }; + shellAbbrs = { + + # Directory aliases + l = "ls -lh"; + lh = "ls -lh"; + ll = "ls -alhF"; + la = "ls -a"; + c = "cd"; + "-" = "cd -"; + mkd = "mkdir -pv"; + + # System + s = "sudo"; + sc = "systemctl"; + scs = "systemctl status"; + m = "make"; + + # Tmux + ta = "tmux attach-session"; + tan = "tmux attach-session -t noah"; + tnn = "tmux new-session -s noah"; + + # Vim (overwritten by Neovim) + v = "vim"; + vl = "vim -c 'normal! `0'"; + + # Notes + sn = "syncnotes"; + + # Fun CLI Tools + weather = "curl wttr.in/$WEATHER_CITY"; + moon = "curl wttr.in/Moon"; + + # Cheat Sheets + ssl = + "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr"; + fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -"; + publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub"; + forloop = "for i in (seq 1 100)"; + + # Docker + dc = "$DOTS/bin/docker_cleanup"; + dr = "docker run --rm -it"; + db = "docker build . -t"; + + # Terraform + te = "terraform"; + + # Kubernetes + k = "kubectl"; + pods = "kubectl get pods -A"; + nodes = "kubectl get nodes"; + deploys = "kubectl get deployments -A"; + dash = "kube-dashboard"; + ks = "k9s"; + + # Python + py = "python"; + po = "poetry"; + pr = "poetry run python"; + + # Rust + ca = "cargo"; + + }; + shellInit = ""; + }; + + home.sessionVariables.fish_greeting = ""; + + programs.starship.enableFishIntegration = true; + programs.zoxide.enableFishIntegration = true; + programs.fzf.enableFishIntegration = true; + + # Provides "command-not-found" options + # Requires activating a manual download + programs.nix-index = { + enable = true; + enableFishIntegration = true; + }; + + }; +} diff --git a/modules/shell/fish/functions/commandline-git-commits.fish b/modules/shell/fish/functions/commandline-git-commits.fish new file mode 100644 index 0000000..f883560 --- /dev/null +++ b/modules/shell/fish/functions/commandline-git-commits.fish @@ -0,0 +1,6 @@ +set commit (git-commits) +if [ $commit ] + commandline -i "$commit" +else + commandline -i HEAD +end diff --git a/modules/shell/fish/functions/edit.fish b/modules/shell/fish/functions/edit.fish new file mode 100644 index 0000000..fbe13b0 --- /dev/null +++ b/modules/shell/fish/functions/edit.fish @@ -0,0 +1,4 @@ +set vimfile (fzf) +and set vimfile (echo $vimfile | tr -d '\r') +and commandline -r "vim $vimfile" +and commandline -f execute diff --git a/modules/shell/fish/functions/fcd.fish b/modules/shell/fish/functions/fcd.fish new file mode 100644 index 0000000..dd48ff9 --- /dev/null +++ b/modules/shell/fish/functions/fcd.fish @@ -0,0 +1,10 @@ +if test -z $directory + set directory "$HOME" +end +if ! test -d $directory + echo "Directory not found: $directory" + return 1 +end +set jump (fd -t d . $directory | fzf) +and cd $jump $argv +and commandline -f execute diff --git a/modules/shell/fish/functions/fish_user_key_bindings.fish b/modules/shell/fish/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..a083736 --- /dev/null +++ b/modules/shell/fish/functions/fish_user_key_bindings.fish @@ -0,0 +1,14 @@ +bind -M insert \co edit +bind -M default \co edit +bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute' +bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute' +bind -M insert \ce recent +bind -M default \ce recent +bind -M insert \cg commandline-git-commits +bind -M insert \cG 'commandline -i (git rev-parse --show-toplevel 2>/dev/null || echo ".")' +bind -M insert \cf fcd +bind -M default \cf fcd +bind -M insert \cp projects +bind -M default \cp projects +bind -M insert \x1F accept-autosuggestion +bind -M default \x1F accept-autosuggestion diff --git a/fish.configlink/functions/fish_vi_cursor.fish b/modules/shell/fish/functions/fish_vi_cursor.fish similarity index 100% rename from fish.configlink/functions/fish_vi_cursor.fish rename to modules/shell/fish/functions/fish_vi_cursor.fish diff --git a/modules/shell/fish/functions/git-add-fuzzy.fish b/modules/shell/fish/functions/git-add-fuzzy.fish new file mode 100644 index 0000000..9e9f641 --- /dev/null +++ b/modules/shell/fish/functions/git-add-fuzzy.fish @@ -0,0 +1,14 @@ +set gitfile (git status -s \ + | fzf \ + --height 50% \ + -m \ + --preview-window right:70% \ + --layout reverse \ + --preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end') +and for gf in $gitfile + set gf (echo $gf \ + | awk '{$1=$1};1' \ + | cut -d' ' -f2 \ + ) + and git add $gf +end diff --git a/modules/shell/fish/functions/git-commits.fish b/modules/shell/fish/functions/git-commits.fish new file mode 100644 index 0000000..ce2b7fd --- /dev/null +++ b/modules/shell/fish/functions/git-commits.fish @@ -0,0 +1,8 @@ +set commitline (git log \ + --pretty="format:%C(auto)%ar %h%d %s" \ + | fzf \ + --height 50% \ + --preview 'git show --color=always (echo {} | cut -d" " -f4)' \ + ) +and set commit (echo $commitline | cut -d" " -f4) +and echo $commit diff --git a/modules/shell/fish/functions/git-fuzzy-branch.fish b/modules/shell/fish/functions/git-fuzzy-branch.fish new file mode 100644 index 0000000..374b992 --- /dev/null +++ b/modules/shell/fish/functions/git-fuzzy-branch.fish @@ -0,0 +1,10 @@ +set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n') +set -l branch (git branch \ + --format "%(refname:short)" \ + | fzf \ + --height 50% \ + --header="On $current, $header" \ + --preview-window right:70% \ + --preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \ + ) +and echo $branch diff --git a/modules/shell/fish/functions/git-history.fish b/modules/shell/fish/functions/git-history.fish new file mode 100644 index 0000000..fc7e252 --- /dev/null +++ b/modules/shell/fish/functions/git-history.fish @@ -0,0 +1,14 @@ +if not count $argv >/dev/null + echo "Must provide filename." + return 1 +end +set commitline ( git log \ + --follow \ + --pretty="format:%C(auto)%ar %h%d %s" \ + -- ./$argv \ + | fzf \ + --height 100% \ + --preview "git diff --color=always (echo {} | cut -d' ' -f4)^1..(echo {} | cut -d' ' -f4) -- ./$argv" \ + ) +and set commit (echo $commitline | cut -d" " -f4) +and echo $commit diff --git a/modules/shell/fish/functions/git-push-upstream.fish b/modules/shell/fish/functions/git-push-upstream.fish new file mode 100644 index 0000000..95bfcbe --- /dev/null +++ b/modules/shell/fish/functions/git-push-upstream.fish @@ -0,0 +1,6 @@ +set -l branch (git branch 2>/dev/null | grep '^\*' | colrm 1 2) +and set -l command "git push --set-upstream origin $branch" +and commandline -r $command +and commandline -f execute +and echo "git push --set-upstream origin $branch" +and git push --set-upstream origin $branch diff --git a/modules/shell/fish/functions/git-show-fuzzy.fish b/modules/shell/fish/functions/git-show-fuzzy.fish new file mode 100644 index 0000000..44da9f9 --- /dev/null +++ b/modules/shell/fish/functions/git-show-fuzzy.fish @@ -0,0 +1,6 @@ +set commitline (git log \ + --pretty="format:%C(auto)%ar %h%d %s" \ + | fzf \ + ) +and set commit (echo $commitline | cut -d" " -f4 ) +and git show $commit diff --git a/modules/shell/fish/functions/git.fish b/modules/shell/fish/functions/git.fish new file mode 100644 index 0000000..be63ae0 --- /dev/null +++ b/modules/shell/fish/functions/git.fish @@ -0,0 +1,37 @@ +if contains f $argv + switch $argv[1] + case checkout + git-checkout-fuzzy + case add + git-add-fuzzy + case show + git-show-fuzzy + case merge + git-merge-fuzzy + case branch + if test "$argv[2]" = -d + git-delete-fuzzy + else if test "$argv[2]" = -D + git-force-delete-fuzzy + else + echo "Not a fuzzy option." + return 1 + end + case reset + set commit (git-commits) + and if test "$argv[2]" = --hard + git reset --hard $commit + else + git reset $commit + end + case "*" + echo "No fuzzy option." + return 1 + end +else + if count $argv >/dev/null + command git $argv + else + command git status -sb + end +end diff --git a/modules/shell/fish/functions/ip.fish b/modules/shell/fish/functions/ip.fish new file mode 100644 index 0000000..1808915 --- /dev/null +++ b/modules/shell/fish/functions/ip.fish @@ -0,0 +1,5 @@ +if count $argv >/dev/null + curl ipinfo.io/$argv +else + curl checkip.amazonaws.com +end diff --git a/modules/shell/fish/functions/note.fish b/modules/shell/fish/functions/note.fish new file mode 100644 index 0000000..58d1e29 --- /dev/null +++ b/modules/shell/fish/functions/note.fish @@ -0,0 +1,8 @@ +if test -n "$filename" + vim $NOTES_PATH/$filename.md +else + set file (ls $NOTES_PATH | fzf) + if [ $status -eq 0 ] + vim $NOTES_PATH/$file + end +end diff --git a/modules/shell/fish/functions/recent.fish b/modules/shell/fish/functions/recent.fish new file mode 100644 index 0000000..d3d1c40 --- /dev/null +++ b/modules/shell/fish/functions/recent.fish @@ -0,0 +1,4 @@ +set vimfile (fd -t f --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf) +and set vimfile (echo $vimfile | tr -d '\r') +and commandline -r "vim $vimfile" +and commandline -f execute diff --git a/modules/shell/fish/functions/syncnotes.fish b/modules/shell/fish/functions/syncnotes.fish new file mode 100644 index 0000000..70ce739 --- /dev/null +++ b/modules/shell/fish/functions/syncnotes.fish @@ -0,0 +1,7 @@ +set current_dir $PWD +cd $NOTES_PATH +git pull +git add -A +git commit -m autosync +git push +cd $current_dir diff --git a/modules/shell/fish/functions/uncommitted.fish b/modules/shell/fish/functions/uncommitted.fish new file mode 100644 index 0000000..4e4fcc9 --- /dev/null +++ b/modules/shell/fish/functions/uncommitted.fish @@ -0,0 +1,11 @@ +set current_dir (pwd) +cd $HOME/dev +find . -type d -name '.git' | while read dir + cd $dir/../ + and if test -n (echo (git status -s)) + pwd + git status -s + end + cd - +end +cd $current_dir diff --git a/modules/shell/fzf.nix b/modules/shell/fzf.nix new file mode 100644 index 0000000..2e3d099 --- /dev/null +++ b/modules/shell/fzf.nix @@ -0,0 +1,31 @@ +{ config, ... }: { + + home-manager.users.${config.user} = { + + programs.fzf.enable = true; + + programs.fish = { + functions = { + projects = { + description = "Jump to a project"; + body = '' + set projdir (ls ${config.homePath}/dev/personal | fzf) + and cd ${config.homePath}/dev/personal/$projdir + and commandline -f execute + ''; + }; + }; + shellAbbrs = { lf = "ls -lh | fzf"; }; + }; + + # Global fzf configuration + home.sessionVariables = let fzfCommand = "fd --type file"; + in { + FZF_DEFAULT_COMMAND = fzfCommand; + FZF_CTRL_T_COMMAND = fzfCommand; + FZF_DEFAULT_OPTS = "-m --height 50% --border"; + }; + + }; + +} diff --git a/modules/shell/git.nix b/modules/shell/git.nix new file mode 100644 index 0000000..3851f83 --- /dev/null +++ b/modules/shell/git.nix @@ -0,0 +1,125 @@ +{ config, pkgs, lib, ... }: + +let home-packages = config.home-manager.users.${config.user}.home.packages; + +in { + + options = { + fullName = lib.mkOption { + type = lib.types.str; + description = "Human readable name of the user"; + }; + gitEmail = lib.mkOption { + type = lib.types.str; + description = "Email to use for git commits"; + }; + }; + + config = { + + home-manager.users.root.programs.git = { + enable = true; + extraConfig.safe.directory = config.dotfilesPath; + }; + + home-manager.users.${config.user} = { + programs.git = { + enable = true; + userName = config.fullName; + userEmail = config.gitEmail; + extraConfig = { + pager = { branch = "false"; }; + safe = { directory = config.dotfilesPath; }; + pull = { ff = "only"; }; + init = { defaultBranch = "master"; }; + }; + }; + + programs.fish.shellAbbrs = { + g = "git"; + gs = "git status"; + gd = "git diff"; + gds = "git diff --staged"; + gdp = "git diff HEAD^"; + ga = "git add"; + gaa = "git add -A"; + gac = "git commit -am"; + gc = "git commit -m"; + gca = "git commit --amend --no-edit"; + gcae = "git commit --amend"; + gu = "git pull"; + gp = "git push"; + gpp = "git-push-upstream"; + gl = "git log --graph --decorate --oneline -20"; + gll = "git log --graph --decorate --oneline"; + gco = "git checkout"; + gcom = '' + git switch (git symbolic-ref refs/remotes/origin/HEAD | cut -d"/" -f4)''; + gcob = "git switch -c"; + gb = "git branch"; + gbd = "git branch -d"; + gbD = "git branch -D"; + gr = "git reset"; + grh = "git reset --hard"; + gm = "git merge"; + gcp = "git cherry-pick"; + cdg = "cd (git rev-parse --show-toplevel)"; + }; + + programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages + && builtins.elem pkgs.bat home-packages) { + git = { body = builtins.readFile ./fish/functions/git.fish; }; + git-add-fuzzy = { + body = builtins.readFile ./fish/functions/git-add-fuzzy.fish; + }; + git-fuzzy-branch = { + argumentNames = "header"; + body = builtins.readFile ./fish/functions/git-fuzzy-branch.fish; + }; + git-checkout-fuzzy = { + body = '' + set branch (git-fuzzy-branch "checkout branch...") + and git checkout $branch + ''; + }; + git-delete-fuzzy = { + body = '' + set branch (git-fuzzy-branch "delete branch...") + and git branch -d $branch + ''; + }; + git-force-delete-fuzzy = { + body = '' + set branch (git-fuzzy-branch "force delete branch...") + and git branch -D $branch + ''; + }; + git-merge-fuzzy = { + body = '' + set branch (git-fuzzy-branch "merge from...") + and git merge $branch + ''; + }; + git-show-fuzzy = { + body = builtins.readFile ./fish/functions/git-show-fuzzy.fish; + }; + git-commits = { + body = builtins.readFile ./fish/functions/git-commits.fish; + }; + git-history = { + body = builtins.readFile ./fish/functions/git-history.fish; + }; + git-push-upstream = { + description = "Create upstream branch"; + body = builtins.readFile ./fish/functions/git-push-upstream.fish; + }; + uncommitted = { + description = "Find uncommitted git repos"; + body = builtins.readFile ./fish/functions/uncommitted.fish; + }; + }; + }; + + }; + +} diff --git a/modules/shell/github.nix b/modules/shell/github.nix new file mode 100644 index 0000000..1fbe9e4 --- /dev/null +++ b/modules/shell/github.nix @@ -0,0 +1,36 @@ +{ config, pkgs, lib, ... }: { + + home-manager.users.${config.user} = { + + programs.gh = + lib.mkIf config.home-manager.users.${config.user}.programs.git.enable { + enable = true; + enableGitCredentialHelper = true; + settings.git_protocol = "https"; + }; + + programs.fish = + lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable { + shellAbbrs = { + ghr = "gh repo view -w"; + gha = + "gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view"; + grw = "gh run watch"; + grf = "gh run view --log-failed"; + grl = "gh run view --log"; + }; + functions = { + repos = { + description = "Clone GitHub repositories"; + argumentNames = "organization"; + body = '' + set directory (gh-repos $organization) + and cd $directory + ''; + }; + }; + }; + + }; + +} diff --git a/modules/shell/starship.nix b/modules/shell/starship.nix new file mode 100644 index 0000000..f69c343 --- /dev/null +++ b/modules/shell/starship.nix @@ -0,0 +1,54 @@ +{ config, lib, ... }: { + + home-manager.users.${config.user}.programs.starship = { + enable = true; + settings = { + add_newline = false; # Don't print new line at the start of the prompt + format = lib.concatStrings [ + "$directory" + "$git_branch" + "$git_commit" + "$git_status" + "$python" + "$cmd_duration" + "$character" + ]; + character = { + success_symbol = "[❯](bold green)"; + error_symbol = "[❯](bold red)"; + vicmd_symbol = "[❮](bold green)"; + }; + cmd_duration = { + min_time = 5000; + show_notifications = true; + min_time_to_notify = 30000; + format = "[$duration]($style) "; + }; + directory = { + truncate_to_repo = true; + truncation_length = 100; + }; + git_branch = { format = "[$symbol$branch]($style)"; }; + git_commit = { + format = "( @ [$hash]($style) )"; + only_detached = false; + }; + git_status = { + format = "([$all_status$ahead_behind]($style) )"; + conflicted = "="; + ahead = "⇡"; + behind = "⇣"; + diverged = "⇕"; + untracked = "⋄"; + stashed = "⩮"; + modified = "∽"; + staged = "+"; + renamed = "»"; + deleted = "✘"; + style = "red"; + }; + python = { format = "[\\($virtualenv\\)]($style)"; }; + }; + }; + +} diff --git a/modules/shell/utilities.nix b/modules/shell/utilities.nix new file mode 100644 index 0000000..5053c8f --- /dev/null +++ b/modules/shell/utilities.nix @@ -0,0 +1,61 @@ +{ config, pkgs, ... }: + +let + + ignorePatterns = '' + !.env* + !.github/ + !.gitignore + !*.tfvars + .terraform/ + .target/ + /Library/''; + +in { + + home-manager.users.${config.user} = { + + home.packages = with pkgs; [ + unzip # Extract zips + rsync # Copy folders + ripgrep # grep + bat # cat + fd # find + sd # sed + jq # JSON manipulation + tealdeer # Cheatsheets + tree # View directory hierarchy + htop # Show system processes + glow # Pretty markdown previews + qrencode # Generate qr codes + vimv # Batch rename files + dig # DNS lookup + ]; + + programs.zoxide.enable = true; # Shortcut jump command + + home.file = { + ".rgignore".text = ignorePatterns; + ".fdignore".text = ignorePatterns; + ".digrc".text = "+noall +answer"; # Cleaner dig commands + }; + + programs.fish.shellAbbrs = { + cat = "bat"; # Swap cat with bat + }; + + programs.fish.functions = { + ping = { + description = "Improved ping"; + argumentNames = "target"; + body = "${pkgs.prettyping}/bin/prettyping --nolegend $target"; + }; + qr = { + body = + "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | open /tmp/qr.png"; # Fix for non-macOS + }; + }; + + }; + +} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..0a8574e --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,8 @@ +{ ... }: { + + imports = [ ./user.nix ./timezone.nix ./doas.nix ]; + + # Pin a state version to prevent warnings + system.stateVersion = "22.11"; + +} diff --git a/modules/system/doas.nix b/modules/system/doas.nix index 3fdcdef..bbe48b8 100644 --- a/modules/system/doas.nix +++ b/modules/system/doas.nix @@ -2,27 +2,29 @@ { config, ... }: { - config = { - security = { + security = { - # Remove sudo - sudo.enable = false; + # Remove sudo + sudo.enable = false; - # Add doas - doas = { - enable = true; + # Add doas + doas = { + enable = true; - # No password required - wheelNeedsPassword = false; + # No password required + wheelNeedsPassword = false; - # Pass environment variables from user to root - # Also requires removing password here - extraRules = [{ - groups = [ "wheel" ]; - noPass = true; - keepEnv = true; - }]; - }; + # Pass environment variables from user to root + # Also requires removing password here + extraRules = [{ + groups = [ "wheel" ]; + noPass = true; + keepEnv = true; + }]; }; }; + + home-manager.users.${config.user}.programs.fish.shellAliases = { + sudo = "doas"; + }; } diff --git a/modules/system/installer.nix b/modules/system/installer.nix new file mode 100644 index 0000000..e49d5bb --- /dev/null +++ b/modules/system/installer.nix @@ -0,0 +1,44 @@ +{ pkgs, ... }: { + + # Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix + # This script will partition and format drives; use at your own risk! + + type = "app"; + + program = pkgs.writeShellScriptBin "installer" '' + #!${pkgs.stdenv.shell} + + set -e + + DISK=$1 + FLAKE=$2 + PARTITION_PREFIX="" + + if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then + echo "Missing required parameter." + echo "Usage: installer -- " + echo "Example: installer -- nvme0n1 desktop" + echo "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop" + echo "(exiting)" + exit 1 + fi + + case "$DISK" in nvme*) + PARTITION_PREFIX="p" + esac + + parted /dev/''${DISK} -- mklabel gpt + parted /dev/''${DISK} -- mkpart primary 512MiB 100% + parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB + parted /dev/''${DISK} -- set 3 esp on + mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1 + mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2 + + mount /dev/disk/by-label/nixos /mnt + mkdir --parents /mnt/boot + mount /dev/disk/by-label/boot /mnt/boot + + nixos-install --flake github:nmasur/dotfiles#''${FLAKE} + ''; + +} diff --git a/modules/system/timezone.nix b/modules/system/timezone.nix index 7af7da6..896af0b 100644 --- a/modules/system/timezone.nix +++ b/modules/system/timezone.nix @@ -1,14 +1,15 @@ -{ config, ... }: +{ ... }: { -{ - config = { + # Service to determine location for time zone + services.geoclue2.enable = true; + services.geoclue2.enableWifi = false; # Breaks when it can't connect + location = { provider = "geoclue2"; }; - # Service to determine location for time zone - services.geoclue2.enable = true; - location = { provider = "geoclue2"; }; + # Enable local time based on time zone + services.localtimed.enable = true; - # Enable local time based on time zone - services.localtime.enable = true; + # Required to get localtimed to talk to geoclue2 + services.geoclue2.appConfig.localtimed.isSystem = true; + services.geoclue2.appConfig.localtimed.isAllowed = true; - }; } diff --git a/modules/system/user.nix b/modules/system/user.nix new file mode 100644 index 0000000..9d42048 --- /dev/null +++ b/modules/system/user.nix @@ -0,0 +1,50 @@ +{ config, lib, ... }: { + + options = { + + passwordHash = lib.mkOption { + type = lib.types.str; + description = "Password created with mkpasswd -m sha-512"; + }; + + }; + + config = { + + # Allows us to declaritively set password + users.mutableUsers = false; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${config.user} = { + + # Create a home directory for human user + isNormalUser = true; + + # Automatically create a password to start + hashedPassword = config.passwordHash; + + extraGroups = [ + "wheel" # Sudo privileges + ]; + + }; + + home-manager.users.${config.user}.xdg = { + userDirs = { + enable = true; + createDirectories = true; + documents = "$HOME/documents"; + download = config.userDirs.download; + music = "$HOME/media/music"; + pictures = "$HOME/media/images"; + videos = "$HOME/media/videos"; + desktop = "$HOME/other/desktop"; + publicShare = "$HOME/other/public"; + templates = "$HOME/other/templates"; + extraConfig = { XDG_DEV_DIR = "$HOME/dev"; }; + }; + }; + + }; + +} diff --git a/mpv.configlink/mpv.conf b/mpv.configlink/mpv.conf deleted file mode 100644 index 46fa013..0000000 --- a/mpv.configlink/mpv.conf +++ /dev/null @@ -1,8 +0,0 @@ -#script-opts=ytdl_hook-ytdl_path=/usr/local/bin/yt-dlp - -[Youtube-dl] -profile = protocol.https -ytdl-format = bestvideo[height<=?1080]+bestaudio/best[height<=?1080] -demuxer-seekable-cache = yes -demuxer-max-bytes = 2048MiB -demuxer-max-back-bytes = 1024MiB diff --git a/nixos/Makefile b/nixos/Makefile deleted file mode 100644 index 7ab1371..0000000 --- a/nixos/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# Show these options -default: - @echo "sudo make bootstrap -- Install from scratch" - @echo "make channels -- Set intended software channels" - @echo "make system -- Update system config" - @echo "make home -- Update home config" - -# Bootstrap from nothing -bootstrap: - nix-channel --add https://nixos.org/channels/nixos-unstable - nix-channel --add https://nixos.org/channels/nixpkgs-unstable - nix-channel --update - nixos-rebuild switch -I nixos-config=./configuration.nix - -# Use intended software channels -channels: - doas nix-channel --add https://nixos.org/channels/nixos-unstable - doas nix-channel --add https://nixos.org/channels/nixpkgs-unstable - doas nix-channel --update - -# Update the system -system: - doas nixos-rebuild switch -I nixos-config=./configuration.nix - -# Update the user environment -home: - home-manager switch -f ./home.nix - -upgrade: - nix-channel --update - nixos-rebuild switch -I nixos-config=./configuration.nix --upgrade - -prune: - nix-env --delete-generations 14d - nix-collect-garbage --delete-old diff --git a/nixos/awesomerc.lua b/nixos/awesomerc.lua deleted file mode 100644 index a8de26f..0000000 --- a/nixos/awesomerc.lua +++ /dev/null @@ -1,564 +0,0 @@ --- If LuaRocks is installed, make sure that packages installed through it are --- found (e.g. lgi). If LuaRocks is not installed, do nothing. -pcall(require, "luarocks.loader") - --- Standard awesome library -local gears = require("gears") -local awful = require("awful") -require("awful.autofocus") --- Widget and layout library -local wibox = require("wibox") --- Theme handling library -local beautiful = require("beautiful") --- Notification library -local naughty = require("naughty") -local menubar = require("menubar") -local hotkeys_popup = require("awful.hotkeys_popup") --- Enable hotkeys help widget for VIM and other apps --- when client with a matching name is opened: -require("awful.hotkeys_popup.keys") - --- {{{ Variable definitions --- Themes define colours, icons, font and wallpapers. -beautiful.init(gears.filesystem.get_themes_dir() .. "zenburn/theme.lua") - --- This is used later as the default terminal and editor to run. -terminal = "alacritty" -editor = os.getenv("EDITOR") or "vim" -editor_cmd = terminal .. " -e " .. editor - --- Default modkey. --- Usually, Mod4 is the key with a logo between Control and Alt. --- If you do not like this or do not have such a key, --- I suggest you to remap Mod4 to another key using xmodmap or other tools. --- However, you can use another modifier like Mod1, but it may interact with others. -modkey = "Mod4" - --- Table of layouts to cover with awful.layout.inc, order matters. -awful.layout.layouts = { - awful.layout.suit.tile, - awful.layout.suit.floating, - -- awful.layout.suit.tile.left, - -- awful.layout.suit.tile.bottom, - -- awful.layout.suit.tile.top, - -- awful.layout.suit.fair, - -- awful.layout.suit.fair.horizontal, - -- awful.layout.suit.spiral, - -- awful.layout.suit.spiral.dwindle, - -- awful.layout.suit.max, - -- awful.layout.suit.max.fullscreen, - -- awful.layout.suit.magnifier, - -- awful.layout.suit.corner.nw, - -- awful.layout.suit.corner.ne, - -- awful.layout.suit.corner.sw, - -- awful.layout.suit.corner.se, -} --- }}} - --- {{{ Menu --- Create a launcher widget and a main menu -myawesomemenu = { - { - "hotkeys", - function() - hotkeys_popup.show_help(nil, awful.screen.focused()) - end, - }, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { - "quit", - function() - awesome.quit() - end, - }, -} - -mymainmenu = awful.menu({ - items = { - { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "open terminal", terminal }, - }, -}) - -mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) - --- Menubar configuration -menubar.utils.terminal = terminal -- Set the terminal for applications that require it --- }}} - --- Keyboard map indicator and switcher -mykeyboardlayout = awful.widget.keyboardlayout() - --- {{{ Wibar --- Create a textclock widget -mytextclock = wibox.widget.textclock() - --- Create a wibox for each screen and add it -local taglist_buttons = gears.table.join( - awful.button({}, 1, function(t) - t:view_only() - end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({}, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({}, 4, function(t) - awful.tag.viewnext(t.screen) - end), - awful.button({}, 5, function(t) - awful.tag.viewprev(t.screen) - end) -) - -local tasklist_buttons = gears.table.join( - awful.button({}, 1, function(c) - if c == client.focus then - c.minimized = true - else - c:emit_signal("request::activate", "tasklist", { raise = true }) - end - end), - awful.button({}, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end), - awful.button({}, 4, function() - awful.client.focus.byidx(1) - end), - awful.button({}, 5, function() - awful.client.focus.byidx(-1) - end) -) - -local function set_wallpaper(s) - -- Wallpaper - if beautiful.wallpaper then - local wallpaper = beautiful.wallpaper - -- If wallpaper is a function, call it with the screen - if type(wallpaper) == "function" then - wallpaper = wallpaper(s) - end - gears.wallpaper.maximized(wallpaper, s, true) - end -end - --- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) -screen.connect_signal("property::geometry", set_wallpaper) - -awful.screen.connect_for_each_screen(function(s) - -- Wallpaper - set_wallpaper(s) - - -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) - - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({}, 1, function() - awful.layout.inc(1) - end), - awful.button({}, 3, function() - awful.layout.inc(-1) - end), - awful.button({}, 4, function() - awful.layout.inc(1) - end), - awful.button({}, 5, function() - awful.layout.inc(-1) - end) - )) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist({ - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons, - }) - - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist({ - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons, - }) - - -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s }) - - -- Add widgets to the wibox - s.mywibox:setup({ - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - mylauncher, - s.mytaglist, - s.mypromptbox, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - mykeyboardlayout, - wibox.widget.systray(), - mytextclock, - s.mylayoutbox, - }, - }) -end) --- }}} - --- {{{ Mouse bindings -root.buttons(gears.table.join( - awful.button({}, 3, function() - mymainmenu:toggle() - end), - awful.button({}, 4, awful.tag.viewnext), - awful.button({}, 5, awful.tag.viewprev) -)) --- }}} - --- {{{ Key bindings -globalkeys = gears.table.join( - awful.key({ modkey }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }), - awful.key({ modkey }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }), - awful.key({ modkey }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }), - awful.key({ modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }), - - awful.key({ modkey }, "j", function() - awful.client.focus.byidx(1) - end, { description = "focus next by index", group = "client" }), - awful.key({ modkey }, "k", function() - awful.client.focus.byidx(-1) - end, { description = "focus previous by index", group = "client" }), - awful.key({ modkey }, "w", function() - mymainmenu:show() - end, { description = "show main menu", group = "awesome" }), - - -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function() - awful.client.swap.byidx(1) - end, { description = "swap with next client by index", group = "client" }), - awful.key({ modkey, "Shift" }, "k", function() - awful.client.swap.byidx(-1) - end, { description = "swap with previous client by index", group = "client" }), - awful.key({ modkey, "Control" }, "j", function() - awful.screen.focus_relative(1) - end, { description = "focus the next screen", group = "screen" }), - awful.key({ modkey, "Control" }, "k", function() - awful.screen.focus_relative(-1) - end, { description = "focus the previous screen", group = "screen" }), - awful.key({ modkey }, "u", awful.client.urgent.jumpto, { description = "jump to urgent client", group = "client" }), - awful.key({ modkey }, "Tab", function() - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, { description = "go back", group = "client" }), - - -- Standard program - awful.key({ modkey }, "Return", function() - awful.spawn(terminal) - end, { description = "open a terminal", group = "launcher" }), - awful.key({ modkey, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }), - awful.key({ modkey, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }), - - awful.key({ modkey }, "l", function() - awful.tag.incmwfact(0.05) - end, { description = "increase master width factor", group = "layout" }), - awful.key({ modkey }, "h", function() - awful.tag.incmwfact(-0.05) - end, { description = "decrease master width factor", group = "layout" }), - awful.key({ modkey, "Shift" }, "h", function() - awful.tag.incnmaster(1, nil, true) - end, { description = "increase the number of master clients", group = "layout" }), - awful.key({ modkey, "Shift" }, "l", function() - awful.tag.incnmaster(-1, nil, true) - end, { description = "decrease the number of master clients", group = "layout" }), - awful.key({ modkey, "Control" }, "h", function() - awful.tag.incncol(1, nil, true) - end, { description = "increase the number of columns", group = "layout" }), - awful.key({ modkey, "Control" }, "l", function() - awful.tag.incncol(-1, nil, true) - end, { description = "decrease the number of columns", group = "layout" }), - awful.key({ modkey }, "space", function() - awful.layout.inc(1) - end, { description = "select next", group = "layout" }), - awful.key({ modkey, "Shift" }, "space", function() - awful.layout.inc(-1) - end, { description = "select previous", group = "layout" }), - - awful.key({ modkey, "Control" }, "n", function() - local c = awful.client.restore() - -- Focus restored client - if c then - c:emit_signal("request::activate", "key.unminimize", { raise = true }) - end - end, { description = "restore minimized", group = "client" }), - - -- Prompt - awful.key({ modkey }, "r", function() - awful.screen.focused().mypromptbox:run() - end, { description = "run prompt", group = "launcher" }), - - awful.key({ modkey }, "x", function() - awful.prompt.run({ - prompt = "Run Lua code: ", - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval", - }) - end, { description = "lua execute prompt", group = "awesome" }), - -- Menubar - awful.key({ modkey }, "p", function() - menubar.show() - end, { description = "show the menubar", group = "launcher" }), - - -- Volume - awful.key({}, "XF86AudioLowerVolume", function() - awful.spawn("pamixer -d 2") - end), - awful.key({}, "XF86AudioRaiseVolume", function() - awful.spawn("pamixer -i 2") - end) -) - -clientkeys = gears.table.join( - awful.key({ modkey }, "f", function(c) - c.fullscreen = not c.fullscreen - c:raise() - end, { description = "toggle fullscreen", group = "client" }), - awful.key({ modkey, "Shift" }, "c", function(c) - c:kill() - end, { description = "close", group = "client" }), - awful.key( - { modkey, "Control" }, - "space", - awful.client.floating.toggle, - { description = "toggle floating", group = "client" } - ), - awful.key({ modkey, "Control" }, "Return", function(c) - c:swap(awful.client.getmaster()) - end, { description = "move to master", group = "client" }), - awful.key({ modkey }, "o", function(c) - c:move_to_screen() - end, { description = "move to screen", group = "client" }), - awful.key({ modkey }, "t", function(c) - c.ontop = not c.ontop - end, { description = "toggle keep on top", group = "client" }), - awful.key({ modkey }, "n", function(c) - -- The client currently has the input focus, so it cannot be - -- minimized, since minimized clients can't have the focus. - c.minimized = true - end, { description = "minimize", group = "client" }), - awful.key({ modkey }, "m", function(c) - c.maximized = not c.maximized - c:raise() - end, { description = "(un)maximize", group = "client" }), - awful.key({ modkey, "Control" }, "m", function(c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end, { description = "(un)maximize vertically", group = "client" }), - awful.key({ modkey, "Shift" }, "m", function(c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end, { description = "(un)maximize horizontally", group = "client" }) -) - --- Bind all key numbers to tags. --- Be careful: we use keycodes to make it work on any keyboard layout. --- This should map on the top row of your keyboard, usually 1 to 9. -for i = 1, 9 do - globalkeys = gears.table.join( - globalkeys, - -- View tag only. - awful.key({ modkey }, "#" .. i + 9, function() - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end, { description = "view tag #" .. i, group = "tag" }), - -- Toggle tag display. - awful.key({ modkey, "Control" }, "#" .. i + 9, function() - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end, { description = "toggle tag #" .. i, group = "tag" }), - -- Move client to tag. - awful.key({ modkey, "Shift" }, "#" .. i + 9, function() - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, { description = "move focused client to tag #" .. i, group = "tag" }), - -- Toggle tag on focused client. - awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function() - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end, { description = "toggle focused client on tag #" .. i, group = "tag" }) - ) -end - -clientbuttons = gears.table.join( - awful.button({}, 1, function(c) - c:emit_signal("request::activate", "mouse_click", { raise = true }) - end), - awful.button({ modkey }, 1, function(c) - c:emit_signal("request::activate", "mouse_click", { raise = true }) - awful.mouse.client.move(c) - end), - awful.button({ modkey }, 3, function(c) - c:emit_signal("request::activate", "mouse_click", { raise = true }) - awful.mouse.client.resize(c) - end) -) - --- Set keys -root.keys(globalkeys) --- }}} - --- {{{ Rules --- Rules to apply to new clients (through the "manage" signal). -awful.rules.rules = { - -- All clients will match this rule. - { - rule = {}, - properties = { - border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = clientkeys, - buttons = clientbuttons, - screen = awful.screen.preferred, - placement = awful.placement.no_overlap + awful.placement.no_offscreen, - }, - }, - - -- Floating clients. - { - rule_any = { - instance = { - "DTA", -- Firefox addon DownThemAll. - "copyq", -- Includes session name in class. - "pinentry", - }, - class = { - "Arandr", - "Blueman-manager", - "Gpick", - "Kruler", - "MessageWin", -- kalarm. - "Sxiv", - "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. - "Wpa_gui", - "veromix", - "xtightvncviewer", - }, - - -- Note that the name property shown in xprop might be set slightly after creation of the client - -- and the name shown there might not match defined rules here. - name = { - "Event Tester", -- xev. - }, - role = { - "AlarmWindow", -- Thunderbird's calendar. - "ConfigManager", -- Thunderbird's about:config. - "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. - }, - }, - properties = { floating = true }, - }, - - -- Add titlebars to normal clients and dialogs - { rule_any = { type = { "normal", "dialog" } }, properties = { titlebars_enabled = true } }, - - -- Set Firefox to always map on the tag named "2" on screen 1. - -- { rule = { class = "Firefox" }, - -- properties = { screen = 1, tag = "2" } }, -} --- }}} - --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function(c) - -- Set the windows at the slave, - -- i.e. put it at the end of others instead of setting it master. - -- if not awesome.startup then awful.client.setslave(c) end - - if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then - -- Prevent clients from being unreachable after screen count changes. - awful.placement.no_offscreen(c) - end -end) - --- Add a titlebar if titlebars_enabled is set to true in the rules. -client.connect_signal("request::titlebars", function(c) - -- buttons for the titlebar - local buttons = gears.table.join( - awful.button({}, 1, function() - c:emit_signal("request::activate", "titlebar", { raise = true }) - awful.mouse.client.move(c) - end), - awful.button({}, 3, function() - c:emit_signal("request::activate", "titlebar", { raise = true }) - awful.mouse.client.resize(c) - end) - ) - - awful.titlebar(c):setup({ - { -- Left - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal, - }, - { -- Middle - { -- Title - align = "center", - widget = awful.titlebar.widget.titlewidget(c), - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal, - }, - { -- Right - awful.titlebar.widget.floatingbutton(c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.stickybutton(c), - awful.titlebar.widget.ontopbutton(c), - awful.titlebar.widget.closebutton(c), - layout = wibox.layout.fixed.horizontal(), - }, - layout = wibox.layout.align.horizontal, - }) -end) - --- Enable sloppy focus, so that focus follows mouse. -client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", { raise = false }) -end) - -client.connect_signal("focus", function(c) - c.border_color = beautiful.border_focus -end) -client.connect_signal("unfocus", function(c) - c.border_color = beautiful.border_normal -end) --- }}} diff --git a/nixos/configuration.nix b/nixos/configuration.nix deleted file mode 100644 index 06121f8..0000000 --- a/nixos/configuration.nix +++ /dev/null @@ -1,170 +0,0 @@ -# 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’). - -{ config, pkgs, ... }: - -{ - imports = [ # Include the results of the hardware scan. - /etc/nixos/hardware-configuration.nix - ../modules/system/timezone.nix - ../modules/system/doas.nix - ../modules/gaming/steam.nix - ]; - - nixpkgs.config.allowUnfree = true; - nix.extraOptions = "experimental-features = nix-command flakes"; - - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # The global useDHCP flag is deprecated, therefore explicitly set to false here. - # Per-interface useDHCP will be mandatory in the future, so this generated config - # replicates the default behaviour. - networking.useDHCP = false; - networking.interfaces.enp0s31f6.useDHCP = true; - networking.interfaces.wlp3s0.useDHCP = true; - - # Enable the X11 windowing system. - services.xserver = { - enable = true; - - windowManager = { i3 = { enable = true; }; }; - - # Enable touchpad support - libinput.enable = true; - - # Disable mouse acceleration - libinput.mouse.accelProfile = "flat"; - libinput.mouse.accelSpeed = "1.25"; - - # Keyboard responsiveness - autoRepeatDelay = 250; - autoRepeatInterval = 40; - - # Configure keymap in X11 - layout = "us"; - xkbOptions = "eurosign:e,caps:swapescape"; - - # Login screen - displayManager = { - lightdm = { - enable = true; - - # Make the login screen dark - greeters.gtk.theme.name = "Adwaita-dark"; - - # Put the login screen on the left monitor - greeters.gtk.extraConfig = '' - active-monitor=0 - ''; - }; - setupCommands = '' - ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 \ - --mode 1920x1200 \ - --pos 1920x0 \ - --rotate left \ - --output HDMI-0 \ - --primary \ - --mode 1920x1080 \ - --pos 0x559 \ - --rotate normal \ - --output DVI-0 --off \ - --output DVI-1 --off \ - ''; - }; - - }; - - # Required for setting GTK theme (for preferred-color-scheme in browser) - services.dbus.packages = with pkgs; [ pkgs.dconf ]; - - # Mouse config - services.ratbagd.enable = true; - - # Enable sound. - sound.enable = true; - hardware.pulseaudio.enable = true; - - # Install fonts - fonts.fonts = with pkgs; [ - victor-mono # Used for Vim and Terminal - nerdfonts # Used for icons in Vim - font-awesome # Icons for i3 - # siji # More icons for Polybar - ]; - fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ]; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.noah = { - - # Create a home directory for human user - isNormalUser = true; - - # Automatically create a password to start - initialPassword = "changeme"; - - # Enable sudo privileges - extraGroups = [ - "wheel" # Sudo privileges - "i2c" # Access to external monitors - ]; - - # Use the fish shell - shell = pkgs.fish; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - fish - vim - wget - curl - home-manager - xclip # Clipboard - pamixer # Audio control - dmenu # Launcher - feh # Wallpaper - playerctl # Media control - polybarFull # Polybar + PulseAudio - ddcutil # Monitor brightness control - - # Mouse config - libratbag # Mouse adjustments - piper # Mouse adjustments GUI - ]; - - # Reduce blue light at night - services.redshift = { - enable = true; - brightness = { - day = "1.0"; - night = "1.0"; - }; - }; - - # Detect monitors (brightness) - hardware.i2c.enable = true; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # 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 = "21.11"; # Did you read the comment? - -} diff --git a/nixos/default.nix b/nixos/default.nix deleted file mode 100644 index ac091f3..0000000 --- a/nixos/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -# This file does nothing but call configuration.nix -# It is required when in a shell.nix environment -{ ... }: { - imports = [ ./configuration.nix ]; -} diff --git a/nixos/home.nix b/nixos/home.nix deleted file mode 100644 index 3d28bfa..0000000 --- a/nixos/home.nix +++ /dev/null @@ -1,345 +0,0 @@ -{ pkgs, ... }: - -let - - name = "Noah Masur"; - editor = "nvim"; - font = "Victor Mono"; - dotfiles = builtins.toString ../.; - nixos_config = builtins.toString ./.; - notes_path = "$HOME/dev/personal/notes"; - - ignore_patterns = '' - !.env* - !.github/ - !.gitignore - !*.tfvars - .terraform/ - .target/ - /Library/ - keybase/ - kbfs/ - ''; - -in { - nixpkgs.config.allowUnfree = true; - - home.packages = with pkgs; [ - # Applications - firefox - neovim - alacritty - _1password-gui - discord - # neomutt - himalaya # Email - mpv # Video viewer - sxiv # Image viewer - zathura # PDF viewer - qbittorrent - - # Utilities - unzip - gcc # for tree-sitter - starship - rsync - fzf - ripgrep - bat - fd - exa - sd - zoxide - jq - tealdeer - gh - direnv - tree - htop - glow - - # Encryption - keybase-gui - gnupg - pass - ]; - - gtk.enable = true; - gtk.theme = { name = "Adwaita-dark"; }; - - programs.alacritty = { - enable = true; - settings = { - window = { - dimensions = { - columns = 85; - lines = 30; - }; - padding = { - x = 20; - y = 20; - }; - }; - scrolling.history = 10000; - font = { - size = 14.0; - normal = { family = "${font}"; }; - }; - key_bindings = [ - { - key = "L"; - mods = "Control|Shift"; - chars = "\\x1F"; - } - { - key = "K"; - mods = "Control"; - mode = "~Vi"; - action = "ToggleViMode"; - } - { - key = "Return"; - mode = "Vi"; - action = "ToggleViMode"; - } - ]; - colors = { - primary = { - background = "0x1d2021"; - foreground = "0xd5c4a1"; - }; - cursor = { - text = "0x1d2021"; - cursor = "0xd5c4a1"; - }; - normal = { - black = "0x1d2021"; - red = "0xfb4934"; - green = "0xb8bb26"; - yellow = "0xfabd2f"; - blue = "0x83a598"; - magenta = "0xd3869b"; - cyan = "0x8ec07c"; - white = "0xd5c4a1"; - }; - bright = { - black = "0x665c54"; - red = "0xfe8019"; - green = "0x3c3836"; - yellow = "0x504945"; - blue = "0xbdae93"; - magenta = "0xebdbb2"; - cyan = "0xd65d0e"; - white = "0xfbf1c7"; - }; - }; - draw_bold_text_with_bright_colors = false; - }; - }; - - programs.fish = { - enable = true; - functions = { }; - interactiveShellInit = ""; - loginShellInit = ""; - shellAliases = { - vim = "nvim"; - sudo = "doas"; - }; - shellAbbrs = { - - # Directory aliases - l = "ls"; - lh = "ls -lh"; - ll = "ls -alhF"; - la = "ls -a"; - lf = "ls -lh | fzf"; - c = "cd"; - "-" = "cd -"; - mkd = "mkdir -pv"; - - # System - s = "sudo"; - sc = "systemctl"; - scs = "systemctl status"; - - # Tmux - ta = "tmux attach-session"; - tan = "tmux attach-session -t noah"; - tnn = "tmux new-session -s noah"; - - # Git - g = "git"; - gs = "git status"; - gd = "git diff"; - gds = "git diff --staged"; - gdp = "git diff HEAD^"; - ga = "git add"; - gaa = "git add -A"; - gac = "git commit -am"; - gc = "git commit -m"; - gca = "git commit --amend --no-edit"; - gcae = "git commit --amend"; - gu = "git pull"; - gp = "git push"; - gpp = "git_set_upstream"; - gl = "git log --graph --decorate --oneline -20"; - gll = "git log --graph --decorate --oneline"; - gco = "git checkout"; - gcom = "git switch master"; - gcob = "git switch -c"; - gb = "git branch"; - gbd = "git branch -d"; - gbD = "git branch -D"; - gr = "git reset"; - grh = "git reset --hard"; - gm = "git merge"; - gcp = "git cherry-pick"; - cdg = "cd (git rev-parse --show-toplevel)"; - - # GitHub - ghr = "gh repo view -w"; - gha = - "gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view"; - grw = "gh run watch"; - grf = "gh run view --log-failed"; - grl = "gh run view --log"; - - # Vim - v = "vim"; - vl = "vim -c 'normal! `0'"; - vll = "vim -c 'Telescope oldfiles'"; - vimrc = "vim ${dotfiles}/nvim.configlink/init.lua"; - - # Notes - qn = "quicknote"; - sn = "syncnotes"; - to = "today"; - work = "vim $NOTES_PATH/work.md"; - - # CLI Tools - cat = "bat"; # Swap cat with bat - h = "http -Fh --all"; # Curl site for headers - m = "make"; # For makefiles - - # Fun CLI Tools - weather = "curl wttr.in/$WEATHER_CITY"; - moon = "curl wttr.in/Moon"; - - # Cheat Sheets - ssl = - "openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr"; - fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -"; - publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub"; - forloop = "for i in (seq 1 100)"; - - # Docker - dc = "$DOTS/bin/docker_cleanup"; - dr = "docker run --rm -it"; - db = "docker build . -t"; - - # Terraform - te = "terraform"; - - # Kubernetes - k = "kubectl"; - pods = "kubectl get pods -A"; - nodes = "kubectl get nodes"; - deploys = "kubectl get deployments -A"; - dash = "kube-dashboard"; - ks = "k9s"; - - # Python - py = "python"; - po = "poetry"; - pr = "poetry run python"; - - # Rust - ca = "cargo"; - - }; - shellAliases = { }; - shellInit = ""; - }; - - home.sessionVariables = { - fish_greeting = ""; - EDITOR = "${editor}"; - NIXOS_CONFIG = "${nixos_config}"; - DOTS = "${dotfiles}"; - NOTES_PATH = "${notes_path}"; - }; - - programs.starship = { - enable = true; - enableFishIntegration = true; - }; - - programs.fzf = { - enable = true; - enableFishIntegration = true; - }; - - programs.zoxide = { - enable = true; - enableFishIntegration = true; - }; - - # Other configs - xdg.configFile = { - "starship.toml".source = ../starship/starship.toml.configlink; - "nvim/init.lua".source = ../nvim.configlink/init.lua; - "fish/functions".source = ../fish.configlink/functions; - "awesome/rc.lua".source = ./awesomerc.lua; - "qtile/config.py".source = ./qtile.py; - "direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc"; - "spectrwm/spectrwm.conf".source = ./spectrwm.conf; - }; - home.file = { - ".rgignore".text = ignore_patterns; - ".fdignore".text = ignore_patterns; - }; - - programs.direnv = { - enable = true; - nix-direnv.enable = true; - config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; }; - }; - - programs.git = { - enable = true; - userName = "${name}"; - userEmail = "7386960+nmasur@users.noreply.github.com"; - extraConfig = { - core = { editor = "nvim"; }; - pager = { branch = "false"; }; - }; - }; - - programs.gh = { - enable = true; - enableGitCredentialHelper = true; - settings.git_protocol = "https"; - }; - - # Email - # programs.himalaya = { - # enable = true; - # settings = { - # name = "${name}"; - # downloads-dir = "~/Downloads"; - # home = { - # default = true; - # email = "censored"; - # imap-host = "censored"; - # imap-port = 993; - # imap-login = "censored"; - # imap-passwd-cmd = "cat ~/.config/himalaya/passwd"; - # smtp-host = "censored"; - # smtp-port = 587; - # smtp-login = "censored"; - # smtp-passwd-cmd = "cat ~/.config/himalaya/passwd"; - # }; - # }; - # }; -} diff --git a/nixos/qtile.py b/nixos/qtile.py deleted file mode 100644 index 7b9584b..0000000 --- a/nixos/qtile.py +++ /dev/null @@ -1,195 +0,0 @@ -# Copyright (c) 2010 Aldo Cortesi -# Copyright (c) 2010, 2014 dequis -# Copyright (c) 2012 Randall Ma -# Copyright (c) 2012-2014 Tycho Andersen -# Copyright (c) 2012 Craig Barnes -# Copyright (c) 2013 horsik -# Copyright (c) 2013 Tao Sauvage -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from typing import List # noqa: F401 - -from libqtile import bar, layout, widget -from libqtile.config import Click, Drag, Group, Key, Match, Screen -from libqtile.lazy import lazy -from libqtile.utils import guess_terminal - -mod = "mod4" -terminal = guess_terminal() - -keys = [ - # A list of available commands that can be bound to keys can be found - # at https://docs.qtile.org/en/latest/manual/config/lazy.html - - # Switch between windows - Key([mod], "h", lazy.layout.left(), desc="Move focus to left"), - Key([mod], "l", lazy.layout.right(), desc="Move focus to right"), - Key([mod], "j", lazy.layout.down(), desc="Move focus down"), - Key([mod], "k", lazy.layout.up(), desc="Move focus up"), - Key([mod], "space", lazy.layout.next(), - desc="Move window focus to other window"), - - # Move windows between left/right columns or move up/down in current stack. - # Moving out of range in Columns layout will create new column. - Key([mod, "shift"], "h", lazy.layout.shuffle_left(), - desc="Move window to the left"), - Key([mod, "shift"], "l", lazy.layout.shuffle_right(), - desc="Move window to the right"), - Key([mod, "shift"], "j", lazy.layout.shuffle_down(), - desc="Move window down"), - Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), - - # Grow windows. If current window is on the edge of screen and direction - # will be to screen edge - window would shrink. - Key([mod, "control"], "h", lazy.layout.grow_left(), - desc="Grow window to the left"), - Key([mod, "control"], "l", lazy.layout.grow_right(), - desc="Grow window to the right"), - Key([mod, "control"], "j", lazy.layout.grow_down(), - desc="Grow window down"), - Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), - Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), - - # Toggle between split and unsplit sides of stack. - # Split = all windows displayed - # Unsplit = 1 window displayed, like Max layout, but still with - # multiple stack panes - Key([mod, "shift"], "Return", lazy.layout.toggle_split(), - desc="Toggle between split and unsplit sides of stack"), - Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), - - # Toggle between different layouts as defined below - Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), - Key([mod], "w", lazy.window.kill(), desc="Kill focused window"), - - Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), - Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), - Key([mod], "r", lazy.spawncmd(), - desc="Spawn a command using a prompt widget"), -] - -groups = [Group(i) for i in "123456789"] - -for i in groups: - keys.extend([ - # mod1 + letter of group = switch to group - Key([mod], i.name, lazy.group[i.name].toscreen(), - desc="Switch to group {}".format(i.name)), - - # mod1 + shift + letter of group = switch to & move focused window to group - Key([mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True), - desc="Switch to & move focused window to group {}".format(i.name)), - # Or, use below if you prefer not to switch to that group. - # # mod1 + shift + letter of group = move focused window to group - # Key([mod, "shift"], i.name, lazy.window.togroup(i.name), - # desc="move focused window to group {}".format(i.name)), - ]) - -layouts = [ - layout.Columns(border_focus_stack=['#d75f5f', '#8f3d3d'], border_width=4), - layout.Max(), - # Try more layouts by unleashing below layouts. - # layout.Stack(num_stacks=2), - # layout.Bsp(), - # layout.Matrix(), - # layout.MonadTall(), - # layout.MonadWide(), - # layout.RatioTile(), - # layout.Tile(), - # layout.TreeTab(), - # layout.VerticalTile(), - # layout.Zoomy(), -] - -widget_defaults = dict( - font='sans', - fontsize=12, - padding=3, -) -extension_defaults = widget_defaults.copy() - -screens = [ - Screen( - top=bar.Bar( - [ - widget.CurrentLayout(), - widget.GroupBox(), - widget.Prompt(), - widget.WindowName(), - widget.Chord( - chords_colors={ - 'launch': ("#ff0000", "#ffffff"), - }, - name_transform=lambda name: name.upper(), - ), - widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"), - widget.Volume(), - widget.Systray(), - widget.Clock(format='%Y-%m-%d %a %I:%M %p'), - widget.QuickExit(), - ], - 24, - # border_width=[2, 0, 2, 0], # Draw top and bottom borders - # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta - ), - ), -] - -# Drag floating layouts. -mouse = [ - Drag([mod], "Button1", lazy.window.set_position_floating(), - start=lazy.window.get_position()), - Drag([mod], "Button3", lazy.window.set_size_floating(), - start=lazy.window.get_size()), - Click([mod], "Button2", lazy.window.bring_to_front()) -] - -dgroups_key_binder = None -dgroups_app_rules = [] # type: List -follow_mouse_focus = True -bring_front_click = False -cursor_warp = False -floating_layout = layout.Floating(float_rules=[ - # Run the utility of `xprop` to see the wm class and name of an X client. - *layout.Floating.default_float_rules, - Match(wm_class='confirmreset'), # gitk - Match(wm_class='makebranch'), # gitk - Match(wm_class='maketag'), # gitk - Match(wm_class='ssh-askpass'), # ssh-askpass - Match(title='branchdialog'), # gitk - Match(title='pinentry'), # GPG key password entry -]) -auto_fullscreen = True -focus_on_window_activation = "smart" -reconfigure_screens = True - -# If things like steam games want to auto-minimize themselves when losing -# focus, should we respect this or not? -auto_minimize = True - -# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this -# string besides java UI toolkits; you can see several discussions on the -# mailing lists, GitHub issues, and other WM documentation that suggest setting -# this string if your java app doesn't work correctly. We may as well just lie -# and say that we're a working one by default. -# -# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in -# java that happens to be on java's whitelist. -wmname = "LG3D" diff --git a/nixos/spectrwm.conf b/nixos/spectrwm.conf deleted file mode 100644 index 3914371..0000000 --- a/nixos/spectrwm.conf +++ /dev/null @@ -1,256 +0,0 @@ -# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE! -# https://htmlpreview.github.io/?https://github.com/conformal/spectrwm/blob/master/spectrwm.html -# NOTE: all rgb color values in this file are in hex! see XQueryColor for examples - -workspace_limit = 9 -# focus_mode = default -# focus_close = previous -# focus_close_wrap = 1 -# focus_default = last -# spawn_position = next -# workspace_clamp = 1 -# warp_focus = 1 -# warp_pointer = 1 - -# Window Decoration -border_width = 0 -# color_focus = red -# color_focus_maximized = yellow -# color_unfocus = rgb:88/88/88 -# color_unfocus_maximized = rgb:88/88/00 -region_padding = 20 -tile_gap = 20 - -# Region containment -# Distance window must be dragged/resized beyond the region edge before it is -# allowed outside the region. -# boundary_width = 50 - -# Remove window border when bar is disabled and there is only one window in workspace -# disable_border = 1 - -# Bar Settings -# bar_enabled = 1 -# bar_enabled_ws[1] = 1 -# bar_border_width = 1 -# bar_border[1] = rgb:00/80/80 -# bar_border_unfocus[1] = rgb:00/40/40 -# bar_color[1] = black -# bar_color_selected[1] = rgb:00/80/80 -# bar_font_color[1] = rgb:a0/a0/a0 -# bar_font_color_selected = black -# bar_font = xos4 Terminus:pixelsize=14:antialias=true -bar_font = Victor Mono:pixelsize=14:antialias=true -# bar_font_pua = Typicons:pixelsize=14:antialias=true -# bar_action = baraction.sh -# bar_action_expand = 0 -bar_justify = center -bar_format = +I +S <+D>+4<%a %b %d %R +8<+A+4<+V -# workspace_indicator = listcurrent,listactive,markcurrent,printnames -# bar_at_bottom = 1 -# stack_enabled = 1 -# clock_enabled = 1 -# clock_format = %a %b %d %R %Z %Y -# iconic_enabled = 0 -# maximize_hide_bar = 0 -# window_class_enabled = 0 -# window_instance_enabled = 0 -# window_name_enabled = 0 -# verbose_layout = 1 -# urgent_enabled = 1 -# urgent_collapse = 0 - -# Dialog box size ratio when using TRANSSZ quirk; 0.3 < dialog_ratio <= 1.0 -# dialog_ratio = 0.6 - -# Split a non-RandR dual head setup into one region per monitor -# (non-standard driver-based multihead is not seen by spectrwm) -# region = screen[1]:1280x1024+0+0 -# region = screen[1]:1280x1024+1280+0 - -# Launch applications in a workspace of choice -# autorun = ws[1]:xterm -# autorun = ws[2]:xombrero http://www.openbsd.org - -# Customize workspace layout at start -# layout = ws[1]:4:0:0:0:vertical -# layout = ws[2]:0:0:0:0:horizontal -# layout = ws[3]:0:0:0:0:fullscreen -# layout = ws[4]:4:0:0:0:vertical_flip -# layout = ws[5]:0:0:0:0:horizontal_flip - -# Set workspace name at start -name = ws[1]:Terminal -name = ws[2]:Browser -name = ws[3]:Comms -# name = ws[10]:Music - -# Mod key, (Windows key is Mod4) (Apple key on OSX is Mod2) -modkey = Mod4 - -# This allows you to include pre-defined key bindings for your keyboard layout. -# keyboard_mapping = ~/.spectrwm_us.conf - -# PROGRAMS - -# Validated default programs: -# program[lock] = xlock -program[term] = alacritty -# program[menu] = dmenu_run $dmenu_bottom -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected -# program[search] = dmenu $dmenu_bottom -i -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected -# program[name_workspace] = dmenu $dmenu_bottom -p Workspace -fn $bar_font -nb $bar_color -nf $bar_font_color -sb $bar_color_selected -sf $bar_font_color_selected - -# To disable validation of the above, free the respective binding(s): -# bind[] = MOD+Shift+Delete # disable lock -# bind[] = MOD+Shift+Return # disable term -# bind[] = MOD+p # disable menu - -# Optional default programs that will only be validated if you override: -# program[screenshot_all] = screenshot.sh full # optional -# program[screenshot_wind] = screenshot.sh window # optional -# program[initscr] = initscreen.sh # optional - -# EXAMPLE: Define 'firefox' action and bind to key. -# program[firefox] = firefox http://spectrwm.org/ -# bind[firefox] = MOD+Shift+b - -# QUIRKS -# Default quirks, remove with: quirk[class:name] = NONE -# quirk[MPlayer:xv] = FLOAT + FULLSCREEN + FOCUSPREV -# quirk[OpenOffice.org 2.4:VCLSalFrame] = FLOAT -# quirk[OpenOffice.org 3.0:VCLSalFrame] = FLOAT -# quirk[OpenOffice.org 3.1:VCLSalFrame] = FLOAT -# quirk[Firefox-bin:firefox-bin] = TRANSSZ -# quirk[Firefox:Dialog] = FLOAT -# quirk[Gimp:gimp] = FLOAT + ANYWHERE -# quirk[XTerm:xterm] = XTERM_FONTADJ -# quirk[xine:Xine Window] = FLOAT + ANYWHERE -# quirk[Xitk:Xitk Combo] = FLOAT + ANYWHERE -# quirk[xine:xine Panel] = FLOAT + ANYWHERE -# quirk[Xitk:Xine Window] = FLOAT + ANYWHERE -# quirk[xine:xine Video Fullscreen Window] = FULLSCREEN + FLOAT -# quirk[pcb:pcb] = FLOAT - -# Key bindings for United States (us) keyboards -# unbind with: bind[] = -# bind[bar_toggle] = MOD+b -# bind[bar_toggle_ws] = MOD+Shift+b -# bind[button2] = MOD+v -# bind[cycle_layout] = MOD+space -# bind[flip_layout] = MOD+Shift+backslash -# bind[float_toggle] = MOD+t -# bind[focus_main] = MOD+m -# bind[focus_next] = MOD+j -# bind[focus_next] = MOD+Tab -# bind[focus_prev] = MOD+k -# bind[focus_prev] = MOD+Shift+Tab -# bind[focus_urgent] = MOD+u -# bind[height_grow] = MOD+Shift+equal -# bind[height_shrink] = MODssh git.charm.sh+Shift+minus -# bind[iconify] = MOD+w -# bind[initscr] = MOD+Shift+i -# bind[lock] = MOD+Shift+Delete -# bind[master_add] = MOD+comma -# bind[master_del] = MOD+period -# bind[master_grow] = MOD+l -# bind[master_shrink] = MOD+h -# bind[maximize_toggle] = MOD+e -# bind[menu] = MOD+p -# bind[move_down] = MOD+Shift+bracketright -# bind[move_left] = MOD+bracketleft -# bind[move_right] = MOD+bracketright -# bind[move_up] = MOD+Shift+bracketleft -# bind[mvrg_1] = MOD+Shift+KP_End -# bind[mvrg_2] = MOD+Shift+KP_Down -# bind[mvrg_3] = MOD+Shift+KP_Next -# bind[mvrg_4] = MOD+Shift+KP_Left -# bind[mvrg_5] = MOD+Shift+KP_Begin -# bind[mvrg_6] = MOD+Shift+KP_Right -# bind[mvrg_7] = MOD+Shift+KP_Home -# bind[mvrg_8] = MOD+Shift+KP_Up -# bind[mvrg_9] = MOD+Shift+KP_Prior -# bind[mvws_1] = MOD+Shift+1 -# bind[mvws_2] = MOD+Shift+2 -# bind[mvws_3] = MOD+Shift+3 -# bind[mvws_4] = MOD+Shift+4 -# bind[mvws_5] = MOD+Shift+5 -# bind[mvws_6] = MOD+Shift+6 -# bind[mvws_7] = MOD+Shift+7 -# bind[mvws_8] = MOD+Shift+8 -# bind[mvws_9] = MOD+Shift+9 -# bind[mvws_10] = MOD+Shift+0 -# bind[mvws_11] = MOD+Shift+F1 -# bind[mvws_12] = MOD+Shift+F2 -# bind[mvws_13] = MOD+Shift+F3 -# bind[mvws_14] = MOD+Shift+F4 -# bind[mvws_15] = MOD+Shift+F5 -# bind[mvws_16] = MOD+Shift+F6 -# bind[mvws_17] = MOD+Shift+F7 -# bind[mvws_18] = MOD+Shift+F8 -# bind[mvws_19] = MOD+Shift+F9 -# bind[mvws_20] = MOD+Shift+F10 -# bind[mvws_21] = MOD+Shift+F11 -# bind[mvws_22] = MOD+Shift+F12 -# bind[name_workspace] = MOD+Shift+slash -# bind[quit] = MOD+Shift+q -# bind[raise_toggle] = MOD+Shift+r -# bind[restart] = MOD+q -# bind[rg_1] = MOD+KP_End -# bind[rg_2] = MOD+KP_Down -# bind[rg_3] = MOD+KP_Next -# bind[rg_4] = MOD+KP_Left -# bind[rg_5] = MOD+KP_Begin -# bind[rg_6] = MOD+KP_Right -# bind[rg_7] = MOD+KP_Home -# bind[rg_8] = MOD+KP_Up -# bind[rg_9] = MOD+KP_Prior -# bind[rg_next] = MOD+Shift+Right -# bind[rg_prev] = MOD+Shift+Left -# bind[screenshot_all] = MOD+s -# bind[screenshot_wind] = MOD+Shift+s -# bind[search_win] = MOD+f -# bind[search_workspace] = MOD+slash -# bind[stack_dec] = MOD+Shift+period -# bind[stack_inc] = MOD+Shift+comma -# bind[stack_reset] = MOD+Shift+space -bind[swap_main] = MOD+Shift+Return -# bind[swap_next] = MOD+Shift+j -# bind[swap_prev] = MOD+Shift+k -bind[rg_next] = MOD+Shift+j -bind[rg_prev] = MOD+Shift+k -bind[term] = MOD+Return -# bind[uniconify] = MOD+Shift+w -# bind[version] = MOD+Shift+v -# bind[width_grow] = MOD+equal -# bind[width_shrink] = MOD+minus -# bind[wind_del] = MOD+x -bind[wind_kill] = MOD+Shift+c -# bind[ws_1] = MOD+1 -# bind[ws_2] = MOD+2 -# bind[ws_3] = MOD+3 -# bind[ws_4] = MOD+4 -# bind[ws_5] = MOD+5 -# bind[ws_6] = MOD+6 -# bind[ws_7] = MOD+7 -# bind[ws_8] = MOD+8 -# bind[ws_9] = MOD+9 -# bind[ws_10] = MOD+0 -# bind[ws_11] = MOD+F1 -# bind[ws_12] = MOD+F2 -# bind[ws_13] = MOD+F3 -# bind[ws_14] = MOD+F4 -# bind[ws_15] = MOD+F5 -# bind[ws_16] = MOD+F6 -# bind[ws_17] = MOD+F7 -# bind[ws_18] = MOD+F8 -# bind[ws_19] = MOD+F9 -# bind[ws_20] = MOD+F10 -# bind[ws_21] = MOD+F11 -# bind[ws_22] = MOD+F12 -# bind[ws_next] = MOD+Right -# bind[ws_next_all] = MOD+Up -# bind[ws_next_move] = MOD+Shift+Up -# bind[ws_prev] = MOD+Left -# bind[ws_prev_all] = MOD+Down -# bind[ws_prev_move] = MOD+Shift+Down -# bind[ws_prior] = MOD+a diff --git a/nvim.configlink/init.lua b/nvim.configlink/init.lua deleted file mode 100644 index c1461eb..0000000 --- a/nvim.configlink/init.lua +++ /dev/null @@ -1,734 +0,0 @@ --- Bootstrap the Packer plugin manager -local fn = vim.fn -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - packer_bootstrap = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) -end - --- Packer plugin installations -require("packer").startup(function(use) - -- Maintain plugin manager - use("wbthomason/packer.nvim") - - -- Startup speed hacks - use({ - "lewis6991/impatient.nvim", - config = function() - require("impatient") - end, - }) - - -- Important tweaks - use("tpope/vim-surround") --- Manipulate parentheses - use("tpope/vim-commentary") --- Use gc or gcc to add comments - - -- Convenience tweaks - use("tpope/vim-eunuch") --- File manipulation in Vim - use("tpope/vim-vinegar") --- Fixes netrw file explorer - use("tpope/vim-fugitive") --- Git commands and syntax - use("tpope/vim-repeat") --- Actually repeat using . - use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes - - -- Colorscheme - use({ - "morhetz/gruvbox", - config = function() - vim.g.gruvbox_italic = 1 - vim.cmd([[colorscheme gruvbox]]) - end, - }) - - -- Git next to line numbers - use({ - "lewis6991/gitsigns.nvim", - branch = "main", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - require("gitsigns").setup() - end, - }) - - -- Status bar - use({ - "hoob3rt/lualine.nvim", - requires = { "kyazdani42/nvim-web-devicons", opt = true }, - config = function() - require("lualine").setup({ - options = { - theme = "gruvbox", - icons_enabled = true, - }, - }) - end, - }) - - -- Improve speed and filetype detection - use({ - "nathom/filetype.nvim", - config = function() - -- Filetype for .env files - local envfiletype = function() - vim.bo.filetype = "text" - vim.bo.syntax = "sh" - end - -- Force filetype patterns that Vim doesn't know about - require("filetype").setup({ - overrides = { - extensions = { - Brewfile = "brewfile", - muttrc = "muttrc", - tfvars = "terraform", - tf = "terraform", - }, - literal = { - Caskfile = "brewfile", - [".gitignore"] = "gitignore", - config = "config", - }, - complex = { - [".*git/config"] = "gitconfig", - ["tmux.conf%..*link"] = "tmux", - ["gitconfig%..*link"] = "gitconfig", - [".*ignore%..*link"] = "gitignore", - [".*%.toml%..*link"] = "toml", - }, - function_extensions = {}, - function_literal = { - [".envrc"] = envfiletype, - [".env"] = envfiletype, - [".env.dev"] = envfiletype, - [".env.prod"] = envfiletype, - [".env.example"] = envfiletype, - }, - }, - }) - end, - }) - - -- Alignment tool - use("godlygeek/tabular") - - -- Markdown renderer / wiki notes - use("vimwiki/vimwiki") - - -- Markdown pretty view - use("ellisonleao/glow.nvim") - - -- Hex color previews - use({ - "norcalli/nvim-colorizer.lua", - config = function() - require("colorizer").setup() - end, - }) - - -- Snippet engine - use("L3MON4D3/LuaSnip") - - -- ======================================================================= - -- Language Server - -- ======================================================================= - - -- Language server engine - use({ - "neovim/nvim-lspconfig", - requires = { "hrsh7th/cmp-nvim-lsp" }, - config = function() - local capabilities = require("cmp_nvim_lsp").update_capabilities( - vim.lsp.protocol.make_client_capabilities() - ) - require("lspconfig").rust_analyzer.setup({ capabilities = capabilities }) - require("lspconfig").tflint.setup({ capabilities = capabilities }) - require("lspconfig").terraformls.setup({ capabilities = capabilities }) - require("lspconfig").pyright.setup({ - on_attach = function() - -- set keymaps (requires 0.7.0) - -- vim.keymap.set("n", "", "", {buffer=0}) - end, - capabilities = capabilities, - }) - end, - }) - - -- Pretty highlights - use("folke/lsp-colors.nvim") - - -- Linting - use({ - "jose-elias-alvarez/null-ls.nvim", - branch = "main", - requires = { - "nvim-lua/plenary.nvim", - "neovim/nvim-lspconfig", - }, - config = function() - require("null-ls").setup({ - sources = { - require("null-ls").builtins.formatting.stylua, - require("null-ls").builtins.formatting.black, - require("null-ls").builtins.formatting.fish_indent, - require("null-ls").builtins.formatting.nixfmt, - require("null-ls").builtins.formatting.rustfmt, - require("null-ls").builtins.diagnostics.shellcheck, - require("null-ls").builtins.formatting.shfmt.with({ - extra_args = { "-i", "4", "-ci" }, - }), - require("null-ls").builtins.formatting.terraform_fmt, - -- require("null-ls").builtins.diagnostics.luacheck, - -- require("null-ls").builtins.diagnostics.markdownlint, - -- require("null-ls").builtins.diagnostics.pylint, - }, - -- Format on save - on_attach = function(client) - if client.resolved_capabilities.document_formatting then - vim.cmd([[ - augroup LspFormatting - autocmd! * - autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync() - augroup END - ]]) - end - end, - }) - end, - }) - - -- ======================================================================= - -- Completion System - -- ======================================================================= - - -- Completion sources - use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin - use("hrsh7th/cmp-buffer") --- Generic text completion - use("hrsh7th/cmp-path") --- Local file completion - use("hrsh7th/cmp-cmdline") --- Command line completion - use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion - use("saadparwaiz1/cmp_luasnip") --- Luasnip completion - use("lukas-reineke/cmp-rg") --- Ripgrep completion - - -- Completion engine - use({ - "hrsh7th/nvim-cmp", - requires = { "L3MON4D3/LuaSnip" }, - config = function() - local cmp = require("cmp") - cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), - [""] = function(fallback) - cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }) - vim.cmd("stopinsert") --- Abort and leave insert mode - end, - -- [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), - -- [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }), - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [""] = cmp.mapping(function(fallback) - if require("luasnip").expand_or_jumpable() then - require("luasnip").expand_or_jump() - end - end, { "i", "s" }), - }, - sources = { - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - { name = "buffer", keyword_length = 3, max_item_count = 10 }, - { - name = "rg", - keyword_length = 6, - max_item_count = 10, - option = { additional_arguments = "--ignore-case" }, - }, - }, - experimental = { - native_menu = false, --- Use cmp menu instead of Vim menu - ghost_text = true, --- Show preview auto-completion - }, - }) - - -- Use buffer source for `/` - cmp.setup.cmdline("/", { - sources = { - { name = "buffer", keyword_length = 5 }, - }, - }) - - -- Use cmdline & path source for ':' - cmp.setup.cmdline(":", { - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - }) - end, - }) - - -- ======================================================================= - -- Syntax - -- ======================================================================= - - -- Syntax engine - use({ - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "hcl", - "python", - "lua", - "nix", - "fish", - "toml", - "yaml", - "json", - }, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, - }) - - -- Additional syntax sources - use("bfontaine/Brewfile.vim") --- Brewfile syntax - use("chr4/nginx.vim") --- Nginx syntax - use("towolf/vim-helm") --- Helm syntax - use("rodjek/vim-puppet") --- Puppet syntax - - -- ======================================================================= - -- Fuzzy Launcher - -- ======================================================================= - - use({ - "nvim-telescope/telescope.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function() - -- Telescope: quit instantly with escape - local actions = require("telescope.actions") - require("telescope").setup({ - defaults = { - mappings = { - i = { - [""] = actions.close, - [""] = "which_key", - }, - }, - }, - pickers = { - find_files = { theme = "ivy" }, - oldfiles = { theme = "ivy" }, - buffers = { theme = "dropdown" }, - }, - extensions = { - fzy_native = {}, - tmux = {}, - zoxide = {}, - --neoclip = {}, - project = { - base_dirs = { "~/dev/work" }, - }, - }, - }) - end, - }) - - -- Faster sorting - use("nvim-telescope/telescope-fzy-native.nvim") - - -- Jump around tmux sessions - use("camgraff/telescope-tmux.nvim") - - -- Jump directories - use({ - "jvgrootveld/telescope-zoxide", - requires = { "nvim-lua/popup.nvim" }, - }) - - -- Jump projects - use({ - "nvim-telescope/telescope-project.nvim", - requires = { "nvim-telescope/telescope.nvim" }, - config = function() - require("telescope").load_extension("project") - end, - }) - - -- File browser - use({ - "nvim-telescope/telescope-file-browser.nvim", - requires = { "nvim-telescope/telescope.nvim" }, - config = function() - require("telescope").load_extension("file_browser") - end, - }) - - -- Clipboard history - -- use({ - -- "AckslD/nvim-neoclip.lua", - -- branch = "main", - -- requires = { - -- { "tami5/sqlite.lua", module = "sqlite" }, - -- { "nvim-telescope/telescope.nvim" }, - -- }, - -- config = function() - -- require("neoclip").setup({ - -- enable_persistant_history = true, - -- default_register = { "+", '"' }, - -- keys = { - -- telescope = { - -- i = { paste = "" }, - -- }, - -- }, - -- }) - -- require("telescope").load_extension("neoclip") - -- end, - -- }) - - -- Project bookmarks - use({ - "ThePrimeagen/harpoon", - requires = { - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - }) - - -- TLDR Lookup - use({ - "mrjones2014/tldr.nvim", - requires = { "nvim-telescope/telescope.nvim" }, - }) - - -- ======================================================================= - - -- Install on initial bootstrap - if packer_bootstrap then - require("packer").sync() - end -end) - --- =========================================================================== --- Settings --- =========================================================================== - -vim.o.termguicolors = true --- Set to truecolor -vim.o.hidden = true --- Don't unload buffers when leaving them -vim.wo.number = true --- Show line numbers -vim.wo.relativenumber = true --- Relative numbers instead of absolute -vim.o.list = true --- Reveal whitespace with dashes -vim.o.expandtab = true --- Tabs into spaces -vim.o.shiftwidth = 4 --- Amount to shift with > key -vim.o.softtabstop = 4 --- Amount to shift with key -vim.o.ignorecase = true --- Ignore case when searching -vim.o.smartcase = true --- Check case when using capitals in search -vim.o.infercase = true --- Don't match cases when completing suggestions -vim.o.incsearch = true --- Search while typing -vim.o.visualbell = true --- No sounds -vim.o.scrolljump = 1 --- Number of lines to scroll -vim.o.scrolloff = 3 --- Margin of lines to see while scrolling -vim.o.splitright = true --- Vertical splits on the right side -vim.o.splitbelow = true --- Horizontal splits on the bottom side -vim.o.pastetoggle = "" --- Use F3 to enter raw paste mode -vim.o.clipboard = "unnamedplus" --- Uses system clipboard for yanking -vim.o.updatetime = 300 --- Faster diagnostics -vim.o.mouse = "nv" --- Mouse interaction / scrolling - --- Neovim features -vim.o.inccommand = "split" --- Live preview search and replace ---- Required for nvim-cmp completion -vim.opt.completeopt = { - "menu", - "menuone", - "noselect", -} --- Required until 0.6.0: do not source the default filetype.vim -vim.g.did_load_filetypes = 1 - --- Remember last position when reopening file -vim.api.nvim_exec( - [[ - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif -]], - false -) - --- Better backup, swap and undo storage -vim.o.backup = true --- Easier to recover and more secure -vim.bo.swapfile = false --- Instead of swaps, create backups -vim.bo.undofile = true --- Keeps undos after quit - --- Create backup directories if they don't exist --- Should be fixed in 0.6 by https://github.com/neovim/neovim/pull/15433 -vim.o.backupdir = vim.fn.stdpath("cache") .. "/backup" -vim.api.nvim_exec( - [[ - if !isdirectory(&backupdir) - call mkdir(&backupdir, "p") - endif -]], - false -) - --- LaTeX options -vim.api.nvim_exec( - [[ - au FileType tex inoremap ;bf \textbf{}i - au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw! -]], - false -) - --- Highlight when yanking -vim.api.nvim_exec( - [[ - au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } -]], - false -) - --- Netrw -vim.g.netrw_liststyle = 3 -- Change style to 'tree' view -vim.g.netrw_banner = 0 -- Remove useless banner -vim.g.netrw_winsize = 15 -- Explore window takes % of page -vim.g.netrw_browse_split = 4 -- Open in previous window -vim.g.netrw_altv = 1 -- Always split left - --- VimWiki -vim.g.vimwiki_list = { - { - ["path"] = "$NOTES_PATH", - ["syntax"] = "markdown", - ["index"] = "home", - ["ext"] = ".md", - }, -} -vim.g.vimwiki_key_mappings = { - ["all_maps"] = 1, - ["mouse"] = 1, -} -vim.g.vimwiki_auto_chdir = 1 -- Set local dir to Wiki when open -vim.g.vimwiki_create_link = 0 -- Don't automatically create new links -vim.g.vimwiki_listsyms = " x" -- Set checkbox symbol progression -vim.g.vimwiki_table_mappings = 0 -- VimWiki table keybinds interfere with tab completion -vim.api.nvim_exec( - [[ - au FileType markdown inoremap ;tt :AddTag - - function! PInsert(item) - let @z=a:item - norm "zpx - endfunction - - command! AddTag call fzf#run({'source': 'rg "#[A-Za-z/]+[ |\$]" -o --no-filename --no-line-number | sort | uniq', 'sink': function('PInsert')}) -]], - false -) - --- =========================================================================== --- Custom Functions --- =========================================================================== - -grep_notes = function() - local opts = { - prompt_title = "Search Notes", - cwd = "$NOTES_PATH", - } - require("telescope.builtin").live_grep(opts) -end - -find_notes = function() - local opts = { - prompt_title = "Find Notes", - cwd = "$NOTES_PATH", - } - require("telescope.builtin").find_files(opts) -end - -find_downloads = function() - local opts = { - prompt_title = "Find Downloads", - cwd = "~/Downloads", - } - require("telescope").extensions.file_browser.file_browser(opts) -end - -choose_project = function() - local opts = require("telescope.themes").get_ivy({ - layout_config = { - bottom_pane = { - height = 10, - }, - }, - }) - require("telescope").extensions.project.project(opts) -end - --- clipboard_history = function() --- local opts = require("telescope.themes").get_cursor({ --- layout_config = { --- cursor = { --- width = 150, --- }, --- }, --- }) --- require("telescope").extensions.neoclip.neoclip(opts) --- end - -command_history = function() - local opts = require("telescope.themes").get_ivy({ - layout_config = { - bottom_pane = { - height = 15, - }, - }, - }) - require("telescope.builtin").command_history(opts) -end - --- =========================================================================== --- Key Mapping --- =========================================================================== - --- Function to cut down config boilerplate -local key = function(mode, key_sequence, action, params) - params = params or {} - params["noremap"] = true - vim.api.nvim_set_keymap(mode, key_sequence, action, params) -end - --- Remap space as leader key -key("", "", "", { silent = true }) -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --- Keep selection when changing indentation -key("v", "<", "", ">gv") - --- Clear search register -key("n", "", ":noh", { silent = true }) - --- Shuffle lines around -key("n", "", ":m .+1==") -key("n", "", ":m .-2==") -key("i", "", ":m .+1==gi") -key("i", "", ":m .-2==gi") -key("v", "", ":m '>+1gv=gv") -key("v", "", ":m '<-2gv=gv") - --- Telescope (fuzzy finder) -key("n", "k", ":Telescope keymaps") -key("n", "/", ":Telescope live_grep") -key("n", "ff", ":Telescope find_files") -key("n", "fp", ":Telescope git_files") -key("n", "fN", "lua find_notes()") -key("n", "N", "lua grep_notes()") -key("n", "fD", "lua find_downloads()") -key("n", "fa", ":Telescope file_browser") -key("n", "fw", ":Telescope grep_string") -key("n", "wt", ":Telescope tmux sessions") -key("n", "ww", ":Telescope tmux windows") -key("n", "w/", ":Telescope tmux pane_contents") -key("n", "fz", ":Telescope zoxide list") -key("n", "b", ":Telescope buffers") -key("n", "hh", ":Telescope help_tags") -key("n", "fr", ":Telescope oldfiles") -key("n", "cc", ":Telescope commands") -key("n", "cr", "lua command_history()") -key("n", "y", "lua clipboard_history()") -key("i", "", "lua clipboard_history()") -key("n", "s", ":Telescope current_buffer_fuzzy_find") -key("n", "gc", ":Telescope git_commits") -key("n", "gf", ":Telescope git_bcommits") -key("n", "gb", ":Telescope git_branches") -key("n", "gs", ":Telescope git_status") -key("n", "", "lua choose_project()") - --- Harpoon -key("n", "m", "lua require('harpoon.mark').add_file()") -key("n", "`", "lua require('harpoon.ui').toggle_quick_menu()") -key("n", "1", "lua require('harpoon.ui').nav_file(1)") -key("n", "2", "lua require('harpoon.ui').nav_file(2)") -key("n", "3", "lua require('harpoon.ui').nav_file(3)") - --- LSP -key("n", "gd", "lua vim.lsp.buf.definition()", { silent = true }) -key("n", "gT", "lua vim.lsp.buf.type_definition()", { silent = true }) -key("n", "gi", "lua vim.lsp.buf.implementation()", { silent = true }) -key("n", "gh", "lua vim.lsp.buf.hover()", { silent = true }) -key("n", "gr", "Telescope lsp_references", { silent = true }) -key("n", "R", "lua vim.lsp.buf.rename()", { silent = true }) -key("n", "]e", "lua vim.diagnostic.goto_next()", { silent = true }) -key("n", "[e", "lua vim.diagnostic.goto_prev()", { silent = true }) -key("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", { silent = true }) -key("n", "E", "lua vim.lsp.buf.code_action()", { silent = true }) - --- File commands -key("n", "q", ":quit") -key("n", "Q", ":quitall") -key("n", "fs", ":write") -key("n", "fd", ":lcd %:p:h", { silent = true }) -key("n", "fu", ":lcd ..", { silent = true }) -key("n", "", ":b#", { silent = true }) -key("n", "gr", ":!gh repo view -w", { silent = true }) -key("n", "tt", [[exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md']]) -key("n", "jj", ":!journal:e") - --- Window commands -key("n", "wv", ":vsplit") -key("n", "wh", ":split") -key("n", "wm", ":only") - --- Tabularize -key("", "ta", ":Tabularize /") -key("", "t#", ":Tabularize /#") -key("", "tl", ":Tabularize /---") - --- Vimrc editing -key("n", "fv", ":edit $DOTS/nvim.configlink/init.lua") -key("n", "rr", ":luafile $MYVIMRC") -key("n", "rp", ":luafile $MYVIMRC:PackerInstall:") -key("n", "rc", ":luafile $MYVIMRC:PackerCompile") - --- Keep cursor in place -key("n", "n", "nzz") -key("n", "N", "Nzz") -key("n", "J", "mzJ`z") --- Mark and jump back to it - --- Add undo breakpoints -key("i", ",", ",u") -key("i", ".", ".u") -key("i", "!", "!u") -key("i", "?", "?u") - --- Other -key("t", "", "") --- Exit terminal mode -key("n", "", ":noh", { silent = true }) --- Clear search in VimWiki -key("n", "Y", "y$") --- Copy to end of line -key("v", "", "y:%s/+//gc") --- Substitute selected -key("v", "D", "y'>gp") --- Duplicate selected diff --git a/nvim.configlink/stylua.toml b/nvim.configlink/stylua.toml deleted file mode 100644 index 394e884..0000000 --- a/nvim.configlink/stylua.toml +++ /dev/null @@ -1 +0,0 @@ -indent_type = "Spaces" diff --git a/python/boto/poetry.lock b/python/boto/poetry.lock deleted file mode 100644 index e871a32..0000000 --- a/python/boto/poetry.lock +++ /dev/null @@ -1,120 +0,0 @@ -[[package]] -name = "boto3" -version = "1.20.5" -description = "The AWS SDK for Python" -category = "main" -optional = false -python-versions = ">= 3.6" - -[package.dependencies] -botocore = ">=1.23.5,<1.24.0" -jmespath = ">=0.7.1,<1.0.0" -s3transfer = ">=0.5.0,<0.6.0" - -[package.extras] -crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] - -[[package]] -name = "botocore" -version = "1.23.5" -description = "Low-level, data-driven core of boto 3." -category = "main" -optional = false -python-versions = ">= 3.6" - -[package.dependencies] -jmespath = ">=0.7.1,<1.0.0" -python-dateutil = ">=2.1,<3.0.0" -urllib3 = ">=1.25.4,<1.27" - -[package.extras] -crt = ["awscrt (==0.12.5)"] - -[[package]] -name = "jmespath" -version = "0.10.0" -description = "JSON Matching Expressions" -category = "main" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - -[[package]] -name = "python-dateutil" -version = "2.8.2" -description = "Extensions to the standard Python datetime module" -category = "main" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" - -[package.dependencies] -six = ">=1.5" - -[[package]] -name = "s3transfer" -version = "0.5.0" -description = "An Amazon S3 Transfer Manager" -category = "main" -optional = false -python-versions = ">= 3.6" - -[package.dependencies] -botocore = ">=1.12.36,<2.0a.0" - -[package.extras] -crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"] - -[[package]] -name = "six" -version = "1.16.0" -description = "Python 2 and 3 compatibility utilities" -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" - -[[package]] -name = "urllib3" -version = "1.26.7" -description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" - -[package.extras] -brotli = ["brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] - -[metadata] -lock-version = "1.1" -python-versions = "^3.8" -content-hash = "fc1d3a2527ef475cf30a75a0bccfbe2fc3ca0ed539edb55268147bce9b170ff5" - -[metadata.files] -boto3 = [ - {file = "boto3-1.20.5-py3-none-any.whl", hash = "sha256:81ca80fbb3d551819c35c809cb159fd0bec6701d3d8f0e5906a22da7558d098e"}, - {file = "boto3-1.20.5.tar.gz", hash = "sha256:cc620c289b12d7bf7c2706b517c9f8950f9be4622aacc9e7580b8b4ee0d3bc73"}, -] -botocore = [ - {file = "botocore-1.23.5-py3-none-any.whl", hash = "sha256:c8eaeee0bac356396386aa9165043808fe736fb9e03ac0dedb1dfd82f41ad1a3"}, - {file = "botocore-1.23.5.tar.gz", hash = "sha256:49d1f012dc8467577a5fe603fc87cc13af816dd926b2bc2e28a3b2999ab14d36"}, -] -jmespath = [ - {file = "jmespath-0.10.0-py2.py3-none-any.whl", hash = "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f"}, - {file = "jmespath-0.10.0.tar.gz", hash = "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9"}, -] -python-dateutil = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, -] -s3transfer = [ - {file = "s3transfer-0.5.0-py3-none-any.whl", hash = "sha256:9c1dc369814391a6bda20ebbf4b70a0f34630592c9aa520856bf384916af2803"}, - {file = "s3transfer-0.5.0.tar.gz", hash = "sha256:50ed823e1dc5868ad40c8dc92072f757aa0e653a192845c94a3b676f4a62da4c"}, -] -six = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, -] -urllib3 = [ - {file = "urllib3-1.26.7-py2.py3-none-any.whl", hash = "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"}, - {file = "urllib3-1.26.7.tar.gz", hash = "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece"}, -] diff --git a/python/boto/pyproject.toml b/python/boto/pyproject.toml deleted file mode 100644 index 29b0d53..0000000 --- a/python/boto/pyproject.toml +++ /dev/null @@ -1,15 +0,0 @@ -[tool.poetry] -name = "boto" -version = "0.1.0" -description = "Amazon Web Services API" -authors = ["Noah Masur "] - -[tool.poetry.dependencies] -python = "^3.8" -boto3 = "^1.14.46" - -[tool.poetry.dev-dependencies] - -[build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" diff --git a/python/requests/poetry.lock b/python/requests/poetry.lock deleted file mode 100644 index 9f47717..0000000 --- a/python/requests/poetry.lock +++ /dev/null @@ -1,96 +0,0 @@ -[[package]] -name = "certifi" -version = "2020.12.5" -description = "Python package for providing Mozilla's CA Bundle." -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "chardet" -version = "3.0.4" -description = "Universal encoding detector for Python 2 and 3" -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "idna" -version = "2.10" -description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[[package]] -name = "python-dotenv" -version = "0.15.0" -description = "Add .env support to your django/flask apps in development and deployments" -category = "main" -optional = false -python-versions = "*" - -[package.extras] -cli = ["click (>=5.0)"] - -[[package]] -name = "requests" -version = "2.25.0" -description = "Python HTTP for Humans." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - -[package.dependencies] -certifi = ">=2017.4.17" -chardet = ">=3.0.2,<4" -idna = ">=2.5,<3" -urllib3 = ">=1.21.1,<1.27" - -[package.extras] -security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] -socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] - -[[package]] -name = "urllib3" -version = "1.26.5" -description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" - -[package.extras] -brotli = ["brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] - -[metadata] -lock-version = "1.1" -python-versions = "^3.9" -content-hash = "0e7791a51dfaac094d66da11fbe4465030798924ede1baef134e9a184d6eaa8b" - -[metadata.files] -certifi = [ - {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"}, - {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"}, -] -chardet = [ - {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, - {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, -] -idna = [ - {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, - {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, -] -python-dotenv = [ - {file = "python-dotenv-0.15.0.tar.gz", hash = "sha256:587825ed60b1711daea4832cf37524dfd404325b7db5e25ebe88c495c9f807a0"}, - {file = "python_dotenv-0.15.0-py2.py3-none-any.whl", hash = "sha256:0c8d1b80d1a1e91717ea7d526178e3882732420b03f08afea0406db6402e220e"}, -] -requests = [ - {file = "requests-2.25.0-py2.py3-none-any.whl", hash = "sha256:e786fa28d8c9154e6a4de5d46a1d921b8749f8b74e28bde23768e5e16eece998"}, - {file = "requests-2.25.0.tar.gz", hash = "sha256:7f1a0b932f4a60a1a65caa4263921bb7d9ee911957e0ae4a23a6dd08185ad5f8"}, -] -urllib3 = [ - {file = "urllib3-1.26.5-py2.py3-none-any.whl", hash = "sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c"}, - {file = "urllib3-1.26.5.tar.gz", hash = "sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098"}, -] diff --git a/python/requests/pyproject.toml b/python/requests/pyproject.toml deleted file mode 100644 index fb4576a..0000000 --- a/python/requests/pyproject.toml +++ /dev/null @@ -1,16 +0,0 @@ -[tool.poetry] -name = "ipython" -version = "0.1.0" -description = "" -authors = ["Your Name "] - -[tool.poetry.dependencies] -python = "^3.9" -requests = "^2.25.0" -python-dotenv = "^0.15.0" - -[tool.poetry.dev-dependencies] - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" diff --git a/rg/rgignore.symlink b/rg/rgignore.symlink deleted file mode 100644 index ae09259..0000000 --- a/rg/rgignore.symlink +++ /dev/null @@ -1,8 +0,0 @@ -!.env* -!.github/ -!.gitignore -!*.tfvars -!.ssh/ -.terraform/ -.target/ -/Library/ diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 127b816..0000000 --- a/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -# Environment with formatting tools for editing these files -{ pkgs ? import { } }: -pkgs.mkShell { - nativeBuildInputs = [ - pkgs.buildPackages.stylua - pkgs.buildPackages.nixfmt - pkgs.buildPackages.shfmt - pkgs.buildPackages.shellcheck - ]; -} diff --git a/starship/starship.toml.configlink b/starship/starship.toml.configlink deleted file mode 100644 index ba83599..0000000 --- a/starship/starship.toml.configlink +++ /dev/null @@ -1,57 +0,0 @@ -# Don't print a new line at the start of the prompt -add_newline = false -format = """\ - $directory\ - $git_branch\ - $git_commit\ - $git_status\ - $python\ - $character\ - """ - -[character] -success_symbol = "[❯](bold green)" -error_symbol = "[❯](bold red)" -vicmd_symbol = "[❮](bold green)" - -[cmd_duration] -min_time = 3_000 -show_notifications = true -min_time_to_notify = 30_000 -format = "[$duration]($style) " - -[directory] -truncate_to_repo = true -truncation_length = 100 - -[git_branch] -format = "[$symbol$branch]($style)" - -[git_commit] -format = "( @ [$hash]($style) )" -only_detached = false - -[git_status] -format = "([$all_status$ahead_behind]($style) )" -conflicted = "=" -ahead = "⇡" -behind = "⇣" -diverged = "⇕" -untracked = "⋄" -stashed = "⩮" -modified = "∽" -staged = "+" -renamed = "»" -deleted = "✘" -style = "red" - -[python] -symbol = "" -format = '[\($virtualenv\)]($style)' - -[custom.virtualenv] -command = "echo (basename $VIRTUAL_ENV)" # shows output of command -format = "[$output]($style) " -when = "true" -# prefix = "(" -# suffix = ") " diff --git a/windows/utc-time.reg b/windows/utc-time.reg new file mode 100644 index 0000000..9f09753 --- /dev/null +++ b/windows/utc-time.reg @@ -0,0 +1,7 @@ +Windows Registry Editor Version 5.00 + +; Changes registry to expect UTC from the hardware clock +; More info here: https://wiki.archlinux.org/title/System_time#UTC_in_Microsoft_Windows + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] +"RealTimeIsUniversal"=dword:00000001 \ No newline at end of file