From d77f800e896eaf15dc9da4bf90db71ca3e927bb2 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 25 Jan 2022 12:27:52 +0100 Subject: [PATCH] trantor changes --- capibara.nix | 19 +- home/alacritty/capibara.nix | 6 + home/alacritty/{default.nix => nixos.nix} | 2 - home/alacritty/trantor.nix | 6 + home/{default.nix => capibara.nix} | 2 +- home/desktop-xmonad/autorandr.nix | 52 ---- home/desktop-xmonad/autorandr/capibara.nix | 48 ++++ home/desktop-xmonad/autorandr/common.nix | 12 + home/desktop-xmonad/autorandr/trantor.nix | 67 +++++ home/desktop-xmonad/capibara.nix | 13 + home/desktop-xmonad/common.nix | 51 ++++ home/desktop-xmonad/default.nix | 294 --------------------- home/desktop-xmonad/desktop_config.nix | 247 +++++++++++++++++ home/desktop-xmonad/misc.nix | 17 +- home/desktop-xmonad/trantor.nix | 27 ++ home/theming/common.nix | 33 +++ home/theming/default.nix | 32 +-- home/theming/trantor.nix | 6 + home/trantor.nix | 160 +++++++++++ nixos/common.nix | 24 +- nixos/hardware-configuration/trantor.nix | 18 ++ trantor.nix | 77 +++++- 22 files changed, 789 insertions(+), 424 deletions(-) create mode 100644 home/alacritty/capibara.nix rename home/alacritty/{default.nix => nixos.nix} (84%) create mode 100644 home/alacritty/trantor.nix rename home/{default.nix => capibara.nix} (99%) delete mode 100644 home/desktop-xmonad/autorandr.nix create mode 100644 home/desktop-xmonad/autorandr/capibara.nix create mode 100644 home/desktop-xmonad/autorandr/common.nix create mode 100644 home/desktop-xmonad/autorandr/trantor.nix create mode 100644 home/desktop-xmonad/capibara.nix create mode 100644 home/desktop-xmonad/common.nix delete mode 100644 home/desktop-xmonad/default.nix create mode 100644 home/desktop-xmonad/desktop_config.nix create mode 100644 home/desktop-xmonad/trantor.nix create mode 100644 home/theming/common.nix create mode 100644 home/theming/trantor.nix create mode 100644 home/trantor.nix create mode 100644 nixos/hardware-configuration/trantor.nix diff --git a/capibara.nix b/capibara.nix index 799a998..df49839 100644 --- a/capibara.nix +++ b/capibara.nix @@ -8,13 +8,19 @@ let impermanence = builtins.fetchTarball { url = "https://github.com/nix-community/impermanence/archive/master.tar.gz"; }; + home-manager = builtins.fetchTarball { + url = "https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz"; + }; in { imports = [ # Include the results of the hardware scan. ./nixos/hardware-configuration/capibara.nix ./nixos/common.nix + "${home-manager}/nixos" "${impermanence}/nixos.nix" ]; + home-manager.users.rilla = import home/capibara.nix; + fileSystems = { "/" = { device = "tmpfs"; @@ -132,19 +138,6 @@ in { }; }; - services.udev.extraRules = '' - # UDEV rules for Teensy USB devices - ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" - ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" - KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" - ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="664", GROUP="plugdev" - ''; - - hardware.opengl.enable = true; - hardware.bluetooth.enable = true; - services.blueman.enable = true; - # 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/home/alacritty/capibara.nix b/home/alacritty/capibara.nix new file mode 100644 index 0000000..fdd6020 --- /dev/null +++ b/home/alacritty/capibara.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./nixos.nix ]; + programs.alacritty.settings.font.size = 9; +} diff --git a/home/alacritty/default.nix b/home/alacritty/nixos.nix similarity index 84% rename from home/alacritty/default.nix rename to home/alacritty/nixos.nix index fc5fb11..8355890 100644 --- a/home/alacritty/default.nix +++ b/home/alacritty/nixos.nix @@ -9,8 +9,6 @@ x = 0; y = 0; }; - # size = 7; - size = 9; }; }; }; diff --git a/home/alacritty/trantor.nix b/home/alacritty/trantor.nix new file mode 100644 index 0000000..7061a5a --- /dev/null +++ b/home/alacritty/trantor.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./nixos.nix ]; + programs.alacritty.settings.font.size = 7.5; +} diff --git a/home/default.nix b/home/capibara.nix similarity index 99% rename from home/default.nix rename to home/capibara.nix index 7902141..7303f20 100644 --- a/home/default.nix +++ b/home/capibara.nix @@ -22,7 +22,7 @@ in { ./barrier ./browsers ./dav - # ./desktop-xmonad + # ./desktop-xmonad/capibara.nix ./fonts ./git ./gotify diff --git a/home/desktop-xmonad/autorandr.nix b/home/desktop-xmonad/autorandr.nix deleted file mode 100644 index e9a9b04..0000000 --- a/home/desktop-xmonad/autorandr.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, pkgs, ... }: - -let - lvds_fingerprint = { - "LVDS-1" = "00ffffffffffff0030e4d8020000000000160103801c1078ea8855995b558f261d505400000001010101010101010101010101010101601d56d85000183030404700159c1000001b000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503132355748322d534c42330059"; - }; - hdmi_fingerprint = { - "HDMI-2" = "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047"; - }; - lvds_config = { - "LVDS-1" = { - enable = true; - crtc = 0; - mode = "1366x768"; - position = "1920x0"; - rate = "60.00"; - }; - }; - hdmi_config = { - "HDMI-2" = { - enable = true; - primary = true; - crtc = 0; - mode = "1920x1080"; - position = "0x0"; - rate = "60.00"; - }; - }; -in -{ - programs.autorandr = { - enable = true; - hooks.postswitch = { - "change-background" = "/run/current-system/sw/bin/systemctl --user restart random-background.service"; - "restart-xmonad" = "${pkgs.xmonad-with-packages}/bin/xmonad --restart"; - }; - profiles = { - "default" = { - fingerprint = lvds_fingerprint; - config = lvds_config; - }; - "docked-open" = { - fingerprint = pkgs.lib.mkMerge [ hdmi_fingerprint lvds_fingerprint ]; - config = pkgs.lib.mkMerge [ hdmi_config lvds_config ]; - }; - "docked-closed" = { - fingerprint = hdmi_fingerprint; - config = hdmi_config; - }; - }; - }; -} diff --git a/home/desktop-xmonad/autorandr/capibara.nix b/home/desktop-xmonad/autorandr/capibara.nix new file mode 100644 index 0000000..b4fac26 --- /dev/null +++ b/home/desktop-xmonad/autorandr/capibara.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: + +let + ext_monitor_fingerprint = + "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047"; + lvds_fingerprint = + "00ffffffffffff0030e4d8020000000000160103801c1078ea8855995b558f261d505400000001010101010101010101010101010101601d56d85000183030404700159c1000001b000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503132355748322d534c42330059"; + lvds_config = { + enable = true; + crtc = 0; + mode = "1366x768"; + position = "0x0"; + rate = "60.00"; + }; + hdmi_config = { + enable = true; + primary = true; + crtc = 0; + mode = "1920x1080"; + position = "0x0"; + rate = "60.00"; + }; +in { + imports = [ ./common.nix ]; + programs.autorandr.profiles = { + + default = { + fingerprint."LVDS-1" = lvds_fingerprint; + config."LVDS-1" = lvds_config; + }; + + docked = { + fingerprint = { + "HDMI-2" = ext_monitor_fingerprint; + "LVDS-1" = lvds_fingerprint; + }; + config = { + "LVDS-1" = lvds_config // { position = "1920x0"; }; + "HDMI-2" = hdmi_config; + }; + }; + docked_closed = { + fingerprint."HDMI-2" = ext_monitor_fingerprint; + config."HDMI-2" = hdmi_config; + }; + + }; +} diff --git a/home/desktop-xmonad/autorandr/common.nix b/home/desktop-xmonad/autorandr/common.nix new file mode 100644 index 0000000..70db164 --- /dev/null +++ b/home/desktop-xmonad/autorandr/common.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + programs.autorandr = { + enable = true; + hooks.postswitch = { + "change-background" = + "/run/current-system/sw/bin/systemctl --user restart random-background.service"; + "restart-xmonad" = "${pkgs.xmonad-with-packages}/bin/xmonad --restart"; + }; + }; +} diff --git a/home/desktop-xmonad/autorandr/trantor.nix b/home/desktop-xmonad/autorandr/trantor.nix new file mode 100644 index 0000000..f49f6a6 --- /dev/null +++ b/home/desktop-xmonad/autorandr/trantor.nix @@ -0,0 +1,67 @@ +{ config, pkgs, ... }: + +let + ext_monitor_fingerprint = + "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047"; + edp_fingerprint = + "00ffffffffffff0030e46e040000000000180104a52615780a0bb5a35955a0270c5054000000010101010101010101010101010101012e3680a070381f40302035007ed71000001b1f2480a070381f40302035007ed71000001b00000000000000000000000000000000000000000002000a30ff0a3c96191d4896000000003f"; + edp_config = { + enable = true; + crtc = 0; + mode = "1368x768"; + position = "1920x0"; + rate = "60.00"; + rotate = "left"; + }; + hdmi_config = { + enable = true; + primary = true; + crtc = 0; + mode = "1920x1080"; + position = "0x0"; + rate = "60.00"; + }; +in { + imports = [ ./common.nix ]; + programs.autorandr.profiles = { + + default = { + fingerprint = { + "HDMI-1-1" = ext_monitor_fingerprint; + "eDP-1-1" = edp_fingerprint; + }; + config = { + "HDMI-1-1" = hdmi_config; + "eDP-1-1" = edp_config; + }; + }; + + default_intel = { + fingerprint = { + "HDMI-1" = ext_monitor_fingerprint; + "eDP-1" = edp_fingerprint; + }; + config = { + "HDMI-1" = hdmi_config; + "eDP-1" = edp_config; + }; + }; + + nomonitor_intel = { + fingerprint."eDP-1" = edp_fingerprint; + config."eDP-1" = edp_config // { position = "0x0"; }; + }; + onlymonitor_intel = { + fingerprint = { "HDMI-1" = ext_monitor_fingerprint; }; + config = { "HDMI-1" = hdmi_config; }; + }; + nomonitor_nvidia = { + fingerprint."eDP-1-1" = edp_fingerprint; + config."eDP-1-1" = edp_config // { position = "0x0"; }; + }; + onlymonitor_nvidia = { + fingerprint = { "HDMI-1-1" = ext_monitor_fingerprint; }; + config = { "HDMI-1-1" = hdmi_config; }; + }; + }; +} diff --git a/home/desktop-xmonad/capibara.nix b/home/desktop-xmonad/capibara.nix new file mode 100644 index 0000000..89fc812 --- /dev/null +++ b/home/desktop-xmonad/capibara.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +let + desktopConfig = import ./desktop_config.nix { + config = config; + pkgs = pkgs; + }; +in desktopConfig // { + imports = [ ./common.nix ./autorandr/capibara.nix ]; + home.file.".xinitrc".text = '' + exec ${config.home.homeDirectory}/.xsession + ''; +} diff --git a/home/desktop-xmonad/common.nix b/home/desktop-xmonad/common.nix new file mode 100644 index 0000000..a3e5c1e --- /dev/null +++ b/home/desktop-xmonad/common.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: + +let + obtoxmd = pkgs.callPackage ./obtoxmd.nix { inherit config pkgs; }; +in { + imports = [ ./rofi.nix ./misc.nix ]; + home = { + keyboard = { + layout = "us"; + options = [ "caps:escape" ]; + variant = "altgr-intl"; + }; + packages = [ obtoxmd pkgs.openbox ]; + file = { + ".xmonad/icons/3cols.xpm".source = ./icons/3cols.xpm; + ".xmonad/icons/float.xpm".source = ./icons/float.xpm; + ".xmonad/icons/full.xpm".source = ./icons/full.xpm; + ".xmonad/icons/grid.xpm".source = ./icons/grid.xpm; + ".xmonad/icons/mtall.xpm".source = ./icons/mtall.xpm; + ".xmonad/icons/tabs.xpm".source = ./icons/tabs.xpm; + ".xmonad/icons/tall.xpm".source = ./icons/tall.xpm; + }; + }; + + xsession = { + enable = true; + initExtra = '' + xset s off -dpms + ${pkgs.autorandr}/bin/autorandr --change --default default + export WINIT_X11_SCALE_FACTOR=1.33 + ''; + }; + + services.stalonetray = { + enable = true; + config = { + icon_size = 20; + background = "#282828"; # todo + sticky = true; + geometry = "3x1-350+0"; + icon_gravity = "E"; + grow_gravity = "E"; + }; + }; + + programs.zsh.loginExtra = '' + [[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \ + exec "${pkgs.xorg.xinit}/bin/startx" 1> "${config.home.homeDirectory}/.xsession-errors" 2>&1 + ''; + +} diff --git a/home/desktop-xmonad/default.nix b/home/desktop-xmonad/default.nix deleted file mode 100644 index 8f3000c..0000000 --- a/home/desktop-xmonad/default.nix +++ /dev/null @@ -1,294 +0,0 @@ -{ config, pkgs, ... }: - -let - gruvbox-dark = { - bg = "#282828"; - bg1 = "#3c3836"; - bg2 = "#504945"; - - fg = "#ebdbb2"; - fg0 = "#fbf1c7"; - fg3 = "#bdae93"; - - red = "#cc241d"; - green = "#98971a"; - yellow = "#d79921"; - blue = "#458588"; - purple = "#b16286"; - aqua = "#689d6a"; - gray = "#a89984"; - - gray2 = "#928374"; - red-light = "#fb4934"; - green-light = "#b8bb26"; - yellow-light = "#fabd2f"; - blue-light = "#83a598"; - purple-light = "#d3869b"; - aqua-light = "#8ec07c"; - - }; - colors = { - fg = gruvbox-dark.fg; - selFg = gruvbox-dark.fg0; - bg = gruvbox-dark.bg; - sel = gruvbox-dark.blue; - inactive = gruvbox-dark.gray; - inactiveBorder = gruvbox-dark.bg2; - urgent = gruvbox-dark.red; - }; - rofiTransparency = "96"; - font = { - name = "Inter"; - size = "10"; - }; - monoFont = { - name = "Hack"; - size = "9"; - }; - hmonitors = pkgs.haskellPackages.callPackage ./hmonitors.nix {}; - obtoxmd = pkgs.callPackage ./obtoxmd.nix { inherit config pkgs; }; - - hmonitorsQuery = "${hmonitors}/bin/hmonitors-query"; - acpi = "${pkgs.acpi}/bin/acpi"; - nmcli = "${pkgs.networkmanager}/bin/nmcli"; - pamixer = "${pkgs.pamixer}/bin/pamixer"; - -in -{ - imports = [ ./autorandr.nix ./rofi.nix ./misc.nix ]; - home = { - keyboard = { - layout = "us"; - options = ["caps:escape"]; - variant = "altgr-intl"; - }; - packages = [hmonitors obtoxmd pkgs.acpi pkgs.pamixer pkgs.openbox]; - file = { - ".xinitrc".text = "exec ${config.home.homeDirectory}/.xsession"; - ".xmonad/icons/3cols.xpm".source = ./icons/3cols.xpm; - ".xmonad/icons/float.xpm".source = ./icons/float.xpm; - ".xmonad/icons/full.xpm".source = ./icons/full.xpm; - ".xmonad/icons/grid.xpm".source = ./icons/grid.xpm; - ".xmonad/icons/mtall.xpm".source = ./icons/mtall.xpm; - ".xmonad/icons/tabs.xpm".source = ./icons/tabs.xpm; - ".xmonad/icons/tall.xpm".source = ./icons/tall.xpm; - }; - }; - - xsession = { - enable = true; - initExtra = '' - xset s off -dpms - ${pkgs.autorandr}/bin/autorandr --change --default default - export WINIT_X11_SCALE_FACTOR=1.33 - ''; - windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - extraPackages = haskellPackages : [ - haskellPackages.monad-logger - haskellPackages.dbus - ]; - config = ./xmonad/xmonad.hs; - libFiles = { - "Bindings.hs" = ./xmonad/lib/Bindings.hs; - "DefaultConfig.hs" = ./xmonad/lib/DefaultConfig.hs; - "Layouts.hs" = ./xmonad/lib/Layouts.hs; - "ManageHook.hs" = ./xmonad/lib/ManageHook.hs; - "Prompts.hs" = ./xmonad/lib/Prompts.hs; - "Utils.hs" = ./xmonad/lib/Utils.hs; - "Xmobar.hs" = ./xmonad/lib/Xmobar.hs; - "HostConfig.hs" = pkgs.writeText "HostConfig.hs" '' - module HostConfig - ( fontConfig - , colorConfig - , FontConfig (FontConfig) - , fontSize - , fontName - , ColorConfig (ColorConfig) - , fgColor - , selFgColor - , bgColor - , selColor - , inactiveColor - , inactiveBorderColor - , urgentColor - ) where - - fontConfig :: FontConfig - fontConfig = FontConfig - { fontSize = ${font.size} - , fontName = "${font.name}" - } - - colorConfig :: ColorConfig - colorConfig = ColorConfig - { fgColor = "${colors.fg}" - , selFgColor = "${colors.selFg}" - , bgColor = "${colors.bg}" - , selColor = "${colors.sel}" - , inactiveColor = "${colors.inactive}" - , inactiveBorderColor = "${colors.inactiveBorder}" - , urgentColor = "${colors.urgent}" - } - - data FontConfig = FontConfig - { fontSize :: Int - , fontName :: String - } deriving Show - - data ColorConfig = ColorConfig - { fgColor :: String - , selFgColor :: String - , bgColor :: String - , selColor :: String - , inactiveColor :: String - , inactiveBorderColor :: String - , urgentColor :: String - } deriving Show - ''; - }; - }; - }; - - programs.xmobar = { - enable = true; - extraConfig = '' - Config - { font = "xft:${font.name}:style=Regular:size=${font.size}" - , additionalFonts = ["xft:mplus Nerd Font:size=12"] - , bgColor = "${colors.bg}" - , fgColor = "${colors.fg}" - , alignSep = "}{" - , sepChar = "%" - , template = "%StdinReader% }{ %vol%%bat%%net%%date%" - , lowerOnStart = True - , hideOnStart = False - , persistent = True - , allDesktops = True - , position = TopW L 100 - , commands = - [ Run Com "${hmonitorsQuery}" ["date" ] "date" 10 - , Run Com "${hmonitorsQuery}" ["bat", "${acpi}" ] "bat" 10 - , Run Com "${hmonitorsQuery}" ["net", "${nmcli}" ] "net" 20 - , Run Com "${hmonitorsQuery}" ["vol", "${pamixer}"] "vol" 5 - , Run StdinReader - ] - } - ''; - }; - - services.dunst = { - enable = true; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; - settings = { - global = { - font = "${font.name} ${font.size}"; - format = ''%s\n%b''; - sort = "yes"; - indicate_hidden = "yes"; - alignment = "left"; - bounce_freq = 0; - show_age_threshold = 60; - word_wrap = "yes"; - ignore_newline = "no"; - geometry = "300x5-30+20"; - shrink = "yes"; - transparency = 0; - idle_threshold = 10; - monitor = 0; - follow = "mouse"; - sticky_history = "yes"; - history_length = 20; - show_indicators = "yes"; - line_height = 0; - separator_height = 2; - padding = 8; - horizontal_padding = 8; - separator_color = "frame"; - startup_notification = false; - dmenu = "${pkgs.rofi}/bin/rofi -dmenu -p dunst:"; - browser = "${pkgs.firefox}/bin/firefox"; - icon_position = "left"; - frame_width = 0; - frame_color = colors.inactive; - }; - shortcuts = { - close = "ctrl+space"; - close_all = "ctrl+shift+space"; - context = "ctrl+shift+period"; - }; - urgency_low = { - background = "${colors.bg}${rofiTransparency}"; - foreground = colors.fg; - timeout = 10; - }; - urgency_normal = { - background = "${colors.sel}${rofiTransparency}"; - foreground = colors.selFg; - timeout = 10; - }; - urgency_critical = { - background = "${colors.urgent}${rofiTransparency}"; - foreground = colors.selFg; - timeout = 10; - }; - }; - }; - - services.stalonetray = { - enable = true; - config = { - icon_size = 20; - background = colors.bg; - sticky = true; - geometry = "3x1-350+0"; - icon_gravity = "E"; - grow_gravity = "E"; - }; - }; - - xresources.properties = { - "Sxiv.foreground" = colors.fg; - "Sxiv.background" = colors.bg; - "Sxiv.font" = "${monoFont.name}:size=${monoFont.size}"; - }; - - programs.zathura = { - enable = true; - options = { - font = "${monoFont.name} ${monoFont.size}"; - default-bg = colors.bg; - default-fg = gruvbox-dark.bg1; - statusbar-fg = gruvbox-dark.fg3; - statusbar-bg = gruvbox-dark.bg2; - inputbar-bg = colors.bg; - inputbar-fg = colors.sel; - notification-bg = colors.bg; - notification-fg = colors.sel; - notification-error-bg = colors.bg; - notification-error-fg = gruvbox-dark.red-light; - notification-warning-bg = colors.bg; - notification-warning-fg = gruvbox-dark.red-light; - highlight-color = gruvbox-dark.yellow-light; - highlight-active-color = gruvbox-dark.blue-light; - completion-bg = gruvbox-dark.bg1; - completion-fg = gruvbox-dark.blue-light; - completion-highlight-fg = colors.selFg; - completion-highlight-bg = gruvbox-dark.blue-light; - recolor-lightcolor = colors.bg; - recolor-darkcolor = colors.fg; - recolor = false; - recolor-keephue = false; - }; - }; - - programs.zsh.loginExtra = '' - [[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \ - exec "${pkgs.xorg.xinit}/bin/startx" 1> "${config.home.homeDirectory}/.xsession-errors" 2>&1 - ''; - -} diff --git a/home/desktop-xmonad/desktop_config.nix b/home/desktop-xmonad/desktop_config.nix new file mode 100644 index 0000000..e10c51e --- /dev/null +++ b/home/desktop-xmonad/desktop_config.nix @@ -0,0 +1,247 @@ +{ config, pkgs, fontSize ? "10", monoFontSize ? "9", ... }: + +let + gruvbox-dark = { + bg = "#282828"; + bg1 = "#3c3836"; + bg2 = "#504945"; + + fg = "#ebdbb2"; + fg0 = "#fbf1c7"; + fg3 = "#bdae93"; + + red = "#cc241d"; + green = "#98971a"; + yellow = "#d79921"; + blue = "#458588"; + purple = "#b16286"; + aqua = "#689d6a"; + gray = "#a89984"; + + gray2 = "#928374"; + red-light = "#fb4934"; + green-light = "#b8bb26"; + yellow-light = "#fabd2f"; + blue-light = "#83a598"; + purple-light = "#d3869b"; + aqua-light = "#8ec07c"; + + }; + colors = { + fg = gruvbox-dark.fg; + selFg = gruvbox-dark.fg0; + bg = gruvbox-dark.bg; + sel = gruvbox-dark.blue; + inactive = gruvbox-dark.gray; + inactiveBorder = gruvbox-dark.bg2; + urgent = gruvbox-dark.red; + }; + rofiTransparency = "96"; + font = { + name = "Inter"; + size = fontSize; + }; + monoFont = { + name = "Hack"; + size = monoFontSize; + }; + + hmonitors = pkgs.haskellPackages.callPackage ./hmonitors.nix { }; + + hmonitorsQuery = "${hmonitors}/bin/hmonitors-query"; + acpi = "${pkgs.acpi}/bin/acpi"; + nmcli = "${pkgs.networkmanager}/bin/nmcli"; + pamixer = "${pkgs.pamixer}/bin/pamixer"; + +in { + xsession.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + extraPackages = haskellPackages: [ + haskellPackages.monad-logger + haskellPackages.dbus + ]; + config = ./xmonad/xmonad.hs; + libFiles = { + "Bindings.hs" = ./xmonad/lib/Bindings.hs; + "DefaultConfig.hs" = ./xmonad/lib/DefaultConfig.hs; + "Layouts.hs" = ./xmonad/lib/Layouts.hs; + "ManageHook.hs" = ./xmonad/lib/ManageHook.hs; + "Prompts.hs" = ./xmonad/lib/Prompts.hs; + "Utils.hs" = ./xmonad/lib/Utils.hs; + "Xmobar.hs" = ./xmonad/lib/Xmobar.hs; + "HostConfig.hs" = pkgs.writeText "HostConfig.hs" '' + module HostConfig + ( fontConfig + , colorConfig + , FontConfig (FontConfig) + , fontSize + , fontName + , ColorConfig (ColorConfig) + , fgColor + , selFgColor + , bgColor + , selColor + , inactiveColor + , inactiveBorderColor + , urgentColor + ) where + + fontConfig :: FontConfig + fontConfig = FontConfig + { fontSize = ${font.size} + , fontName = "${font.name}" + } + + colorConfig :: ColorConfig + colorConfig = ColorConfig + { fgColor = "${colors.fg}" + , selFgColor = "${colors.selFg}" + , bgColor = "${colors.bg}" + , selColor = "${colors.sel}" + , inactiveColor = "${colors.inactive}" + , inactiveBorderColor = "${colors.inactiveBorder}" + , urgentColor = "${colors.urgent}" + } + + data FontConfig = FontConfig + { fontSize :: Int + , fontName :: String + } deriving Show + + data ColorConfig = ColorConfig + { fgColor :: String + , selFgColor :: String + , bgColor :: String + , selColor :: String + , inactiveColor :: String + , inactiveBorderColor :: String + , urgentColor :: String + } deriving Show + ''; + }; + }; + + programs.xmobar = { + enable = true; + extraConfig = '' + Config + { font = "xft:${font.name}:style=Regular:size=${font.size}" + , additionalFonts = ["xft:mplus Nerd Font:size=12"] + , bgColor = "${colors.bg}" + , fgColor = "${colors.fg}" + , alignSep = "}{" + , sepChar = "%" + , template = "%StdinReader% }{ %vol%%bat%%net%%date%" + , lowerOnStart = True + , hideOnStart = False + , persistent = True + , allDesktops = True + , position = TopW L 100 + , commands = + [ Run Com "${hmonitorsQuery}" ["date" ] "date" 10 + , Run Com "${hmonitorsQuery}" ["bat", "${acpi}" ] "bat" 10 + , Run Com "${hmonitorsQuery}" ["net", "${nmcli}" ] "net" 20 + , Run Com "${hmonitorsQuery}" ["vol", "${pamixer}"] "vol" 5 + , Run StdinReader + ] + } + ''; + }; + + services.dunst = { + enable = true; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + settings = { + global = { + font = "${font.name} ${font.size}"; + format = "%s\\n%b"; + sort = "yes"; + indicate_hidden = "yes"; + alignment = "left"; + bounce_freq = 0; + show_age_threshold = 60; + word_wrap = "yes"; + ignore_newline = "no"; + geometry = "300x5-30+20"; + shrink = "yes"; + transparency = 0; + idle_threshold = 10; + monitor = 0; + follow = "mouse"; + sticky_history = "yes"; + history_length = 20; + show_indicators = "yes"; + line_height = 0; + separator_height = 2; + padding = 8; + horizontal_padding = 8; + separator_color = "frame"; + startup_notification = false; + dmenu = "${pkgs.rofi}/bin/rofi -dmenu -p dunst:"; + browser = "${pkgs.firefox}/bin/firefox"; + icon_position = "left"; + frame_width = 0; + frame_color = colors.inactive; + }; + shortcuts = { + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + context = "ctrl+shift+period"; + }; + urgency_low = { + background = "${colors.bg}${rofiTransparency}"; + foreground = colors.fg; + timeout = 10; + }; + urgency_normal = { + background = "${colors.sel}${rofiTransparency}"; + foreground = colors.selFg; + timeout = 10; + }; + urgency_critical = { + background = "${colors.urgent}${rofiTransparency}"; + foreground = colors.selFg; + timeout = 10; + }; + }; + }; + + xresources.properties = { + "Sxiv.foreground" = colors.fg; + "Sxiv.background" = colors.bg; + "Sxiv.font" = "${monoFont.name}:size=${monoFont.size}"; + }; + + programs.zathura = { + enable = true; + options = { + font = "${monoFont.name} ${monoFont.size}"; + default-bg = colors.bg; + default-fg = gruvbox-dark.bg1; + statusbar-fg = gruvbox-dark.fg3; + statusbar-bg = gruvbox-dark.bg2; + inputbar-bg = colors.bg; + inputbar-fg = colors.sel; + notification-bg = colors.bg; + notification-fg = colors.sel; + notification-error-bg = colors.bg; + notification-error-fg = gruvbox-dark.red-light; + notification-warning-bg = colors.bg; + notification-warning-fg = gruvbox-dark.red-light; + highlight-color = gruvbox-dark.yellow-light; + highlight-active-color = gruvbox-dark.blue-light; + completion-bg = gruvbox-dark.bg1; + completion-fg = gruvbox-dark.blue-light; + completion-highlight-fg = colors.selFg; + completion-highlight-bg = gruvbox-dark.blue-light; + recolor-lightcolor = colors.bg; + recolor-darkcolor = colors.fg; + recolor = false; + recolor-keephue = false; + }; + }; +} diff --git a/home/desktop-xmonad/misc.nix b/home/desktop-xmonad/misc.nix index 73811bc..8aca028 100644 --- a/home/desktop-xmonad/misc.nix +++ b/home/desktop-xmonad/misc.nix @@ -1,14 +1,12 @@ { config, pkgs, ... }: -let - wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled"; -in -{ +let wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled"; +in { services.picom = { enable = true; - blur = true; - fade = false; - shadow = true; + blur = true; + fade = false; + shadow = true; }; services.random-background = { @@ -28,9 +26,6 @@ in Type = "simple"; ExecStart = "${pkgs.xbanish}/bin/xbanish"; }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; + Install = { WantedBy = [ "graphical-session.target" ]; }; }; - } diff --git a/home/desktop-xmonad/trantor.nix b/home/desktop-xmonad/trantor.nix new file mode 100644 index 0000000..90e50fc --- /dev/null +++ b/home/desktop-xmonad/trantor.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +let + desktopConfig = import ./desktop_config.nix { + config = config; + pkgs = pkgs; + fontSize = "12"; + monoFontSize = "13"; + }; +in desktopConfig // { + imports = [ ./common.nix ./autorandr/trantor.nix ]; + + home.file.".xinitrc".text = '' + ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 + ${pkgs.xorg.xrandr}/bin/xrandr --auto + exec ${config.home.homeDirectory}/.xsession + ''; + + services.picom = { + backend = "glx"; + vSync = true; + extraOptions = '' + unredir-if-possible=false; + ''; + }; + +} diff --git a/home/theming/common.nix b/home/theming/common.nix new file mode 100644 index 0000000..2c4155b --- /dev/null +++ b/home/theming/common.nix @@ -0,0 +1,33 @@ +{ config, pkgs, ... }: + +{ + home.packages = [ + pkgs.gruvbox-dark-gtk + pkgs.papirus-icon-theme + pkgs.lxappearance + pkgs.qt5ct + pkgs.gtk-engine-murrine + pkgs.gtk_engines + ]; + + gtk = { + enable = true; + font = { + name = "Inter"; + package = pkgs.inter; + }; + theme = { + name = "gruvbox-dark"; + package = pkgs.gruvbox-dark-gtk; + }; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + }; +} diff --git a/home/theming/default.nix b/home/theming/default.nix index ef7f10c..23e18dc 100644 --- a/home/theming/default.nix +++ b/home/theming/default.nix @@ -1,34 +1,6 @@ { config, pkgs, ... }: { - home.packages = [ - pkgs.gruvbox-dark-gtk - pkgs.papirus-icon-theme - pkgs.lxappearance - pkgs.qt5ct - pkgs.gtk-engine-murrine - pkgs.gtk_engines - ]; - - gtk = { - enable = true; - font = { - name = "Inter"; - size = 10; - package = pkgs.inter; - }; - theme = { - name = "gruvbox-dark"; - package = pkgs.gruvbox-dark-gtk; - }; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; - }; - - qt = { - enable = true; - platformTheme = "gtk"; - }; + imports = [ ./common.nix ]; + gtk.font.size = 10; } diff --git a/home/theming/trantor.nix b/home/theming/trantor.nix new file mode 100644 index 0000000..491d8a3 --- /dev/null +++ b/home/theming/trantor.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./common.nix ]; + gtk.font.size = 12; +} diff --git a/home/trantor.nix b/home/trantor.nix new file mode 100644 index 0000000..95ad78d --- /dev/null +++ b/home/trantor.nix @@ -0,0 +1,160 @@ +{ config, pkgs, ... }: + +let + impermanence = builtins.fetchTarball { + url = "https://github.com/nix-community/impermanence/archive/master.tar.gz"; + }; + +in { + # Let Home Manager install and manage itself. + # programs.home-manager.enable = true; + + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "rilla"; + home.homeDirectory = "/home/rilla"; + + imports = [ + "${impermanence}/home-manager.nix" + # ./desktop-sway + ./alacritty/trantor.nix + ./arduino + ./barrier + ./browsers + ./dav + ./desktop-xmonad/trantor.nix + ./fonts + ./git + ./gotify + ./gpg + ./idasen + ./mail + ./minidisc + ./mpd + ./msg + ./music + ./neovim + ./pass + ./rss + ./snapcast + ./sound + ./ssh + ./theming/trantor.nix + ./tmux + ./vitetris + ./wallets + ./zsh + ]; + + home.sessionVariables = { + EDITOR = "${pkgs.neovim}/bin/nvim"; + VISUAL = "${pkgs.neovim}/bin/nvim"; + BROWSER = "${pkgs.firefox}/bin/firefox"; + # OPENER = "todo"; # todo + TERMINAL = "${pkgs.alacritty}/bin/alacritty"; + CM_LAUNCHER = "rofi"; # for clipmenu + LEDGER_FILE = "${config.home.homeDirectory}/finance/2021.journal"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + + }; + + home.packages = with pkgs; [ + R + acpi + android-tools + ansible + bind.dnsutils + calibre + docker-compose + file + gimp + gnumake + htop + jq + killall + libnotify + libreoffice + lxqt.pcmanfm-qt + mosh + mpv + neofetch + networkmanagerapplet + nextcloud-client + pandoc + pv + ripgrep + signify + sxiv + telnet + virt-manager + wget + ]; + + services.syncthing.enable = true; + + services.kdeconnect.enable = true; + + programs.bat = { + enable = true; + config = { theme = "gruvbox-dark"; }; + }; + + programs.fzf = { + enable = true; + enableZshIntegration = true; + # defaultOptions = [ + # "--preview --preview 'bat --color=always --style=header,grid --line-range :300 {}'" + # ]; + tmux.enableShellIntegration = true; + }; + + services.gnome-keyring = { + enable = true; + components = [ "secrets" ]; + }; + + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; + + xdg.mimeApps = { + enable = true; + defaultApplications = { + "x-scheme-handler/http" = "firefox.desktop"; + "x-scheme-handler/https" = " firefox.desktop"; + "x-scheme-handler/chrome" = " firefox.desktop"; + "text/html" = "firefox.desktop"; + "application/x-extension-htm" = "firefox.desktop"; + "application/x-extension-html" = "firefox.desktop"; + "application/x-extension-shtml" = "firefox.desktop"; + "application/xhtml+xml" = "firefox.desktop"; + "application/x-extension-xhtml" = "firefox.desktop"; + "application/x-extension-xht" = "firefox.desktop"; + "x-scheme-handler/tg" = "userapp-Telegram Desktop.desktop"; + }; + associations.added = { + "x-scheme-handler/http" = "firefox.desktop"; + "x-scheme-handler/https" = " firefox.desktop"; + "x-scheme-handler/chrome" = " firefox.desktop"; + "text/html" = "firefox.desktop"; + "application/x-extension-htm" = "firefox.desktop"; + "application/x-extension-html" = "firefox.desktop"; + "application/x-extension-shtml" = "firefox.desktop"; + "application/xhtml+xml" = "firefox.desktop"; + "application/x-extension-xhtml" = "firefox.desktop"; + "application/x-extension-xht" = "firefox.desktop"; + "x-scheme-handler/tg" = "userapp-Telegram Desktop.desktop"; + + }; + }; + + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + "autoconnect" = [ "qemu:///system" ]; + "uris" = [ "qemu:///system" ]; + }; + }; + + home.stateVersion = "21.11"; +} diff --git a/nixos/common.nix b/nixos/common.nix index aee16b7..fd59f7a 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -1,12 +1,6 @@ { config, pkgs, ... }: -let - home-manager = builtins.fetchTarball { - url = "https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz"; - }; -in { - imports = [ "${home-manager}/nixos" ]; - +{ nixpkgs.config = { packageOverrides = pkgs: { nur = import (builtins.fetchTarball @@ -76,6 +70,7 @@ in { Option "AccelerationProfile" "0" Option "AccelerationScheme" "predictable" Option "AccelerationNumerator" "3" + Option "AccelSpeed" "-0.5" EndSection ''; }; @@ -170,8 +165,6 @@ in { }; }; - home-manager.users.rilla = import ../home; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -200,6 +193,19 @@ in { }; programs.dconf.enable = true; + services.udev.extraRules = '' + # UDEV rules for Teensy USB devices + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" + KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="664", GROUP="plugdev" + ''; + + hardware.opengl.enable = true; + hardware.bluetooth.enable = true; + services.blueman.enable = true; + # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # diff --git a/nixos/hardware-configuration/trantor.nix b/nixos/hardware-configuration/trantor.nix new file mode 100644 index 0000000..c701109 --- /dev/null +++ b/nixos/hardware-configuration/trantor.nix @@ -0,0 +1,18 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/trantor.nix b/trantor.nix index 1aaec82..4cf4a40 100644 --- a/trantor.nix +++ b/trantor.nix @@ -4,12 +4,24 @@ { config, pkgs, ... }: -{ +let + impermanence = builtins.fetchTarball { + url = "https://github.com/nix-community/impermanence/archive/master.tar.gz"; + }; + home-manager = builtins.fetchTarball { + url = + "https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz"; + }; +in { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ./common.nix + ./nixos/hardware-configuration/trantor.nix + ./nixos/common.nix + "${home-manager}/nixos" + "${impermanence}/nixos.nix" ]; + home-manager.users.rilla = import home/trantor.nix; + fileSystems = { "/" = { device = "/dev/mapper/cryptroot"; @@ -30,15 +42,20 @@ }; "/home" = { - device = "/dev/mapper/cryptroot"; + device = "/dev/mapper/crypthome"; fsType = "btrfs"; options = [ "subvol=home" "compress-force=zstd" ]; }; - "/boot" = { - device = "/dev/mapper/cryptroot"; + "/boot/efi" = { + device = "/dev/disk/by-uuid/0BFA-9A66"; + fsType = "vfat"; + }; + + "/home/rilla/Maildir" = { + device = "/dev/mapper/crypthome"; fsType = "btrfs"; - options = [ "subvol=boot" "compress-force=zstd" ]; + options = [ "subvol=mail" "compress-force=zstd" ]; }; "/swap" = { @@ -47,15 +64,40 @@ options = [ "subvol=swap" ]; }; - "/boot/efi" = { - device = "/dev/disk/by-uuid/0BFA-9A66"; - fsType = "vfat"; - }; + # "/home/rilla/music" = { + # device = "narwhal:/music"; + # fsType = "nfs"; + # options = [ + # "nfsvers=4" + # "noauto" + # "x-systemd.automount" + # "x-systemd.idle-timeout=1min" + # ]; + # }; + + # "/home/rilla/calibre" = { + # device = "narwhal:/calibre"; + # fsType = "nfs"; + # options = [ + # "nfsvers=4" + # "noauto" + # "x-systemd.automount" + # "x-systemd.idle-timeout=1min" + # ]; + # }; }; swapDevices = [{ device = "/swap/swapfile"; }]; + environment.variables = { + NIXOS_CONFIG = "/home/rilla/configs/nix-config/trantor.nix"; + WINT_HDPI_FACTOR = "1"; + }; + + networking.networkmanager.wifi.macAddress = "80:FA:5B:41:12:0F"; + nixpkgs.config.allowUnfree = true; + programs.steam.enable = true; boot = { loader = { @@ -68,8 +110,8 @@ enable = true; version = 2; device = "nodev"; - efiSupport = true; enableCryptodisk = true; + efiSupport = true; }; }; initrd = { @@ -98,6 +140,17 @@ }; }; + services.xserver = { videoDrivers = [ "nvidia" ]; }; + hardware.nvidia = { + nvidiaPersistenced = true; + modesetting.enable = true; + prime = { + sync.enable = true; + nvidiaBusId = "PCI:1:0:0"; + intelBusId = "PCI:0:2:0"; + }; + }; + # 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