From 235b3825356f3a072c9695c1e4220dfd482b02e7 Mon Sep 17 00:00:00 2001 From: k Date: Wed, 25 Sep 2024 16:37:56 -0400 Subject: [PATCH 1/4] basic sway --- hosts/home/home_common.nix | 1 + hosts/home/sway.nix | 45 ++++++++++++++++++++ hosts/home/waybar.nix | 78 ++++++++++++++++++++++++++++++++++ hosts/laptop/configuration.nix | 3 ++ hosts/laptop/home.nix | 7 ++- 5 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 hosts/home/sway.nix create mode 100644 hosts/home/waybar.nix diff --git a/hosts/home/home_common.nix b/hosts/home/home_common.nix index bf31df3..3f3e0b8 100644 --- a/hosts/home/home_common.nix +++ b/hosts/home/home_common.nix @@ -13,6 +13,7 @@ userName = "k"; userEmail = "markers711@gmail.com"; }; + tmux = {enable = true;}; starship.enable = true; zsh = { enable = true; diff --git a/hosts/home/sway.nix b/hosts/home/sway.nix new file mode 100644 index 0000000..8846bcd --- /dev/null +++ b/hosts/home/sway.nix @@ -0,0 +1,45 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [./waybar.nix]; + + wayland.windowManager.sway = { + enable = true; + config = { + modifier = "Mod4"; + floating.border = 0; + window.border = 1; + window.titlebar = false; + terminal = "${pkgs.foot}/bin/foot"; + menu = "${pkgs.rofi}/bin/rofi -show drun -modi drun"; + bars = [{ "command" = "${pkgs.waybar}/bin/waybar"; }]; + gaps = { + inner = 10; + outer = 5; + }; + }; + }; + + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + MOZ_USE_XINPUT2 = "1"; + XDG_SESSION_TYPE = "wayland"; + SDL_VIDEODRIVER = "wayland"; + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + _JAVA_AWT_WM_NONREPARENTING = 1; + }; + services = { + mako = { enable = true; }; + swayidle = { enable = true; }; + }; + + home.packages = with pkgs; [ rofi alacritty waybar swaylock ]; + programs = { + rofi = { enable = true; }; + mako = { enable = true; }; + alacritty = {enable = true; }; + foot = {enable = true; }; + }; +} + diff --git a/hosts/home/waybar.nix b/hosts/home/waybar.nix new file mode 100644 index 0000000..a92a5ff --- /dev/null +++ b/hosts/home/waybar.nix @@ -0,0 +1,78 @@ +{ config, pkgs, ... }: +{ + programs.waybar = { + enable = true; + systemd.enable = true; + settings = { + mainBar = { + layer = "bottom"; + position = "bottom"; + output = [ + "eDP-1" + ]; + + modules-left = ["sway/workspaces" "sway/mode"]; + modules-center = ["clock"]; + modules-right = ["pulseaudio" "network" "battery"]; + + cpu = { + interval = 15; + format = " {}%"; + max-length = 15; + }; + + memory = { + interval = 30; + format = " {}%"; + max-length = 15; + }; + + "pulseaudio" = { + format = "{volume}% {icon}"; + format-bluetooth = "{volume}% {icon}"; + format-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" ""]; + }; + scroll-step = 1; + on-click = "pavucontrol"; + }; + + backlight = { + tooltip = false; + format = " {}%"; + interval = 1; + on-scroll-up = "brightnessctl s 1515"; + on-scroll-down = "brightnessctl s 1"; + }; + + network = { + format = "{ifname}"; + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} 󰊗"; + format-disconnected = "󰤮"; + tooltip-format = "{ifname} via {gwaddr} 󰊗"; + tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + }; + + battery = { + format = "{capacity}% {icon}"; + "format-icons" = ["" "" "" "" ""]; + }; + + clock = { + "format-alt" = "{:%a, %d. %b %H:%M}"; + }; + }; + }; + }; +} diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index b3632e9..78e19bf 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -56,13 +56,16 @@ stylix = { enable = true; + autoEnable = true; polarity = "light"; image = ./wallpaper.png; base16Scheme = "${pkgs.base16-schemes}/share/themes/brushtrees.yaml"; opacity = { terminal = .85; popups = .75; + desktop = .75; }; + cursor = { package = pkgs.adwaita-icon-theme; name = "Adwaita"; diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 5052165..0826315 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -4,9 +4,9 @@ imports = [ ../home/home_common.nix ../home/gnome.nix + ../home/sway.nix ]; - stylix.enable = true; nixpkgs.config.allowUnfree = true; @@ -46,4 +46,9 @@ defaultEditor = true; }; }; + stylix = { + enable = true; + autoEnable = true; + }; + } From 7ce35c765519135e8a2acfb4748180ee7953299b Mon Sep 17 00:00:00 2001 From: k Date: Wed, 25 Sep 2024 16:39:04 -0400 Subject: [PATCH 2/4] nixfmt --- flake.nix | 65 ++++++++++++------------- hosts/home/gnome.nix | 4 +- hosts/home/home_common.nix | 2 +- hosts/home/sway.nix | 6 +-- hosts/home/waybar.nix | 23 ++++----- hosts/laptop/configuration.nix | 6 +-- hosts/laptop/home.nix | 9 +--- hosts/server/configuration.nix | 26 +++++----- hosts/tablet/configuration.nix | 52 +++++++++----------- hosts/tablet/hardware-configuration.nix | 31 ++++++------ hosts/tablet/home.nix | 22 ++++----- 11 files changed, 109 insertions(+), 137 deletions(-) diff --git a/flake.nix b/flake.nix index 7f71bf8..250b0c2 100644 --- a/flake.nix +++ b/flake.nix @@ -13,40 +13,39 @@ }; outputs = { self, nixpkgs, nixos-hardware, ... }@inputs: - let - system = "x86_64-linux"; - pkg = nixpkgs.legacyPackages.${system}; - in - { - nixosConfigurations = { - laptop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - modules = [ - ./hosts/laptop/configuration.nix - inputs.home-manager.nixosModules.default - inputs.stylix.nixosModules.stylix - nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga - ]; - }; + let + system = "x86_64-linux"; + pkg = nixpkgs.legacyPackages.${system}; + in { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/laptop/configuration.nix + inputs.home-manager.nixosModules.default + inputs.stylix.nixosModules.stylix + nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga + ]; + }; - server = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - modules = [ - ./hosts/server/configuration.nix - inputs.home-manager.nixosModules.default - nixos-hardware.nixosModules.system76 - ]; - }; + server = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/server/configuration.nix + inputs.home-manager.nixosModules.default + nixos-hardware.nixosModules.system76 + ]; + }; - tablet = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - modules = [ - ./hosts/tablet/configuration.nix - inputs.home-manager.nixosModules.default - nixos-hardware.nixosModules.microsoft-surface-pro-intel - ]; - }; + tablet = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/tablet/configuration.nix + inputs.home-manager.nixosModules.default + nixos-hardware.nixosModules.microsoft-surface-pro-intel + ]; + }; - }; - }; + }; + }; } diff --git a/hosts/home/gnome.nix b/hosts/home/gnome.nix index 4346387..1276373 100644 --- a/hosts/home/gnome.nix +++ b/hosts/home/gnome.nix @@ -10,8 +10,8 @@ # `gnome-extensions list` for a list enabled-extensions = [ "Vitals@CoreCoding.com" - "blur-my-shell@aunetx" - "search-light@icedman.github.com" + "blur-my-shell@aunetx" + "search-light@icedman.github.com" ]; }; }; diff --git a/hosts/home/home_common.nix b/hosts/home/home_common.nix index 3f3e0b8..218315b 100644 --- a/hosts/home/home_common.nix +++ b/hosts/home/home_common.nix @@ -13,7 +13,7 @@ userName = "k"; userEmail = "markers711@gmail.com"; }; - tmux = {enable = true;}; + tmux = { enable = true; }; starship.enable = true; zsh = { enable = true; diff --git a/hosts/home/sway.nix b/hosts/home/sway.nix index 8846bcd..0eb337e 100644 --- a/hosts/home/sway.nix +++ b/hosts/home/sway.nix @@ -1,7 +1,7 @@ { config, pkgs, inputs, ... }: { - imports = [./waybar.nix]; + imports = [ ./waybar.nix ]; wayland.windowManager.sway = { enable = true; @@ -38,8 +38,8 @@ programs = { rofi = { enable = true; }; mako = { enable = true; }; - alacritty = {enable = true; }; - foot = {enable = true; }; + alacritty = { enable = true; }; + foot = { enable = true; }; }; } diff --git a/hosts/home/waybar.nix b/hosts/home/waybar.nix index a92a5ff..48b846b 100644 --- a/hosts/home/waybar.nix +++ b/hosts/home/waybar.nix @@ -1,5 +1,4 @@ -{ config, pkgs, ... }: -{ +{ config, pkgs, ... }: { programs.waybar = { enable = true; systemd.enable = true; @@ -7,13 +6,11 @@ mainBar = { layer = "bottom"; position = "bottom"; - output = [ - "eDP-1" - ]; + output = [ "eDP-1" ]; - modules-left = ["sway/workspaces" "sway/mode"]; - modules-center = ["clock"]; - modules-right = ["pulseaudio" "network" "battery"]; + modules-left = [ "sway/workspaces" "sway/mode" ]; + modules-center = [ "clock" ]; + modules-right = [ "pulseaudio" "network" "battery" ]; cpu = { interval = 15; @@ -38,7 +35,7 @@ phone = ""; portable = ""; car = ""; - default = ["" ""]; + default = [ "" "" ]; }; scroll-step = 1; on-click = "pavucontrol"; @@ -56,7 +53,7 @@ format = "{ifname}"; format-wifi = "{essid} ({signalStrength}%) "; format-ethernet = "{ipaddr}/{cidr} 󰊗"; - format-disconnected = "󰤮"; + format-disconnected = "󰤮"; tooltip-format = "{ifname} via {gwaddr} 󰊗"; tooltip-format-wifi = "{essid} ({signalStrength}%) "; tooltip-format-ethernet = "{ifname} "; @@ -66,12 +63,10 @@ battery = { format = "{capacity}% {icon}"; - "format-icons" = ["" "" "" "" ""]; + "format-icons" = [ "" "" "" "" "" ]; }; - clock = { - "format-alt" = "{:%a, %d. %b %H:%M}"; - }; + clock = { "format-alt" = "{:%a, %d. %b %H:%M}"; }; }; }; }; diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 78e19bf..e16e26c 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -61,9 +61,9 @@ image = ./wallpaper.png; base16Scheme = "${pkgs.base16-schemes}/share/themes/brushtrees.yaml"; opacity = { - terminal = .85; - popups = .75; - desktop = .75; + terminal = 0.85; + popups = 0.75; + desktop = 0.75; }; cursor = { diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 0826315..8819111 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -1,15 +1,10 @@ { config, pkgs, inputs, ... }: { - imports = [ - ../home/home_common.nix - ../home/gnome.nix - ../home/sway.nix - ]; - + imports = [ ../home/home_common.nix ../home/gnome.nix ../home/sway.nix ]; nixpkgs.config.allowUnfree = true; - + home = { packages = with pkgs; [ nerdfonts diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 5417d52..4f74910 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -27,24 +27,20 @@ home-manager = { users = { "k" = import ./home.nix; }; }; - environment.systemPackages = with pkgs; [ - microcodeIntel - ]; + environment.systemPackages = with pkgs; [ microcodeIntel ]; hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-compute-runtime - intel-media-driver - vaapiIntel - vaapiVdpau - libvdpau-va-gl - vpl-gpu-rt - ]; + enable = true; + extraPackages = with pkgs; [ + intel-compute-runtime + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + vpl-gpu-rt + ]; }; - - - services.xserver.videoDrivers = ["intel"]; + services.xserver.videoDrivers = [ "intel" ]; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/hosts/tablet/configuration.nix b/hosts/tablet/configuration.nix index 3cbc642..e040184 100644 --- a/hosts/tablet/configuration.nix +++ b/hosts/tablet/configuration.nix @@ -5,14 +5,12 @@ { config, pkgs, inputs, nixos-hardware, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - nix.settings.experimental-features = ["nix-command" "flakes"]; + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; nixpkgs.config.allowUnfree = true; - networking.networkmanager.enable = true; # Set your time zone. @@ -33,19 +31,18 @@ LC_TIME = "en_US.UTF-8"; }; - # Enable the X11 windowing system. #services.xserver.enable = true; # Enable the GNOME Desktop Environment. services.xserver.desktopManager.phosh = { - enable = true; - group = ""; - user = "k"; - phocConfig.xwayland = "immediate"; -}; - - # Enable CUPS to print documents. + enable = true; + group = ""; + user = "k"; + phocConfig.xwayland = "immediate"; + }; + + # Enable CUPS to print documents. services.printing.enable = true; services.auto-cpufreq.enable = true; services.thermald.enable = true; @@ -63,38 +60,33 @@ pulse.enable = true; jack.enable = true; }; - - # Enable touchpad support (enabled default in most desktopManager). + + # 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’. - programs.zsh.enable = true; + programs.zsh.enable = true; users.users.k = { isNormalUser = true; description = "k"; extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [zsh]; + packages = with pkgs; [ zsh ]; shell = pkgs.zsh; }; - home-manager = { - users = { - "k" = import ./home.nix; - }; - }; + home-manager = { users = { "k" = import ./home.nix; }; }; system.autoUpgrade.enable = true; nix.gc.automatic = true; - # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - intel-vaapi-driver - intel-compute-runtime - intel-media-driver - microcodeIntel - gnome-console - neovim + intel-vaapi-driver + intel-compute-runtime + intel-media-driver + microcodeIntel + gnome-console + neovim ]; boot.kernelModules = [ "soc_button_array" ]; diff --git a/hosts/tablet/hardware-configuration.nix b/hosts/tablet/hardware-configuration.nix index 83feedc..7d33460 100644 --- a/hosts/tablet/hardware-configuration.nix +++ b/hosts/tablet/hardware-configuration.nix @@ -4,11 +4,10 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -20,21 +19,18 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + fileSystems."/" = { + device = "/dev/disk/by-uuid/479b497e-7807-48e4-82e6-d6468549a281"; + fsType = "ext4"; + }; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/479b497e-7807-48e4-82e6-d6468549a281"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/DACA-E1BC"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/DACA-E1BC"; + fsType = "vfat"; + }; swapDevices = - [ { device = "/dev/disk/by-uuid/19941c01-ac8c-4609-a834-20259f3ee32e"; } - ]; + [{ device = "/dev/disk/by-uuid/19941c01-ac8c-4609-a834-20259f3ee32e"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -44,5 +40,6 @@ # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/tablet/home.nix b/hosts/tablet/home.nix index f479368..a583aea 100644 --- a/hosts/tablet/home.nix +++ b/hosts/tablet/home.nix @@ -25,17 +25,15 @@ enableCompletion = true; syntaxHighlighting.enable = true; autocd = true; - plugins = [ - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.8.0"; - sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; - }; - } - ]; + plugins = [{ + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.8.0"; + sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; + }; + }]; }; } From 4a31a114a9e38dcc048717dd680b31975a15be96 Mon Sep 17 00:00:00 2001 From: k Date: Wed, 25 Sep 2024 20:01:30 -0400 Subject: [PATCH 3/4] moved basics out of sway.nix --- hosts/home/sway.nix | 12 ++---------- hosts/home/tile.nix | 20 ++++++++++++++++++++ hosts/laptop/configuration.nix | 2 ++ 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 hosts/home/tile.nix diff --git a/hosts/home/sway.nix b/hosts/home/sway.nix index 0eb337e..149e8f4 100644 --- a/hosts/home/sway.nix +++ b/hosts/home/sway.nix @@ -1,7 +1,7 @@ { config, pkgs, inputs, ... }: { - imports = [ ./waybar.nix ]; + imports = [ ./waybar.nix ./tile.nix ]; wayland.windowManager.sway = { enable = true; @@ -12,7 +12,7 @@ window.titlebar = false; terminal = "${pkgs.foot}/bin/foot"; menu = "${pkgs.rofi}/bin/rofi -show drun -modi drun"; - bars = [{ "command" = "${pkgs.waybar}/bin/waybar"; }]; + bars = []; gaps = { inner = 10; outer = 5; @@ -30,16 +30,8 @@ _JAVA_AWT_WM_NONREPARENTING = 1; }; services = { - mako = { enable = true; }; swayidle = { enable = true; }; }; - home.packages = with pkgs; [ rofi alacritty waybar swaylock ]; - programs = { - rofi = { enable = true; }; - mako = { enable = true; }; - alacritty = { enable = true; }; - foot = { enable = true; }; - }; } diff --git a/hosts/home/tile.nix b/hosts/home/tile.nix new file mode 100644 index 0000000..efb8c3c --- /dev/null +++ b/hosts/home/tile.nix @@ -0,0 +1,20 @@ +{ config, pkgs, inputs, ... }: + +{ + + services = { + mako = { enable = true; }; + }; + + programs = { + mako = { enable = true; }; + foot = { enable = true; }; + swaylock = {enable = true;}; + rofi = { + enable = true; + package = pkgs.rofi-wayland; + show-icons = true; + }; + }; +} + diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index e16e26c..93cb66f 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -7,6 +7,8 @@ system.autoUpgrade.enable = true; time.timeZone = "America/New_York"; security.rtkit.enable = true; + security.polkit.enable = true; + security.pam.services.swaylock = {}; powerManagement.enable = true; nix = { From 8114541671fc5493a18cc080fd3e0678832c285f Mon Sep 17 00:00:00 2001 From: k Date: Sat, 28 Sep 2024 23:29:53 -0400 Subject: [PATCH 4/4] remove icon from rofi --- hosts/home/tile.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/hosts/home/tile.nix b/hosts/home/tile.nix index efb8c3c..a8d3935 100644 --- a/hosts/home/tile.nix +++ b/hosts/home/tile.nix @@ -13,7 +13,6 @@ rofi = { enable = true; package = pkgs.rofi-wayland; - show-icons = true; }; }; }