From e27cafb15bf81c6d07043607eb32bb97dc1b3b63 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Thu, 4 Apr 2024 18:44:59 -0500 Subject: [PATCH] i3 is mostly working! --- flake.lock | 36 ++-- flake.nix | 16 +- hosts/archlaptop-vm/configuration.nix | 137 ------------ hosts/archlaptop-vm/default.nix | 115 ++++++++++ hosts/archlaptop-vm/home.nix | 31 --- hosts/workstation-vm/default.nix | 57 ++--- hosts/workstation-vm/home.nix | 15 -- modules/both/i3/default.nix | 203 ++++++++++++++++-- modules/both/sound.nix | 7 + modules/home-manager/dunst.nix | 51 +++++ .../home-manager/{i3/default.nix => mpd.nix} | 0 modules/home-manager/nvim/options.nix | 2 +- modules/home-manager/nvim/simpleplugins.nix | 2 +- modules/home-manager/nvim/which-key.nix | 2 +- modules/home-manager/rofi.nix | 13 ++ modules/nixos/common.nix | 8 +- modules/nixos/touchpad.nix | 9 +- 17 files changed, 444 insertions(+), 260 deletions(-) delete mode 100644 hosts/archlaptop-vm/configuration.nix create mode 100644 hosts/archlaptop-vm/default.nix delete mode 100644 hosts/archlaptop-vm/home.nix delete mode 100644 hosts/workstation-vm/home.nix create mode 100644 modules/home-manager/dunst.nix rename modules/home-manager/{i3/default.nix => mpd.nix} (100%) create mode 100644 modules/home-manager/rofi.nix diff --git a/flake.lock b/flake.lock index 7af0878..6e57085 100644 --- a/flake.lock +++ b/flake.lock @@ -138,11 +138,11 @@ ] }, "locked": { - "lastModified": 1711133180, - "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", + "lastModified": 1712212014, + "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", "owner": "nix-community", "repo": "home-manager", - "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", + "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", "type": "github" }, "original": { @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1711133180, - "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", + "lastModified": 1711625603, + "narHash": "sha256-W+9dfqA9bqUIBV5u7jaIARAzMe3kTq/Hp2SpSVXKRQw=", "owner": "nix-community", "repo": "home-manager", - "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", + "rev": "c0ef0dab55611c676ad7539bf4e41b3ec6fa87d2", "type": "github" }, "original": { @@ -180,11 +180,11 @@ ] }, "locked": { - "lastModified": 1710717205, - "narHash": "sha256-Wf3gHh5uV6W1TV/A8X8QJf99a5ypDSugY4sNtdJDe0A=", + "lastModified": 1711763326, + "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "bcc8afd06e237df060c85bad6af7128e05fd61a3", + "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", "type": "github" }, "original": { @@ -195,11 +195,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1711163522, - "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { @@ -222,11 +222,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1711284540, - "narHash": "sha256-DTzi4ujZoxM3ZXStCwD6Lph3FdGtkBlvfYsDCRITjfA=", + "lastModified": 1712234256, + "narHash": "sha256-UKt7HrwYc9xab+gDb5C24V75MVKfHW2VsZ6qL28my6Q=", "owner": "nix-community", "repo": "nixvim", - "rev": "e7a3461fefd983ae3443e9aa849e9d1566ab47e4", + "rev": "2c99cefa913c8afb8fa08e53608c6f8bd5a2e5c4", "type": "github" }, "original": { @@ -250,11 +250,11 @@ ] }, "locked": { - "lastModified": 1710923068, - "narHash": "sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI+JMJuLo45aG3cKc=", + "lastModified": 1711760932, + "narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e611897ddfdde3ed3eaac4758635d7177ff78673", + "rev": "c11e43aed6f17336c25cd120eac886b96c455731", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6c1cfd3..66e0bd9 100644 --- a/flake.nix +++ b/flake.nix @@ -33,21 +33,7 @@ # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - archlaptop-vm = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = {inherit inputs outputs;}; - # > Our main nixos configuration file < - modules = [ - ./hosts/archlaptop-vm/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.gabe = import ./hosts/archlaptop-vm/home.nix; - home-manager.extraSpecialArgs = {inherit inputs outputs;}; - } - ]; - }; + archlaptop-vm = import ./hosts/archlaptop-vm {inherit inputs outputs;}; workstation-vm = import ./hosts/workstation-vm {inherit inputs outputs;}; }; diff --git a/hosts/archlaptop-vm/configuration.nix b/hosts/archlaptop-vm/configuration.nix deleted file mode 100644 index d86228e..0000000 --- a/hosts/archlaptop-vm/configuration.nix +++ /dev/null @@ -1,137 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - pkgs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "archlaptop-vm"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "America/Chicago"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - nix = { - package = pkgs.nixFlakes; - extraOptions = '' - experimental-features = nix-command flakes - ''; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the Cinnamon Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.cinnamon.enable = true; - - # Configure keymap in X11 - services.xserver = { - xkb.layout = "us"; - xkb.variant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.gabe = { - isNormalUser = true; - description = "Gabe Venberg"; - shell = pkgs.nushell; - extraGroups = ["networkmanager" "wheel"]; - packages = with pkgs; [ - firefox - # thunderbird - ]; - }; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - ]; - - # 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; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix new file mode 100644 index 0000000..a93aa67 --- /dev/null +++ b/hosts/archlaptop-vm/default.nix @@ -0,0 +1,115 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + inputs, + outputs, + ... +}: +inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs outputs;}; + # > Our main nixos configuration file < + modules = [ + inputs.home-manager.nixosModules.home-manager + ./hardware-configuration.nix + ../../modules/commonopts.nix + ../../modules/nixos/common.nix + ../../modules/nixos/printing.nix + ../../modules/both/sound.nix + ../../modules/both/networking.nix + ../../modules/both/i3 + ({ + config, + pkgs, + ... + }: { + host = { + user = "gabe"; + gui.enable = true; + }; + networking.hostName = "archlaptop-vm"; # Define your hostname. + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${config.host.user} = { + isNormalUser = true; + description = "Gabe Venberg"; + shell = pkgs.nushell; + extraGroups = ["wheel"]; + packages = with pkgs; [ + firefox + # thunderbird + ]; + }; + + home-manager.users.${config.host.user} = {inputs, ...}: { + host = { + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile.enable = false; + }; + }; + imports = [ + ../../modules/home-manager/terminal + ../../modules/home-manager/nvim + ../../modules/home-manager + inputs.nixvim.homeManagerModules.nixvim + ]; + }; + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + + # Enable the X11 windowing system. + # services.xserver.enable = true; + # + # # Enable the Cinnamon Desktop Environment. + # services.xserver.displayManager.lightdm.enable = true; + # services.xserver.desktopManager.cinnamon.enable = true; + }) + ]; +} diff --git a/hosts/archlaptop-vm/home.nix b/hosts/archlaptop-vm/home.nix deleted file mode 100644 index cfa1306..0000000 --- a/hosts/archlaptop-vm/home.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - ... -}: { - # machine specific options - host = { - enable-speech = true; - nvim = { - enable-lsp = true; - enable-treesitter = true; - }; - git = { - profile = { - name = "Gabe Venberg"; - email = "gabevenberg@gmail.com"; - }; - workProfile.enable = false; - }; - }; - - imports = [ - ../../modules/home-manager/terminal - ../../modules/home-manager/nvim - ../../modules/home-manager - ../../modules/home-manager/kittty.nix - inputs.nixvim.homeManagerModules.nixvim - ]; -} diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index b8fa3cc..e5ab33f 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -13,32 +13,20 @@ inputs.nixpkgs.lib.nixosSystem { modules = [ inputs.home-manager.nixosModules.home-manager ./hardware-configuration.nix - ./home.nix ../../modules/commonopts.nix ../../modules/nixos/common.nix ../../modules/nixos/printing.nix ../../modules/both/sound.nix ../../modules/both/networking.nix + ../../modules/both/i3 ({ config, pkgs, ... }: { host = { - enable-speech = true; user = "gabe"; gui.enable = true; - nvim = { - enable-lsp = true; - enable-treesitter = true; - }; - git = { - profile = { - name = "Gabe Venberg"; - email = "gabevenberg@gmail.com"; - }; - workProfile.enable = false; - }; }; networking.hostName = "workstation-vm"; # Define your hostname. # Set your time zone. @@ -59,13 +47,6 @@ inputs.nixpkgs.lib.nixosSystem { LC_TIME = "en_US.UTF-8"; }; - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the Cinnamon Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.cinnamon.enable = true; - # Configure keymap in X11 services.xserver = { xkb.layout = "us"; @@ -82,13 +63,30 @@ inputs.nixpkgs.lib.nixosSystem { firefox # thunderbird ]; - }; - - home-manager.users.${config.host.user} = import ./home.nix; - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = {inherit inputs outputs;}; + }; + home-manager.users.${config.host.user} = {inputs, ...}: { + host = { + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile.enable = false; + }; + }; + imports = [ + ../../modules/home-manager/terminal + ../../modules/home-manager/nvim + ../../modules/home-manager + inputs.nixvim.homeManagerModules.nixvim + ]; + }; # Enable the OpenSSH daemon. services.openssh.enable = true; @@ -105,6 +103,13 @@ inputs.nixpkgs.lib.nixosSystem { # 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 = "23.11"; # Did you read the comment? + + # Enable the X11 windowing system. + # services.xserver.enable = true; + # + # # Enable the Cinnamon Desktop Environment. + # services.xserver.displayManager.lightdm.enable = true; + # services.xserver.desktopManager.cinnamon.enable = true; }) ]; } diff --git a/hosts/workstation-vm/home.nix b/hosts/workstation-vm/home.nix deleted file mode 100644 index f8a375c..0000000 --- a/hosts/workstation-vm/home.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - ... -}: { - imports = [ - ../../modules/home-manager/terminal - ../../modules/home-manager/nvim - ../../modules/home-manager - ../../modules/home-manager/kitty.nix - inputs.nixvim.homeManagerModules.nixvim - ]; -} diff --git a/modules/both/i3/default.nix b/modules/both/i3/default.nix index e2c1137..fce1f5f 100644 --- a/modules/both/i3/default.nix +++ b/modules/both/i3/default.nix @@ -4,18 +4,195 @@ lib, ... }: { - home.stateVersion = "23.11"; # Please read the comment before changing. - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # enable flakes - nix = - lib.mkIf config.targets.genericLinux.enable - { - package = pkgs.nix; - settings.experimental-features = ["nix-command" "flakes"]; - settings.max-jobs = "auto"; - gc.automatic = true; + services.xserver = { + enable = true; + displayManager = { + defaultSession = "none+i3"; + lightdm.enable = true; }; + windowManager.i3.enable = true; + }; + home-manager.users.${config.host.user} = {config, ...}: { + home.packages = with pkgs; [ + maim + brightnessctl + ]; + services.playerctld.enable = true; + xsession.enable = true; + xsession.windowManager.i3 = let + mod = "Mod4"; + + ws1 = "1"; + ws2 = "2"; + ws3 = "3"; + ws4 = "4"; + ws5 = "5"; + ws6 = "6"; + ws7 = "7"; + ws8 = "8"; + ws9 = "9"; + ws10 = "10"; + in { + enable = true; + config = { + modifier = mod; + terminal = "kitty"; + menu = "rofi -show drun"; + keybindings = { + "${mod}+Return" = "exec ${config.xsession.windowManager.i3.config.terminal}"; + "${mod}+d" = "exec ${config.xsession.windowManager.i3.config.menu}"; + "${mod}+Shift+q" = "kill"; + + "${mod}+Left" = "focus left"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; + "${mod}+Right" = "focus right"; + + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Right" = "move right"; + + "${mod}+h" = "split h"; + "${mod}+v" = "split v"; + "${mod}+f" = "fullscreen toggle"; + + "${mod}+e" = "layout stacking"; + "${mod}+r" = "layout tabbed"; + "${mod}+t" = "layout toggle split"; + + "${mod}+Shift+space" = "floating toggle"; + "${mod}+space" = "focus mode_toggle"; + + "${mod}+a" = "focus parent"; + + "${mod}+Shift+o" = "move scratchpad"; + "${mod}+o" = "scratchpad show"; + + "${mod}+1" = "workspace ${ws1}"; + "${mod}+2" = "workspace ${ws2}"; + "${mod}+3" = "workspace ${ws3}"; + "${mod}+4" = "workspace ${ws4}"; + "${mod}+5" = "workspace ${ws5}"; + "${mod}+6" = "workspace ${ws6}"; + "${mod}+7" = "workspace ${ws7}"; + "${mod}+8" = "workspace ${ws8}"; + "${mod}+9" = "workspace ${ws9}"; + "${mod}+0" = "workspace ${ws10}"; + + "${mod}+Shift+1" = "move container to workspace ${ws1}"; + "${mod}+Shift+2" = "move container to workspace ${ws2}"; + "${mod}+Shift+3" = "move container to workspace ${ws3}"; + "${mod}+Shift+4" = "move container to workspace ${ws4}"; + "${mod}+Shift+5" = "move container to workspace ${ws5}"; + "${mod}+Shift+6" = "move container to workspace ${ws6}"; + "${mod}+Shift+7" = "move container to workspace ${ws7}"; + "${mod}+Shift+8" = "move container to workspace ${ws8}"; + "${mod}+Shift+9" = "move container to workspace ${ws9}"; + "${mod}+Shift+0" = "move container to workspace ${ws10}"; + + "${mod}+Shift+n" = "reload"; + "${mod}+Shift+r" = "restart"; + "${mod}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; + + "${mod}+ctrl+r" = "mode resize"; + + # disable screen going to sleep with mod+b, enable screen going to sleep with mod+shift+b + "${mod}+b" = '' + exec --no-startup-id "xset s off -dpms; dunstify --timeout=500 'screen blanking off'" + ''; + "${mod}+shift+b" = '' + exec --no-startup-id "xset +dpms; dunstify --timeout=500 'screen blanking on'" + ''; + # change brightness + "${mod}+control+plus" = '' + exec --no-startup-id "brightnessctl s +1%; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m| cut --delimiter=, -f 4)" + ''; + "${mod}+control+minus" = '' + exec --no-startup-id "brightnessctl s 1%-; dunstify -h string:x-dunst-stack-tag:brightness --timeout=500 Brightness\ $(brightnessctl -m| cut --delimiter=, -f 4)" + ''; + + #screenshot everything with mod+s, current window with mod+shift+s, selection with mod+ctrl+s + "${mod}+s" = '' + exec --no-startup-id "maim ~/Pictures/$(date +%s).png; dunstify --timeout=1000 'Whole-desktop screenshot taken'" + ''; + "${mod}+shift+s" = '' + exec --no-startup-id "maim -i $(xdotool getactivewindow) ~/Pictures/$(date +%s).png; dunstify --timeout=1000 'Window screenshot taken'" + ''; + "${mod}+ctrl+s" = '' + exec --no-startup-id "maim -s ~/Pictures/$(date +%s).png; dunstify --timeout=1000 'Selection screenshot taken'" + ''; + + #screenshot everything with mod+c, current window with mod+shift+c, selection with mod+ctrl+c (to clipboard) + "${mod}+c" = '' + exec --no-startup-id "maim | xclip -selection clipboard -t image/png; dunstify --timeout=1000 'Whole-desktop screenshot taken to clipboard'" + ''; + "${mod}+shift+c" = '' + exec --no-startup-id "maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png; dunstify --timeout=1000 'Window screenshot taken to clipboard'" + ''; + "${mod}+ctrl+c" = '' + exec --no-startup-id "maim -s | xclip -selection clipboard -t image/png; dunstify --timeout=1000 'Selection screenshot taken to clipboard'" + ''; + + "${mod}+mod1+p" = '' + exec --no-startup-id "playerctl play-pause" + ''; + "${mod}+mod1+plus" = '' + exec --no-startup-id "playerctl volume -- +0.1; dunstify -h string:x-dunst-stack-tag:playervol --timeout=500 Player $(playerctl volume)" + ''; + "${mod}+mod1+minus" = '' + exec --no-startup-id "playerctl volume -- -0.1; dunstify -h string:x-dunst-stack-tag:playervol --timeout=500 Player $(playerctl volume)" + ''; + + #open volume control + "${mod}+shift+p" = ''exec pwvucontrol''; + + #volume control + "${mod}+plus" = '' + exec --no-startup-id "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; dunstify --timeout=1000 -h string:x-dunst-stack-tag:volume -h int:value:$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2 | awk '{print $1*100}' ) Volume" + ''; + "${mod}+minus" = '' + exec --no-startup-id "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-; dunstify --timeout=1000 -h string:x-dunst-stack-tag:volume -h int:value:$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2 | awk '{print $1*100}' ) Volume" + ''; + + #open firefox + "${mod}+w" = ''exec firefox''; + }; + modes = { + resize = { + "Left" = "resize shrink width 10 px or 10 ppt"; + "Down" = "resize grow height 10 px or 10 ppt"; + "Up" = "resize shrink height 10 px or 10 ppt"; + "Right" = "resize grow width 10 px or 10 ppt"; + "Escape" = "mode default"; + "Return" = "mode default"; + }; + }; + gaps = { + inner = 5; + outer = 2; + }; + fonts = { + names = ["Fira Code"]; + size = 8.0; + }; + floating = { + modifier = mod; + # you can find window class names with xprop. + criteria = [ + {class = "pwvucontrol";} + {class = "helvum";} + ]; + }; + }; + }; + imports = [ + ../../home-manager/kitty.nix + ../../home-manager/rofi.nix + ../../home-manager/dunst.nix + ]; + }; + imports = [ + ../sound.nix + ]; } diff --git a/modules/both/sound.nix b/modules/both/sound.nix index 474094a..4378895 100644 --- a/modules/both/sound.nix +++ b/modules/both/sound.nix @@ -13,4 +13,11 @@ alsa.support32Bit = true; pulse.enable = true; }; + + home-manager.users.${config.host.user} = {config, ...}: { + home.packages = with pkgs; [ + pwvucontrol + helvum + ]; + }; } diff --git a/modules/home-manager/dunst.nix b/modules/home-manager/dunst.nix new file mode 100644 index 0000000..f2f2981 --- /dev/null +++ b/modules/home-manager/dunst.nix @@ -0,0 +1,51 @@ +{ + config, + pkgs, + lib, + ... +}: { + services = { + dunst.enable = true; + dunst.settings = { + global = { + font = "Fira Code"; + follow = "keyboard"; + origin = "top-right"; + transparency = 5; + padding = 6; + horizontal_padding = 6; + }; + urgency_low = { + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + frame_color = "#3B7C87"; + foreground = "#3B7C87"; + background = "#191311"; + #background = "#2B313C" + timeout = 4; + # Icon for notifications with low urgency, uncomment to enable + #default_icon = /path/to/icon + }; + + urgency_normal = { + frame_color = "#5B8234"; + foreground = "#5B8234"; + background = "#191311"; + #background = "#2B313C" + timeout = 6; + # Icon for notifications with normal urgency, uncomment to enable + #default_icon = /path/to/icon + }; + + urgency_critical = { + frame_color = "#B7472A"; + foreground = "#B7472A"; + background = "#191311"; + #background = "#2B313C" + timeout = 8; + # Icon for notifications with critical urgency, uncomment to enable + #default_icon = /path/to/icon + }; + }; + }; +} diff --git a/modules/home-manager/i3/default.nix b/modules/home-manager/mpd.nix similarity index 100% rename from modules/home-manager/i3/default.nix rename to modules/home-manager/mpd.nix diff --git a/modules/home-manager/nvim/options.nix b/modules/home-manager/nvim/options.nix index 3ac7717..bb1f0b2 100644 --- a/modules/home-manager/nvim/options.nix +++ b/modules/home-manager/nvim/options.nix @@ -5,7 +5,7 @@ ... }: { programs.nixvim = { - options = { + opts = { mouse = "a"; lazyredraw = true; termguicolors = true; diff --git a/modules/home-manager/nvim/simpleplugins.nix b/modules/home-manager/nvim/simpleplugins.nix index 7103301..bf49c98 100644 --- a/modules/home-manager/nvim/simpleplugins.nix +++ b/modules/home-manager/nvim/simpleplugins.nix @@ -4,7 +4,7 @@ ... }: { programs.nixvim = { - plugins.comment-nvim.enable = true; + plugins.comment.enable = true; plugins.marks.enable = true; plugins.surround.enable = true; plugins.todo-comments.enable = true; diff --git a/modules/home-manager/nvim/which-key.nix b/modules/home-manager/nvim/which-key.nix index e8886b8..13c0ec6 100644 --- a/modules/home-manager/nvim/which-key.nix +++ b/modules/home-manager/nvim/which-key.nix @@ -4,7 +4,7 @@ ... }: { programs.nixvim = { - options = { + opts = { timeout = true; timeoutlen = 300; }; diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix new file mode 100644 index 0000000..84404a6 --- /dev/null +++ b/modules/home-manager/rofi.nix @@ -0,0 +1,13 @@ +{ + config, + pkgs, + lib, + ... +}: { + programs.rofi = { + enable = true; + location = "top"; + terminal = "kitty"; + theme = "gruvbox-dark-soft"; + }; +} diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 2e86582..bc5077b 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -1,6 +1,8 @@ { config, pkgs, + inputs, + outputs, ... }: { # Bootloader. @@ -18,6 +20,10 @@ # packages that should be on every system. environment.systemPackages = with pkgs; [ - vi # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. ]; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = {inherit inputs outputs;}; } diff --git a/modules/nixos/touchpad.nix b/modules/nixos/touchpad.nix index b6c8808..df60b15 100644 --- a/modules/nixos/touchpad.nix +++ b/modules/nixos/touchpad.nix @@ -4,5 +4,12 @@ ... }: { # Enable touchpad support (enabled default in most desktopManager). - services.xserver.libinput.enable = true; + services.xserver.libinput = { + enable = true; + disableWhileTyping = true; + naturalScrolling = true; + additionalOptions = '' + Option "PalmDetection" "True" + ''; + }; }