diff --git a/flake.lock b/flake.lock index b97643f..8c84085 100644 --- a/flake.lock +++ b/flake.lock @@ -50,7 +50,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1694529238, @@ -106,6 +106,167 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717181720, + "narHash": "sha256-yv+QZWsusu/NWjydkxixHC2g+tIJ9v+xkE2EiVpJj6g=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "9e27a2c2ceb1e0b85bd55b0afefad196056fe87c", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "systems": "systems", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1718273282, + "narHash": "sha256-Drdpjgw9ZHbS2SC5V41PmuFqVpxXqKJyi8Wl7gUneYI=", + "ref": "refs/heads/main", + "rev": "e6d10539af1fdca33b10bc3c1dfac16f1cdfe1c8", + "revCount": 4819, + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + }, + "original": { + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "xdph", + "nixpkgs" + ], + "systems": [ + "hyprland", + "xdph", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717881852, + "narHash": "sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM+Jj94=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "ec6938c66253429192274d612912649a0cfe4d28", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717881334, + "narHash": "sha256-a0inRgJhPL6v9v7RPM/rx1kbXdfe3xJA1c9z0ZkYnh4=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "0693f9398ab693d89c9a0aa3b3d062dd61b7a60e", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717784906, + "narHash": "sha256-YxmfxHfWed1fosaa7fC1u7XoKp1anEZU+7Lh/ojRKoM=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "0f30f9eca6e404130988554accbb64d1c9ec877d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "nix-matlab": { "inputs": { "flake-compat": "flake-compat", @@ -129,16 +290,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717281328, - "narHash": "sha256-evZPzpf59oNcDUXxh2GHcxHkTEG4fjae2ytWP85jXRo=", - "owner": "nixos", + "lastModified": 1717974879, + "narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b3b2b28c1daa04fe2ae47c21bb76fd226eac4ca1", + "rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-24.05", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -175,12 +336,29 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1717281328, + "narHash": "sha256-evZPzpf59oNcDUXxh2GHcxHkTEG4fjae2ytWP85jXRo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b3b2b28c1daa04fe2ae47c21bb76fd226eac4ca1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "alacritty-theme": "alacritty-theme", "home-manager": "home-manager", + "hyprland": "hyprland", "nix-matlab": "nix-matlab", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "snowfall-lib": "snowfall-lib", "sops-nix": "sops-nix" @@ -230,6 +408,21 @@ } }, "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -243,6 +436,36 @@ "repo": "default", "type": "github" } + }, + "xdph": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1717918856, + "narHash": "sha256-I38bmPLqamvOfVSArd1hhZtkVRAYBK38fOHZCU1P9Qg=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "72907822c19afc0983c69d59d299204381623725", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 97374d6..1552274 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,8 @@ sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + + hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; }; outputs = diff --git a/homes/x86_64-linux/julian@aspi/default.nix b/homes/x86_64-linux/julian@aspi/default.nix index 85c70ce..b62e8c9 100644 --- a/homes/x86_64-linux/julian@aspi/default.nix +++ b/homes/x86_64-linux/julian@aspi/default.nix @@ -34,8 +34,9 @@ neovim.enable = true; alacritty.enable = true; emacs.enable = true; - i3.enable = true; - rofi.enable = true; + # i3.enable = true; + # rofi.enable = true; + hyprland.enable = true; nix-helper.enable = true; }; @@ -78,6 +79,7 @@ ./fonts.nix ./packages.nix ]; + # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix new file mode 100644 index 0000000..99074e6 --- /dev/null +++ b/modules/home/hyprland/default.nix @@ -0,0 +1,221 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.hyprland; +in +{ + options.modules.hyprland = { + enable = lib.mkOption { default = false; }; + }; + + # imports = [ (ib.mkIf inputs.hyprland.homeManagerModules.default) ]; + + config = lib.mkIf cfg.enable { + + services.dunst.enable = true; + + home.packages = with pkgs; [ + wofi + xfce.thunar + wlogout + waybar + hyprlock + ]; + + wayland.windowManager.hyprland = { + # Whether to enable Hyprland wayland compositor + enable = true; + # The hyprland package to use (simplifies use of plugins) + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + # Whether to enable XWayland + xwayland.enable = true; + + # Optional + # Whether to enable hyprland-session.target on hyprland startup + systemd.enable = true; + + settings = { + "$mod" = "SUPER"; + + # Monitors + monitor = ",preferred,auto,auto"; + + # Autostart + exec-once = [ + "nm-applet" + "waybar" + "firefox" + "hyprlock" + ]; + + # Environment Variables + # env = "XCURSOR_SIZE,24"; + # env = "HYPRCURSOR_SIZE,24"; + + # Look and Feel + general = { + # gaps_in = 5 + # gaps_out = 20 + + # border_size = 2 + + # # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + # col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + # col.inactive_border = rgba(595959aa) + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + # resize_on_border = false + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + # allow_tearing = false + + layout = "master"; + }; + + # Dwindle layout + dwindle = { + pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # You probably want this + }; + + # Master layout + master = { + new_is_master = false; + no_gaps_when_only = 2; # with border + mfact = 0.5; # Do not make master bigger + }; + + misc = { + # disable auto polling for config file changes + disable_autoreload = true; + + force_default_wallpaper = 0; + + # we do, in fact, want direct scanout + # no_direct_scanout = false; + }; + + # Input + input = { + kb_layout = "de"; + }; + + # Window rules + windowrulev2 = "suppressevent maximize, class:.*"; # You'll probably like this. + + # Workspace rules + workspace = [ + "1, monitor:HDMI-A-1" + "2, monitor:HDMI-A-1" + "3, monitor:HDMI-A-1" + "4, monitor:HDMI-A-1" + "5, monitor:HDMI-A-1" + "6, monitor:eDP-1" + "7, monitor:eDP-1" + "8, monitor:eDP-1" + "9, monitor:eDP-1" + "10, monitor:eDP-1" + ]; + + # Mouse binds + bindm = [ + "$mod, mouse:272, movewindow" # leftclick + "$mod, mouse:273, resizewindow" # rightclick + ]; + + # binds + bind = [ + # compositor commands + "$mod, SPC, togglefloating," + "$mod, F, fullscreen," + "$mod, X, killactive," + + "$mod, R, togglesplit," # dwindle + "$mod, P, pseudo," # dwindle + + # opening applications + "$mod, D, exec, wofi --show drun" + "$mod, E, exec, thunar" + "$mod, Return, exec, alacritty" + "$mod, B, exec, firefox" + + # other commands + "$mod, Escape, exec, wlogout -p layer-shell" + "$mod, TAB, exec, loginctl lock-session" + "$mod SHIFT, R, exec, hyprctl reload" + ", Print, exec, grimblast --notify copysave area" + + # "$mod SHIFT, E, exec, pkill Hyprland" + # "$mod, G, togglegroup," + # "$mod SHIFT, N, changegroupactive, f" + # "$mod SHIFT, P, changegroupactive, b" + # "$mod ALT, ,resizeactive," + + # move focus + "$mod, left, movefocus, l" + "$mod, H, movefocus, l" + "$mod, right, movefocus, r" + "$mod, L, movefocus, r" + "$mod, up, movefocus, u" + "$mod, K, movefocus, u" + "$mod, down, movefocus, d" + "$mod, J, movefocus, d" + + # move window + "$mod SHIFT, left, movewindow, l" + "$mod SHIFT, H, movewindow, l" + "$mod SHIFT, right, movewindow, r" + "$mod SHIFT, L, movewindow, r" + "$mod SHIFT, up, movewindow, u" + "$mod SHIFT, K, movewindow, u" + "$mod SHIFT, down, movewindow, d" + "$mod SHIFT, J, movewindow, d" + + # Switch workspaces with mainMod + [0-9] + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod, 0, workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mod SHIFT, 1, movetoworkspace, 1" + "$mod SHIFT, 2, movetoworkspace, 2" + "$mod SHIFT, 3, movetoworkspace, 3" + "$mod SHIFT, 4, movetoworkspace, 4" + "$mod SHIFT, 5, movetoworkspace, 5" + "$mod SHIFT, 6, movetoworkspace, 6" + "$mod SHIFT, 7, movetoworkspace, 7" + "$mod SHIFT, 8, movetoworkspace, 8" + "$mod SHIFT, 9, movetoworkspace, 9" + "$mod SHIFT, 0, movetoworkspace, 10" + ]; + }; + }; + }; +} diff --git a/modules/nixos/greetd/default.nix b/modules/nixos/greetd/default.nix new file mode 100644 index 0000000..7a5b566 --- /dev/null +++ b/modules/nixos/greetd/default.nix @@ -0,0 +1,52 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + + # Additional metadata is provided by Snowfall Lib. + namespace, # The namespace used for your flake, defaulting to "internal" if not set. + system, # The system architecture for this host (eg. `x86_64-linux`). + target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). + format, # A normalized name for the system target (eg. `iso`). + virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. + systems, # An attribute map of your defined hosts. + + # All other arguments come from the module system. + config, + ... +}: + +let + cfg = config.modules.greetd; +in +{ + options.modules.greetd = { + enable = lib.mkOption { default = false; }; + }; + + config = lib.mkIf cfg.enable { + # greetd display manager + services.greetd = + let + session = { + command = "${lib.getExe config.programs.hyprland.package}"; + user = "julian"; + }; + in + { + enable = true; + settings = { + terminal.vt = 1; + default_session = session; + initial_session = session; + }; + }; + + # unlock GPG keyring on login + # security.pam.services.greetd.enableGnomeKeyring = true; + }; +} diff --git a/systems/x86_64-linux/aspi/default.nix b/systems/x86_64-linux/aspi/default.nix index 51acaee..717d7c5 100644 --- a/systems/x86_64-linux/aspi/default.nix +++ b/systems/x86_64-linux/aspi/default.nix @@ -71,6 +71,7 @@ modules = { locales.enable = true; + # greetd.enable = true; }; nix.settings.auto-optimise-store = true; @@ -84,12 +85,15 @@ substituters = [ "https://nix-community.cachix.org" "https://cache.nixos.org/" + "https://hyprland.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; - trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; # Enable the X11 windowing system. - services.xserver.enable = true; hardware.opengl.enable = true; nix.gc = { @@ -99,21 +103,26 @@ }; # Enable the XFCE Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager = { - xterm.enable = false; - xfce = { - enable = true; - noDesktop = true; - enableXfwm = false; - }; - }; - services.displayManager.defaultSession = "none+i3"; - services.xserver.windowManager.i3.enable = true; - services.xserver.windowManager.i3.package = pkgs.i3-gaps; + services.xserver.displayManager.gdm.enable = true; + # services.displayManager.sddm.wayland.enable = true; + # services.xserver.desktopManager = { + # xterm.enable = false; + # xfce = { + # enable = true; + # noDesktop = true; + # enableXfwm = false; + # }; + # }; + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.windowManager.i3.enable = true; + # services.xserver.windowManager.i3.package = pkgs.i3-gaps; + + programs.hyprland.enable = true; + programs.hyprland.xwayland.enable = true; # Configure keymap in X11 services.xserver = { + enable = true; xkb.layout = "de"; xkb.variant = ""; }; @@ -124,12 +133,16 @@ # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; + security.polkit.enable = true; + + # Sound security.rtkit.enable = true; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + jack.enable = true; }; # Enable touchpad support (enabled default in most desktopManager). @@ -215,7 +228,10 @@ services.flatpak.enable = true; xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + xdg.portal.extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-hyprland + ]; # services.emacs.enable = true;