From 8ea644f66524045f937b175ec6c40f32b2530195 Mon Sep 17 00:00:00 2001 From: Jan Bulthuis Date: Mon, 2 Sep 2024 20:03:39 +0200 Subject: [PATCH] Changes --- machines/laptop.nix | 1 + modules/bluetooth/default.nix | 23 +++++++++++ modules/default.nix | 1 + modules/users/default.nix | 7 +++- modules/users/modules/bluetuith/default.nix | 28 +++++++++++++ .../modules/browser/qutebrowser/default.nix | 17 ++++++++ modules/users/modules/default.nix | 3 ++ modules/users/modules/desktop/bar/waybar.nix | 8 +++- modules/users/modules/desktop/default.nix | 2 + .../modules/desktop/window-manager/river.nix | 24 ++++++----- modules/users/modules/language/haskell.nix | 40 +++++++++++++++++++ modules/users/modules/language/rust.nix | 19 +++++---- modules/users/modules/theming/default.nix | 2 + .../modules/theming/themes/oxocarbon.nix | 25 ++++++++++++ .../modules/theming/themes/papercolor.nix | 25 ++++++++++++ modules/users/modules/vscode/default.nix | 3 ++ modules/users/modules/whatsapp/default.nix | 22 ++++++++++ users/jan.nix | 22 +++++++++- 18 files changed, 250 insertions(+), 22 deletions(-) create mode 100644 modules/bluetooth/default.nix create mode 100644 modules/users/modules/bluetuith/default.nix create mode 100644 modules/users/modules/language/haskell.nix create mode 100644 modules/users/modules/theming/themes/oxocarbon.nix create mode 100644 modules/users/modules/theming/themes/papercolor.nix create mode 100644 modules/users/modules/whatsapp/default.nix diff --git a/machines/laptop.nix b/machines/laptop.nix index 66af017..b1f6eff 100644 --- a/machines/laptop.nix +++ b/machines/laptop.nix @@ -16,6 +16,7 @@ # Enabled modules modules = { base.enable = true; + bluetooth.enable = true; power-saving.enable = false; pipewire.enable = true; wpa_supplicant.enable = true; diff --git a/modules/bluetooth/default.nix b/modules/bluetooth/default.nix new file mode 100644 index 0000000..a210ae0 --- /dev/null +++ b/modules/bluetooth/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +let + cfg = config.modules.bluetooth; +in +{ + options.modules.bluetooth = { + enable = mkEnableOption "bluetooth"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ bluez ]; + + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 24842d7..c077c1f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -10,6 +10,7 @@ with lib; imports = [ # Import modules ./base/default.nix + ./bluetooth/default.nix ./boot/clean-tmp.nix ./boot/silent-boot.nix ./boot/systemd-boot.nix diff --git a/modules/users/default.nix b/modules/users/default.nix index 005f682..62e0d92 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -8,7 +8,12 @@ with lib; let # Nixvim - nixvim = import (builtins.fetchGit { url = "https://github.com/nix-community/nixvim"; }); + nixvim = import ( + builtins.fetchGit { + url = "https://github.com/nix-community/nixvim"; + # ref = "nixos-24.05"; + } + ); # Stylix stylix = import ( diff --git a/modules/users/modules/bluetuith/default.nix b/modules/users/modules/bluetuith/default.nix new file mode 100644 index 0000000..4c986fd --- /dev/null +++ b/modules/users/modules/bluetuith/default.nix @@ -0,0 +1,28 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +let + cfg = config.modules.bluetuith; +in +{ + options.modules.bluetuith = { + enable = mkEnableOption "bluetuith"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ bluetuith ]; + + # Add nix tree + xdg.desktopEntries.bluetuith = { + exec = "${pkgs.bluetuith}/bin/bluetuith"; + name = "Bluetuith"; + terminal = true; + type = "Application"; + }; + }; +} diff --git a/modules/users/modules/browser/qutebrowser/default.nix b/modules/users/modules/browser/qutebrowser/default.nix index 9b05a00..bd5a01c 100644 --- a/modules/users/modules/browser/qutebrowser/default.nix +++ b/modules/users/modules/browser/qutebrowser/default.nix @@ -19,6 +19,23 @@ in config = mkIf cfg.enable { default.browser = mkIf cfg.default "org.qutebrowser.qutebrowser.desktop"; + # TODO: Remove once nixpkgs updates + nixpkgs.config.packageOverrides = pkgs: { + python3 = pkgs.python3.override { + packageOverrides = self: super: { + pykeepass = super.pykeepass.overrideAttrs (attrs: { + version = "4.1.0.post1"; + src = pkgs.fetchFromGitHub { + owner = "libkeepass"; + repo = "pykeepass"; + rev = "refs/tags/v4.1.0.post1"; + hash = "sha256-64is/XoRF/kojqd4jQIAQi1od8TRhiv9uR+WNIGvP2A="; + }; + }); + }; + }; + }; + programs.qutebrowser = { enable = true; diff --git a/modules/users/modules/default.nix b/modules/users/modules/default.nix index 0abfbe3..cf469ba 100644 --- a/modules/users/modules/default.nix +++ b/modules/users/modules/default.nix @@ -8,11 +8,13 @@ { imports = [ # Import all modules + ./bluetuith/default.nix ./browser/default.nix ./desktop/default.nix ./discord/default.nix ./feishin/default.nix ./fontconfig/default.nix + ./language/haskell.nix ./language/nix.nix ./language/rust.nix ./mako/default.nix @@ -27,6 +29,7 @@ ./terminal/foot/default.nix ./theming/default.nix ./vscode/default.nix + ./whatsapp/default.nix ./winbox/default.nix ./zathura/default.nix diff --git a/modules/users/modules/desktop/bar/waybar.nix b/modules/users/modules/desktop/bar/waybar.nix index 145ddf9..f661b13 100644 --- a/modules/users/modules/desktop/bar/waybar.nix +++ b/modules/users/modules/desktop/bar/waybar.nix @@ -35,6 +35,7 @@ in "mpris" ]; modules-right = [ + "bluetooth" "network" "pulseaudio" "battery" @@ -110,6 +111,11 @@ in tooltip-format = ""; interval = 1; }; + bluetooth = { + tooltip = false; + format = "  {status}"; # Spacing achieved using "Thin Space" + format-connected = "  {device_alias}"; # Spacing achieved using "Thin Space" + }; }; }; # TODO: Replace base03 color with named color @@ -133,7 +139,7 @@ in padding: 0 5px 1px 5px; border-radius: 0; font-size: 16px; - font-family: "Unifont"; + font-family: "wenquanyi bitmap song"; } #tags button.occupied { diff --git a/modules/users/modules/desktop/default.nix b/modules/users/modules/desktop/default.nix index ff59af8..5d95879 100644 --- a/modules/users/modules/desktop/default.nix +++ b/modules/users/modules/desktop/default.nix @@ -36,6 +36,8 @@ in [ pkgs.wl-clipboard pkgs.wtype + pkgs.grim + pkgs.slurp ] ); diff --git a/modules/users/modules/desktop/window-manager/river.nix b/modules/users/modules/desktop/window-manager/river.nix index ba50b1b..7c937a2 100644 --- a/modules/users/modules/desktop/window-manager/river.nix +++ b/modules/users/modules/desktop/window-manager/river.nix @@ -25,6 +25,7 @@ in # TODO: Move elsewhere home.packages = with pkgs; [ brightnessctl + river-filtile # owm ]; @@ -56,7 +57,7 @@ in xwayland.enable = true; settings = let - layout = "rivertile"; + layout = "filtile"; layoutOptions = "-outer-padding ${toString config.theming.layout.windowPadding} -view-padding ${toString config.theming.layout.windowPadding}"; modes = [ "normal" @@ -108,7 +109,7 @@ in ]; map = ( lib.attrsets.recursiveUpdate - ({ + { normal = { "${main} Q" = "close"; @@ -119,6 +120,7 @@ in "${ssm} Return" = "spawn foot"; "${main} P" = "spawn \"rofi -show drun\""; "${ssm} P" = "spawn rofi-rbw"; + "${main} S" = "spawn \"grim -g \\\"\\\$(slurp)\\\" ~/Images/Screenshots/\\\$(date +'%s_grim.png')\""; # Window focus "${main} J" = "focus-view next"; @@ -130,22 +132,22 @@ in "${main} Return" = "zoom"; # Main ratio - "${main} H" = "send-layout-cmd rivertile 'main-ratio -0.05'"; - "${main} L" = "send-layout-cmd rivertile 'main-ratio +0.05'"; + "${main} H" = "send-layout-cmd ${layout} 'main-ratio -0.05'"; + "${main} L" = "send-layout-cmd ${layout} 'main-ratio +0.05'"; # Main count - "${ssm} H" = "send-layout-cmd rivertile 'main-count +1'"; - "${ssm} L" = "send-layout-cmd rivertile 'main-count -1'"; + "${ssm} H" = "send-layout-cmd ${layout} 'main-count +1'"; + "${ssm} L" = "send-layout-cmd ${layout} 'main-count -1'"; # Tags "${main} 0" = "set-focused-tags ${toString (pow2 32 - 1)}"; "${ssm} 0" = "set-view-tags ${toString (pow2 32 - 1)}"; # Orientation - "${main} Up" = "send-layout-cmd rivertile \"main-location top\""; - "${main} Right" = "send-layout-cmd rivertile \"main-location right\""; - "${main} Down" = "send-layout-cmd rivertile \"main-location bottom\""; - "${main} Left" = "send-layout-cmd rivertile \"main-location left\""; + "${main} Up" = "send-layout-cmd ${layout} \"main-location top\""; + "${main} Right" = "send-layout-cmd ${layout} \"main-location right\""; + "${main} Down" = "send-layout-cmd ${layout} \"main-location bottom\""; + "${main} Left" = "send-layout-cmd ${layout} \"main-location left\""; # Move floating windows "${sam} H" = "move left 100"; @@ -191,7 +193,7 @@ in ]) tags ) ); - }) + } ( builtins.listToAttrs ( map (mode: { diff --git a/modules/users/modules/language/haskell.nix b/modules/users/modules/language/haskell.nix new file mode 100644 index 0000000..c273aae --- /dev/null +++ b/modules/users/modules/language/haskell.nix @@ -0,0 +1,40 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +let + cfg = config.modules.haskell; +in +{ + options.modules.haskell = { + enable = mkEnableOption "haskell"; + }; + + config = mkIf cfg.enable { + # Development packages + home.packages = with pkgs; [ + haskell.compiler.ghc948 + (haskell-language-server.override { supportedGhcVersions = [ "948" ]; }) + ]; + + # VSCode configuration + programs.vscode = { + extensions = with pkgs.vscode-extensions; [ + haskell.haskell + justusadam.language-haskell + ]; + + userSettings = { + "[haskell]" = { }; + # "haskell.formattingProvider" = "fourmolu"; + }; + }; + + # Neovim configuration + programs.nixvim = { }; + }; +} diff --git a/modules/users/modules/language/rust.nix b/modules/users/modules/language/rust.nix index c556ddd..4fa1682 100644 --- a/modules/users/modules/language/rust.nix +++ b/modules/users/modules/language/rust.nix @@ -17,28 +17,31 @@ in config = mkIf cfg.enable { # Development packages home.packages = with pkgs; [ - # rustup - rustc - cargo + rustup + # rustc + # cargo gcc - # lldb - gdb - rust-analyzer - rustfmt + lldb + # rust-analyzer + # rustfmt + # clippy ]; # VSCode configuration programs.vscode = { extensions = with pkgs.vscode-extensions; [ rust-lang.rust-analyzer - # ms-vscode.cpp-tools vadimcn.vscode-lldb + tamasfe.even-better-toml + serayuzgur.crates ]; userSettings = { "[rust]" = { "editor.inlayHints.enabled" = "off"; }; + "rust-analyzer.check.command" = "clippy"; + "rust-analyzer.showUnlinkedFileNotification" = false; }; }; diff --git a/modules/users/modules/theming/default.nix b/modules/users/modules/theming/default.nix index 6d0b509..8989e60 100644 --- a/modules/users/modules/theming/default.nix +++ b/modules/users/modules/theming/default.nix @@ -101,6 +101,8 @@ in # Import all themes ./themes/catppuccin.nix ./themes/gruvbox.nix + ./themes/oxocarbon.nix + ./themes/papercolor.nix ./themes/sakura.nix ]; diff --git a/modules/users/modules/theming/themes/oxocarbon.nix b/modules/users/modules/theming/themes/oxocarbon.nix new file mode 100644 index 0000000..8d6c345 --- /dev/null +++ b/modules/users/modules/theming/themes/oxocarbon.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; +let + cfg = config.theming.themes.oxocarbon; + mode = if cfg.darkMode then "dark" else "light"; +in +{ + options = { + theming.themes.oxocarbon = { + enable = mkEnableOption "oxocarbon"; + darkMode = mkEnableOption "dark mode"; + }; + }; + + config.theming = mkIf cfg.enable { + darkMode = cfg.darkMode; + colorScheme = "${pkgs.base16-schemes}/share/themes/oxocarbon-${mode}.yaml"; + }; +} diff --git a/modules/users/modules/theming/themes/papercolor.nix b/modules/users/modules/theming/themes/papercolor.nix new file mode 100644 index 0000000..645326c --- /dev/null +++ b/modules/users/modules/theming/themes/papercolor.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; +let + cfg = config.theming.themes.papercolor; + mode = if cfg.darkMode then "dark" else "light"; +in +{ + options = { + theming.themes.papercolor = { + enable = mkEnableOption "papercolor"; + darkMode = mkEnableOption "dark mode"; + }; + }; + + config.theming = mkIf cfg.enable { + darkMode = cfg.darkMode; + colorScheme = "${pkgs.base16-schemes}/share/themes/papercolor-${mode}.yaml"; + }; +} diff --git a/modules/users/modules/vscode/default.nix b/modules/users/modules/vscode/default.nix index 4042892..5ae76a4 100644 --- a/modules/users/modules/vscode/default.nix +++ b/modules/users/modules/vscode/default.nix @@ -35,6 +35,9 @@ in extensions = with pkgs.vscode-extensions; [ eamodio.gitlens ms-vscode.hexeditor + mkhl.direnv + usernamehw.errorlens + gruntfuggly.todo-tree ]; userSettings = { diff --git a/modules/users/modules/whatsapp/default.nix b/modules/users/modules/whatsapp/default.nix new file mode 100644 index 0000000..3abcb6c --- /dev/null +++ b/modules/users/modules/whatsapp/default.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; +let + cfg = config.modules.whatsapp; +in +{ + options.modules.whatsapp = { + enable = mkEnableOption "whatsapp"; + }; + + config = mkIf cfg.enable { + modules.unfree.allowedPackages = [ "whatsapp-for-linux" ]; + + home.packages = with pkgs; [ whatsapp-for-linux ]; + }; +} diff --git a/users/jan.nix b/users/jan.nix index e847732..a5b6670 100644 --- a/users/jan.nix +++ b/users/jan.nix @@ -7,6 +7,9 @@ # State version home.stateVersion = "24.05"; + # TODO: Move into modules + home.packages = with pkgs; [ libreoffice-fresh ]; + # Enabled modules modules = { # Window manager @@ -26,6 +29,7 @@ vscode.enable = true; zathura.enable = true; fish.enable = true; + whatsapp.enable = true; winbox.enable = true; discord.enable = true; qutebrowser = { @@ -35,8 +39,10 @@ neovim.enable = true; rofi-rbw.enable = true; obsidian.enable = true; + bluetuith.enable = true; # Programming languages + haskell.enable = true; nix.enable = true; rust.enable = true; @@ -58,11 +64,25 @@ fonts.extraFonts = [ ]; # Color scheme + themes.oxocarbon = { + enable = false; + darkMode = false; + }; themes.catppuccin = { enable = true; - flavor = "latte"; + flavor = "mocha"; }; themes.sakura.enable = false; + + # TODO: Remove + # Nice themes: + # - rose-pine-dawn: Decent, bit too yellow though. + # - sagelight: Barely readable + # - danqing-light: Too minty + # - fruit-soda: Colors too bright, background too dark. + # - solarflare-light: Nice + # darkMode = false; + # colorScheme = "${pkgs.base16-schemes}/share/themes/solarflare-light.yaml"; }; # TODO: Remove everything below, it is here out of convenience and should be elsewhere