diff --git a/entropy/kitty/kitty.conf b/entropy/kitty/kitty.conf index a28e1e0..84ed330 100644 --- a/entropy/kitty/kitty.conf +++ b/entropy/kitty/kitty.conf @@ -23,7 +23,7 @@ font_family Hack Nerd Font #: italic_font Operator Mono Book Italic #: bold_italic_font Operator Mono Medium Italic -font_size 16.0 +font_size 10.0 #: Font size (in pts) @@ -523,7 +523,7 @@ background #202020 #: macos_hide_titlebar. # macos_hide_titlebar no -macos_hide_titlebar yes +hide_window_decorations yes #: Hide the kitty window's title bar on macOS. diff --git a/entropy/nixos/configuration.nix b/entropy/nixos/configuration.nix index 1b2c36a..4f6f80d 100644 --- a/entropy/nixos/configuration.nix +++ b/entropy/nixos/configuration.nix @@ -12,6 +12,10 @@ ./modules/r.nix # python with modules ./modules/python.nix + # Wayland + ./modules/sway.nix + # old i3 compositor + # ./modules/i3.nix ]; # set up LUKS discovery @@ -20,12 +24,6 @@ # make the screen usable #hardware.video.hidpi.enable = true; #services.xserver.dpi = 180; - services.xserver.dpi = 192; - environment.variables = { - GDK_SCALE = "2"; - GDK_DPI_SCALE = "0.5"; - _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2"; - }; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; @@ -84,45 +82,10 @@ # use the xkb-config from the X server console.useXkbConfig = true; - # Configure X Server - services.xserver.enable = true; - services.xserver.windowManager.i3 = { - enable = true; - package = pkgs.i3-gaps; - extraPackages = with pkgs; [ - dmenu - #(i3status-rust.overrideAttrs ( oldAttrs: { cargoBuildFlags = [ "--features=notmuch" ]; })) - i3status-rust - i3lock-fancy - libnotify - dunst - feh - ]; - # extraSessionCommands = "feh --bg-scale /home/felix/wall.jpg"; - }; - # login window options - services.xserver.displayManager.lightdm = { - background = "/etc/nixos/extra/login.jpg"; - # should be enabled by selecting i3 - # enable = true; - greeters.gtk = { - cursorTheme.name = "Adwaita-dark"; - iconTheme.name = "Adwaita-dark"; - theme.name = "Adwaita-dark"; - }; - }; - - services.xserver.xautolock = { - enable = true; - extraOptions = [ "-detectsleep" ]; - locker = "${pkgs.i3lock-fancy}/bin/i3lock-fancy"; - nowlocker = "${pkgs.i3lock-fancy}/bin/i3lock-fancy"; - time = 10; - }; # Configure keymap in X11 services.xserver.layout = "gb"; services.xserver.xkbOptions = "eurosign:e,ctrl:nocaps,compose:prsc"; - # enable touchpas support + # enable touchpad support services.xserver.libinput.enable = true; # Enable CUPS to print documents. @@ -213,6 +176,12 @@ } ]; + ## enable fingerprint reader + #services.fprintd.enable = true; + #security.pam.services.login.fprintAuth = true; + ##security.pam.services.xscreensaver.fprintAuth = true; + #security.pam.services.sudo.fprintAuth = true; + # set up virtualization with virtualbox virtualisation.virtualbox.host.enable = true; # I'm gonna keep this disabled for the sake of my sanity @@ -232,7 +201,6 @@ ripgrep sshfs ncdu - scrot tldr unzip ncat @@ -242,8 +210,6 @@ screen moreutils file - ## automatic detection of display changes - autorandr ## audio management pavucontrol ## password management @@ -278,7 +244,8 @@ vscodium eclipses.eclipse-platform typora - firefox + firefox-wayland + torbrowser next rstudio ## time tracking @@ -363,10 +330,6 @@ # for SAMBA file shares services.gvfs.enable = true; - # use redshift - services.redshift.enable = true; - services.redshift.temperature.night = 3500; - # allow brightness control services.illum.enable = true; diff --git a/entropy/nixos/modules/i3.nix b/entropy/nixos/modules/i3.nix new file mode 100644 index 0000000..388da2d --- /dev/null +++ b/entropy/nixos/modules/i3.nix @@ -0,0 +1,55 @@ +{ pkgs, ... }: + +{ + services.xserver.dpi = 192; + environment.variables = { + GDK_SCALE = "2"; + GDK_DPI_SCALE = "0.5"; + _JAVA_OPTIONS = "-Dsun.java2d.uiScale=2"; + }; + + # Configure X Server + services.xserver.enable = true; + services.xserver.windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraPackages = with pkgs; [ + dmenu + #(i3status-rust.overrideAttrs ( oldAttrs: { cargoBuildFlags = [ "--features=notmuch" ]; })) + i3status-rust + i3lock-fancy + libnotify + dunst + feh + scrot + ## automatic detection of display changes + # autorandr + ]; + # extraSessionCommands = "feh --bg-scale /home/felix/wall.jpg"; + }; + # login window options + services.xserver.displayManager.lightdm = { + background = "/etc/nixos/extra/login.jpg"; + # should be enabled by selecting i3 + # enable = true; + greeters.gtk = { + cursorTheme.name = "Adwaita-dark"; + iconTheme.name = "Adwaita-dark"; + theme.name = "Adwaita-dark"; + }; + }; + + services.xserver.xautolock = { + enable = true; + extraOptions = [ "-detectsleep" ]; + locker = "${pkgs.i3lock-fancy}/bin/i3lock-fancy"; + nowlocker = "${pkgs.i3lock-fancy}/bin/i3lock-fancy"; + time = 10; + }; + + # use redshift + services.redshift = { + enable = true; + temperature.night = 3500; + }; +} diff --git a/entropy/nixos/modules/sway.nix b/entropy/nixos/modules/sway.nix new file mode 100644 index 0000000..d726ca1 --- /dev/null +++ b/entropy/nixos/modules/sway.nix @@ -0,0 +1,132 @@ +{ pkgs, ... }: + +{ + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; # so that gtk works properly + extraPackages = with pkgs; [ + swaylock + swayidle + xwayland # for legacy apps + waybar + wl-clipboard + mako # notification daemon + alacritty # Alacritty is the default terminal in the config + dmenu # Dmenu is the default in the config but i recommend wofi since its wayland native + kanshi # replacement for autorandr + sway-contrib.grimshot + imv # image viewer + ]; + extraSessionCommands = '' + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + }; + + + #environment = { + #etc = { + ## Put config files in /etc. Note that you also can put these in ~/.config, but then you can't manage them with NixOS anymore! + #"sway/config".source = ./dotfiles/sway/config; + #"xdg/waybar/config".source = ./dotfiles/waybar/config; + #"xdg/waybar/style.css".source = ./dotfiles/waybar/style.css; + #}; + #}; + + # Here we but a shell script into path, which lets us start sway.service (after importing the environment of the login shell). + environment.systemPackages = with pkgs; [ + ( + pkgs.writeTextFile { + name = "startsway"; + destination = "/bin/startsway"; + executable = true; + text = '' + #! ${pkgs.bash}/bin/bash + + # first import environment variables from the login manager + systemctl --user import-environment + # then start the service + exec systemctl --user start sway.service + ''; + } + ) + ]; + + # use gdm for authentication + services.xserver.enable = true; + services.xserver.displayManager.gdm = { + enable = true; + wayland = true; + }; + + services.redshift = { + enable = true; + # Redshift with wayland support isn't present in nixos-19.09 atm. You have to cherry-pick the commit from https://github.com/NixOS/nixpkgs/pull/68285 to do that. + package = pkgs.redshift-wlr; + temperature.night = 3500; + }; + + systemd.user.targets.sway-session = { + description = "Sway compositor session"; + documentation = [ "man:systemd.special(7)" ]; + bindsTo = [ "graphical-session.target" ]; + wants = [ "graphical-session-pre.target" ]; + after = [ "graphical-session-pre.target" ]; + }; + + systemd.user.services.sway = { + description = "Sway - Wayland window manager"; + documentation = [ "man:sway(5)" ]; + bindsTo = [ "graphical-session.target" ]; + wants = [ "graphical-session-pre.target" ]; + after = [ "graphical-session-pre.target" ]; + # We explicitly unset PATH here, as we want it to be set by + # systemctl --user import-environment in startsway + environment.PATH = pkgs.lib.mkForce null; + serviceConfig = { + Type = "simple"; + ExecStart = '' + ${pkgs.dbus}/bin/dbus-run-session ${pkgs.sway}/bin/sway --debug + ''; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + + systemd.user.services.swayidle = { + description = "Idle Manager for Wayland"; + documentation = [ "man:swayidle(1)" ]; + wantedBy = [ "sway-session.target" ]; + partOf = [ "graphical-session.target" ]; + path = [ pkgs.bash ]; + serviceConfig = { + ExecStart = '' ${pkgs.swayidle}/bin/swayidle -w -d \ + timeout 300 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \ + resume '${pkgs.sway}/bin/swaymsg "output * dpms on"' + ''; + }; + }; + + programs.waybar.enable = true; + + systemd.user.services.kanshi = { + description = "Kanshi output autoconfig "; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig = { + # kanshi doesn't have an option to specifiy config file yet, so it looks + # at .config/kanshi/config + ExecStart = '' + ${pkgs.kanshi}/bin/kanshi + ''; + RestartSec = 5; + Restart = "always"; + }; + }; +}