misc: formatting + updates that weren't commited properly before

This commit is contained in:
Pierre Martin
2025-11-27 17:16:07 +01:00
parent 2dc7c688ed
commit 1da4bf6163
12 changed files with 400 additions and 295 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# Secrets
files/.aider.conf.yml
*.conf
# Nix
.direnv/
result

27
Makefile Normal file
View File

@@ -0,0 +1,27 @@
.PHONY: all fmt fmt-nix fmt-shell lint lint-shell check clean
all: fmt lint
# Formatage
fmt: fmt-nix fmt-shell
fmt-nix:
find . -name '*.nix' -not -path './.direnv/*' | xargs nixfmt
fmt-shell:
find . -name '*.sh' -not -path './.direnv/*' | xargs shfmt -w -i 2
# Validation
lint: lint-shell
lint-shell:
find . -name '*.sh' -not -path './.direnv/*' | xargs shellcheck
# Vérification sans modification
check:
find . -name '*.nix' -not -path './.direnv/*' | xargs nixfmt --check
find . -name '*.sh' -not -path './.direnv/*' | xargs shfmt -d -i 2
# Nettoyage
clean:
rm -rf .direnv result

9
files/curl-timings.txt Normal file
View File

@@ -0,0 +1,9 @@
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
Legend: https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2EfInkqn7sNtWkWFdxPDk4/2f3e1c0202ed6025bbe12f6f540c1b4a/Screen-Shot-2018-10-16-at-14.51.29-1.png

View File

@@ -50,7 +50,7 @@ start_recording() {
download_model
# Enregistre avec arecord (format compatible whisper.cpp)
arecord -f S16_LE -r 16000 -c 1 -t wav "$AUDIO_FILE" &
echo $! > "$RECORDING_PID"
echo $! >"$RECORDING_PID"
notify "Enregistrement..." 1000
}
@@ -76,10 +76,10 @@ stop_and_transcribe() {
-l fr \
-nt \
-np \
"$AUDIO_FILE" 2>&1 \
| grep -v "^load_backend:" \
| tr -d '\n' \
| sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
"$AUDIO_FILE" 2>&1 |
grep -v "^load_backend:" |
tr -d '\n' |
sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
rm -f "$AUDIO_FILE"
@@ -95,16 +95,16 @@ stop_and_transcribe() {
}
case "${1:-toggle}" in
start) start_recording ;;
stop) stop_and_transcribe ;;
toggle)
start) start_recording ;;
stop) stop_and_transcribe ;;
toggle)
if [[ -f "$RECORDING_PID" ]]; then
stop_and_transcribe
else
start_recording
fi
;;
*)
*)
echo "Usage: $0 {start|stop|toggle}"
exit 1
;;

View File

@@ -8,13 +8,13 @@
home.file.".config/traefik/traefik.toml".source = ./files/traefik.toml;
home.file.".npmrc".source = ./files/.npmrc;
home.file.".aider.conf.yml".source = ./files/.aider.conf.yml;
home.file.".local/bin/stt-dictate" = {
source = ./files/stt-dictate.sh;
executable = true;
};
imports =
[
imports = [
./packages.nix
./programs/git.nix
@@ -27,7 +27,7 @@
programs.vscode = {
enable = true;
package = pkgs.vscode.fhs;
extensions = [ ];
profiles = { default = { extensions = [ ]; }; };
};
programs.rofi = {
enable = true;
@@ -37,23 +37,35 @@
programs.autorandr = {
enable = true;
hooks = {
postswitch = {
"notify-i3" = "${pkgs.i3}/bin/i3-msg restart";
};
postswitch = { "notify-i3" = "${pkgs.i3}/bin/i3-msg restart"; };
};
};
# https://github.com/nix-community/nix-direnv/
programs.direnv =
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [ obs-backgroundremoval ];
};
services.unclutter.enable = true;
services.blueman-applet.enable = true;
services.dunst.enable = true; # notification daemon
services.udiskie.enable = true; # require "services.udisks2.enable = true" in system configuration
services.udiskie.enable =
true; # require "services.udisks2.enable = true" in system configuration
# Workaround for Failed to restart syncthingtray.service: Unit tray.target not found.
# - https://github.com/nix-community/home-manager/issues/2064
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
};
}

View File

@@ -5,8 +5,7 @@
{ config, pkgs, ... }:
{
imports =
[
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./framework.nix
@@ -30,25 +29,24 @@
# Enable networking
networking.networkmanager.enable = true;
networking.extraHosts = "
";
networking.extraHosts = "";
# Set your time zone.
time.timeZone = "Europe/Paris";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.utf8";
LC_IDENTIFICATION = "fr_FR.utf8";
LC_MEASUREMENT = "fr_FR.utf8";
LC_MONETARY = "fr_FR.utf8";
LC_NAME = "fr_FR.utf8";
LC_NUMERIC = "fr_FR.utf8";
LC_PAPER = "fr_FR.utf8";
LC_TELEPHONE = "fr_FR.utf8";
LC_TIME = "fr_FR.utf8";
LC_ADDRESS = "fr_FR.UTF-8";
LC_IDENTIFICATION = "fr_FR.UTF-8";
LC_MEASUREMENT = "fr_FR.UTF-8";
LC_MONETARY = "fr_FR.UTF-8";
LC_NAME = "fr_FR.UTF-8";
LC_NUMERIC = "fr_FR.UTF-8";
LC_PAPER = "fr_FR.UTF-8";
LC_TELEPHONE = "fr_FR.UTF-8";
LC_TIME = "fr_FR.UTF-8";
};
# Configure keymap in X11
@@ -59,15 +57,9 @@
variant = "bepo";
};
windowManager = {
i3 = {
enable = true;
};
};
};
services.displayManager = {
defaultSession = "none+i3";
windowManager = { i3 = { enable = true; }; };
};
services.displayManager = { defaultSession = "none+i3"; };
# Configure console keymap
console.keyMap = "fr";
@@ -89,7 +81,7 @@
# Basics
docker
gitAndTools.gitFull
gitFull
vim
# Sound
@@ -108,25 +100,36 @@
# enable = true;
# enableSSHSupport = true;
# };
programs.zsh.enable = true; # see https://github.com/NixOS/nixpkgs/issues/20548#issuecomment-261965667
programs.zsh.enable =
true; # see https://github.com/NixOS/nixpkgs/issues/20548#issuecomment-261965667
programs.light.enable = true;
programs.nix-ld = {
enable = true;
libraries = with pkgs; [ fnm stdenv.cc.cc.lib ];
};
# List services that you want to enable:
services.nscd.enable = true;
services.tlp.enable = true;
services.upower.enable = true; # keyboard backlight
services.gnome.at-spi2-core.enable = true; # see https://github.com/NixOS/nixpkgs/pull/49636/files
services.gnome.gnome-keyring.enable = true; # see https://nixos.wiki/wiki/Visual_Studio_Code#Error_after_Sign_On
services.gnome.at-spi2-core.enable =
true; # see https://github.com/NixOS/nixpkgs/pull/49636/files
services.gnome.gnome-keyring.enable =
true; # see https://nixos.wiki/wiki/Visual_Studio_Code#Error_after_Sign_On
services.blueman.enable = true;
services.udisks2.enable = true;
services.resolved.enable = true;
services.gvfs.enable =
true; # to view MTP devices in file manager - https://www.perplexity.ai/search/how-to-browse-files-from-bus-0-QWBoYG1gRLu3uMRqFSzw9A
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Ports: 9003 - Xdebug
networking.firewall.allowedTCPPorts = [ 9003 ];
networking.firewall.allowedUDPPorts = [ 9003 ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# https://github.com/nix-community/nix-direnv/
@@ -134,6 +137,7 @@
keep-outputs = true
keep-derivations = true
'';
nix.settings.extra-experimental-features = [ "nix-command" "flakes" ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions

View File

@@ -1,4 +1,3 @@
#
# NixOS Configuration for Framework Laptop
# Source: https://gist.github.com/digitalknk/ee0379c1cd4597463c31a323ea5882a5
# Alt: https://github.com/NixOS/nixos-hardware/blob/master/framework/default.nix
@@ -17,8 +16,7 @@
"layout=bls" # Read $KERNEL_INSTALL_LAYOUT from /etc/machine-info. Please move it to the layout= setting of /etc/kernel/install.conf.
];
# Use latest kernel version because on 5.15 screen is not detected properly (and external monitor doesn't work either)
boot.kernelPackages = pkgs.linuxPackages_6_1; # see https://github.com/NixOS/nixpkgs/issues/183955#issuecomment-1210468614
boot.kernelPackages = pkgs.linuxPackages_latest;
# prevent "/boot/efi No space left on device" errors - see https://github.com/NixOS/nixpkgs/issues/23926
boot.loader.grub.configurationLimit = 10;
@@ -47,12 +45,11 @@
# Display things like a boss
## Make it work
hardware.opengl.enable = true;
hardware.opengl.extraPackages = with pkgs; [
mesa.drivers # was mesa_drivers before 27th september 2022
vaapiIntel
vaapiVdpau
libvdpau-va-gl
hardware.graphics.enable = true;
hardware.graphics.extraPackages = with pkgs; [
mesa
intel-vaapi-driver # used to be vaapiIntel
libva-vdpau-driver # used to be vaapiVdpau
intel-media-driver
];
## Make it nice (https://nixos.wiki/wiki/Xorg && https://wiki.archlinux.org/title/Framework_Laptop#HiDPI_settings)
@@ -64,9 +61,9 @@
services.xserver.dpi = 130;
environment.variables = {
GDK_SCALE = "1.5";
GDK_SCALE = "1.3";
GDK_DPI_SCALE = "0.77"; # 1/1.3
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=1.5";
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=1.3";
};
# Bring in some audio

View File

@@ -4,24 +4,20 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/db660732-f520-4e68-9141-b0899f221e82";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{
fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/D7D6-B4C6";
fsType = "vfat";
};
@@ -37,5 +33,6 @@
# networking.interfaces.wlp166s0.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,7 +1,11 @@
{ pkgs, lib, ... }:
{
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
let
atomicptr = import (fetchTarball
"https://github.com/atomicptr/nix/archive/refs/heads/master.tar.gz") { };
in {
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"1password"
"1password-cli"
@@ -10,12 +14,10 @@
"vscode"
"code"
"vivaldi"
"google-chrome"
"slack"
"spotify"
"spotify-unwrapped"
"zoom"
"ticktick"
];
@@ -24,7 +26,7 @@
wget
curl
httpie
hurl
hurl # TODO 2025-08-28 Compilation error: error: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
bind
gcc
openssl.dev
@@ -34,11 +36,14 @@
hey
ngrok
openssl
atomicptr.crab
pulseaudioFull
pavucontrol
bluez # was bluezFull before 27th september 2022
solaar # bluetooth unifying devices and receiver
# see https://discourse.nixos.org/t/error-nose-1-3-7-not-supported-for-interpreter-python3-12/48703
# solaar # bluetooth unifying devices and receiver
sakura
fasd
@@ -62,12 +67,12 @@
xsel
trippy
monolith # save a web page as a single file
killport
atool
unzip
zip
pass
_1password-cli
_1password-gui
yubico-pam
@@ -85,35 +90,32 @@
gh
meld
difftastic
glab
firefox
vivaldi
google-chrome
epiphany
offpunk
lagrange
thunderbird
slack
mattermost-desktop
signal-desktop
tdesktop
zoom-us
libreoffice
freemind
filezilla
vokoscreen-ng
ffmpeg
flameshot
ksnip
gimp
copyq
wireshark
gcalcli
zed-editor
kdePackages.kcachegrind
spotify
spotdl
# spotdl see https://discourse.nixos.org/t/error-nose-1-3-7-not-supported-for-interpreter-python3-12/48703
vlc
audacity
obs-studio
shotcut
jetbrains-mono
vscode.fhs
@@ -122,13 +124,14 @@
playerctl
numlockx
nixpkgs-fmt
nodejs_20
nixfmt-classic
nodejs_22
fnm
bun
cypress
docker
docker-compose
kube3d
k3d
kubectl
kubernetes-helm
stern
@@ -136,16 +139,23 @@
krew
php
php83Packages.composer
python3
pipx # for global python packages (aider-chat, fabric, etc.)
conda
php84Packages.composer
mariadb
adminer
python312
python312Packages.pip
python312Packages.uv
# pipx # for global python packages (aider-chat, fabric, etc.)
twine
# uv
# conda
mkcert
goaccess
grafana-loki # logcli
checkbashisms
shellcheck
shfmt
toilet
# AI
@@ -158,9 +168,18 @@
# Perso
nextcloud-client
rclone
ventoy-full
# calibre
gparted
ticktick
agate
beancount
## TODO: fix fava
# Checking runtime dependencies for fava-1.29-py3-none-any.whl
# copying path '/nix/store/yxd2da4vc9gi5jbs1nlvwpsmwj308bp1-kdoctools-6.10.0' from 'https://cache.nixos.org'...
# - beancount<3,>=2.3.5 not satisfied by version 3.0.0
# copying path '/nix/store/a8n27li3n2fy8jfdm99v9j3yn6w3yk5y-kguiaddons-6.10.0' from 'https://cache.nixos.org'...
# error: builder for '/nix/store/2xd25ssas4yliykz4y4n8p6h762wcalm-fava-1.29.drv' failed with exit code 1
# fava
];
}

View File

@@ -4,17 +4,7 @@
programs.gitui.enable = true;
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
# TODO: https://www.imagile.fr/utiliser-automatiquement-plusieurs-identites-sur-git/
userEmail = "pierre@front-commerce.com";
userName = "Pierre Martin";
aliases = {
co = "checkout";
pushf = "push --force-with-lease --force-if-includes";
aimr = "log --pretty=format:'%s%n%b---'";
};
package = pkgs.gitFull;
ignores = [
".DS_Store"
@@ -28,11 +18,29 @@
"shell.nix"
".envrc"
".direnv"
".ddev"
".claude"
"CLAUDE.local.md"
];
# see https://github.com/dandavison/delta#get-started
delta.enable = true;
extraConfig = {
#delta.enable = true;
# TEMPORARY DEACTIVATED due to the error
# error[E0282]: type annotations needed for `Box<_>`
# --> /build/delta-0.17.0-vendor.tar.gz/time/src/format_description/parse/mod.rs:83:9
settings = {
alias = {
co = "checkout";
pushf = "push --force-with-lease --force-if-includes";
aimr = "log --pretty=format:'%s%n%b---'";
};
user = {
email = "pierre@front-commerce.com";
name = "Pierre Martin";
};
merge.conflictstyle = "diff3";
diff.colorMoved = "default";

View File

@@ -3,29 +3,28 @@
{
home.file.".i3status.conf".source = ../files/.i3status.conf;
xsession.windowManager.i3 =
let
modifier = "Mod4";
in
{
xsession.windowManager.i3 = let modifier = "Mod4";
in {
enable = true;
config = {
assigns = {
# https://rycee.gitlab.io/home-manager/options.html#opt-xsession.windowManager.i3.config.assigns
};
focus = {
mouseWarping = false; # Whether mouse cursor should be warped to the center of the window when switching focus to a window on a different output.
mouseWarping =
false; # Whether mouse cursor should be warped to the center of the window when switching focus to a window on a different output.
};
modifier = modifier;
# see https://rycee.gitlab.io/home-manager/options.html#opt-xsession.windowManager.i3.config.keybindings
keybindings = pkgs.lib.mkOptionDefault {
"${modifier}+Return" = "exec sakura"; #i3-sensible-terminal
"${modifier}+Return" = "exec sakura"; # i3-sensible-terminal
### BÉPO ###
"${modifier}+b" = "kill";
"${modifier}+d" = "exec rofi -combi-modi 'window#run#ssh#emoji#calc' -modi 'calc#combi' -show combi";
"${modifier}+d" =
"exec rofi -combi-modi 'window#run#ssh#emoji#calc' -modi 'calc#combi' -show combi";
"${modifier}+e" = "fullscreen toggle";
# change container layout (stacked, tabbed, toggle split)
"${modifier}+u" = "layout stacking";
@@ -63,9 +62,12 @@
# See https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html
# Pulse Audio controls
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +5%"; #increase sound volume
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -5%"; #decrease sound volume
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound
"XF86AudioRaiseVolume" =
"exec --no-startup-id pactl set-sink-volume 0 +5%"; # increase sound volume
"XF86AudioLowerVolume" =
"exec --no-startup-id pactl set-sink-volume 0 -5%"; # decrease sound volume
"XF86AudioMute" =
"exec --no-startup-id pactl set-sink-mute 0 toggle"; # mute sound
# Media player controls
"XF86AudioPlay" = "exec playerctl play";
@@ -75,20 +77,40 @@
# Sreen brightness controls
"XF86MonBrightnessUp" = "exec light -A 2"; # increase screen brightness
"XF86MonBrightnessDown" = "exec light -U 2"; # decrease screen brightness
"XF86MonBrightnessDown" =
"exec light -U 2"; # decrease screen brightness
# Speech-to-text (toggle: press to start/stop)
"${modifier}+space" = "exec ~/.local/bin/stt-dictate toggle";
};
startup = [
{ command = "nextcloud"; notification = false; }
{ command = "setxkbmap -layout fr -variant bepo"; notification = false; }
{ command = "copyq"; notification = false; }
{ command = "numlockx on"; notification = false; } # turn verr num on
{
command = "nextcloud";
notification = false;
}
{
command = "setxkbmap -layout fr -variant bepo";
notification = false;
}
{
command = "copyq";
notification = false;
}
{
command = "numlockx on";
notification = false;
} # turn verr num on
{ command = "autorandr -c"; notification = false; }
{ command = "feh --bg-scale /home/pierre/Documents/Graphisme/fc-bg-light-black.png"; notification = false; }
{
command = "autorandr -c";
notification = false;
}
{
command =
"feh --bg-scale /home/pierre/Documents/Graphisme/fc-bg-light-black.png";
notification = false;
}
# docker run -d --net traefik --ip 172.10.0.10 --restart always -v /var/run/docker.sock:/var/run/docker.sock:ro --name traefik -p 80:80 -p 8080:8080 traefik:2.4.9 --api.insecure=true --providers.docker
# { command = "docker start traefik"; notification = false; }

View File

@@ -1,16 +1,15 @@
{ pkgs, ... }:
{
# see https://starship.rs/fr-fr/installing/#declaration-utilisateur-unique-via-home-manager
programs.starship =
{
programs.starship = {
enable = true;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
autosuggestion = {
enable = true;
};
autosuggestion = { enable = true; };
enableCompletion = true;
history = {
ignoreDups = true;
@@ -37,9 +36,9 @@
# `$` must be escaped with `''` :metal:
# source: https://nixos.org/nix-dev/2015-December/019018.html
initExtra = ''
initContent = ''
bindkey ' ' forward-word
zstyle ':completion:*:hosts' hosts ''${=''${''${''${''${(@M)''${(f)"''$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
zstyle ':completion:*:hosts' hosts ''${=''${''${''${''${(@M)''${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
setopt PROMPT_CR
setopt PROMPT_SP
@@ -77,6 +76,9 @@
source <(k3d completion zsh)
source <(kubectl completion zsh)
source <(k9s completion zsh); compdef _k9s k9s
# https://github.com/Schniz/fnm#shell-setup
eval "$(fnm env --use-on-cd --shell zsh)"
'';
sessionVariables = {
@@ -88,6 +90,7 @@
# see https://github.com/NixOS/nixpkgs/pull/56387 and https://discourse.nixos.org/t/cypress-with-npm/15137/4
CYPRESS_INSTALL_BINARY = 0;
CYPRESS_RUN_BINARY = "$HOME/.nix-profile/bin/Cypress";
LD_LIBRARY_PATH = "${pkgs.libgcc}/lib";
};
shellAliases = {