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 = {
desktop.xorg = true;
desktop = {
xorg = true;
x11_screens = [ "HDMI-1-0" "eDP1" ];
maxVideoHeight = 1440;
numlock = true;
};
dev = {
docker = true;
};

View file

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

View file

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

View file

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

View file

@ -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
]);
};
}

View file

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

View file

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

View file

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

View file

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

View file

@ -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
];
});
})
];
};
}

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.desktop.xorg = true;
frogeye.desktop = {
xorg = true;
x11_screens = [ "DP-1" "eDP-1" ];
maxVideoHeight = 720;
};
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