From 1cd3d7a903cdf017f678c33cfa21538cab0793bc Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 May 2023 03:17:09 +0200 Subject: [PATCH] Hyprland --- common/fonts.nix | 5 +- dotfiles/neovim/lazy-lock.json | 2 +- dotfiles/neovim/lua/my/plugins/firenvim.lua | 2 + dotfiles/neovim/lua/my/plugins/init.lua | 8 +- .../lua/my/plugins/themes/catppuccin.lua | 6 +- flake.lock | 165 +++++++++++++----- flake.nix | 12 +- home/adrielus/features/cli/bat.nix | 4 +- home/adrielus/features/cli/default.nix | 1 + .../features/desktop/common/alacritty.nix | 4 +- .../features/desktop/common/discord.nix | 1 + .../desktop/common/firefox/default.nix | 11 ++ .../desktop/common/polybar/default.nix | 2 +- .../features/desktop/common/wayland.nix | 47 +++++ .../adrielus/features/desktop/common/wofi.nix | 23 +++ home/adrielus/features/desktop/default.nix | 16 ++ .../features/desktop/hyprland/default.nix | 11 ++ .../features/desktop/hyprland/hyprland.conf | 131 ++++++++++++++ home/adrielus/features/desktop/xmonad.nix | 14 +- home/adrielus/global/default.nix | 8 + home/adrielus/tethys.nix | 13 +- hosts/nixos/common/global/default.nix | 1 + hosts/nixos/common/optional/hyprland.nix | 3 + hosts/nixos/common/optional/lightdm.nix | 20 ++- hosts/nixos/common/optional/touchpad.nix | 2 +- hosts/nixos/common/optional/xdg-portal.nix | 4 +- hosts/nixos/tethys/default.nix | 45 ++--- modules/home-manager/default.nix | 1 + modules/home-manager/discord.nix | 33 ++-- modules/home-manager/persistence.nix | 2 +- modules/home-manager/wofi.nix | 78 +++++++++ 31 files changed, 543 insertions(+), 132 deletions(-) create mode 100644 home/adrielus/features/desktop/common/wayland.nix create mode 100644 home/adrielus/features/desktop/common/wofi.nix create mode 100644 home/adrielus/features/desktop/default.nix create mode 100644 home/adrielus/features/desktop/hyprland/default.nix create mode 100644 home/adrielus/features/desktop/hyprland/hyprland.conf create mode 100644 hosts/nixos/common/optional/hyprland.nix create mode 100644 modules/home-manager/wofi.nix diff --git a/common/fonts.nix b/common/fonts.nix index 3391641..25f6c71 100644 --- a/common/fonts.nix +++ b/common/fonts.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - stylix.fonts = rec { + stylix.fonts = { monospace = { name = "FiraCode Nerd Font"; package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }; @@ -11,6 +11,7 @@ }; # Why would you not want sansSerif - serif = sansSerif; + # (that's what I used to think, but I somewhat changed my mind) + # serif = sansSerif; }; } diff --git a/dotfiles/neovim/lazy-lock.json b/dotfiles/neovim/lazy-lock.json index 1d24ef2..e5c9280 100644 --- a/dotfiles/neovim/lazy-lock.json +++ b/dotfiles/neovim/lazy-lock.json @@ -2,7 +2,6 @@ "LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" }, "abbreinder.nvim": { "branch": "main", "commit": "5b2b5ff08a9ada42238d733aeebc6d3d96314d77" }, "abbremand.nvim": { "branch": "main", "commit": "d633341f632b0b2666dfc6dfe6b9842ba1610a1d" }, - "catppuccin": { "branch": "main", "commit": "6eb93f7240476ac51cec909fe0016e9a269c2a92" }, "clipboard-image.nvim": { "branch": "main", "commit": "3d10d535cb3bf300fb8e74d886840edb81a63bd4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "af88e700417c6449719fc77f6f3745f88e42d5da" }, @@ -21,6 +20,7 @@ "glow.nvim": { "branch": "main", "commit": "a3f24fdaa71d2c25a2b88026032b34f5b6a6e215" }, "harpoon": { "branch": "master", "commit": "f7040fd0c44e7a4010369136547de5604b9c22a1" }, "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, + "hyprland-vim-syntax": { "branch": "main", "commit": "254df6b476db5784bc6bfe3f612129b73dfc43b5" }, "idris2-nvim": { "branch": "main", "commit": "dd850c1c67bcacd2395121b0898374fe9cdd228f" }, "inc-rename.nvim": { "branch": "main", "commit": "fb1b7468f27d874feb209eac46be5205e20b7fd3" }, "iron.nvim": { "branch": "master", "commit": "792dd11752c4699ea52c737b5e932d6f21b25834" }, diff --git a/dotfiles/neovim/lua/my/plugins/firenvim.lua b/dotfiles/neovim/lua/my/plugins/firenvim.lua index e289301..56dedb0 100644 --- a/dotfiles/neovim/lua/my/plugins/firenvim.lua +++ b/dotfiles/neovim/lua/my/plugins/firenvim.lua @@ -45,6 +45,8 @@ function M.config() blacklist("twitter\\.com") blacklist("desmos\\.com\\/calculator") blacklist("geogebra\\.org\\/calculator") + blacklist("google\\.com\\/search") + blacklist("github\\.com\\/.*\\/blob") -- }}} -- {{{ Comitting our config changes vim.g.firenvim_config = { localSettings = M.localSettings } diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index 4cdaa41..c395a75 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -56,7 +56,13 @@ return { { "kaarmu/typst.vim", - ft = { "typst" }, + ft = "typst", + cond = env.vscode.not_active(), + }, + + { + "theRealCarneiro/hyprland-vim-syntax", + ft = "hypr", cond = env.vscode.not_active(), }, --}}} diff --git a/dotfiles/neovim/lua/my/plugins/themes/catppuccin.lua b/dotfiles/neovim/lua/my/plugins/themes/catppuccin.lua index 15a1e90..cd620ea 100644 --- a/dotfiles/neovim/lua/my/plugins/themes/catppuccin.lua +++ b/dotfiles/neovim/lua/my/plugins/themes/catppuccin.lua @@ -4,14 +4,12 @@ local M = { "catppuccin/nvim", name = "catppuccin", lazy = false, - -- enabled = H.theme_contains("Catppuccin"), - enabled = true, + enabled = H.theme_contains("Catppuccin"), } function M.config() local catppuccin = require("catppuccin") - -- vim.g.catppuccin_flavour = H.variant("Catppuccin") - vim.g.catppuccin_flavour = "latte" + vim.g.catppuccin_flavour = H.variant("Catppuccin") catppuccin.setup({ transparent_background = false, diff --git a/flake.lock b/flake.lock index bb03ae0..c4395ed 100644 --- a/flake.lock +++ b/flake.lock @@ -57,28 +57,6 @@ "type": "github" } }, - "coricamu": { - "inputs": { - "nixpkgs": [ - "stylix", - "nixpkgs" - ], - "utils": "utils_2" - }, - "locked": { - "lastModified": 1677749800, - "narHash": "sha256-xIqxDr4fkOA5R4OudbQoUMS8xvPJNCyGfqugENutSP4=", - "owner": "danth", - "repo": "coricamu", - "rev": "40db414609dc6d72319987d3e9d7b56fe405c28f", - "type": "github" - }, - "original": { - "owner": "danth", - "repo": "coricamu", - "type": "github" - } - }, "firefox-addons": { "inputs": { "flake-utils": "flake-utils", @@ -211,14 +189,14 @@ "stylix", "nixpkgs" ], - "utils": "utils_3" + "utils": "utils_2" }, "locked": { - "lastModified": 1658924727, - "narHash": "sha256-Fhh9FK9CvuCLxG1WkWJPoendDeXKI4gHYTfezo1n2Zg=", + "lastModified": 1680000368, + "narHash": "sha256-TlgC4IJ7aotynUdkGRtaAVxquaiddO38Ws89nB7VGY8=", "owner": "nix-community", "repo": "home-manager", - "rev": "0e2f7876d2f2ae98a67d89a8bef8c49332aae5af", + "rev": "765e4007b6f9f111469a25d1df6540e8e0ca73a6", "type": "github" }, "original": { @@ -247,6 +225,70 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1684332077, + "narHash": "sha256-briamwodIZsYolceEjX41mqw/VkKiHuIEprw0u5wioY=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "79b8576df9630ea1c0fb1c6e399a424c3dcdcd47", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-contrib": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1684479483, + "narHash": "sha256-NCkOkgR7PtkAQmYgeYd6vOzkulQjxlf+vWGUmrQu4uw=", + "owner": "hyprwm", + "repo": "contrib", + "rev": "805bedf51a2f75a2279b6fc75b3066ff21f235ee", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "contrib", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681065697, + "narHash": "sha256-QPzwwlGKX95tl6ZEshboZbEwwAXww6lNLdVYd6T9Mrc=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "4d29e48433270a2af06b8bc711ca1fe5109746cd", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1668668915, @@ -342,11 +384,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1659102345, - "narHash": "sha256-Vbzlz254EMZvn28BhpN8JOi5EuKqnHZ3ujFYgFcSGvk=", + "lastModified": 1679793451, + "narHash": "sha256-JafTtgMDATE8dZOImBhWMA9RCn9AP8FVOpN+9K/tTlg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "11b60e4f80d87794a2a4a8a256391b37c59a1ea7", + "rev": "0cd51a933d91078775b300cf0f29aa3495231aa2", "type": "github" }, "original": { @@ -379,6 +421,8 @@ "grub2-themes": "grub2-themes", "home-manager": "home-manager", "homeage": "homeage", + "hyprland": "hyprland", + "hyprland-contrib": "hyprland-contrib", "impermanence": "impermanence", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs", @@ -412,11 +456,11 @@ ] }, "locked": { - "lastModified": 1684383189, - "narHash": "sha256-UdJaqAJz7mkZ5za02xX4qhfVyXR0jUOA+ygAS6Pa6qk=", + "lastModified": 1684623545, + "narHash": "sha256-aoGWkm9rxqIXuTHelBNpRje/AsG27wZHNjGNaKgvhPU=", "owner": "Mateiadrielrafael", "repo": "slambda", - "rev": "ebf29f1421232bd328f0dd8a52f5278622c36344", + "rev": "93e3a98c57044e7900980019da349b20edb6a938", "type": "github" }, "original": { @@ -428,17 +472,16 @@ "stylix": { "inputs": { "base16": "base16", - "coricamu": "coricamu", "flake-compat": "flake-compat_2", "home-manager": "home-manager_2", "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1678458325, - "narHash": "sha256-LppqiGnyIPCHUndi8m6iF/EoC885FXeJ/nbhbydZyTU=", + "lastModified": 1684436450, + "narHash": "sha256-P0QN0cJl2+dxymCAnXR2Q89aIXHn0xf8hB+IkYhQ/38=", "owner": "danth", "repo": "stylix", - "rev": "679a80676840185cbc72a3751ccdac169477c21a", + "rev": "1c953ad0dc9d7f0a8e0dd52b286d2d25dd43f0b5", "type": "github" }, "original": { @@ -464,11 +507,11 @@ }, "utils_2": { "locked": { - "lastModified": 1642700792, - "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -477,18 +520,46 @@ "type": "github" } }, - "utils_3": { + "wlroots": { + "flake": false, "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "host": "gitlab.freedesktop.org", + "lastModified": 1682436395, + "narHash": "sha256-GGEjkQO9m7YLYIXIXM76HWdhjg4Ye+oafOtyaFAYKI4=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "6830bfc17fd94709e2cdd4da0af989f102a26e59", + "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": 1682439384, + "narHash": "sha256-zHDa8LCZs05TZHQSIZ3ucwyMPglBGHcqTBzfkLjYXTM=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "c0e233955568fbea4e859336f6d3d14d51294d7c", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", "type": "github" } } diff --git a/flake.nix b/flake.nix index e25f110..d0c6f2e 100644 --- a/flake.nix +++ b/flake.nix @@ -35,11 +35,11 @@ stylix.url = "github:danth/stylix"; # Catpuccin base16 color schemes - catppuccin-base16.url = github:catppuccin/base16; + catppuccin-base16.url = "github:catppuccin/base16"; catppuccin-base16.flake = false; # Rosepine base16 color schemes - rosepine-base16.url = github:edunfelt/base16-rose-pine-scheme; + rosepine-base16.url = "github:edunfelt/base16-rose-pine-scheme"; rosepine-base16.flake = false; # Impermanence @@ -52,6 +52,14 @@ # Neovim nightly neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs"; + + # Hyprland (available in nix unstable only atm) + hyprland.url = "github:hyprwm/Hyprland"; + hyprland.inputs.nixpkgs.follows = "nixpkgs-unstable"; + + # Hyprland (available in nix unstable only atm) + hyprland-contrib.url = "github:hyprwm/contrib"; + hyprland-contrib.inputs.nixpkgs.follows = "nixpkgs-unstable"; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: diff --git a/home/adrielus/features/cli/bat.nix b/home/adrielus/features/cli/bat.nix index 145895e..8578996 100644 --- a/home/adrielus/features/cli/bat.nix +++ b/home/adrielus/features/cli/bat.nix @@ -1,6 +1,8 @@ { + # Enabling this produces an uglier theme for some reason. + # options.stylix.targets.bat.enable =true; programs.bat = { enable = true; - config.theme = "base16"; + config.theme = "base16-256"; }; } diff --git a/home/adrielus/features/cli/default.nix b/home/adrielus/features/cli/default.nix index 11c4a12..af5e5df 100644 --- a/home/adrielus/features/cli/default.nix +++ b/home/adrielus/features/cli/default.nix @@ -30,5 +30,6 @@ unzip # Unzipping files unrar # For extracting shit from rars tokei # Useless but fun line of code counter (sloc alternative) + bottom # System monitor ]; } diff --git a/home/adrielus/features/desktop/common/alacritty.nix b/home/adrielus/features/desktop/common/alacritty.nix index f59005a..2387070 100644 --- a/home/adrielus/features/desktop/common/alacritty.nix +++ b/home/adrielus/features/desktop/common/alacritty.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { stylix.targets.alacritty.enable = true; @@ -6,7 +6,7 @@ enable = true; settings = { - window.decorations = "none"; + window.opacity = lib.mkForce 0.5; # Conflicts with stylix window.padding = { x = 4; y = 4; diff --git a/home/adrielus/features/desktop/common/discord.nix b/home/adrielus/features/desktop/common/discord.nix index 6dabc23..5aa37b7 100644 --- a/home/adrielus/features/desktop/common/discord.nix +++ b/home/adrielus/features/desktop/common/discord.nix @@ -1,6 +1,7 @@ { config, ... }: { programs.discord = { enable = true; + enableOpenASAR = false; disableUpdateCheck = true; enableDevtools = true; }; diff --git a/home/adrielus/features/desktop/common/firefox/default.nix b/home/adrielus/features/desktop/common/firefox/default.nix index 66e49d7..f3b6dcd 100644 --- a/home/adrielus/features/desktop/common/firefox/default.nix +++ b/home/adrielus/features/desktop/common/firefox/default.nix @@ -158,6 +158,16 @@ in # Set language to english "general.useragent.locale" = "en-GB"; + + # Do not restore sessions after what looks like a "crash" + "browser.sessionstore.resume_from_crash" = false; + + # Tell firefox to make multiple requests at once + # See [this random page](https://doorsanchar.com/how-to-make-mozilla-firefox-30-times-faster/) + # "network.http.pipelining" = true; + # "network.http.proxy.pipelining" = true; + # "network.http.pipelining.maxrequests" = 30; # Allow 30 requests at once + # "nglayout.initialpaint.delay" = 0; }; # }}} }; @@ -225,3 +235,4 @@ in ]; # }}} } + diff --git a/home/adrielus/features/desktop/common/polybar/default.nix b/home/adrielus/features/desktop/common/polybar/default.nix index e729997..cc5a812 100644 --- a/home/adrielus/features/desktop/common/polybar/default.nix +++ b/home/adrielus/features/desktop/common/polybar/default.nix @@ -10,8 +10,8 @@ let in { services.polybar = { - inherit script; enable = true; + script = ""; # Otherwise this tries starting on wayland extraConfig = '' ; Generated theme include-file = ${base16-polybar} diff --git a/home/adrielus/features/desktop/common/wayland.nix b/home/adrielus/features/desktop/common/wayland.nix new file mode 100644 index 0000000..fc79bc6 --- /dev/null +++ b/home/adrielus/features/desktop/common/wayland.nix @@ -0,0 +1,47 @@ +# Common wayland stuff +{ lib, pkgs, upkgs, ... }: { + imports = [ ../common/wofi.nix ]; + # Makes some stuff run on wayland (?) + # Taken from [here](https://github.com/fufexan/dotfiles/blob/3b0075fa7a5d38de13c8c32140c4b020b6b32761/home/wayland/default.nix#L14) + # TODO: ask author what those do + # home.sessionVariables = { + # QT_QPA_PLATFORM = "wayland"; + # SDL_VIDEODRIVER = "wayland"; + # XDG_SESSION_TYPE = "wayland"; + # }; + + # TODO: set up + # - screen recording + # - volume/backlight controls + # - eww bar + # - configure hyprland colors using base16 stuff + # - look into swaylock or whatever people use + # - look into greetd or something + # - multiple keyboard layouts + # - wallpaper + # - notification daemon + + home.packages = + let + _ = lib.getExe; + + # Taken from [here](https://github.com/fufexan/dotfiles/blob/3b0075fa7a5d38de13c8c32140c4b020b6b32761/home/wayland/default.nix#L14) + wl-ocr = pkgs.writeShellScriptBin "wl-ocr" '' + ${_ pkgs.grim} -g "$(${_ pkgs.slurp})" -t ppm - \ + | ${_ pkgs.tesseract5} - - \ + | ${pkgs.wl-clipboard}/bin/wl-copy + ''; + in + with pkgs; [ + # utils + wl-ocr # Custom ocr script + wl-clipboard # Clipboard manager + wlogout # Nice logout script + # REASON: not available on stable yet + upkgs.hyprpicker # Color picker + + # screenshot related tools + grim # Take screenshot + slurp # Area selector + ]; +} diff --git a/home/adrielus/features/desktop/common/wofi.nix b/home/adrielus/features/desktop/common/wofi.nix new file mode 100644 index 0000000..1eebf12 --- /dev/null +++ b/home/adrielus/features/desktop/common/wofi.nix @@ -0,0 +1,23 @@ +{ pkgs, config, ... }: +let + base16-wofi = config.lib.stylix.colors { + templateRepo = pkgs.fetchFromSourcehut { + owner = "~knezi"; + repo = "base16-wofi"; + rev = "2182a5ad36d372e625b3d8e1a20ba7447e77ed22"; + sha256 = "0hzn9lgh7rzahmzzdsgxnz4f8vvcpx5diwsnc7gb29gj9nbb1a8f"; + }; + }; +in +{ + programs.wofi = { + enable = true; + settings = { + allow_markup = true; + allow_images = true; + }; + }; + + # xdg.configFile."wofi/style.css".source = base16-wofi; +} + diff --git a/home/adrielus/features/desktop/default.nix b/home/adrielus/features/desktop/default.nix new file mode 100644 index 0000000..684e020 --- /dev/null +++ b/home/adrielus/features/desktop/default.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: { + imports = [ + ./common/rofi + ./common/polybar + ./common/eww + ./common/feh.nix + ]; + + # Other packages I want to install: + home.packages = with pkgs; [ + xclip # Clipboard stuff + spectacle # Take screenshots + ]; + + stylix.targets.xresources.enable = true; +} diff --git a/home/adrielus/features/desktop/hyprland/default.nix b/home/adrielus/features/desktop/hyprland/default.nix new file mode 100644 index 0000000..a5bd9b2 --- /dev/null +++ b/home/adrielus/features/desktop/hyprland/default.nix @@ -0,0 +1,11 @@ +{ pkgs, inputs, ... }: { + imports = [ ../common/wayland.nix ]; + + home.packages = [ inputs.hyprland-contrib.packages.${pkgs.system}.grimblast ]; + + wayland.windowManager.hyprland = { + enable = true; + recommendedEnvironment = true; + extraConfig = builtins.readFile ./hyprland.conf; + }; +} diff --git a/home/adrielus/features/desktop/hyprland/hyprland.conf b/home/adrielus/features/desktop/hyprland/hyprland.conf new file mode 100644 index 0000000..dab9540 --- /dev/null +++ b/home/adrielus/features/desktop/hyprland/hyprland.conf @@ -0,0 +1,131 @@ +# Monitors +# https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,1 + +general { + cursor_inactive_timeout = 30 # Hide cursor after being inactive for 30s + resize_on_border = true # Click on borders with the mouse to resize +} + +decoration { + rounding = 10 # Rounded corners of 10px + blur = true + blur_size = 10 + blur_passes = 3 + active_opacity = 0.9 + inactive_opacity = 0.9 +} + +input { + kb_layout = us + + # TODO: standardize the touchpad settings. + # Right now I also have similar settings for xorg. + touchpad { + natural_scroll = true # Invert scrolling direction + } +} + +gestures { + workspace_swipe = true + workspace_swipe_fingers = 3 +} + +# Execute apps at launch +exec-once = NO_TMUX=1 wezterm & firefox & discord + +# {{{ Window rules +# {{{ Automatically move stuff to workspaces +windowrulev2 = workspace 2 silent, title:^(.*Firefox.*)$ +windowrulev2 = workspace 3 silent, title:^(.*(Disc|WebC)ord.*)$ +windowrulev2 = workspace 6 silent, title:^(.*Spotify.*)$ +# }}} +# {{{ Idleinhibit rules +# - while firefox is fullscreen +windowrulev2 = idleinhibit fullscreen, class:^(firefox)$ +# - while watching videos +windowrulev2 = idleinhibit focus, class:^(mpv|.+exe)$ +windowrulev2 = idleinhibit focus, class:^(firefox)$, title:^(.*YouTube.*)$ +# }}} +# }}} +# {{{ Keybinds +$mod = SUPER + +#u {{{ General +bind = $mod, C, killactive, # Kill current +bind = $mod, F, fullscreen, # Fullscreen + +# Execute external things +bind = $mod, return, exec, NO_TMUX=1 wezterm # Launch wezterm +bind = $mod, T, exec, wl-ocr # Use ocr script +bind = $mod SHIFT, T, exec, hyprpicker -a # Color picker +bind = $mod, Q, exec, wlogout # Show logout menu +bind = $mod, L, exec, loginctl lock-session # Lock screen +bind = $mod, P, exec, wofi --show drun # Launch app + +# Work with the special workspace +bind = $mod, x, togglespecialworkspace, +bind = $mod SHIFT, x, movetoworkspace, special +# }}} +# {{{ Screenshotting +bind = $mod, S, exec, grimblast --notify copysave area +bind = $mod SHIFT, S, exec, grimblast --notify copysave active +bind = $mod CONTROL, S, exec, grimblast --notify copysave screen +# }}} +# {{{ Grouping +bind = $mod, G, togglegroup, +bind = $mod SHIFT, D, changegroupactive, f +bind = $mod SHIFT, S, changegroupactive, b +# }}} +# {{{ Mouse move/resize +# Move/resize windows with mod + LMB/RMB and dragging +bindm = $mod, mouse:272, movewindow +bindm = $mod, mouse:273, resizewindow +# }}} +# {{{ Move focus +bind = $mod, h, movefocus, l +bind = $mod, l, movefocus, r +bind = $mod, k, movefocus, u +bind = $mod, j, movefocus, d +# }}} +# {{{ Switch to workspace +bind = $mod, 1, workspace, 1 +bind = $mod, 2, workspace, 2 +bind = $mod, 3, workspace, 3 +bind = $mod, 4, workspace, 4 +bind = $mod, 5, workspace, 5 +bind = $mod, 6, workspace, 6 +bind = $mod, 7, workspace, 7 +bind = $mod, 8, workspace, 8 +bind = $mod, 9, workspace, 9 +bind = $mod, 0, workspace, 10 +# }}} +# {{{ Send to workspace +# Move active window to a workspace with mod + SHIFT + [0-9] +bind = $mod SHIFT, 1, movetoworkspace, 1 +bind = $mod SHIFT, 2, movetoworkspace, 2 +bind = $mod SHIFT, 3, movetoworkspace, 3 +bind = $mod SHIFT, 4, movetoworkspace, 4 +bind = $mod SHIFT, 5, movetoworkspace, 5 +bind = $mod SHIFT, 6, movetoworkspace, 6 +bind = $mod SHIFT, 7, movetoworkspace, 7 +bind = $mod SHIFT, 8, movetoworkspace, 8 +bind = $mod SHIFT, 9, movetoworkspace, 9 +bind = $mod SHIFT, 0, movetoworkspace, 10 +# }}} +# {{{ Resize +bind=SUPER,R,submap,resize + +submap=resize + +# sets repeatable binds for resizing the active window +binde=,l,resizeactive,10 0 +binde=,h,resizeactive,-10 0 +binde=,k,resizeactive,0 -10 +binde=,j,resizeactive,0 10 + +bind=,escape,submap,reset + +submap=reset +# }}} +# }}} diff --git a/home/adrielus/features/desktop/xmonad.nix b/home/adrielus/features/desktop/xmonad.nix index 9868c56..c070b56 100644 --- a/home/adrielus/features/desktop/xmonad.nix +++ b/home/adrielus/features/desktop/xmonad.nix @@ -1,22 +1,16 @@ { pkgs, ... }: { imports = [ - ./common/rofi - ./common/polybar - ./common/eww ./common/wezterm ./common/alacritty.nix - ./common/feh.nix ]; # Other packages I want to install: home.packages = with pkgs; [ vimclip # Vim anywhere! - xclip # Clipboard stuff - spectacle # Take screenshots ]; - stylix.targets = { - xresources.enable = true; - gtk.enable = true; - }; + stylix.targets.gtk.enable = true; + + # Command required to get the xdg stuff to work. Suggested by @lily on discord. + xsession.initExtra = "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd --all"; } diff --git a/home/adrielus/global/default.nix b/home/adrielus/global/default.nix index 2ed2b91..e73447b 100644 --- a/home/adrielus/global/default.nix +++ b/home/adrielus/global/default.nix @@ -6,6 +6,7 @@ let inputs.homeage.homeManagerModules.homeage inputs.nur.nixosModules.nur inputs.impermanence.nixosModules.home-manager.impermanence + inputs.hyprland.homeManagerModules.default ../features/cli ../features/neovim @@ -57,4 +58,11 @@ in # Set the xdg env vars xdg.enable = true; + + # Create xdg user directories + xdg.userDirs = { + enable = lib.mkDefault true; + createDirectories = lib.mkDefault true; + extraConfig.XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + }; } diff --git a/home/adrielus/tethys.nix b/home/adrielus/tethys.nix index 997e387..ea15997 100644 --- a/home/adrielus/tethys.nix +++ b/home/adrielus/tethys.nix @@ -1,12 +1,14 @@ { inputs, outputs, lib, config, pkgs, ... }: { imports = [ ./global - ./features/desktop/xmonad.nix ./features/desktop/common/discord.nix ./features/desktop/common/signal.nix ./features/desktop/common/qbittorrent.nix ./features/desktop/common/zathura.nix ./features/desktop/common/firefox + ./features/desktop/xmonad.nix + ./features/desktop/hyprland + ./features/desktop ./features/games ]; @@ -50,13 +52,4 @@ at.cache.path = "/persist/cache"; }; }; - - - # Temp stuff - # systemd.servinces.dbus-update-activation-environment = { - # script = lib.escapeShellArgs "${pkgs.dbu}/bin/dbus-update-activation-environment --systemd --all"; - # serviceConfig.Restart = "no"; - # serviceConfig.User = config.home.user; - # }; - xsession.initExtra = "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd --all"; } diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index 8226cdd..0f1a3c7 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -7,6 +7,7 @@ let inputs.slambda.nixosModule inputs.nur.nixosModules.nur inputs.impermanence.nixosModule + inputs.hyprland.nixosModules.default ./nix.nix ./openssh.nix diff --git a/hosts/nixos/common/optional/hyprland.nix b/hosts/nixos/common/optional/hyprland.nix new file mode 100644 index 0000000..98dfe35 --- /dev/null +++ b/hosts/nixos/common/optional/hyprland.nix @@ -0,0 +1,3 @@ +{ + programs.hyprland.enable = true; +} diff --git a/hosts/nixos/common/optional/lightdm.nix b/hosts/nixos/common/optional/lightdm.nix index 2631cdb..b9a7d53 100644 --- a/hosts/nixos/common/optional/lightdm.nix +++ b/hosts/nixos/common/optional/lightdm.nix @@ -1,13 +1,19 @@ +{ lib, config, ... }: +let greeter = "enso"; +in { - services.xserver = { + services.xserver.displayManager.lightdm = { enable = true; - displayManager.lightdm = { - enable = true; - greeters.enso = { - enable = true; - blur = true; - }; + greeters.slick = lib.mkIf (greeter == "slick") { + enable = true; + draw-user-backgrounds = true; + font = config.stylix.fonts.sansSerif; + }; + + greeters.enso = lib.mkIf (greeter == "enso") { + enable = true; + blur = true; }; }; diff --git a/hosts/nixos/common/optional/touchpad.nix b/hosts/nixos/common/optional/touchpad.nix index f39f5a5..9b97f01 100644 --- a/hosts/nixos/common/optional/touchpad.nix +++ b/hosts/nixos/common/optional/touchpad.nix @@ -7,7 +7,7 @@ # How fast we should scroll I think accelSpeed = "3.5"; - # TODO: I forgor what this did + # Inverts axis naturalScrolling = true; # Dsiable the touchpad while typing diff --git a/hosts/nixos/common/optional/xdg-portal.nix b/hosts/nixos/common/optional/xdg-portal.nix index a251f8e..e8005e1 100644 --- a/hosts/nixos/common/optional/xdg-portal.nix +++ b/hosts/nixos/common/optional/xdg-portal.nix @@ -1,4 +1,5 @@ { pkgs, lib, ... }: { + services.dbus.enable = true; xdg.portal = { enable = true; xdgOpenUsePortal = true; @@ -7,6 +8,5 @@ # HACK: copied from @lily on discord. systemd.user.services.xdg-desktop-portal.path = lib.mkAfter [ "/run/current-system/sw" ]; - - services.gnome.at-spi2-core.enable = true; + # services.gnome.at-spi2-core.enable = true; } diff --git a/hosts/nixos/tethys/default.nix b/hosts/nixos/tethys/default.nix index 7152430..8c6d777 100644 --- a/hosts/nixos/tethys/default.nix +++ b/hosts/nixos/tethys/default.nix @@ -10,6 +10,7 @@ ../common/optional/steam.nix ../common/optional/slambda.nix ../common/optional/xdg-portal.nix + ../common/optional/hyprland.nix ../common/optional/xmonad ./hardware-configuration.nix @@ -27,26 +28,26 @@ # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "22.11"; - # Temp stuff: - services.postgresql = { - enable = true; - package = pkgs.postgresql_15; - enableTCPIP = true; - authentication = pkgs.lib.mkOverride 10 '' - local all all trust - host all all 127.0.0.1/32 trust - host all all ::1/128 trust - ''; - initialScript = pkgs.writeText "backend-initScript" '' - CREATE ROLE adrielus WITH - LOGIN - SUPERUSER - INHERIT - CREATEDB - CREATEROLE - REPLICATION; - CREATE DATABASE lunarbox; - GRANT ALL PRIVILEGES ON DATABASE lunarbox TO adrielus; - ''; - }; + # Temp stuff: enable when running lunarbox + # services.postgresql = { + # enable = true; + # package = pkgs.postgresql_15; + # enableTCPIP = true; + # authentication = pkgs.lib.mkOverride 10 '' + # local all all trust + # host all all 127.0.0.1/32 trust + # host all all ::1/128 trust + # ''; + # initialScript = pkgs.writeText "backend-initScript" '' + # CREATE ROLE adrielus WITH + # LOGIN + # SUPERUSER + # INHERIT + # CREATEDB + # CREATEROLE + # REPLICATION; + # CREATE DATABASE lunarbox; + # GRANT ALL PRIVILEGES ON DATABASE lunarbox TO adrielus; + # ''; + # }; } diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 2dc6578..19f5517 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -6,4 +6,5 @@ firefox = import ./firefox; satellite-dev = import ./satellite-dev.nix; satellite-persistence = import ./persistence.nix; + wofi = import ./wofi.nix; } diff --git a/modules/home-manager/discord.nix b/modules/home-manager/discord.nix index 60b345c..d23c6ea 100644 --- a/modules/home-manager/discord.nix +++ b/modules/home-manager/discord.nix @@ -1,30 +1,27 @@ { config, lib, pkgs, ... }: -let - cfg = config.programs.discord; +let cfg = config.programs.discord; in { options.programs.discord = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - }; + enable = lib.mkEnableOption "Discord"; + enableOpenASAR = lib.mkEnableOption "openASAR"; + disableUpdateCheck = lib.mkEnableOption "update skipping"; + enableDevtools = lib.mkEnableOption "devtools"; - disableUpdateCheck = lib.mkOption { - type = lib.types.bool; - default = false; - }; - - enableDevtools = lib.mkOption { - type = lib.types.bool; - default = false; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.discord; + description = "The discord package to install"; }; }; config = lib.mkIf cfg.enable { - home.packages = [ - pkgs.discord - ]; - + home.packages = + [ + (if cfg.enableOpenASAR + then cfg.package.override { withOpenASAR = true; } + else cfg.package) + ]; xdg.configFile."discord/settings.json".text = builtins.toJSON diff --git a/modules/home-manager/persistence.nix b/modules/home-manager/persistence.nix index be2e2c4..a009909 100644 --- a/modules/home-manager/persistence.nix +++ b/modules/home-manager/persistence.nix @@ -4,7 +4,7 @@ let cfg = config.satellite.persistence; in { options.satellite.persistence = { - enable = lib.mkEnableOption (lib.mkDoc "satellite persitence"); + enable = lib.mkEnableOption "satellite persitence"; at = lib.mkOption { default = { }; diff --git a/modules/home-manager/wofi.nix b/modules/home-manager/wofi.nix new file mode 100644 index 0000000..2170628 --- /dev/null +++ b/modules/home-manager/wofi.nix @@ -0,0 +1,78 @@ +# Temporary copy of [this](https://github.com/nix-community/home-manager/blob/master/modules/programs/wofi.nix) +# until the next home manager relase. +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.wofi; + + toConfig = attrs: + '' + # Generated by Home Manager. + '' + generators.toKeyValue { } + (filterAttrs (name: value: value != null) attrs); +in { + meta.maintainers = [ maintainers.christoph-heiss ]; + + options.programs.wofi = { + enable = mkEnableOption + "wofi: a launcher/menu program for wlroots based wayland compositors such as sway"; + + package = mkPackageOption pkgs "wofi" { }; + + settings = mkOption { + default = { }; + type = types.attrs; + description = '' + Configuration options for wofi. See + + wofi + 5 + . + ''; + example = literalExpression '' + { + location = "bottom-right"; + allow_markup = true; + width = 250; + } + ''; + }; + + style = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + CSS style for wofi to use as a stylesheet. See + + wofi + 7 + . + ''; + example = '' + * { + font-family: monospace; + } + + window { + background-color: #7c818c; + } + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ]; + + home.packages = [ cfg.package ]; + + xdg.configFile = mkMerge [ + (mkIf (cfg.settings != { }) { + "wofi/config".text = toConfig cfg.settings; + }) + (mkIf (cfg.style != null) { "wofi/style.css".text = cfg.style; }) + ]; + }; +}