From f12ff6a989f420b4ba677c6f2f24c424c7362e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Mon, 4 Dec 2023 22:47:02 +0100 Subject: [PATCH] Fix a lot of FIXMEs --- curacao/options.nix | 7 ++- dk/single_uefi_btrfs.nix | 2 +- hm/common.nix | 8 ++-- hm/desktop.nix | 47 ++++++++++++------- hm/extra.nix | 14 ++++-- hm/frobar/default.nix | 1 - hm/frobar/frobar/display.py | 2 +- hm/style.nix | 5 -- options.nix | 6 +++ os/desktop.nix | 13 +++++ os/sct_aarch64.patch | 10 ++++ pindakaas/options.nix | 6 ++- .../host_vars/pindakaas.geoffrey.frogeye.fr | 16 ------- 13 files changed, 86 insertions(+), 51 deletions(-) create mode 100644 os/sct_aarch64.patch delete mode 100644 unprocessed/config/automatrop/host_vars/pindakaas.geoffrey.frogeye.fr diff --git a/curacao/options.nix b/curacao/options.nix index be760c1..a941a5f 100644 --- a/curacao/options.nix +++ b/curacao/options.nix @@ -1,7 +1,12 @@ { ... }: { frogeye = { - desktop.xorg = true; + desktop = { + xorg = true; + x11_screens = [ "HDMI-1-0" "eDP1" ]; + maxVideoHeight = 1440; + numlock = true; + }; dev = { docker = true; }; diff --git a/dk/single_uefi_btrfs.nix b/dk/single_uefi_btrfs.nix index b839c1f..979f3c7 100644 --- a/dk/single_uefi_btrfs.nix +++ b/dk/single_uefi_btrfs.nix @@ -26,7 +26,7 @@ content = { type = "luks"; name = "${name}"; - passwordFile = "/tmp/secret.key"; # TODO Generate this somehow + passwordFile = "/tmp/secret.key"; # FIXME Generate this somehow settings = { # Not having SSDs die fast is more important than crypto # nerds that could potentially discover which filesystem I diff --git a/hm/common.nix b/hm/common.nix index 35b972d..746ac95 100644 --- a/hm/common.nix +++ b/hm/common.nix @@ -238,7 +238,8 @@ in }; # TODO highlight or bat nix-index = { - enable = true; + enable = false; # TODO Index is impossible to generate, should use https://github.com/nix-community/nix-index-database + # but got no luck without flakes enableZshIntegration = true; }; less.enable = true; @@ -398,8 +399,6 @@ in # terminal essentials moreutils man - # nodePackages.insect # FIXME Don't install on aarch64 - # TODO Use whatever replaces insect unzip unrar p7zip @@ -448,6 +447,9 @@ in # TODO Lots of redundancy with other way things are defined here + ] ++ lib.optionals pkgs.stdenv.isx86_64 [ + nodePackages.insect + # TODO Use whatever replaces insect, hopefully that works on aarch64 ]; sessionVariables = { # Favourite commands diff --git a/hm/desktop.nix b/hm/desktop.nix index 0f0a5c7..f7a5920 100644 --- a/hm/desktop.nix +++ b/hm/desktop.nix @@ -4,7 +4,6 @@ frogeye.shellAliases = { noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise''; beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null''; - # FIXME ALSA lib dlmisc.c:337:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pulse.so (/nix/store/9b06fxbvm07iy9f9dvi5vk2iy9pk8hyz-alsa-lib-1.2.8/lib/alsa-lib/libasound_module_pcm_pulse.so: cannot open shared object file: No such file or directory) # n = "$HOME/.config/i3/terminal & disown"; # Not used anymore since alacritty daemon mode doesn't preserve environment variables x = "startx ${config.xdg.configHome}/xinitrc; logout"; @@ -67,7 +66,7 @@ mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue"; in { - modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM + modifier = "Mod4"; terminal = "alacritty"; bars = [ ]; # Using frobar colors = let ignore = "#ff00ff"; in @@ -86,14 +85,14 @@ mod = config.xsession.windowManager.i3.config.modifier; rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi"; pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS - scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'"; - # TODO nix path and create directory? + screenshots_dir = config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR; + scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ${screenshots_dir}/ && ${pkgs.optipng}/bin/optipng ${screenshots_dir}/$f'"; in { # Compatibility layer for people coming from other backgrounds - # "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM + "Mod1+Tab" = "${rofi} -modi window -show window"; "Mod1+F2" = "${rofi} -modi drun -show drun"; - # "Mod1+F4" = "kill"; # FIXME When no longer using a VM + "Mod1+F4" = "kill"; # kill focused window "${mod}+z" = "kill"; button2 = "kill"; @@ -140,7 +139,7 @@ }"; # Screenshots "Print" = "exec ${scrot} --focused"; - "${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM + "${mod}+Print" = "exec ${scrot}"; "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; # TODO Try using bindsym --release instead of sleep # change focus @@ -282,13 +281,12 @@ "d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default"; } // return_bindings; "${mode_temp}" = { - # "r" = "exec ${pkgs.sct}/bin/sct 1000"; - # "d" = "exec ${pkgs.sct}/bin/sct 2000"; - # "c" = "exec ${pkgs.sct}/bin/sct 4500"; - # "o" = "exec ${pkgs.sct}/bin/sct"; - # "a" = "exec ${pkgs.sct}/bin/sct 8000"; - # "b" = "exec ${pkgs.sct}/bin/sct 10000"; - # FIXME Not on aarch64 + "r" = "exec ${pkgs.sct}/bin/sct 1000"; + "d" = "exec ${pkgs.sct}/bin/sct 2000"; + "c" = "exec ${pkgs.sct}/bin/sct 4500"; + "o" = "exec ${pkgs.sct}/bin/sct"; + "a" = "exec ${pkgs.sct}/bin/sct 8000"; + "b" = "exec ${pkgs.sct}/bin/sct 10000"; } // return_bindings; }; window = { @@ -312,6 +310,7 @@ ]; }; startup = [ + { notification = false; command = "${pkgs.autorandr}/bin/autorandr --change"; } # Lock screen after 10 minutes { notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; } { @@ -330,7 +329,7 @@ focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus} workspaceOutputAssign = let - x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing + x11_screens = config.frogeye.desktop.x11_screens; workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10); forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1)); in @@ -338,7 +337,7 @@ }; }; }; - numlock.enable = true; # FIXME Only on computers with a separate one + numlock.enable = config.frogeye.desktop.numlock; }; programs = { @@ -417,7 +416,14 @@ # Terminal alacritty = { - # FIXME Emojis + # TODO Emojis. Or maybe they work on NixOS? + # Arch (working) shows this with alacritty -vvv: + # [TRACE] [crossfont] Got font path="/usr/share/fonts/twemoji/twemoji.ttf", index=0 + # [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: MONOCHROME | TARGET_MONO | COLOR, render_mode: "Mono", lcd_filter: 1 } + # Nix (not working) shows this: + # [TRACE] [crossfont] Got font path="/nix/store/872g3w9vcr5nh93r0m83a3yzmpvd2qrj-home-manager-path/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf", index=0 + # [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | COLOR, render_mode: "Lcd", lcd_filter: 1 } + enable = true; settings = { bell = { @@ -427,6 +433,11 @@ duration = 100; }; cursor = { vi_mode_style = "Underline"; }; + env = { + WINIT_X11_SCALE_FACTOR = "1"; + # Prevents Alacritty from resizing from one monitor to another. + # Might cause issue on HiDPI screens but we'll get there when we get there + }; hints = { enabled = [ { @@ -681,6 +692,8 @@ ]; sessionVariables = { MPD_PORT = "${toString config.services.mpd.network.port}"; + ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; # Fixes an issue with sox (Cannot open shared library libasound_module_pcm_pulse.so) + # UPST Patch this upstream like: https://github.com/NixOS/nixpkgs/blob/216b111fb87091632d077898df647d1438fc2edb/pkgs/applications/audio/espeak-ng/default.nix#L84 }; }; }; diff --git a/hm/extra.nix b/hm/extra.nix index 4d65521..c716de5 100644 --- a/hm/extra.nix +++ b/hm/extra.nix @@ -42,18 +42,22 @@ gimp inkscape darktable - blender puddletag - musescore audacity # downloading transmission-qt - ] ++ lib.optionals (builtins.currentSystem == "x86_64-linux") [ - # Not sure this works in case of cross-compilation, but couldn't find a - # thing that works in both os and hm context + # wine only makes sense on x86_64 + ] ++ lib.optionals pkgs.stdenv.isx86_64 [ wine # TODO wine-gecko wine-mono lib32-libpulse (?) + + ] ++ lib.optionals (!stdenv.isAarch64) [ + # Musescore is broken on aarch64 + musescore + # Blender 4.0.1 can't compile on aarch64 + # https://hydra.nixos.org/job/nixos/release-23.11/nixpkgs.blender.aarch64-linux + blender ]); }; } diff --git a/hm/frobar/default.nix b/hm/frobar/default.nix index 5bbfa92..b33ea53 100644 --- a/hm/frobar/default.nix +++ b/hm/frobar/default.nix @@ -32,5 +32,4 @@ let }; in frobar_launcher -# FIXME Not using Nerdfont # TODO Connection with i3 is lost sometimes, more often than with Arch? diff --git a/hm/frobar/frobar/display.py b/hm/frobar/frobar/display.py index 3a18af7..d6113c3 100644 --- a/hm/frobar/frobar/display.py +++ b/hm/frobar/frobar/display.py @@ -56,7 +56,7 @@ class Bar: """ # Constants - FONTS = ["DejaVuSansMono Nerd Font Mono"] + FONTS = ["DejaVuSansM Nerd Font"] FONTSIZE = 10 @staticmethod diff --git a/hm/style.nix b/hm/style.nix index ed8362a..50b1792 100644 --- a/hm/style.nix +++ b/hm/style.nix @@ -19,11 +19,6 @@ in # The background is set on some occasions, autorandr + feh do the rest fonts = { - sizes = { - applications = 10; - terminal = 10; - }; - # FIXME Somehow this seems smaller than Arch on the left screen, yet bigger on the right... monospace = { package = pkgs.nerdfonts.override { fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix diff --git a/options.nix b/options.nix index 4b763d5..6e7bf15 100644 --- a/options.nix +++ b/options.nix @@ -5,6 +5,12 @@ gaming = lib.mkEnableOption "Games"; desktop = { xorg = lib.mkEnableOption "Enable X11 support"; + numlock = lib.mkEnableOption "Auto-enable numlock"; + x11_screens = lib.mkOption { + default = ["UNSET1"]; + description = "A list of xrandr screen names from left to right."; + type = lib.types.listOf lib.types.str; + }; nixGLIntel = lib.mkEnableOption "Enable nixGLIntel/nixVulkanIntel for windows manager"; maxVideoHeight = lib.mkOption { type = lib.types.int; diff --git a/os/desktop.nix b/os/desktop.nix index c6a2d16..ab3b08c 100644 --- a/os/desktop.nix +++ b/os/desktop.nix @@ -34,5 +34,18 @@ # Enable sound sound.enable = true; hardware.pulseaudio.enable = true; + + # UPST + # TODO Find a way to override packages either at NixOS level or HM level depending on what is used + nixpkgs.overlays = [ + (final: prev: { + sct = prev.sct.overrideAttrs + (old: { + patches = (old.patches or [ ]) ++ [ + ./sct_aarch64.patch + ]; + }); + }) + ]; }; } diff --git a/os/sct_aarch64.patch b/os/sct_aarch64.patch new file mode 100644 index 0000000..8a04378 --- /dev/null +++ b/os/sct_aarch64.patch @@ -0,0 +1,10 @@ +--- a/Makefile ++++ b/Makefile +@@ -32,6 +32,7 @@ LIBDIR_i386=$(PREFIX)/lib + LIBDIR_i686=$(PREFIX)/lib + LIBDIR_amd64=$(PREFIX)/lib + LIBDIR_x86_64=$(PREFIX)/lib64 ++LIBDIR_aarch64=$(PREFIX)/lib + LIBDIR?=$(LIBDIR_$(MACHINE)) + MANDIR_Darwin=$(PREFIX)/share/man + MANDIR_Linux=$(PREFIX)/share/man diff --git a/pindakaas/options.nix b/pindakaas/options.nix index 7a7ef11..b3b7910 100644 --- a/pindakaas/options.nix +++ b/pindakaas/options.nix @@ -1,6 +1,10 @@ { ... }: { frogeye.extra = true; - frogeye.desktop.xorg = true; + frogeye.desktop = { + xorg = true; + x11_screens = [ "DP-1" "eDP-1" ]; + maxVideoHeight = 720; + }; frogeye.dev.docker = true; } diff --git a/unprocessed/config/automatrop/host_vars/pindakaas.geoffrey.frogeye.fr b/unprocessed/config/automatrop/host_vars/pindakaas.geoffrey.frogeye.fr deleted file mode 100644 index 0b27504..0000000 --- a/unprocessed/config/automatrop/host_vars/pindakaas.geoffrey.frogeye.fr +++ /dev/null @@ -1,16 +0,0 @@ -root_access: yes -display_server: "x11" -dev_stuffs: - - shell - - network - - ansible - - python -has_battery: yes -encrypt_home_stacked_fs: yes -extensions: - - g - - gh -x11_screens: - - DP-1 - - eDP-1 -max_video_height: 720