From 7fc2437bedef29e0149eae496efb3e3fec5b0e2a Mon Sep 17 00:00:00 2001 From: Jacob Bachmann Date: Wed, 30 Aug 2023 19:14:26 +0200 Subject: [PATCH] feat: initial commit --- README.md | 12 + flake.lock | 49 ++++ flake.nix | 29 +++ hosts/W530/default.nix | 5 + hosts/W530/hardware.nix | 89 ++++++++ modules/aliases.nix | 16 ++ modules/audio.nix | 11 + modules/bluetooth.nix | 9 + modules/boot.nix | 5 + modules/dbus.nix | 6 + modules/default.nix | 22 ++ modules/fonts.nix | 9 + modules/i18n.nix | 11 + modules/keyd.nix | 28 +++ modules/network.nix | 7 + modules/nix.nix | 7 + modules/nvidia.nix | 15 ++ modules/opengl.nix | 7 + modules/packages.nix | 23 ++ modules/power.nix | 6 + modules/print.nix | 4 + modules/security.nix | 6 + modules/shell.nix | 22 ++ modules/unfree.nix | 3 + modules/xdg-portal.nix | 8 + users/gandalf/default.nix | 36 +++ users/gandalf/modules/alacritty.nix | 24 ++ users/gandalf/modules/common.nix | 20 ++ users/gandalf/modules/default.nix | 14 ++ users/gandalf/modules/fzf.nix | 7 + users/gandalf/modules/gnupg.nix | 12 + users/gandalf/modules/neovim.nix | 131 +++++++++++ users/gandalf/modules/sway.nix | 280 +++++++++++++++++++++++ users/gandalf/modules/tmux.nix | 14 ++ users/gandalf/modules/vscode.nix | 147 ++++++++++++ users/gandalf/modules/waybar.nix | 338 ++++++++++++++++++++++++++++ users/gandalf/modules/wofi.nix | 66 ++++++ users/gandalf/modules/zsh.nix | 30 +++ 38 files changed, 1528 insertions(+) create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/W530/default.nix create mode 100644 hosts/W530/hardware.nix create mode 100644 modules/aliases.nix create mode 100644 modules/audio.nix create mode 100644 modules/bluetooth.nix create mode 100644 modules/boot.nix create mode 100644 modules/dbus.nix create mode 100644 modules/default.nix create mode 100644 modules/fonts.nix create mode 100644 modules/i18n.nix create mode 100644 modules/keyd.nix create mode 100644 modules/network.nix create mode 100644 modules/nix.nix create mode 100644 modules/nvidia.nix create mode 100644 modules/opengl.nix create mode 100644 modules/packages.nix create mode 100644 modules/power.nix create mode 100644 modules/print.nix create mode 100644 modules/security.nix create mode 100644 modules/shell.nix create mode 100644 modules/unfree.nix create mode 100644 modules/xdg-portal.nix create mode 100644 users/gandalf/default.nix create mode 100644 users/gandalf/modules/alacritty.nix create mode 100644 users/gandalf/modules/common.nix create mode 100644 users/gandalf/modules/default.nix create mode 100644 users/gandalf/modules/fzf.nix create mode 100644 users/gandalf/modules/gnupg.nix create mode 100644 users/gandalf/modules/neovim.nix create mode 100644 users/gandalf/modules/sway.nix create mode 100644 users/gandalf/modules/tmux.nix create mode 100644 users/gandalf/modules/vscode.nix create mode 100644 users/gandalf/modules/waybar.nix create mode 100644 users/gandalf/modules/wofi.nix create mode 100644 users/gandalf/modules/zsh.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..4510249 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Nix los hier + +:warning: WIP + +## References + +- https://nixos-and-flakes.thiscute.world/ +- https://git.sbruder.de/simon/nixos-config +- https://neovimcraft.com/ +- https://search.nixos.org/packages +- https://mipmip.github.io/home-manager-option-search/ + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dc817dd --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692099905, + "narHash": "sha256-/pSusGhmIdSdAaywQRFA5dVbfdIzlWQTecM+E46+cJ0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2a6679aa9cc3872c29ba2a57fe1b71b3e3c5649f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1692447944, + "narHash": "sha256-fkJGNjEmTPvqBs215EQU4r9ivecV5Qge5cF/QDLVn3U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d680ded26da5cf104dd2735a51e88d2d8f487b4d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c70219b --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Nix los hier"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations = { + W530 = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + + ./hosts/W530 + ./modules + + home-manager.nixosModules.home-manager + { + imports = [ ./users/gandalf ]; + } + + ]; + }; + }; + }; +} diff --git a/hosts/W530/default.nix b/hosts/W530/default.nix new file mode 100644 index 0000000..4c24c4a --- /dev/null +++ b/hosts/W530/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ ./hardware.nix ]; + + networking.hostName = "W530"; # Define your hostname. +} diff --git a/hosts/W530/hardware.nix b/hosts/W530/hardware.nix new file mode 100644 index 0000000..6d5960f --- /dev/null +++ b/hosts/W530/hardware.nix @@ -0,0 +1,89 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + boot.kernelParams = [ "resume_offset=9364344" ]; + boot.resumeDevice = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@" "compress=zstd" "noatime" ]; + }; + + boot.initrd.luks.devices."cryptlvm".device = "/dev/disk/by-uuid/d04a2c58-4116-45d6-aa6e-2002556e6d22"; + + fileSystems."/home" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@home" "compress=zstd" "noatime" ]; + }; + + fileSystems."/root" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@root" "compress=zstd" "noatime" ]; + }; + + fileSystems."/srv" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@srv" "compress=zstd" "noatime" ]; + }; + + fileSystems."/var/log" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@log" "compress=zstd" "noatime" ]; + }; + + fileSystems."/var/cache" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@cache" "compress=zstd" "noatime" ]; + }; + + fileSystems."/tmp" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@tmp" "compress=zstd" "noatime" ]; + }; + + fileSystems."/swap" = + { + device = "/dev/disk/by-uuid/2e6bd7f5-74f0-4047-a0ab-5679b877a9fe"; + fsType = "btrfs"; + options = [ "subvol=@swap" "noatime" ]; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/A410-7E4F"; + fsType = "vfat"; + }; + + swapDevices = [{ + device = "/swap/swapfile"; + }]; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/aliases.nix b/modules/aliases.nix new file mode 100644 index 0000000..835bbfe --- /dev/null +++ b/modules/aliases.nix @@ -0,0 +1,16 @@ +{ + ls = "lsd --color=auto"; + la = "lsd -lAh --group-directories-first"; + lt = "lsd -lAh --group-directories-first --tree"; + llt = "unbuffer lsd -lAh --group-directories-first --tree | less -r"; + gg = "cd ~/git"; + gs = "git status"; + gl = "git log --oneline"; + glg = "git log --oneline --graph --decorate --all"; + gaa = "git add --all"; + gc = "git commit -m"; + gp = "git push"; + ta = "tmux attach"; + ngc = "sudo nix-collect-garbage -d"; + nec = "sudo nvim -u $HOME/.config/nvim/init.lua --cmd 'cd /etc/nixos'"; +} diff --git a/modules/audio.nix b/modules/audio.nix new file mode 100644 index 0000000..11b3989 --- /dev/null +++ b/modules/audio.nix @@ -0,0 +1,11 @@ +{ ... }: { + # Enable pipewire - audio + services.pipewire = { + enable = true; + audio.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + jack.enable = true; + pulse.enable = true; + }; +} diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix new file mode 100644 index 0000000..44db521 --- /dev/null +++ b/modules/bluetooth.nix @@ -0,0 +1,9 @@ +{ ... }: { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + + services.blueman.enable = true; +} + diff --git a/modules/boot.nix b/modules/boot.nix new file mode 100644 index 0000000..cd4f93c --- /dev/null +++ b/modules/boot.nix @@ -0,0 +1,5 @@ +{ ... }: { + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/modules/dbus.nix b/modules/dbus.nix new file mode 100644 index 0000000..e72e170 --- /dev/null +++ b/modules/dbus.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + services.dbus = { + enable = true; + packages = [ pkgs.gcr ]; # needed for gnome pinentry + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..8e228f7 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,22 @@ +{ + imports = [ + ./audio.nix + ./bluetooth.nix + ./boot.nix + ./dbus.nix + ./fonts.nix + ./i18n.nix + ./keyd.nix + ./network.nix + ./nix.nix + ./nvidia.nix + ./opengl.nix + ./power.nix + ./packages.nix + ./print.nix + ./security.nix + ./shell.nix + ./unfree.nix + ./xdg-portal.nix + ]; +} diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..3121e40 --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + # Add fonts + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + (nerdfonts.override { fonts = [ "DejaVuSansMono" ]; }) + ]; + }; +} diff --git a/modules/i18n.nix b/modules/i18n.nix new file mode 100644 index 0000000..5e93699 --- /dev/null +++ b/modules/i18n.nix @@ -0,0 +1,11 @@ +{ ... }: { + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; +} diff --git a/modules/keyd.nix b/modules/keyd.nix new file mode 100644 index 0000000..bc2dbad --- /dev/null +++ b/modules/keyd.nix @@ -0,0 +1,28 @@ +{ ... }: { + # Enable keyd and remap keys + services.keyd = { + enable = true; + keyboards.default.settings = { + main = { + leftalt = "layer(meta)"; + leftmeta = "layer(alt)"; + altgr = "layer(control)"; + rightalt = "layer(control)"; + capslock = "layer(nav)"; + }; + meta = { + capslock = "overload(nav, capslock)"; + }; + nav = { + h = "left"; + j = "down"; + k = "up"; + l = "right"; + "0" = "home"; + "4" = "end"; + u = "pageup"; + d = "pagedown"; + }; + }; + }; +} diff --git a/modules/network.nix b/modules/network.nix new file mode 100644 index 0000000..e9faaf3 --- /dev/null +++ b/modules/network.nix @@ -0,0 +1,7 @@ +{ ... }: { + networking.networkmanager.enable = true; + + systemd.services = { + NetworkManager-wait-online.enable = false; + }; +} diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..a0d1242 --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,7 @@ +{ ... }: { + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + system.stateVersion = "23.05"; +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix new file mode 100644 index 0000000..f9e389c --- /dev/null +++ b/modules/nvidia.nix @@ -0,0 +1,15 @@ +{ ... }: { + /* + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + # Modesetting is needed for most Wayland compositors + modesetting.enable = true; + # Use the open source version of the kernel module + # Only available on driver 515.43.04+ + open = false; + # Enable the nvidia settings menu + nvidiaSettings = true; + }; + */ +} diff --git a/modules/opengl.nix b/modules/opengl.nix new file mode 100644 index 0000000..ee64259 --- /dev/null +++ b/modules/opengl.nix @@ -0,0 +1,7 @@ +{ ... }: { + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; +} diff --git a/modules/packages.nix b/modules/packages.nix new file mode 100644 index 0000000..4581b19 --- /dev/null +++ b/modules/packages.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + pciutils + qt6.qtwayland + xdg-utils # for opening default programs + glib # gsettings + git + mercurial # contains 'hg' + wget + neofetch + lsd + ripgrep + expect # contains 'unbuffer' + # languages + gcc13 + go + openjdk17 + javaPackages.openjfx17 + gradle_7 + python312 + nodejs_20 + ]; +} diff --git a/modules/power.nix b/modules/power.nix new file mode 100644 index 0000000..8372a65 --- /dev/null +++ b/modules/power.nix @@ -0,0 +1,6 @@ +{ ... }: { + powerManagement = { + enable = true; + powertop.enable = true; + }; +} diff --git a/modules/print.nix b/modules/print.nix new file mode 100644 index 0000000..8b637c8 --- /dev/null +++ b/modules/print.nix @@ -0,0 +1,4 @@ +{ ... }: { + # Enable CUPS to print documents. + services.printing.enable = true; +} diff --git a/modules/security.nix b/modules/security.nix new file mode 100644 index 0000000..2923b05 --- /dev/null +++ b/modules/security.nix @@ -0,0 +1,6 @@ +{ ... }: { + security.polkit.enable = true; + + # rtkit is optional but recommended + security.rtkit.enable = true; +} diff --git a/modules/shell.nix b/modules/shell.nix new file mode 100644 index 0000000..cd15af2 --- /dev/null +++ b/modules/shell.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +let + aliases = import ./aliases.nix; +in +{ + programs.zsh = { + enable = true; + }; + + users.users.gandalf = { + shell = pkgs.zsh; + }; + + environment = { + shellAliases = aliases; + }; + + programs.htop = { + enable = true; + }; + +} diff --git a/modules/unfree.nix b/modules/unfree.nix new file mode 100644 index 0000000..e83f701 --- /dev/null +++ b/modules/unfree.nix @@ -0,0 +1,3 @@ +{ ... }: { + nixpkgs.config.allowUnfree = true; +} diff --git a/modules/xdg-portal.nix b/modules/xdg-portal.nix new file mode 100644 index 0000000..014bfee --- /dev/null +++ b/modules/xdg-portal.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: { + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; +} diff --git a/users/gandalf/default.nix b/users/gandalf/default.nix new file mode 100644 index 0000000..92c95ee --- /dev/null +++ b/users/gandalf/default.nix @@ -0,0 +1,36 @@ +{ pkgs, ... }: +let + aliases = import ../../modules/aliases.nix; +in +{ + users.users.gandalf = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" ]; + packages = with pkgs; [ + firefox + speechd # https://support.mozilla.org/en-US/kb/speechd-setup + gopass + gopass-jsonapi + gnome.nautilus + gimp + ]; + }; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.users.gandalf = { pkgs, ... }: { + imports = [ ./modules ]; + + config = { + home = { + username = "gandalf"; + homeDirectory = "/home/gandalf"; + shellAliases = aliases; + stateVersion = "23.05"; + }; + }; + }; + + # programs.home-manager.enable = true; +} diff --git a/users/gandalf/modules/alacritty.nix b/users/gandalf/modules/alacritty.nix new file mode 100644 index 0000000..26c647d --- /dev/null +++ b/users/gandalf/modules/alacritty.nix @@ -0,0 +1,24 @@ +{ ... }: +let + common = import ./common.nix; +in +{ + # alacritty - a cross-platform, GPU-accelerated terminal emulator + programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + font = { + size = 12; + draw_bold_text_with_bright_colors = true; + normal = { + family = common.font; + }; + }; + scrolling.multiplier = 5; + selection.save_to_clipboard = true; + }; + }; +} + diff --git a/users/gandalf/modules/common.nix b/users/gandalf/modules/common.nix new file mode 100644 index 0000000..f7b0858 --- /dev/null +++ b/users/gandalf/modules/common.nix @@ -0,0 +1,20 @@ +{ + colorschemes = rec { + custom = { + black = "#000000"; + white = "#ffffff"; + + # https://yeun.github.io/open-color/ + active = "#ffdeeb"; # pink1 + activeDark = "#f783ac"; # pink4 + inactive = "#495057"; # gray7 + inactiveDark = "#212529"; # gray9 + alert = "#c92a2a"; # red9 + }; + default = custom; + }; + + font = "DejaVuSansM Nerd Font"; + font-size = "14"; + gtk = "Adwaita"; +} diff --git a/users/gandalf/modules/default.nix b/users/gandalf/modules/default.nix new file mode 100644 index 0000000..84c9aa0 --- /dev/null +++ b/users/gandalf/modules/default.nix @@ -0,0 +1,14 @@ +{ + imports = [ + ./alacritty.nix + ./fzf.nix + ./gnupg.nix + ./neovim.nix + ./sway.nix + ./tmux.nix + ./vscode.nix + ./waybar.nix + ./wofi.nix + ./zsh.nix + ]; +} diff --git a/users/gandalf/modules/fzf.nix b/users/gandalf/modules/fzf.nix new file mode 100644 index 0000000..110524b --- /dev/null +++ b/users/gandalf/modules/fzf.nix @@ -0,0 +1,7 @@ +{ + programs.fzf = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/users/gandalf/modules/gnupg.nix b/users/gandalf/modules/gnupg.nix new file mode 100644 index 0000000..fce39d6 --- /dev/null +++ b/users/gandalf/modules/gnupg.nix @@ -0,0 +1,12 @@ +{ ... }: { + programs.gpg = { + enable = true; + }; + + services.gpg-agent = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + pinentryFlavor = "gnome3"; + }; +} diff --git a/users/gandalf/modules/neovim.nix b/users/gandalf/modules/neovim.nix new file mode 100644 index 0000000..ab5392d --- /dev/null +++ b/users/gandalf/modules/neovim.nix @@ -0,0 +1,131 @@ +{ pkgs, ... }: { + programs.neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + plugins = with pkgs.vimPlugins; [ + telescope-nvim + toggleterm-nvim + nvim-tree-lua + (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) + nvim-lspconfig + ]; + extraPackages = with pkgs; [ + nil + nixpkgs-fmt + ]; + extraLuaConfig = '' + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- set termguicolors to enable highlight groups + vim.opt.termguicolors = true + + local set = vim.opt + set.tabstop = 2 + set.shiftwidth = 2 + set.softtabstop = 2 + set.expandtab = true + -- needed for toggleterm + set.hidden = true + + -- nvim-tree setup + local nvimtree = require('nvim-tree') + local nvimtreeapi = require('nvim-tree.api') + local function nvimtree_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '', api.tree.toggle, {}) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) + end + nvimtree.setup({ + on_attach = nvimtree_on_attach, + }) + vim.keymap.set('n', '', nvimtreeapi.tree.toggle, {}) + + -- telescope setup + local telescope = require('telescope.builtin') + vim.keymap.set('n', 'ff', telescope.find_files, {}) + vim.keymap.set('n', 'fg', telescope.live_grep, {}) + vim.keymap.set('n', 'fb', telescope.buffers, {}) + vim.keymap.set('n', 'fh', telescope.help_tags, {}) + + -- toggleterm setup + local toggleterm = require('toggleterm') + toggleterm.setup{ + open_mapping = [[]], + hide_numbers = false, + autochdir = true, + direction = 'float', + float_opts = { + border = 'curved', + }, + } + + -- nvim-treesitter + local treesitter = require('nvim-treesitter.configs') + treesitter.setup { + indent = { + enable = true + }, + highlight = { + enable = true + }, + } + + -- nvim-lspconfig + local lspconfig = require('lspconfig') + lspconfig.nil_ls.setup { + settings = { + ['nil'] = { + formatting = { + command = { "nixpkgs-fmt" }, + }, + }, + }, + } + + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + -- vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + -- vim.keymap.set('n', 'wl', function() + -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + -- end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + -- vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + -- vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, + }) + ''; + }; +} diff --git a/users/gandalf/modules/sway.nix b/users/gandalf/modules/sway.nix new file mode 100644 index 0000000..804834c --- /dev/null +++ b/users/gandalf/modules/sway.nix @@ -0,0 +1,280 @@ +{ config, pkgs, ... }: +let + cfg = config.wayland.windowManager.sway.config; + common = import ./common.nix; +in +{ + home.packages = with pkgs; [ + brightnessctl # control screen brightness + pavucontrol # control audio + networkmanagerapplet # control network + dracula-theme # gtk theme + gnome3.adwaita-icon-theme # default gnome cursors + # wdisplays # graphical output manager + # wev # wayland event monitor + wl-clipboard # cli tool to manage wayland clipboard + # wl-mirror # emulation for “mirror display” mode + # wlr-randr # output management that actually works + ]; + + wayland.windowManager.sway = { + enable = true; + wrapperFeatures = { + base = true; + gtk = true; + }; + xwayland = true; + extraSessionCommands = '' + export CLUTTER_BACKEND=wayland; + export GDK_BACKEND=wayland; + export GDK_DPI_SCALE=1; + export NIXOS_OZONE_WL=1; + export WLR_NO_HARDWARE_CURSORS=1; + export MOZ_ENABLE_WAYLAND=1; + export MOZ_USE_XINPUT2=1; + export XDG_SESSION_TYPE=wayland; + export XDG_CURRENT_DESKTOP=sway; + # SDL: + export SDL_VIDEODRIVER=wayland + # QT (needs qt5.qtwayland in systemPackages): + export QT_QPA_PLATFORM=wayland-egl + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"; + ''; + config = { + modifier = "Mod4"; + terminal = "${pkgs.alacritty}/bin/alacritty"; + menu = "${pkgs.wofi}/bin/wofi"; + startup = [ + { command = "blueman-applet"; } + { command = "nm-applet"; } + ]; + input = { + "2:7:SynPS/2_Synaptics_TouchPad" = { + accel_profile = "flat"; + dwt = "enabled"; + dwtp = "enabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + scroll_factor = "0.3"; + }; + "2:10:TPPS/2_IBM_TrackPoint" = { + accel_profile = "flat"; + scroll_factor = "0.5"; + }; + }; + left = "h"; + down = "j"; + up = "k"; + right = "l"; + keybindings = { + # Basics + "${cfg.modifier}+Return" = "exec ${cfg.terminal}"; + "${cfg.modifier}+q" = "kill"; + "${cfg.modifier}+Space" = "exec ${cfg.menu}"; + "${cfg.modifier}+Shift+c" = "reload"; + "${cfg.modifier}+Shift+q" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; + + # Focus + "${cfg.modifier}+${cfg.left}" = "focus left"; + "${cfg.modifier}+${cfg.down}" = "focus down"; + "${cfg.modifier}+${cfg.up}" = "focus up"; + "${cfg.modifier}+${cfg.right}" = "focus right"; + + "${cfg.modifier}+Left" = "focus left"; + "${cfg.modifier}+Down" = "focus down"; + "${cfg.modifier}+Up" = "focus up"; + "${cfg.modifier}+Right" = "focus right"; + + # Moving + "${cfg.modifier}+Shift+${cfg.left}" = "move left"; + "${cfg.modifier}+Shift+${cfg.down}" = "move down"; + "${cfg.modifier}+Shift+${cfg.up}" = "move up"; + "${cfg.modifier}+Shift+${cfg.right}" = "move right"; + + "${cfg.modifier}+Shift+Left" = "move left"; + "${cfg.modifier}+Shift+Down" = "move down"; + "${cfg.modifier}+Shift+Up" = "move up"; + "${cfg.modifier}+Shift+Right" = "move right"; + + # Workspaces + "${cfg.modifier}+1" = "workspace number 1"; + "${cfg.modifier}+2" = "workspace number 2"; + "${cfg.modifier}+3" = "workspace number 3"; + "${cfg.modifier}+4" = "workspace number 4"; + "${cfg.modifier}+5" = "workspace number 5"; + "${cfg.modifier}+6" = "workspace number 6"; + "${cfg.modifier}+7" = "workspace number 7"; + "${cfg.modifier}+8" = "workspace number 8"; + "${cfg.modifier}+9" = "workspace number 9"; + "${cfg.modifier}+0" = "workspace number 10"; + + "${cfg.modifier}+Shift+1" = "move container to workspace number 1"; + "${cfg.modifier}+Shift+2" = "move container to workspace number 2"; + "${cfg.modifier}+Shift+3" = "move container to workspace number 3"; + "${cfg.modifier}+Shift+4" = "move container to workspace number 4"; + "${cfg.modifier}+Shift+5" = "move container to workspace number 5"; + "${cfg.modifier}+Shift+6" = "move container to workspace number 6"; + "${cfg.modifier}+Shift+7" = "move container to workspace number 7"; + "${cfg.modifier}+Shift+8" = "move container to workspace number 8"; + "${cfg.modifier}+Shift+9" = "move container to workspace number 9"; + "${cfg.modifier}+Shift+0" = "move container to workspace number 10"; + + "${cfg.modifier}+Control+${cfg.down}" = "workspace prev"; + "${cfg.modifier}+Control+${cfg.up}" = "workspace next"; + "${cfg.modifier}+Control+Shift+${cfg.down}" = "move workspace to output left"; + "${cfg.modifier}+Control+Shift+${cfg.up}" = "move workspace to output right"; + + # Splits + "${cfg.modifier}+b" = "splith"; + "${cfg.modifier}+v" = "splitv"; + + # Layouts + "${cfg.modifier}+s" = "layout stacking"; + "${cfg.modifier}+w" = "layout tabbed"; + "${cfg.modifier}+e" = "layout toggle split"; + "${cfg.modifier}+f" = "fullscreen toggle"; + + "${cfg.modifier}+a" = "focus parent"; + + "${cfg.modifier}+d" = "floating toggle"; + "${cfg.modifier}+Shift+d" = "focus mode_toggle"; + + # Scratchpad + "${cfg.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.modifier}+minus" = "scratchpad show"; + + # Resize mode + "${cfg.modifier}+r" = "mode resize"; + + # Multimedia Keys + "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"; + "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"; + "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "XF86AudioMicMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + + "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%-"; + "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%+"; + + # "XF86AudioPrev" = "exec ${pkgs.mpc_cli}/bin/mpc -q next"; + # "XF86AudioNext" = "exec ${pkgs.mpc_cli}/bin/mpc -q prev"; + # "XF86AudioPlay" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle"; + # "XF86AudioPause" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle"; + + # Programs + "${cfg.modifier}+Shift+v" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; + "${cfg.modifier}+Shift+b" = "exec ${pkgs.blueman}/bin/blueman-manager"; + "${cfg.modifier}+Shift+n" = "exec ${pkgs.networkmanagerapplet}/bin/nm-connection-editor"; + }; + fonts = { + names = [ common.font ]; + style = "Bold"; + size = 12.0; + }; + seat = { + "*" = { + xcursor_theme = common.gtk; + }; + }; + window = { + titlebar = false; + border = 4; + }; + gaps = { + inner = 5; + }; + colors = { + focused = { + border = common.colorschemes.default.active; + background = common.colorschemes.default.active; + text = common.colorschemes.default.black; + indicator = common.colorschemes.default.activeDark; + childBorder = common.colorschemes.default.active; + }; + focusedInactive = { + border = common.colorschemes.default.inactive; + background = common.colorschemes.default.inactive; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.inactive; + childBorder = common.colorschemes.default.inactive; + }; + unfocused = { + border = common.colorschemes.default.inactiveDark; + background = common.colorschemes.default.inactiveDark; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.inactiveDark; + childBorder = common.colorschemes.default.inactiveDark; + }; + urgent = { + border = common.colorschemes.default.alert; + background = common.colorschemes.default.alert; + text = common.colorschemes.default.white; + indicator = common.colorschemes.default.black; + childBorder = common.colorschemes.default.alert; + }; + placeholder = { + border = common.colorschemes.default.active; + background = common.colorschemes.default.active; + text = common.colorschemes.default.black; + indicator = common.colorschemes.default.activeDark; + childBorder = common.colorschemes.default.active; + }; + }; + bars = [ + { + command = "${pkgs.waybar}/bin/waybar"; + } + ]; + }; + extraConfig = '' + for_window [title="Firefox — Sharing Indicator"] { + floating enable + } + for_window [title="Bluetooth Devices"] { + floating enable + resize set 700px 450px + move position 100ppt 0 + move left 700px + } + for_window [title="Volume Control"] { + floating enable + resize set 700px 450px + move position 100ppt 0 + move left 700px + } + for_window [app_id="nm-connection-editor" title="Network Connections"] { + floating enable + resize set 700px 450px + move position 100ppt 0 + move left 700px + } + for_window [app_id="thunderbird" title="Reminder"] { + floating enable + resize set 700px 450px + move position 100ppt 0 + move left 700px + } + + set $ddterm-id dropdown-terminal + set $ddterm ${cfg.terminal} --class $ddterm-id + set $ddterm-resize resize set 100ppt 40ppt, move position 0 0 + + # resize/move new dropdown terminal windows + for_window [app_id="$ddterm-id"] { + floating enable + $ddterm-resize + move to scratchpad + scratchpad show + } + + # show existing or start new dropdown terminal + bindsym ${cfg.modifier}+grave exec swaymsg '[app_id="$ddterm-id"] scratchpad show' || $ddterm && sleep .1 && swaymsg '[app_id="$ddterm-id"] $ddterm-resize' + # ^-- resize again, case moving to different output + ''; + }; +} + diff --git a/users/gandalf/modules/tmux.nix b/users/gandalf/modules/tmux.nix new file mode 100644 index 0000000..dafbcff --- /dev/null +++ b/users/gandalf/modules/tmux.nix @@ -0,0 +1,14 @@ +{ + programs.tmux = { + enable = true; + newSession = true; + terminal = "screen-256color"; + + clock24 = true; + escapeTime = 0; + historyLimit = 10000; + + mouse = true; + keyMode = "vi"; + }; +} diff --git a/users/gandalf/modules/vscode.nix b/users/gandalf/modules/vscode.nix new file mode 100644 index 0000000..65bd286 --- /dev/null +++ b/users/gandalf/modules/vscode.nix @@ -0,0 +1,147 @@ +{ pkgs, ... }: +let + common = import ./common.nix; +in +{ + programs.vscode = { + enable = true; + enableExtensionUpdateCheck = true; + enableUpdateCheck = false; + extensions = with pkgs.vscode-extensions; [ + vscodevim.vim + editorconfig.editorconfig + dbaeumer.vscode-eslint + waderyan.gitblame + bierner.markdown-mermaid + pkief.material-icon-theme + christian-kohler.path-intellisense + johnpapa.vscode-peacock + esbenp.prettier-vscode + bradlc.vscode-tailwindcss + jnoortheen.nix-ide + ]; + userSettings = { + "window.menuBarVisibility" = "toggle"; + + "workbench.iconTheme" = "material-icon-theme"; + + "explorer.confirmDragAndDrop" = false; + "explorer.confirmDelete" = false; + + "editor.renderControlCharacters" = true; + "editor.renderWhitespace" = "all"; + "editor.renderFinalNewline" = "on"; + "editor.tabSize" = 4; + "editor.cursorStyle" = "line"; + "editor.insertSpaces" = false; + "editor.lineNumbers" = "on"; + "editor.wordSeparators" = "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"; + "editor.wordWrap" = "on"; + "editor.suggestSelection" = "first"; + "editor.fontFamily" = common.font; + "editor.fontSize" = 16; + "editor.bracketPairColorization.enabled" = true; + "editor.guides.bracketPairs" = "active"; + "editor.quickSuggestions" = { + strings = "on"; + }; + "editor.codeActionsOnSave" = { + ".source.organizeImports" = true; + }; + + "terminal.integrated.fontFamily" = common.font; + + "files.exclude" = { + "**/.classpath" = true; + "**/.project" = true; + "**/.settings" = true; + "**/.factorypath" = true; + "**/__pycache__" = true; + }; + + "[html]" = { + "editor.tabSize" = 2; + "editor.insertSpaces" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[javascript]" = { + "editor.tabSize" = 2; + "editor.insertSpaces" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[typescript]" = { + "editor.tabSize" = 2; + "editor.insertSpaces" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[typescriptreact]" = { + "editor.tabSize" = 2; + "editor.insertSpaces" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[python]" = { + "editor.tabSize" = 4; + "editor.insertSpaces" = true; + "editor.formatOnType" = true; + }; + "[yaml]" = { + "editor.insertSpaces" = true; + "editor.tabSize" = 2; + "editor.autoIndent" = "advanced"; + }; + "[json]" = { + "editor.defaultFormatter" = "vscode.json-language-features"; + }; + "[jsonc]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[java]" = { + "editor.defaultFormatter" = "redhat.java"; + }; + "[markdown]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[css]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[nix]" = { + "editor.defaultFormatter" = "jnoortheen.nix-ide"; + }; + + + "git.autofetch" = true; + "json.schemaDownload.enable" = true; + "javascript.updateImportsOnFileMove.enabled" = "always"; + "typescript.updateImportsOnFileMove.enabled" = "always"; + + "nix.enableLanguageServer" = true; + "nix.serverPath" = "${pkgs.nil}/bin/nil"; + "nix.formatterPath" = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"; + }; + + keybindings = [ + { + key = "ctrl+tab"; + command = "workbench.action.nextEditor"; + } + { + key = "ctrl+shift+tab"; + command = "workbench.action.previousEditor"; + } + { + key = "alt+left"; + command = "workbench.action.navigateBack"; + } + { + key = "alt+right"; + command = "workbench.action.navigateForward"; + } + { + key = "ctrl+f"; + command = "editor.action.formatDocument"; + when = "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"; + } + ]; + }; +} + diff --git a/users/gandalf/modules/waybar.nix b/users/gandalf/modules/waybar.nix new file mode 100644 index 0000000..76571af --- /dev/null +++ b/users/gandalf/modules/waybar.nix @@ -0,0 +1,338 @@ +{ pkgs, ... }: { + programs.waybar = { + enable = true; + + settings.mainBar = { + layer = "top"; + margin = "5 5 5 5"; + modules-left = [ "sway/workspaces" "sway/window" "sway/mode" ]; + modules-center = [ "clock" ]; + modules-right = [ "tray" "network" "pulseaudio" "custom/mem" "temperature" "backlight" "battery" ]; + "sway/workspaces" = { + disable-scroll = true; + persistent_workspaces = { + "1" = [ ]; + "2" = [ ]; + "3" = [ ]; + "4" = [ ]; + }; + }; + "sway/window" = { + format = "{title}"; + max-length = 43; + }; + "sway/mode" = { + format = "{}"; + }; + clock = { + timezones = [ "Europe/Berlin" ]; + tooltip-format = "{:%Y %B}\n{calendar}"; + format = "{:%a, %d %b, %H:%M}"; + actions = { + on-click = "tz_up"; + }; + }; + network = { + interval = 1; + format = "{ifname}"; + format-wifi = "{signalStrength}% "; + format-ethernet = "eth 󰈁"; + format-disconnected = "󰈂"; # An empty format will hide the module. + tooltip-format = "{ifname} via {gwaddr} 󰈁"; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + }; + pulseaudio = { + reverse-scrolling = 1; + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = "󰖁 {icon} {format_source}"; + format-muted = "󰖁 {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = "󰋎"; + headset = "󰋎"; + phone = ""; + portable = ""; + car = ""; + default = [ + "󰕿" + "󰖀" + "󰕾" + ]; + }; + on-click = "${pkgs.pavucontrol}/bin/pavucontrol"; + min-length = 13; + }; + "custom/mem" = { + format = "{} 󰍛"; + interval = 3; + exec = "free -h | awk '/Mem:/{printf $3}'"; + tooltip = false; + }; + temperature = { + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + tooltip = false; + }; + backlight = { + device = "intel_backlight"; + format = "{percent}% {icon}"; + format-icons = [ + "󰌶" + "󱩎" + "󱩏" + "󱩐" + "󱩑" + "󱩒" + "󱩓" + "󱩔" + "󱩕" + "󱩖" + "󰛨" + ]; + }; + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% 󰂄"; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = [ + "󰂃" + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + on-update = pkgs.writeShellScript "check-battery" '' + bat=/sys/class/power_supply/BAT0 + CRIT=''${1:-15} + + FILE=~/.config/waybar/.notified.target + + stat=$(cat $bat/status) + perc=$(cat $bat/capacity) + + if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then + if [[ ! -f "$FILE" ]]; then + notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%" + touch $FILE + fi + elif [[ -f "$FILE" ]]; then + rm $FILE + fi + ''; + }; + tray = { + icon-size = 16; + spacing = 0; + }; + }; + style = '' + @define-color bg-color #212529; + + * { + border: none; + border-radius: 0; + font-family: DejaVuSansM Nerd Font; + min-height: 20px; + } + + window#waybar { + background: transparent; + } + + window#waybar.hidden { + opacity: 0.2; + } + + #workspaces { + padding-left: 8px; + padding-right: 8px; + margin-right: 8px; + border-radius: 10px; + transition: none; + background: @bg-color; + } + + #workspaces button { + transition: none; + color: #7c818c; + background: transparent; + padding: 5px; + font-size: 18px; + } + + #workspaces button.persistent { + color: #7c818c; + font-size: 12px; + } + + #workspaces button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + border-radius: inherit; + color: @bg-color; + background: #7c818c; + } + + #workspaces button.focused { + color: white; + } + + #window { + padding-left: 16px; + padding-right: 16px; + margin-right: 8px; + border-radius: 10px 10px 10px 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #mode { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #clock { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px 10px 10px 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #network { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #pulseaudio { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; + } + + #custom-mem { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #temperature { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #temperature.critical { + background-color: #eb4d4b; + } + + #backlight { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #battery { + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + #battery.charging { + color: #ffffff; + background-color: #26A65B; + } + + #battery.warning:not(.charging) { + background-color: #ffbe61; + color: black; + } + + #battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #tray { + margin-right: 8px; + padding-left: 16px; + padding-right: 16px; + border-radius: 10px; + transition: none; + color: #ffffff; + background: @bg-color; + } + + @keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } + } + ''; + }; +} diff --git a/users/gandalf/modules/wofi.nix b/users/gandalf/modules/wofi.nix new file mode 100644 index 0000000..65a81dd --- /dev/null +++ b/users/gandalf/modules/wofi.nix @@ -0,0 +1,66 @@ +{ ... }: +let + common = import ./common.nix; +in +{ + programs.wofi = { + enable = true; + settings = { + show = "drun"; + allow_images = true; + image_size = 24; + no_actions = true; + }; + style = '' + * { + font-family: '${common.font}', monospace; + font-size: ${common.font-size}px; + color: ${common.colorschemes.default.black}; + } + + window { + background-color: transparent; + } + + #input { + background-color: ${common.colorschemes.default.active}; + border: 5px; + border-color: ${common.colorschemes.default.activeDark}; + border-radius: 0px; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 20px; + padding-right: 20px; + margin-bottom: 10px; + } + + #scroll { + background-color: ${common.colorschemes.default.active}; + border: 5px; + border-color: ${common.colorschemes.default.activeDark}; + border-radius: 0px; + padding: 10px; + } + + #entry { + padding: 10px; + } + + #entry #text { + margin-left: 20px; + } + + #entry:selected { + background-color: ${common.colorschemes.default.activeDark}; + } + + #entry:selected #img { + background-color: ${common.colorschemes.default.activeDark}; + } + + #entry:selected #text { + background-color: ${common.colorschemes.default.activeDark}; + } + ''; + }; +} diff --git a/users/gandalf/modules/zsh.nix b/users/gandalf/modules/zsh.nix new file mode 100644 index 0000000..a636de2 --- /dev/null +++ b/users/gandalf/modules/zsh.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: { + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + plugins = [ + { + name = "zsh-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = "0.7.1"; + hash = "sha256-gOG0NLlaJfotJfs+SUhGgLTNOnGLjoqnUp54V9aFJg8="; + }; + } + ]; + oh-my-zsh = { + enable = true; + theme = "terminalparty"; + plugins = [ + "git" + ]; + }; + history = { + path = "${config.xdg.dataHome}/zsh/histfile"; + size = 10000; + save = 10000; + }; + }; +}