From 3544950bd40f83880071ee0ef77a6308c9a60408 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 26 Jun 2023 13:23:27 +0100 Subject: [PATCH] Reinstate Hyprland as default window manager --- .rsyncignore | 4 - flake.lock | 88 ++++++++++++++++++ flake.nix | 151 +++++++++++++++++-------------- home/desktop/hyprland.nix | 15 +-- home/desktop/waybar.nix | 2 +- hosts/N0245/configuration.nix | 83 +---------------- hosts/N0245/users/elitherl.nix | 43 +++++++++ hosts/Vanguard/configuration.nix | 42 +-------- hosts/Vanguard/users/xenia.nix | 6 ++ hosts/common.nix | 61 +++++++++++++ 10 files changed, 284 insertions(+), 211 deletions(-) delete mode 100644 .rsyncignore create mode 100644 hosts/N0245/users/elitherl.nix create mode 100644 hosts/Vanguard/users/xenia.nix create mode 100644 hosts/common.nix diff --git a/.rsyncignore b/.rsyncignore deleted file mode 100644 index c806e2f8..00000000 --- a/.rsyncignore +++ /dev/null @@ -1,4 +0,0 @@ -.git* -.pre-commit-config.yaml -.stylua.toml -Makefile diff --git a/flake.lock b/flake.lock index 612cee9d..ced0e464 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,50 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": [ + "nixpkgs" + ], + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1687777431, + "narHash": "sha256-PKTdCVpQySZJIOPy7vHIMMgI8Oxwk1d7QcYAxw5tgI0=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "7ed66abe57c493379721997224332379f6e18a9a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684265364, + "narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1687681650, @@ -39,6 +83,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "hyprland": "hyprland", "nixpkgs": "nixpkgs", "wallpapers": "wallpapers" } @@ -57,6 +102,49 @@ "type": "git", "url": "https://git.xenia.me.uk/xenia/wallpapers.git" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1686753331, + "narHash": "sha256-KovjVFwcuoUO0eu/UiWrnD3+m/K+SHSAVIz4xF9K1XA=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "7e7633abf09b362d0bad9e3fc650fd692369291d", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685385764, + "narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f028339b..1a0a97ab 100644 --- a/flake.nix +++ b/flake.nix @@ -7,114 +7,127 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; wallpapers.url = "git+https://git.xenia.me.uk/xenia/wallpapers.git"; }; outputs = { nixpkgs, home-manager, + hyprland, wallpapers, ... }: let - common = {lib, ...}: { - nix = { - settings.experimental-features = ["nix-command" "flakes"]; - gc = { - automatic = true; - dates = "daily"; - options = "--delete-older-than 7d"; - }; - extraOptions = '' - keep-outputs = true - keep-derivations = true - ''; - }; - nixpkgs.config.allowUnfree = true; + home-config = { + imports = [home-manager.nixosModules.home-manager]; home-manager = { useGlobalPkgs = true; useUserPackages = false; }; - networking.networkmanager.enable = true; - services.power-profiles-daemon.enable = true; - virtualisation.podman.enable = true; - programs = { - ssh.startAgent = true; - dconf.enable = true; - fish.enable = true; - zsh.enable = true; - }; - fonts.fontconfig.enable = true; - environment.localBinInPath = true; }; - hardware-audio = {pkgs, ...}: { - # 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; - }; - programs.noisetorch.enable = true; + hyprland-config = { + imports = [hyprland.homeManagerModules.default]; + xdg.configFile."hypr/hyprpaper.conf".text = '' + preload = ${wallpapers.outputs.default} + wallpaper = ,${wallpapers.outputs.default} + ''; }; - hardware-bluetooth = { - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - }; - wallpaper = {wayland.windowManager.sway.config.output."*".bg = "${wallpapers.outputs.default} fill";}; + waybar-experimental = self: super: {waybar = super.waybar.overrideAttrs (oldAttrs: {mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];});}; in { nixosConfigurations = { Legion = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + pkgs = import nixpkgs { + system = "x86_64-linux"; + config.allowUnfree = true; + }; modules = [ - home-manager.nixosModules.home-manager - common + home-config + ./hosts/common.nix ./hosts/Legion/configuration.nix ./services/Legion.nix ]; }; Vanguard = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + pkgs = import nixpkgs { + system = "x86_64-linux"; + config.allowUnfree = true; + overlays = [waybar-experimental]; + }; modules = [ - home-manager.nixosModules.home-manager - common - hardware-audio - hardware-bluetooth + home-config + hyprland.nixosModules.default + ./hosts/common.nix ./hosts/Vanguard/configuration.nix - {home-manager.users.xenia = {imports = [wallpaper];};} - ./wm/sway.nix ./services/sshd + { + security.pam.services.swaylock = {}; + programs.hyprland.enable = true; + home-manager.users.xenia = { + imports = [ + hyprland-config + ./hosts/Vanguard/users/xenia.nix + ./home/personal.nix + ./home/gui + ./home/desktop/hyprland.nix + ]; + }; + } ]; }; N0245 = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + pkgs = import nixpkgs { + system = "x86_64-linux"; + config.allowUnfree = true; + overlays = [waybar-experimental]; + }; modules = [ - home-manager.nixosModules.home-manager - common - hardware-audio - hardware-bluetooth + home-config + hyprland.nixosModules.default + ./hosts/common.nix ./hosts/N0245/configuration.nix - ./wm/sway.nix - {home-manager.users.elitherl = {imports = [wallpaper];};} ./services/syncthing/N0245.nix + { + hardware.bluetooth.enable = true; + security.pam.services.swaylock = {}; + programs.hyprland.enable = true; + home-manager.users.elitherl = { + imports = [ + hyprland-config + ./hosts/N0245/users/elitherl.nix + ./home/work.nix + ./home/gui + ./home/desktop/hyprland.nix + ]; + }; + } ]; }; }; homeConfigurations = { - "tux" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."aarch64-darwin"; + "tux@Monarch" = home-manager.lib.homeManagerConfiguration { + pkgs = + import nixpkgs + { + system = "aarch64-darwin"; + config.allowUnfree = true; + } + .legacyPackages + ."aarch64-darwin"; modules = [./hosts/Monarch/home.nix]; }; - "xenia" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."aarch64-linux"; - modules = [ - ./hosts/Northstar/home.nix - wallpaper - ]; + "xenia@Northstar" = home-manager.lib.homeManagerConfiguration { + pkgs = + import nixpkgs + { + system = "aarch64-linux"; + config.allowUnfree = true; + } + .legacyPackages + ."aarch64-linux"; + modules = [./hosts/Northstar/home.nix]; }; }; }; diff --git a/home/desktop/hyprland.nix b/home/desktop/hyprland.nix index fca7cd08..7446fb66 100644 --- a/home/desktop/hyprland.nix +++ b/home/desktop/hyprland.nix @@ -2,17 +2,8 @@ pkgs, lib, ... -}: let - flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; - - hyprland = - (import flake-compat { - src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/2df0d034bc4a18fafb3524401eeeceaa6b23e753.tar.gz"; - }) - .defaultNix; -in { +}: { imports = [ - hyprland.homeManagerModules.default ./swaylock.nix # ./eww.nix ./waybar.nix @@ -260,8 +251,4 @@ in { $mantle = 0xff181825 $crust = 0xff11111b ''; - xdg.configFile."hypr/hyprpaper.conf".text = lib.mkDefault '' - preload = ~/nixos/wallpaper.jpg - wallpaper = ,~/nixos/wallpaper.jpg - ''; } diff --git a/home/desktop/waybar.nix b/home/desktop/waybar.nix index 47389beb..4adc9d09 100644 --- a/home/desktop/waybar.nix +++ b/home/desktop/waybar.nix @@ -15,7 +15,7 @@ "~/.config/waybar/layout.json" ]; "modules-left" = lib.mkDefault [ - "sway/workspaces" + "wlr/workspaces" "cpu" "memory" "temperature" diff --git a/hosts/N0245/configuration.nix b/hosts/N0245/configuration.nix index 94c11faf..ede2224e 100644 --- a/hosts/N0245/configuration.nix +++ b/hosts/N0245/configuration.nix @@ -25,30 +25,6 @@ boot.initrd.luks.devices."luks-761eeb11-3091-4142-9232-4fb33165eccd".device = "/dev/disk/by-uuid/761eeb11-3091-4142-9232-4fb33165eccd"; boot.initrd.luks.devices."luks-761eeb11-3091-4142-9232-4fb33165eccd".keyFile = "/crypto_keyfile.bin"; - services.xserver = { - layout = "gb"; - xkbVariant = ""; - }; - console.keyMap = "uk"; - - # Set your time zone. - time.timeZone = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - networking.hostName = "N0245"; # Define your hostname. environment.etc."ppp/options".text = '' ipcp-accept-remote @@ -64,70 +40,13 @@ enable = true; settings = rec { initial_session = { - command = "sway"; + command = "Hyprland"; user = "elitherl"; }; default_session = initial_session; }; }; - home-manager.users.elitherl = { - imports = [ - ../../home/work.nix - ../../home/gui - ../../home/desktop/swayfx.nix - ]; - home.username = "elitherl"; - home.homeDirectory = "/home/elitherl"; - home.stateVersion = "22.11"; - home.packages = with pkgs; [ - zotero - openfortivpn - nomachine-client - teams-for-linux - zoom-us - ]; - programs.firefox.package = pkgs.firefox-wayland; - - wayland.windowManager.sway.config = { - output = { - "Dell Inc. DELL U2417H 5K9YD872FY1L".transform = "270"; - }; - startup = [{command = "firefox";} {command = "teams-for-linux";}]; - workspaceOutputAssign = [ - { - output = "Iiyama North America PLB2403WS 0574281251316"; - workspace = "1"; - } - { - output = "Iiyama North America PLB2403WS 0574281251316"; - workspace = "2"; - } - { - output = "Iiyama North America PLB2403WS 0574281251316"; - workspace = "3"; - } - { - output = "Iiyama North America PLB2403WS 0574281251316"; - workspace = "4"; - } - ]; - }; - programs.waybar.settings = { - main."output" = "!DP-4"; - alt = { - "include" = [ - "~/.config/waybar/modules.json" - "~/.config/waybar/layout.json" - ]; - "output" = "DP-4"; - "modules-left" = ["sway/workspaces"]; - "modules-center" = ["clock#compact"]; - "modules-right" = ["tray"]; - }; - }; - }; - # 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 diff --git a/hosts/N0245/users/elitherl.nix b/hosts/N0245/users/elitherl.nix new file mode 100644 index 00000000..ccacc5b1 --- /dev/null +++ b/hosts/N0245/users/elitherl.nix @@ -0,0 +1,43 @@ +{pkgs, ...}: { + home.username = "elitherl"; + home.homeDirectory = "/home/elitherl"; + home.stateVersion = "22.11"; + home.packages = with pkgs; [ + zotero + openfortivpn + nomachine-client + teams-for-linux + zoom-us + ]; + programs.firefox.package = pkgs.firefox-wayland; + + wayland.windowManager.hyprland.extraConfig = '' + source=./common.conf + + monitor=eDP-1,preferred,auto,1.0 + monitor=DP-3,preferred,auto,auto + monitor=DP-4,preferred,auto,auto,transform,1 + + windowrule = float, title:^([Zz]oom).*$ + windowrule = center, title:^([Zz]oom).*$ + windowrule = workspace 3 silent, ^(teams-for-linux)$ + windowrule = workspace 3, title:^([Zz]oom).*$ + windowrule = workspace 4 silent, ^(Nxplayer.bin)$ + + exec-once = firefox + exec-once = teams-for-linux + ''; + programs.waybar.settings = { + main."output" = "!DP-4"; + alt = { + "include" = [ + "~/.config/waybar/modules.json" + "~/.config/waybar/layout.json" + ]; + "output" = "DP-4"; + "modules-left" = ["wlr/workspaces"]; + "modules-center" = ["clock#compact"]; + "modules-right" = ["tray"]; + }; + }; +} diff --git a/hosts/Vanguard/configuration.nix b/hosts/Vanguard/configuration.nix index f8f57f7a..99116e05 100644 --- a/hosts/Vanguard/configuration.nix +++ b/hosts/Vanguard/configuration.nix @@ -11,30 +11,6 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - services.xserver = { - layout = "gb"; - xkbVariant = ""; - }; - console.keyMap = "uk"; - - # Set your time zone. - time.timeZone = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - networking = { hostName = "Vanguard"; # Define your hostname. nameservers = ["192.168.1.230" "9.9.9.9"]; @@ -61,28 +37,12 @@ shell = pkgs.fish; openssh.authorizedKeys.keys = import ../../auth/authorized_keys.nix; }; - home-manager.users.xenia = { - imports = [ - ../../home/personal.nix - ../../home/gui - ../../home/desktop/swayfx.nix - ]; - home.username = "xenia"; - home.homeDirectory = "/home/xenia"; - home.stateVersion = "22.11"; - programs.firefox.package = pkgs.firefox-wayland; - - wayland.windowManager.sway.config.output."Acer Technologies ED270R TJMEE0043W01" = { - mode = "1920x1080@165Hz"; - adaptive_sync = "on"; - }; - }; services.greetd = { enable = true; settings = rec { initial_session = { - command = "sway"; + command = "Hyprland"; user = "xenia"; }; default_session = initial_session; diff --git a/hosts/Vanguard/users/xenia.nix b/hosts/Vanguard/users/xenia.nix new file mode 100644 index 00000000..bc9bf6e0 --- /dev/null +++ b/hosts/Vanguard/users/xenia.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + home.username = "xenia"; + home.homeDirectory = "/home/xenia"; + home.stateVersion = "22.11"; + programs.firefox.package = pkgs.firefox-wayland; +} diff --git a/hosts/common.nix b/hosts/common.nix new file mode 100644 index 00000000..899a3714 --- /dev/null +++ b/hosts/common.nix @@ -0,0 +1,61 @@ +{...}: { + nix = { + settings.experimental-features = ["nix-command" "flakes"]; + gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 7d"; + }; + extraOptions = '' + keep-outputs = true + keep-derivations = true + ''; + }; + networking.networkmanager.enable = true; + services.power-profiles-daemon.enable = true; + virtualisation.podman.enable = true; + programs = { + ssh.startAgent = true; + dconf.enable = true; + fish.enable = true; + zsh.enable = true; + }; + fonts.fontconfig.enable = true; + environment.localBinInPath = true; + + services.xserver = { + layout = "gb"; + xkbVariant = ""; + }; + console.keyMap = "uk"; + + # Set your time zone. + time.timeZone = "Europe/London"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + + # 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; + }; + programs.noisetorch.enable = true; +}