nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
13 changed files with 86 additions and 51 deletions
Showing only changes of commit f12ff6a989 - Show all commits

View file

@ -1,7 +1,12 @@
{ ... }: { ... }:
{ {
frogeye = { frogeye = {
desktop.xorg = true; desktop = {
xorg = true;
x11_screens = [ "HDMI-1-0" "eDP1" ];
maxVideoHeight = 1440;
numlock = true;
};
dev = { dev = {
docker = true; docker = true;
}; };

View file

@ -26,7 +26,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "${name}"; name = "${name}";
passwordFile = "/tmp/secret.key"; # TODO Generate this somehow passwordFile = "/tmp/secret.key"; # FIXME Generate this somehow
settings = { settings = {
# Not having SSDs die fast is more important than crypto # Not having SSDs die fast is more important than crypto
# nerds that could potentially discover which filesystem I # nerds that could potentially discover which filesystem I

View file

@ -238,7 +238,8 @@ in
}; };
# TODO highlight or bat # TODO highlight or bat
nix-index = { 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; enableZshIntegration = true;
}; };
less.enable = true; less.enable = true;
@ -398,8 +399,6 @@ in
# terminal essentials # terminal essentials
moreutils moreutils
man man
# nodePackages.insect # FIXME Don't install on aarch64
# TODO Use whatever replaces insect
unzip unzip
unrar unrar
p7zip p7zip
@ -448,6 +447,9 @@ in
# TODO Lots of redundancy with other way things are defined here # 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 = { sessionVariables = {
# Favourite commands # Favourite commands

View file

@ -4,7 +4,6 @@
frogeye.shellAliases = { frogeye.shellAliases = {
noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise''; 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''; 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 # 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"; 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"; mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
in in
{ {
modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM modifier = "Mod4";
terminal = "alacritty"; terminal = "alacritty";
bars = [ ]; # Using frobar bars = [ ]; # Using frobar
colors = let ignore = "#ff00ff"; in colors = let ignore = "#ff00ff"; in
@ -86,14 +85,14 @@
mod = config.xsession.windowManager.i3.config.modifier; mod = config.xsession.windowManager.i3.config.modifier;
rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi"; rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS 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'"; screenshots_dir = config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR;
# TODO nix path and create directory? scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ${screenshots_dir}/ && ${pkgs.optipng}/bin/optipng ${screenshots_dir}/$f'";
in in
{ {
# Compatibility layer for people coming from other backgrounds # 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+F2" = "${rofi} -modi drun -show drun";
# "Mod1+F4" = "kill"; # FIXME When no longer using a VM "Mod1+F4" = "kill";
# kill focused window # kill focused window
"${mod}+z" = "kill"; "${mod}+z" = "kill";
button2 = "kill"; button2 = "kill";
@ -140,7 +139,7 @@
}"; }";
# Screenshots # Screenshots
"Print" = "exec ${scrot} --focused"; "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"; "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select";
# TODO Try using bindsym --release instead of sleep # TODO Try using bindsym --release instead of sleep
# change focus # change focus
@ -282,13 +281,12 @@
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default"; "d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
} // return_bindings; } // return_bindings;
"${mode_temp}" = { "${mode_temp}" = {
# "r" = "exec ${pkgs.sct}/bin/sct 1000"; "r" = "exec ${pkgs.sct}/bin/sct 1000";
# "d" = "exec ${pkgs.sct}/bin/sct 2000"; "d" = "exec ${pkgs.sct}/bin/sct 2000";
# "c" = "exec ${pkgs.sct}/bin/sct 4500"; "c" = "exec ${pkgs.sct}/bin/sct 4500";
# "o" = "exec ${pkgs.sct}/bin/sct"; "o" = "exec ${pkgs.sct}/bin/sct";
# "a" = "exec ${pkgs.sct}/bin/sct 8000"; "a" = "exec ${pkgs.sct}/bin/sct 8000";
# "b" = "exec ${pkgs.sct}/bin/sct 10000"; "b" = "exec ${pkgs.sct}/bin/sct 10000";
# FIXME Not on aarch64
} // return_bindings; } // return_bindings;
}; };
window = { window = {
@ -312,6 +310,7 @@
]; ];
}; };
startup = [ startup = [
{ notification = false; command = "${pkgs.autorandr}/bin/autorandr --change"; }
# Lock screen after 10 minutes # 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}"; } { 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} focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
workspaceOutputAssign = workspaceOutputAssign =
let 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); 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)); forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1));
in in
@ -338,7 +337,7 @@
}; };
}; };
}; };
numlock.enable = true; # FIXME Only on computers with a separate one numlock.enable = config.frogeye.desktop.numlock;
}; };
programs = { programs = {
@ -417,7 +416,14 @@
# Terminal # Terminal
alacritty = { 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; enable = true;
settings = { settings = {
bell = { bell = {
@ -427,6 +433,11 @@
duration = 100; duration = 100;
}; };
cursor = { vi_mode_style = "Underline"; }; 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 = { hints = {
enabled = [ enabled = [
{ {
@ -681,6 +692,8 @@
]; ];
sessionVariables = { sessionVariables = {
MPD_PORT = "${toString config.services.mpd.network.port}"; 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
}; };
}; };
}; };

View file

@ -42,18 +42,22 @@
gimp gimp
inkscape inkscape
darktable darktable
blender
puddletag puddletag
musescore
audacity audacity
# downloading # downloading
transmission-qt transmission-qt
] ++ lib.optionals (builtins.currentSystem == "x86_64-linux") [ # wine only makes sense on x86_64
# Not sure this works in case of cross-compilation, but couldn't find a ] ++ lib.optionals pkgs.stdenv.isx86_64 [
# thing that works in both os and hm context
wine wine
# TODO wine-gecko wine-mono lib32-libpulse (?) # 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
]); ]);
}; };
} }

View file

@ -32,5 +32,4 @@ let
}; };
in in
frobar_launcher frobar_launcher
# FIXME Not using Nerdfont
# TODO Connection with i3 is lost sometimes, more often than with Arch? # TODO Connection with i3 is lost sometimes, more often than with Arch?

View file

@ -56,7 +56,7 @@ class Bar:
""" """
# Constants # Constants
FONTS = ["DejaVuSansMono Nerd Font Mono"] FONTS = ["DejaVuSansM Nerd Font"]
FONTSIZE = 10 FONTSIZE = 10
@staticmethod @staticmethod

View file

@ -19,11 +19,6 @@ in
# The background is set on some occasions, autorandr + feh do the rest # The background is set on some occasions, autorandr + feh do the rest
fonts = { fonts = {
sizes = {
applications = 10;
terminal = 10;
};
# FIXME Somehow this seems smaller than Arch on the left screen, yet bigger on the right...
monospace = { monospace = {
package = pkgs.nerdfonts.override { package = pkgs.nerdfonts.override {
fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix

View file

@ -5,6 +5,12 @@
gaming = lib.mkEnableOption "Games"; gaming = lib.mkEnableOption "Games";
desktop = { desktop = {
xorg = lib.mkEnableOption "Enable X11 support"; 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"; nixGLIntel = lib.mkEnableOption "Enable nixGLIntel/nixVulkanIntel for windows manager";
maxVideoHeight = lib.mkOption { maxVideoHeight = lib.mkOption {
type = lib.types.int; type = lib.types.int;

View file

@ -34,5 +34,18 @@
# Enable sound # Enable sound
sound.enable = true; sound.enable = true;
hardware.pulseaudio.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
];
});
})
];
}; };
} }

10
os/sct_aarch64.patch Normal file
View file

@ -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

View file

@ -1,6 +1,10 @@
{ ... }: { ... }:
{ {
frogeye.extra = true; frogeye.extra = true;
frogeye.desktop.xorg = true; frogeye.desktop = {
xorg = true;
x11_screens = [ "DP-1" "eDP-1" ];
maxVideoHeight = 720;
};
frogeye.dev.docker = true; frogeye.dev.docker = true;
} }

View file

@ -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