From 4a7826fee18e7566521a7ca40120783c2280466e Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Thu, 16 Feb 2023 13:52:15 +0100 Subject: [PATCH] updates to make cream work --- nixos/machines/cream/configuration.nix | 27 +++----- .../machines/cream/hardware-configuration.nix | 10 +-- nixos/machines/cream/qemu.nix | 2 +- nixos/machines/cream/syncthing.nix | 16 ++--- nixos/modules/programs/urxvt.nix | 68 +++++++++++-------- nixos/modules/system/font.nix | 18 +++-- nixos/modules/system/x11.nix | 7 +- nixos/system/all/syncthing.nix | 19 +++--- .../desktop/home-manager/doom-emacs.nix | 10 ++- .../desktop/home-manager/doom.d/config.el | 16 ----- nixos/system/desktop/home-manager/i3.nix | 13 ++-- 11 files changed, 92 insertions(+), 114 deletions(-) diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index 85d36b1..f4c8f4e 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -13,7 +13,7 @@ #./wifi-access-point.nix #./wireshark.nix #./scanner.nix - #./qemu.nix + ./qemu.nix ./wireguard.nix ]; @@ -47,14 +47,14 @@ # fonts # ----- - programs.custom.urxvt.fontSize = 12; - programs.custom.xterm.fontSize = 12; - system.custom.fonts.dpi = 200; + programs.custom.urxvt.fontSize = 16; + programs.custom.urxvt.fontType = "vector"; + programs.custom.xterm.fontSize = 16; + # todo : add xterm fontType virtualisation = { docker.enable = true; podman.enable = true; - virtualbox = { host.enable = false; guest.x11 = false; @@ -68,6 +68,7 @@ }; services.xserver.desktopManager.gnome.enable = true; + services.xserver.videoDrivers = [ "modesetting" ]; custom.samba-share = { enable = false; @@ -77,25 +78,13 @@ }; }; - # enable this to use sidequest - programs.adb.enable = true; - users.users.mainUser.extraGroups = [ "adbusers" "video" ]; # for congress and streaming hardware.opengl = { enable = true; - # extraPackages = [ - # intel-media-driver # LIBVA_DRIVER_NAME=iHD - # vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - # vaapiVdpau - # libvdpau-va-gl - # ]; - driSupport = true; - driSupport32Bit = true; + #driSupport = true; + #driSupport32Bit = true; }; - #nixpkgs.config.packageOverrides = pkgs: { - # vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; - #}; system.stateVersion = "22.11"; # Did you read the comment? diff --git a/nixos/machines/cream/hardware-configuration.nix b/nixos/machines/cream/hardware-configuration.nix index 026c6d5..4f0e964 100644 --- a/nixos/machines/cream/hardware-configuration.nix +++ b/nixos/machines/cream/hardware-configuration.nix @@ -62,18 +62,12 @@ swapDevices = [ ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s13f0u4c2.useDHCP = lib.mkDefault true; - # networking.interfaces.tinc.private.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp166s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - #powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; } diff --git a/nixos/machines/cream/qemu.nix b/nixos/machines/cream/qemu.nix index f14ad8d..687e30c 100644 --- a/nixos/machines/cream/qemu.nix +++ b/nixos/machines/cream/qemu.nix @@ -8,10 +8,10 @@ environment.systemPackages = [ pkgs.qemu_kvm + (pkgs.quickemu.override { qemu = pkgs.qemu_kvm; }) pkgs.virt-manager ]; users.users.mainUser.extraGroups = [ "libvirtd" ]; - } diff --git a/nixos/machines/cream/syncthing.nix b/nixos/machines/cream/syncthing.nix index bf27899..1d3124a 100644 --- a/nixos/machines/cream/syncthing.nix +++ b/nixos/machines/cream/syncthing.nix @@ -20,10 +20,10 @@ enable = true; path = "/home/palo/.password-store"; }; - private = { - enable = true; - path = "/home/palo/private"; - }; + #private = { + # enable = true; + # path = "/home/palo/private"; + #}; art = { enable = true; path = "/home/palo/art"; @@ -47,10 +47,10 @@ enable = true; path = "/home/palo/music-library"; }; - music-projects = { - enable = true; - path = "/home/palo/music-projects"; - }; + # music-projects = { + # enable = true; + # path = "/home/palo/music-projects"; + # }; }; }; diff --git a/nixos/modules/programs/urxvt.nix b/nixos/modules/programs/urxvt.nix index 6a22b04..c793f26 100644 --- a/nixos/modules/programs/urxvt.nix +++ b/nixos/modules/programs/urxvt.nix @@ -4,11 +4,8 @@ # urxvt --help 2>&1| sed -n '/: /s/^ */! URxvt*/gp' | les with lib; - let - cfg = config.programs.custom.urxvt; - in { @@ -16,6 +13,11 @@ in enable = mkEnableOption "configure and enable urxvt"; + fontType = mkOption { + type = types.enum [ "bitmap" "vector" ]; + default = "bitmap"; + }; + fontSize = mkOption { type = types.int; default = 17; @@ -73,41 +75,47 @@ in "X11/Xresource.d/urxvt-font".source = let - fontFamily = "terminus"; - normalFont = fontSize: - "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - boldFont = fontSize: - "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - italicFont = normalFont; - itallicBoldFont = boldFont; - backupFont = fontSize: - "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; - fontCommand = key: fontSize: '' - URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${backupFont fontSize}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007 - ''; + bitmapPart = + let + # use xfontsel or fontmatrix to choose line + fontFamily = "terminus"; + normalFont = fontSize: + "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + boldFont = fontSize: + "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + italicFont = normalFont; + itallicBoldFont = boldFont; + in + '' + URxvt.font: ${normalFont cfg.fontSize} + URxvt.boldFont: ${boldFont cfg.fontSize} + URxvt.italicFont: ${italicFont cfg.fontSize} + URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize} + ''; + + vectorPart = + let + # show available fonts = `fc-list` + backupFont = fontSize: style: + #"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; + "xft:JetBrains Mono:pixelsize=${toString fontSize}${optionalString (style != null) ",style:${style}"}"; + in + '' + URxvt.font: ${backupFont cfg.fontSize null} + URxvt.boldFont: ${backupFont cfg.fontSize "Bold"} + URxvt.italicFont: ${backupFont cfg.fontSize "Italic"} + URxvt.bolditalicFont: ${backupFont cfg.fontSize "Bold Italic"} + ''; in pkgs.writeText "Xresource-urxvt-font" '' URxvt.allow_bold: true URxvt.xftAntialias: true - !! use xfontsel or fontmatrix to choose line - !URxvt.font: ${normalFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.boldFont: ${boldFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.italicFont: ${italicFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${backupFont cfg.fontSize} - - URxvt.font: ${normalFont cfg.fontSize} - URxvt.boldFont: ${boldFont cfg.fontSize} - URxvt.italicFont: ${italicFont cfg.fontSize} - URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize} - - ${fontCommand "F1" cfg.fontSize} - ${fontCommand "F2" (cfg.fontSize + 5)} - ${fontCommand "F3" (cfg.fontSize + 10)} - ${fontCommand "F4" (cfg.fontSize + 20)} + ${optionalString (cfg.fontType == "bitmap") bitmapPart} + ${optionalString (cfg.fontType == "vector") vectorPart} ''; "X11/Xresource.d/urxvt-colors".source = diff --git a/nixos/modules/system/font.nix b/nixos/modules/system/font.nix index dc0ac0f..6805ddb 100644 --- a/nixos/modules/system/font.nix +++ b/nixos/modules/system/font.nix @@ -1,21 +1,18 @@ { config, lib, pkgs, ... }: with lib; - let - cfg = config.system.custom.fonts; - in { options.system.custom.fonts = { enable = mkEnableOption "enable fonts"; - dpi = mkOption { + size = mkOption { type = types.int; - default = 141; + default = 17; description = '' - dpi of the monitor + size of the font ''; }; }; @@ -25,7 +22,8 @@ in # see https://nixos.wiki/wiki/Fonts config = mkIf cfg.enable { - services.xserver.dpi = cfg.dpi; + # only set this on x220 to 141, if resolution is shit. + #services.xserver.dpi = cfg.dpi; fonts = { @@ -33,8 +31,8 @@ in enableGhostscriptFonts = true; fontDir.enable = true; + # todo brauch ich überhaupt die urxvt und xterm configurationen? fontconfig = { - #dpi = cfg.dpi; subpixel = { lcdfilter = "default"; rgba = "rgb"; @@ -45,7 +43,7 @@ in }; enable = true; antialias = true; - #defaultFonts = { monospace = [ "inconsolata" ]; }; + defaultFonts = { monospace = [ "JetBrains Mono" ]; }; }; fonts = with pkgs; [ @@ -61,9 +59,9 @@ in # ------------ # nerdfonts powerline-fonts - #font-awesome-ttf font-awesome fira-code-symbols + jetbrains-mono # shell font # ---------- diff --git a/nixos/modules/system/x11.nix b/nixos/modules/system/x11.nix index 66869ae..2fe9d38 100644 --- a/nixos/modules/system/x11.nix +++ b/nixos/modules/system/x11.nix @@ -3,9 +3,7 @@ with lib; let - cfg = config.system.custom.x11; - in { @@ -87,6 +85,11 @@ in # across different files # just add a file into `/etc/X11/Xresource.d/` and it will be # evaluated. + # todo this is better: + #include "/etc/X11/Xresources.d/xterm" + #include "/etc/X11/Xresources.d/rxvt-unicode" + #include "/etc/X11/Xresources.d/fonts" + #include "/etc/X11/Xresources.d/xscreensaver" services.xserver.displayManager.sessionCommands = '' for file in `ls /etc/X11/Xresource.d/` do diff --git a/nixos/system/all/syncthing.nix b/nixos/system/all/syncthing.nix index 777abbd..a68a11a 100644 --- a/nixos/system/all/syncthing.nix +++ b/nixos/system/all/syncthing.nix @@ -10,8 +10,7 @@ with lib; { "${name}" = { name = name; id = id; - #addresses = - # [ "tcp://${name}.private:22000" ]; + addresses = [ "tcp://${name}.private:22000" ]; }; }; in @@ -49,7 +48,7 @@ with lib; { private = { enable = lib.mkDefault false; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "mobi" "bobi" ]; + devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ]; versioning = { type = "simple"; params.keep = "10"; @@ -58,7 +57,7 @@ with lib; { art = { enable = lib.mkDefault false; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "bumba" ]; + devices = [ "pepe" "cream" "sterni" "bumba" ]; versioning = { type = "simple"; params.keep = "2"; @@ -67,7 +66,7 @@ with lib; { password-store = { enable = lib.mkDefault false; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "mobi" "bobi" ]; + devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ]; versioning = { type = "simple"; params.keep = "10"; @@ -76,12 +75,12 @@ with lib; { desktop = { enable = lib.mkDefault false; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "mobi" "bobi" ]; + devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ]; }; finance = { enable = lib.mkDefault false; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "mobi" "bobi" ]; + devices = [ "pepe" "cream" "sterni" "mobi" "bobi" ]; versioning = { type = "simple"; params.keep = "10"; @@ -103,7 +102,7 @@ with lib; { enable = lib.mkDefault false; id = "wwbvs-5lfbh"; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "robi" ]; + devices = [ "pepe" "cream" "sterni" "robi" ]; versioning = { type = "simple"; params.keep = "10"; @@ -132,7 +131,7 @@ with lib; { enable = lib.mkDefault false; id = "gytmq-r2zrx"; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "robi" ]; + devices = [ "pepe" "cream" "sterni" "robi" ]; versioning = { type = "simple"; params.keep = "10"; @@ -142,7 +141,7 @@ with lib; { enable = lib.mkDefault false; id = "acfhu-r4t4f"; watch = lib.mkDefault false; - devices = [ "pepe" "sterni" "robi" ]; + devices = [ "pepe" "cream" "sterni" "robi" ]; versioning = { type = "simple"; params.keep = "10"; diff --git a/nixos/system/desktop/home-manager/doom-emacs.nix b/nixos/system/desktop/home-manager/doom-emacs.nix index f5c3192..e4942e6 100644 --- a/nixos/system/desktop/home-manager/doom-emacs.nix +++ b/nixos/system/desktop/home-manager/doom-emacs.nix @@ -1,8 +1,16 @@ -{ pkgs, lib, ... }: { +{ config, pkgs, lib, ... }: { home-manager.users.mainUser = { programs.doom-emacs = { enable = lib.mkDefault true; doomPrivateDir = ./doom.d; + extraConfig = '' + ;; "monospace" means use the system default. However, the default is usually two + ;; points larger than I'd like, so I specify size 12 here. + (setq doom-font + (font-spec :family "Jetbrains Mono" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light)) + ;(setq doom-font + ; (font-spec :family "Terminus" :size ${toString config.programs.custom.urxvt.fontSize} :weight 'light)) + ''; emacsPackagesOverlay = self: super: { # fixes https://github.com/vlaci/nix-doom-emacs/issues/394 diff --git a/nixos/system/desktop/home-manager/doom.d/config.el b/nixos/system/desktop/home-manager/doom.d/config.el index 05dea04..926c25e 100644 --- a/nixos/system/desktop/home-manager/doom.d/config.el +++ b/nixos/system/desktop/home-manager/doom.d/config.el @@ -1,20 +1,4 @@ ;; configure theme (setq doom-theme 'doom-solarized-light) -; dotspacemacs-default-font '("Terminus" -; :size ${toString fontSize} -; :weight normal -; :width normal -; :powerline-scale 1.1) - -;; "monospace" means use the system default. However, the default is usually two -;; points larger than I'd like, so I specify size 12 here. -;(setq doom-font (font-spec :family "JetBrainsMono" :size 12 :weight 'light) -; doom-variable-pitch-font (font-spec :family "Noto Serif" :size 13) -; ivy-posframe-font (font-spec :family "JetBrainsMono" :size 15)) - -(setq doom-font (font-spec :family "Terminus" :size 12 :weight 'light) - ;doom-variable-pitch-font (font-spec :family "Noto Serif" :size 13) - ;ivy-posframe-font (font-spec :family "JetBrainsMono" :size 15) - ) diff --git a/nixos/system/desktop/home-manager/i3.nix b/nixos/system/desktop/home-manager/i3.nix index e31bab8..b411d07 100644 --- a/nixos/system/desktop/home-manager/i3.nix +++ b/nixos/system/desktop/home-manager/i3.nix @@ -93,17 +93,13 @@ in in [ { command = "${pkgs.albert}/bin/albert"; always = true; } - #{ - # command = "${pkgs.polygon-art.polygon-art}/bin/rings --height ${toString height} --width ${toString width} /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png"; - # always = true; - #} { command = toString backgroundCommand; always = true; } #{ command = "${pkgs.flameshot}/bin/flameshot"; always = true; } # { command = "systemctl --user restart polybar"; always = true; notification = false; } ]; fonts = { - names = [ "Terminus" ]; - size = 9.0; + names = [ "JetBrains Mono" ]; + size = 11.0; }; bars = with colorTheme; @@ -117,10 +113,9 @@ in workspaceButtons = true; workspaceNumbers = true; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.users.users.mainUser.home}/.config/i3status-rust/config-my.toml"; - #fonts = [ "Terminus" ]; fonts = { - names = [ "Terminus" ]; - size = 9.0; + names = [ "JetBrains Mono" ]; + size = 11.0; }; trayOutput = "primary"; colors = {