From 047ff192f53c7f8b8b6a0f68458026c48fb31550 Mon Sep 17 00:00:00 2001 From: Pierre Martin Date: Mon, 3 Aug 2026 10:57:45 +0200 Subject: [PATCH] chore: reindent + install pi.dev --- home.nix | 22 ++- nixos/configuration.nix | 48 ++++-- nixos/framework.nix | 8 +- nixos/hardware-configuration.nix | 23 ++- packages.nix | 6 +- pkgs/rtk.nix | 8 +- programs/i3.nix | 266 +++++++++++++++---------------- programs/pi.nix | 15 ++ 8 files changed, 231 insertions(+), 165 deletions(-) create mode 100644 programs/pi.nix diff --git a/home.nix b/home.nix index 6c7d7a3..e63c65b 100644 --- a/home.nix +++ b/home.nix @@ -6,7 +6,8 @@ # Temporary overlays for patches nixpkgs.overlays = [ ]; - home.file.".docker/cli-plugins/docker-buildx".source = "${pkgs.docker-buildx}/libexec/docker/cli-plugins/docker-buildx"; + home.file.".docker/cli-plugins/docker-buildx".source = + "${pkgs.docker-buildx}/libexec/docker/cli-plugins/docker-buildx"; home.file.".config/traefik/traefik.toml".source = ./files/traefik.toml; home.file.".npmrc".source = ./files/.npmrc; @@ -25,6 +26,7 @@ ./programs/git.nix ./programs/i3.nix + ./programs/pi.nix ./programs/zsh.nix ]; @@ -33,17 +35,26 @@ programs.vscode = { enable = true; package = pkgs.vscode.fhs; - profiles = { default = { extensions = [ ]; }; }; + profiles = { + default = { + extensions = [ ]; + }; + }; }; programs.rofi = { enable = true; - plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; + plugins = [ + pkgs.rofi-calc + pkgs.rofi-emoji + ]; terminal = "sakura"; }; programs.autorandr = { enable = true; hooks = { - postswitch = { "notify-i3" = "${pkgs.i3}/bin/i3-msg restart"; }; + postswitch = { + "notify-i3" = "${pkgs.i3}/bin/i3-msg restart"; + }; }; }; @@ -65,8 +76,7 @@ # Tout ajout home-manager génère un drop-in conflictuel (double ExecStart=). 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 diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 52634ab..9f33516 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -59,9 +59,15 @@ variant = "bepo"; }; - windowManager = { i3 = { enable = true; }; }; + windowManager = { + i3 = { + enable = true; + }; + }; + }; + services.displayManager = { + defaultSession = "none+i3"; }; - services.displayManager = { defaultSession = "none+i3"; }; # Configure console keymap console.keyMap = "fr"; @@ -70,8 +76,14 @@ users.users.pierre = { isNormalUser = true; description = "Pierre"; - extraGroups = - [ "networkmanager" "wheel" "audio" "docker" "video" "lpadmin" ]; + extraGroups = [ + "networkmanager" + "wheel" + "audio" + "docker" + "video" + "lpadmin" + ]; shell = pkgs.zsh; packages = with pkgs; [ ]; }; @@ -103,14 +115,16 @@ # 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 hardware.acpilight.enable = true; hardware.i2c.enable = true; programs.nix-ld = { enable = true; - libraries = with pkgs; [ fnm stdenv.cc.cc.lib ]; + libraries = with pkgs; [ + fnm + stdenv.cc.cc.lib + ]; }; # Printing @@ -139,15 +153,12 @@ 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 + services.gvfs.enable = true; # to view MTP devices in file manager - https://www.perplexity.ai/search/how-to-browse-files-from-bus-0-QWBoYG1gRLu3uMRqFSzw9A # Prevent coredump issues with Antigravity - https://www.perplexity.ai/search/systemd-coredump-high-cpu-on-n-LUnRQViaRuiDn1LR06hU8w#2 systemd.coredump = { @@ -186,7 +197,16 @@ keep-outputs = true keep-derivations = true ''; - nix.settings.extra-experimental-features = [ "nix-command" "flakes" ]; + nix.settings.extra-experimental-features = [ + "nix-command" + "flakes" + ]; + + # Cache binaire de https://github.com/lukasl-dev/pi.nix (cf. programs/pi.nix) + nix.settings.extra-substituters = [ "https://pi.cachix.org" ]; + nix.settings.extra-trusted-public-keys = [ + "pi.cachix.org-1:lGeoGJaZ5ZDabuRzkcD5EBTNnDM4HJ1vqeOxlWk1Flk=" + ]; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/nixos/framework.nix b/nixos/framework.nix index f5a985e..6192caf 100644 --- a/nixos/framework.nix +++ b/nixos/framework.nix @@ -5,7 +5,13 @@ # Doc: https://wiki.archlinux.org/title/Framework_Laptop # -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { boot.kernelParams = [ diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix index 53d4076..859d9c9 100644 --- a/nixos/hardware-configuration.nix +++ b/nixos/hardware-configuration.nix @@ -1,13 +1,24 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { 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 = [ ]; @@ -22,8 +33,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/da431bdf-cec4-4928-b44b-e6d2c3419063"; }]; + swapDevices = [ { device = "/dev/disk/by-uuid/da431bdf-cec4-4928-b44b-e6d2c3419063"; } ]; # 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 @@ -33,6 +43,5 @@ # 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; } diff --git a/packages.nix b/packages.nix index 85d9cb9..cead4a4 100644 --- a/packages.nix +++ b/packages.nix @@ -15,10 +15,12 @@ in let crab = pkgs.callPackage ./pkgs/crab.nix { }; rtk = pkgs.callPackage ./pkgs/rtk.nix { }; -in { +in +{ nixpkgs.overlays = [ pythonOverlay ]; - nixpkgs.config.allowUnfreePredicate = pkg: + nixpkgs.config.allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) [ "1password" "1password-cli" diff --git a/pkgs/rtk.nix b/pkgs/rtk.nix index 7accd17..a445252 100644 --- a/pkgs/rtk.nix +++ b/pkgs/rtk.nix @@ -1,4 +1,10 @@ -{ rustPlatform, fetchFromGitHub, pkg-config, sqlite, lib }: +{ + rustPlatform, + fetchFromGitHub, + pkg-config, + sqlite, + lib, +}: rustPlatform.buildRustPackage { pname = "rtk"; version = "0.22.2"; diff --git a/programs/i3.nix b/programs/i3.nix index 1ea1b02..45113ca 100644 --- a/programs/i3.nix +++ b/programs/i3.nix @@ -3,140 +3,138 @@ { home.file.".i3status.conf".source = ../files/.i3status.conf; - 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 + 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. + }; + + modifier = modifier; + + # see https://rycee.gitlab.io/home-manager/options.html#opt-xsession.windowManager.i3.config.keybindings + keybindings = pkgs.lib.mkOptionDefault { + "${modifier}+Return" = "exec ~/.local/bin/workspace-run sakura --working-directory"; + "${modifier}+Shift+Return" = "exec ~/.local/bin/workspace-run code"; + + ### BÉPO ### + "${modifier}+b" = "kill"; + "${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"; + "${modifier}+eacute" = "layout tabbed"; + "${modifier}+p" = "layout toggle split"; + "${modifier}+Shift+t" = "i3lock --colour=000000"; + # switch to workspace + "${modifier}+quotedbl" = "workspace 1"; + "${modifier}+guillemotleft" = "workspace 2"; + "${modifier}+guillemotright" = "workspace 3"; + "${modifier}+parenleft" = "workspace 4"; + "${modifier}+parenright" = "workspace 5"; + "${modifier}+at" = "workspace 6"; + "${modifier}+plus" = "workspace 7"; + "${modifier}+minus" = "workspace 8"; + "${modifier}+slash" = "workspace 9"; + "${modifier}+asterisk" = "workspace 10"; + # move workspaces between outputs + "${modifier}+Control+Left" = "move workspace to output left"; + "${modifier}+Control+Right" = "move workspace to output right"; + "${modifier}+Control+Up" = "move workspace to output up"; + "${modifier}+Control+Down" = "move workspace to output down"; + # move focused container to workspace + "${modifier}+Shift+quotedbl" = "move container to workspace 1"; + "${modifier}+Shift+guillemotleft" = "move container to workspace 2"; + "${modifier}+Shift+guillemotright" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+at" = "move container to workspace 6"; + "${modifier}+Shift+plus" = "move container to workspace 7"; + "${modifier}+Shift+minus" = "move container to workspace 8"; + "${modifier}+Shift+slash" = "move container to workspace 9"; + "${modifier}+Shift+asterisk" = "move container to workspace 10"; + ### /BÉPO ### + + # 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 + + # Media player controls + "XF86AudioPlay" = "exec playerctl play"; + "XF86AudioPause" = "exec playerctl pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + + # Sreen brightness controls + "XF86MonBrightnessUp" = "exec xbacklight -inc 5"; + "XF86MonBrightnessDown" = "exec xbacklight -dec 5"; + + # Speech-to-text (toggle: press to start/stop) + "${modifier}+space" = "exec ~/.local/bin/stt-dictate toggle"; + }; + + bars = [ + { + statusCommand = "i3status"; + } + { + id = "vmux"; + position = "top"; + statusCommand = "/home/pierre/Code/vibe/vmux/vmux i3bar"; + workspaceButtons = false; + trayOutput = "none"; + colors = { + background = "#0d0d0d"; + }; + } + ]; + + 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 = "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; } + + # Désactive l'extinction automatique de l'écran (DPMS) et l'économiseur d'écran X11 + { + command = "xset s off -dpms"; + notification = false; + } + ]; }; - 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. - }; - - modifier = modifier; - - # see https://rycee.gitlab.io/home-manager/options.html#opt-xsession.windowManager.i3.config.keybindings - keybindings = pkgs.lib.mkOptionDefault { - "${modifier}+Return" = "exec ~/.local/bin/workspace-run sakura --working-directory"; - "${modifier}+Shift+Return" = "exec ~/.local/bin/workspace-run code"; - - ### BÉPO ### - "${modifier}+b" = "kill"; - "${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"; - "${modifier}+eacute" = "layout tabbed"; - "${modifier}+p" = "layout toggle split"; - "${modifier}+Shift+t" = "i3lock --colour=000000"; - # switch to workspace - "${modifier}+quotedbl" = "workspace 1"; - "${modifier}+guillemotleft" = "workspace 2"; - "${modifier}+guillemotright" = "workspace 3"; - "${modifier}+parenleft" = "workspace 4"; - "${modifier}+parenright" = "workspace 5"; - "${modifier}+at" = "workspace 6"; - "${modifier}+plus" = "workspace 7"; - "${modifier}+minus" = "workspace 8"; - "${modifier}+slash" = "workspace 9"; - "${modifier}+asterisk" = "workspace 10"; - # move workspaces between outputs - "${modifier}+Control+Left" = "move workspace to output left"; - "${modifier}+Control+Right" = "move workspace to output right"; - "${modifier}+Control+Up" = "move workspace to output up"; - "${modifier}+Control+Down" = "move workspace to output down"; - # move focused container to workspace - "${modifier}+Shift+quotedbl" = "move container to workspace 1"; - "${modifier}+Shift+guillemotleft" = "move container to workspace 2"; - "${modifier}+Shift+guillemotright" = "move container to workspace 3"; - "${modifier}+Shift+4" = "move container to workspace 4"; - "${modifier}+Shift+5" = "move container to workspace 5"; - "${modifier}+Shift+at" = "move container to workspace 6"; - "${modifier}+Shift+plus" = "move container to workspace 7"; - "${modifier}+Shift+minus" = "move container to workspace 8"; - "${modifier}+Shift+slash" = "move container to workspace 9"; - "${modifier}+Shift+asterisk" = "move container to workspace 10"; - ### /BÉPO ### - - # 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 - - # Media player controls - "XF86AudioPlay" = "exec playerctl play"; - "XF86AudioPause" = "exec playerctl pause"; - "XF86AudioNext" = "exec playerctl next"; - "XF86AudioPrev" = "exec playerctl previous"; - - # Sreen brightness controls - "XF86MonBrightnessUp" = "exec xbacklight -inc 5"; - "XF86MonBrightnessDown" = "exec xbacklight -dec 5"; - - # Speech-to-text (toggle: press to start/stop) - "${modifier}+space" = "exec ~/.local/bin/stt-dictate toggle"; - }; - - bars = [ - { - statusCommand = "i3status"; - } - { - id = "vmux"; - position = "top"; - statusCommand = "/home/pierre/Code/vibe/vmux/vmux i3bar"; - workspaceButtons = false; - trayOutput = "none"; - colors = { - background = "#0d0d0d"; - }; - } - ]; - - 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 = "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; } - - # Désactive l'extinction automatique de l'écran (DPMS) et l'économiseur d'écran X11 - { - command = "xset s off -dpms"; - notification = false; - } - ]; }; - }; } diff --git a/programs/pi.nix b/programs/pi.nix new file mode 100644 index 0000000..7939b6f --- /dev/null +++ b/programs/pi.nix @@ -0,0 +1,15 @@ +{ ... }: + +let + # Ces dotfiles ne sont pas un flake (config par channels) : on résout donc + # les sorties du flake pi.nix à la main, en épinglant le rev. + # Mise à jour : remplacer le rev par le dernier de https://github.com/lukasl-dev/pi.nix + pi = builtins.getFlake "github:lukasl-dev/pi.nix/1d37b58675b763ae6c9dc05d62321109066a4126"; +in +{ + imports = [ pi.homeModules.default ]; + + programs.pi.coding-agent = { + enable = true; + }; +}