diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index a7b536b..7d161dc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ fish_variables homebrew/*.lock.json *.bak *.db +**/.direnv/** diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..394e884 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1 @@ +indent_type = "Spaces" diff --git a/nixos/Makefile b/nixos/Makefile new file mode 100644 index 0000000..32f88e7 --- /dev/null +++ b/nixos/Makefile @@ -0,0 +1,27 @@ +# 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 diff --git a/nixos/awesomerc.lua b/nixos/awesomerc.lua new file mode 100644 index 0000000..a8de26f --- /dev/null +++ b/nixos/awesomerc.lua @@ -0,0 +1,564 @@ +-- 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 new file mode 100644 index 0000000..65ea5c9 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,215 @@ +# 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 + ]; + + 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. + + # Set your time zone, also used by redshift + services.localtime.enable = true; + services.geoclue2.enable = true; + location = { provider = "geoclue2"; }; + + # 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 = { spectrwm = { enable = true; }; }; + + # Enable touchpad support + libinput.enable = true; + + # Disable mouse acceleration + libinput.mouse.accelProfile = "flat"; + libinput.mouse.accelSpeed = "1.5"; + + # 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; [ gnome3.dconf ]; + + # Mouse config + services.ratbagd.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + + # Sound card drivers + alsa = { + enable = true; + support32Bit = true; + }; + + # PulseAudio emulation + pulse.enable = true; + }; + + # Install fonts + fonts.fonts = with pkgs; [ victor-mono nerdfonts ]; + fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ]; + + # Gaming + hardware.opengl = { + enable = true; + driSupport32Bit = true; + }; + hardware.steam-hardware.enable = true; + boot.kernel.sysctl = { "abi.vsyscall32" = 0; }; # League of Legends anti-cheat + + # Replace sudo with doas + security = { + + # Remove sudo + sudo.enable = false; + + # Add doas + doas = { + enable = true; + + # No password required + wheelNeedsPassword = false; + + # Pass environment variables from user to root + # Also requires removing password here + extraRules = [{ + groups = [ "wheel" ]; + noPass = true; + keepEnv = true; + }]; + }; + }; + + # 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" ]; + + # 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 + xlockmore + feh + + # Mouse config + libratbag + piper + + # Gaming + steam + lutris + amdvlk + wine + openssl # Required for League of Legends + dconf + ]; + + environment.variables = { NIX_SKIP_KEYBASE_CHECKS = "1"; }; + + # Reduce blue light at night + services.redshift = { + enable = true; + brightness = { + day = "1.0"; + night = "0.75"; + }; + }; + + # Login to Keybase in the background + services.keybase.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 new file mode 100644 index 0000000..ac091f3 --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,5 @@ +# 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 new file mode 100644 index 0000000..8e857bf --- /dev/null +++ b/nixos/home.nix @@ -0,0 +1,321 @@ +{ pkgs, ... }: + +let + + name = "Noah Masur"; + editor = "nvim"; + font = "Victor Mono"; + dotfiles = builtins.toString ../.; + nixos_config = builtins.toString ./.; + +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 + + # Utilities + unzip + gcc # for tree-sitter + starship + rsync + fzf + ripgrep + bat + fd + exa + sd + zoxide + jq + tealdeer + gh + direnv + tree + htop + glow + + # Encryption + keybase + 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"; + lf = "ls -lh | fzf"; + c = "cd"; + "-" = "cd -"; + mkd = "mkdir -pv"; + + # 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"; + 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}"; + }; + + 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; + }; + + programs.direnv = { + enable = true; + enableFishIntegration = 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 new file mode 100644 index 0000000..7b9584b --- /dev/null +++ b/nixos/qtile.py @@ -0,0 +1,195 @@ +# 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 new file mode 100644 index 0000000..522fcf9 --- /dev/null +++ b/nixos/spectrwm.conf @@ -0,0 +1,256 @@ +# 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 = +N:+I +S <+D>+4<%a %b %d %R %Z %Y+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]:IRC +# name = ws[2]:Email +# name = ws[3]:Browse +# 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/nixos/todo.txt b/nixos/todo.txt new file mode 100644 index 0000000..aba8331 --- /dev/null +++ b/nixos/todo.txt @@ -0,0 +1,14 @@ +libratbag (ratbagd) for input devices + +inspiration: https://github.com/JonathanReeve/dotfiles/blob/minimal/dotfiles/home.nix + +more: https://github.com/mitchellh/nixos-config/blob/main/users/mitchellh/home-manager.nix + +https://github.com/kyechou/leagueoflegends + +Encryption: +https://www.passwordstore.org/ +https://github.com/roddhjav/pass-tomb#readme +https://github.com/AGWA/git-crypt +https://github.com/FiloSottile/age +https://sr.ht/~gpanders/passage/ diff --git a/nvim.configlink/init.lua b/nvim.configlink/init.lua index 4d46f9f..c42adbd 100644 --- a/nvim.configlink/init.lua +++ b/nvim.configlink/init.lua @@ -40,6 +40,7 @@ require("packer").startup(function(use) use({ "morhetz/gruvbox", config = function() + vim.g.gruvbox_italic = 1 vim.cmd([[colorscheme gruvbox]]) end, }) @@ -137,10 +138,10 @@ require("packer").startup(function(use) require("lspconfig").rust_analyzer.setup({ capabilities = capabilities }) require("lspconfig").tflint.setup({ capabilities = capabilities }) require("lspconfig").terraformls.setup({ capabilities = capabilities }) - require("lspconfig").pyright.setup({ - cmd = { "poetry", "run", "pyright-langserver", "--stdio" }, - capabilities = capabilities, - }) + -- require("lspconfig").pyright.setup({ + -- cmd = { "poetry", "run", "pyright-langserver", "--stdio" }, + -- capabilities = capabilities, + -- }) end, }) @@ -159,12 +160,12 @@ require("packer").startup(function(use) require("null-ls").setup({ sources = { require("null-ls").builtins.formatting.stylua, - require("null-ls").builtins.formatting.black.with({ - command = "poetry", - args = { "run", "black", "--quiet", "--fast", "-" }, - }), + -- require("null-ls").builtins.formatting.black.with({ + -- command = "poetry", + -- args = { "run", "black", "--quiet", "--fast", "-" }, + -- }), require("null-ls").builtins.formatting.fish_indent, - -- require("null-ls").builtins.formatting.nixfmt, + 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({ @@ -338,7 +339,7 @@ require("packer").startup(function(use) fzy_native = {}, tmux = {}, zoxide = {}, - neoclip = {}, + --neoclip = {}, project = { base_dirs = { "~/dev/work" }, }, @@ -378,26 +379,26 @@ require("packer").startup(function(use) }) -- 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, - }) + -- 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({ @@ -573,16 +574,16 @@ choose_project = function() 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 +-- 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({ @@ -691,7 +692,7 @@ key("", "t#", ":Tabularize /#") key("", "tl", ":Tabularize /---") -- Vimrc editing -key("n", "fv", ":edit $MYVIMRC") +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") diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..4b583c4 --- /dev/null +++ b/shell.nix @@ -0,0 +1,5 @@ +# Environment with formatting tools for editing these files +{ pkgs ? import { } }: +pkgs.mkShell { + nativeBuildInputs = [ pkgs.buildPackages.stylua pkgs.buildPackages.nixfmt ]; +}