From 797080d5c35a50b2a0d2e1cbd2d259ff15ee8296 Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Sat, 10 Feb 2024 14:52:08 +0100 Subject: [PATCH] Adding nixos-hardware for t480; some nixvim stuff and hyprland --- flake.lock | 48 ++++- flake.nix | 15 +- home/{lambda => }/config-files/config.nu | 2 +- home/config-files/hyprland.conf | 180 ++++++++++++++++++ .../config-files/nvim/cmp/snippet.lua | 0 home/{lambda => }/config-files/nvim/init.lua | 0 home/{lambda => }/config-files/wezterm.lua | 29 ++- home/{lambda => }/default.nix | 17 +- hosts/lilith/default.nix | 39 +++- 9 files changed, 287 insertions(+), 43 deletions(-) rename home/{lambda => }/config-files/config.nu (93%) create mode 100644 home/config-files/hyprland.conf rename home/{lambda => }/config-files/nvim/cmp/snippet.lua (100%) rename home/{lambda => }/config-files/nvim/init.lua (100%) rename home/{lambda => }/config-files/wezterm.lua (64%) rename home/{lambda => }/default.nix (95%) diff --git a/flake.lock b/flake.lock index c0a9365..6f95dd4 100644 --- a/flake.lock +++ b/flake.lock @@ -118,15 +118,15 @@ "home-manager": { "inputs": { "nixpkgs": [ - "nixpkgs" + "nixpkgs-unstable" ] }, "locked": { - "lastModified": 1705659542, - "narHash": "sha256-WA3xVfAk1AYmFdwghT7mt/erYpsU6JPu9mdTEP/e9HQ=", + "lastModified": 1706981411, + "narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "10cd9c53115061aa6a0a90aad0b0dde6a999cdb9", + "rev": "652fda4ca6dafeb090943422c34ae9145787af37", "type": "github" }, "original": { @@ -136,13 +136,29 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1707211557, + "narHash": "sha256-LTKTzZ6fM5j8XWXf51IMBzDaOaJg9kYWLUZxoIhzRN8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "6e5cc385fc8cf5ca6495d70243074ccdea9f64c7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1706718339, - "narHash": "sha256-S+S97c/HzkO2A/YsU7ZmNF9w2s7Xk6P8dzmfDdckzLs=", + "lastModified": 1707347730, + "narHash": "sha256-0etC/exQIaqC9vliKhc3eZE2Mm2wgLa0tj93ZF/egvM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "53fbe41cf76b6a685004194e38e889bc8857e8c2", + "rev": "6832d0d99649db3d65a0e15fa51471537b2c56a6", "type": "github" }, "original": { @@ -168,6 +184,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1707268954, + "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { "inputs": { "beautysh": "beautysh", @@ -248,7 +280,9 @@ "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim" } }, diff --git a/flake.nix b/flake.nix index 9b1a11f..bad8b90 100644 --- a/flake.nix +++ b/flake.nix @@ -2,14 +2,16 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; flake-utils.url = "github:numtide/flake-utils"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager/release-23.11"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; }; }; #inputs.nvidia_pinned = { # inputs.nixpkgs.follows = "nixos-unstable"; #}; + inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master"; inputs.nixvim = { # If you are not running an unstable channel of nixpkgs, select the corresponding branch of nixvim. url = "github:nix-community/nixvim/nixos-23.11"; @@ -17,19 +19,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs @ {self, nixpkgs, home-manager, nixvim, ...}: let + outputs = inputs @ {self, nixpkgs, nixpkgs-unstable, home-manager, nixos-hardware, nixvim, ...}: let lib = nixpkgs.lib; util = (import ./overlays/util.nix {} {}).util; system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; overlays = util.nixFilesIn ./overlays; }; in { - #nixosConfigurations = { - # lambda = lib.nixosSystem { - # system = "x86_64-linux"; - # modules = [ ./lambda/ ]; - # }; - #}; nixosConfigurations = pkgs.util.mapHostAttrs (host: host) (host: lib.nixosSystem { inherit system; modules = [ ./hosts/${host} home-manager.nixosModules.home-manager { @@ -37,8 +33,9 @@ home-manager.useUserPackages = true; home-manager.extraSpecialArgs = inputs; - home-manager.users.xqtc = {...}: {imports = [ ./home/lambda nixvim.homeManagerModules.nixvim ]; }; + home-manager.users.xqtc = {...}: {imports = [ ./home nixvim.homeManagerModules.nixvim ]; }; } + (lib.optionalString (host == "lilith") inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t480) ]; }); }; diff --git a/home/lambda/config-files/config.nu b/home/config-files/config.nu similarity index 93% rename from home/lambda/config-files/config.nu rename to home/config-files/config.nu index c4b9e7f..a87adf3 100644 --- a/home/lambda/config-files/config.nu +++ b/home/config-files/config.nu @@ -1,5 +1,5 @@ let carapace_completer = {|spans| -carapace $spans.0 nushell $spans | from json +carapace ...$spans.0 nushell ...$spans | from json } $env.config = { table: { diff --git a/home/config-files/hyprland.conf b/home/config-files/hyprland.conf new file mode 100644 index 0000000..5ea4cb6 --- /dev/null +++ b/home/config-files/hyprland.conf @@ -0,0 +1,180 @@ +######################################################################################## +AUTOGENERATED HYPR CONFIG. +PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, +OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. +######################################################################################## + +# +# Please note not all available settings / options are set here. +# For a full list, see the wiki +# + +autogenerated = 0 # remove this line to remove the warning + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,1 + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +exec-once = waybar & hyprpaper & dunst & + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = de + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(ff00abee) rgba(d500baee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 10 + blur { + + size = 4 + passes = 1 + new_optimizations = on + } + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = on + workspace_swipe_invert = true +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more +device:epic mouse V1 { + sensitivity = -0.5 +} + +# Example windowrule v1 +windowrule = float, ^(wezterm)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod SHIFT, return, exec, wezterm +bind = $mainMod SHIFT, U, exec, systemctl suspend; swaylock -k -F --image ~/Pictures/walls/1538974492308.png +bind = $mainMod SHIFT, Q, killactive, +bind = $mainMod SHIFT, X, exit, +bind = $mainMod, L, exec, swaylock --indicator --clock --effect-blur 7x5 -e -f -i ~/dotfiles_new/walls/walls/1685550590567432.png +bind = $mainMod SHIFT, SPACE, togglefloating, +bind = $mainMod, P, exec, tofi-drun --drun-launch=true +bind = $mainMod SHIFT, P, exec, tofi, # dwindle +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod SHIFT, I, exec, grimshot copy area +bind = $mainMod, N, exec, neovide +bind = $mainMod, Z, exec, zathura + +bind = ,XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% +bind = ,XF86AudioLowerVolume, exec, zsh -c "pactl set-sink-volume @DEFAULT_SINK@ 5%-" +bind = ,XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle + +bind = ,XF86MonBrightnessUp, exec, brightnessctl s +5% +bind = ,XF86MonBrightnessDown, exec, brightnessctl s 5%- + +bind = ,XF86Search, exec, brightnessctl --device='kbd_backlight' set +5% +bind = ,XF86LaunchA, exec, brightnessctl --device='kbd_backlight' set 5%- + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow diff --git a/home/lambda/config-files/nvim/cmp/snippet.lua b/home/config-files/nvim/cmp/snippet.lua similarity index 100% rename from home/lambda/config-files/nvim/cmp/snippet.lua rename to home/config-files/nvim/cmp/snippet.lua diff --git a/home/lambda/config-files/nvim/init.lua b/home/config-files/nvim/init.lua similarity index 100% rename from home/lambda/config-files/nvim/init.lua rename to home/config-files/nvim/init.lua diff --git a/home/lambda/config-files/wezterm.lua b/home/config-files/wezterm.lua similarity index 64% rename from home/lambda/config-files/wezterm.lua rename to home/config-files/wezterm.lua index fb4ee0c..be67238 100644 --- a/home/lambda/config-files/wezterm.lua +++ b/home/config-files/wezterm.lua @@ -1,8 +1,19 @@ local config = {} +function getHostname() + local handle = io.popen("hostname -s") + local result = handle:read("*a") + handle:close() + return string.gsub(result, "\n$", "") +end + config.color_scheme = "Catppuccin Mocha" config.font = wezterm.font 'Hack Nerd Font Mono' -config.font_size = 12 +if getHostname() == "lilith" then + config.font_size = 15 +else + config.font_size = 11 +end config.window_background_opacity = .8 --config.window_background_image = "/home/xqtc/dotfiles_new/walls/walls/SMT 40.png" @@ -27,19 +38,19 @@ config.keys = { } } for i = 1, 8 do - -- CTRL+ALT + number to activate that tab - table.insert(config.keys, { - key = tostring(i), - mods = 'CTRL', - action = wezterm.action.ActivateTab(i - 1), - }) + -- CTRL+ALT + number to activate that tab + table.insert(config.keys, { + key = tostring(i), + mods = 'CTRL', + action = wezterm.action.ActivateTab(i - 1), + }) end config.text_background_opacity = .4 -config.enable_scroll_bar = false +config.enable_scroll_bar = false config.enable_tab_bar = true config.tab_bar_at_bottom = true -config.enable_wayland = true +config.enable_wayland = true config.front_end = "OpenGL" config.warn_about_missing_glyphs = false return config diff --git a/home/lambda/default.nix b/home/default.nix similarity index 95% rename from home/lambda/default.nix rename to home/default.nix index 9a92065..8a23723 100644 --- a/home/lambda/default.nix +++ b/home/default.nix @@ -88,6 +88,8 @@ lsp = { enable = true; servers = { + lua-ls.enable = true; + clangd.enable = true; svelte.enable = true; tsserver.enable = true; eslint.enable = true; @@ -220,15 +222,15 @@ } ]; }; - #wayland.windowManager.hyprland = { - # enable = true; - # package = pkgs.hyprland; + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.hyprland; - # xwayland.enable = true; + xwayland.enable = true; - # enableNvidiaPatches = true; - - #}; + #enableNvidiaPatches = true; + extraConfig = builtins.readFile ./config-files/hyprland.conf; + }; #home.file."~/.config/hypr/hyprland.conf. @@ -277,4 +279,3 @@ programs.home-manager.enable = true; } - diff --git a/hosts/lilith/default.nix b/hosts/lilith/default.nix index c8ca03b..5d92d32 100644 --- a/hosts/lilith/default.nix +++ b/hosts/lilith/default.nix @@ -1,9 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, nixos-hardware, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + #nixos-hardware.nixosModules.lenovo.thinkpad.t480 + #(builtins.getFlake (builtins.fetchGit "github:NixOs/nixos-hardware")).nixosModules.lenovo-thinkpad-t480 ]; nixpkgs.config.allowUnfree = true; @@ -60,10 +62,10 @@ # }; # Enable the X11 windowing system. - #services.xserver.enable = true; - #services.xserver.displayManager.gdm.enable = true; + services.xserver.enable = true; + services.xserver.displayManager.gdm.enable = true; #services.xserver.displayManager.ly.enable = true; - #services.xserver.desktopManager.gnome.enable = true; + services.xserver.desktopManager.gnome.enable = true; #services.xserver.displayManager.defaultSession = "plasmawayland"; #services.xserver.videoDrivers = ["nvidia"]; @@ -77,12 +79,31 @@ # services.printing.enable = true; # Enable sound. - sound.enable = true; - hardware.pulseaudio = { + #sound.enable = true; + #hardware.pulseaudio = { + # enable = true; + # package = pkgs.pulseaudioFull; + #}; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { enable = true; - package = pkgs.pulseaudioFull; + alsa.enable = true; + alsa.support32Bit = true; + #pulse.enable = true; + # If you want to use JACK applications, uncomment this + jack.enable = true; + }; + environment.etc = { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' + bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" + } + ''; }; - # Enable touchpad support (enabled default in most desktopManager). services.xserver.libinput.enable = true; @@ -91,7 +112,6 @@ isNormalUser = true; extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ - wezterm nushell ]; shell = pkgs.nushell; @@ -115,6 +135,7 @@ waybar wl-clipboard wdisplays + gnomeExtensions.blur-my-shell ]; # Some programs need SUID wrappers, can be configured further or are