From 9158edcb475f7cf4d000c7c06d56791e24166c75 Mon Sep 17 00:00:00 2001 From: Amir Saeid Date: Sat, 18 Apr 2026 21:45:44 +0100 Subject: Add i3 config --- flake.nix | 88 +++++++++++++++---------- hosts/gheshki/home.nix | 168 +++++++++++++++++++++++++++++++++++++++++++++--- hosts/mentat/home.nix | 15 +++-- modules/base.nix | 11 ++-- modules/dev-tools.nix | 14 ++-- modules/host-common.nix | 7 +- modules/shell.nix | 13 ++-- modules/term.nix | 11 ++-- 8 files changed, 254 insertions(+), 73 deletions(-) diff --git a/flake.nix b/flake.nix index 68ba540..87af9f8 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,16 @@ }; }; - outputs = { self, nixpkgs, home-manager, unstable, flake-utils, nixgl, ... }: + outputs = + { + self, + nixpkgs, + home-manager, + unstable, + flake-utils, + nixgl, + ... + }: let mkExtraArgs = system: { unstablePkgs = import unstable { @@ -34,48 +43,59 @@ }; }; - mkHostConfig = { hostname, system ? "aarch64-darwin" }: { - pkgs = import nixpkgs { - inherit system; - overlays = [ nixgl.overlay ]; - config = { - allowUnfree = false; - }; - }; - modules = [ ./hosts/${hostname}/home.nix ]; - extraSpecialArgs = (mkExtraArgs system) // { - inherit hostname; - hmLib = home-manager.lib; - }; - }; - in - flake-utils.lib.eachDefaultSystem - (system: - let + mkHostConfig = + { + hostname, + system ? "aarch64-darwin", + }: + { pkgs = import nixpkgs { inherit system; + overlays = [ nixgl.overlay ]; config = { allowUnfree = false; }; }; - in - { - packages = { - default = home-manager.packages.${system}.home-manager; + modules = [ ./hosts/${hostname}/home.nix ]; + extraSpecialArgs = (mkExtraArgs system) // { + inherit hostname; + hmLib = home-manager.lib; }; - - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - #home-manager - home-manager.packages.${system}.home-manager - nixpkgs-fmt - ]; + }; + in + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = false; }; - } - ) // { + }; + in + { + packages = { + default = home-manager.packages.${system}.home-manager; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + #home-manager + home-manager.packages.${system}.home-manager + nixpkgs-fmt + ]; + }; + } + ) + // { homeConfigurations = { - mentat = home-manager.lib.homeManagerConfiguration (mkHostConfig { hostname = "mentat"; }); - gheshki = home-manager.lib.homeManagerConfiguration (mkHostConfig { hostname = "gheshki"; system = "x86_64-linux"; }); + mentat = home-manager.lib.homeManagerConfiguration (mkHostConfig { + hostname = "mentat"; + }); + gheshki = home-manager.lib.homeManagerConfiguration (mkHostConfig { + hostname = "gheshki"; + system = "x86_64-linux"; + }); }; }; } diff --git a/hosts/gheshki/home.nix b/hosts/gheshki/home.nix index e6b45db..090dead 100644 --- a/hosts/gheshki/home.nix +++ b/hosts/gheshki/home.nix @@ -1,12 +1,13 @@ -{ config -, pkgs -, unstablePkgs -, unfreePkgs -, unstableUnfreePkgs -, userOptions -, lib -, nixgl -, ... +{ + config, + pkgs, + unstablePkgs, + unfreePkgs, + unstableUnfreePkgs, + userOptions, + lib, + nixgl, + ... }: { imports = [ @@ -21,6 +22,155 @@ pkgs.nixgl.nixGLIntel ]; + xsession.windowManager.i3 = { + enable = true; + config = { + modifier = "Mod4"; + + fonts = { + names = [ "BlexMono Nerd Font SemiBold" ]; + size = 10.0; + }; + + terminal = "nixGLIntel alacritty"; + + keybindings = + let + mod = "Mod4"; + in + { + "${mod}+Return" = "exec nixGLIntel alacritty"; + "${mod}+o" = "exec ~/Applications/firefox/firefox"; + "${mod}+d" = "exec dmenu_run"; + + "${mod}+b" = "workspace back_and_forth"; + "${mod}+c" = "kill"; + + "${mod}+f" = "fullscreen toggle"; + "${mod}+h" = "split h"; + "${mod}+v" = "split v"; + + "${mod}+Left" = "focus left"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; + "${mod}+Right" = "focus right"; + + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Right" = "move right"; + + "${mod}+Shift+c" = "reload"; + "${mod}+Shift+r" = "restart"; + "${mod}+Shift+e" = + "exec i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"; + + "${mod}+1" = "workspace number 1"; + "${mod}+2" = "workspace number 2"; + "${mod}+3" = "workspace number 3"; + "${mod}+4" = "workspace number 4"; + "${mod}+5" = "workspace number 5"; + "${mod}+6" = "workspace number 6"; + "${mod}+7" = "workspace number 7"; + "${mod}+8" = "workspace number 8"; + "${mod}+9" = "workspace number 9"; + "${mod}+0" = "workspace number 0"; + + "${mod}+Shift+1" = "move container to workspace 1"; + "${mod}+Shift+2" = "move container to workspace 2"; + "${mod}+Shift+3" = "move container to workspace 3"; + "${mod}+Shift+4" = "move container to workspace 4"; + "${mod}+Shift+5" = "move container to workspace 5"; + "${mod}+Shift+6" = "move container to workspace 6"; + "${mod}+Shift+7" = "move container to workspace 7"; + "${mod}+Shift+8" = "move container to workspace 8"; + "${mod}+Shift+9" = "move container to workspace 9"; + "${mod}+Shift+0" = "move container to workspace 0"; + }; + + bars = [ + { + fonts = { + names = [ "BlexMono Nerd Font" ]; + style = "SemiBold"; + size = 10.0; + }; + position = "bottom"; + statusCommand = "i3status"; + } + ]; + + gaps = { + smartGaps = true; + inner = 10; + outer = 5; + }; + + window = { + border = 1; + titlebar = false; + commands = [ + { + criteria = { + window_role = "About"; + }; + command = "floating enable"; + } + ]; + }; + }; + }; + + programs.i3status = { + enable = true; + enableDefault = false; + general = { + colors = true; + interval = 5; + }; + modules = { + "tztime local" = { + position = 6; + settings = { + format = "%Y-%m-%d %H-%M"; + }; + }; + "disk /" = { + position = 5; + settings = { + format = "disk: %free"; + }; + }; + "cpu_usage" = { + position = 4; + settings = { + format = "cpu: %usage"; + }; + }; + "cpu_temperature 0" = { + position = 3; + settings = { + format = "cpu: %degrees°C"; + path = "/sys/class/hwmon/hwmon1/temp1_input"; + }; + }; + "cpu_temperature 1" = { + position = 2; + settings = { + format = "gpu: %degrees°C"; + path = "/sys/class/hwmon/hwmon2/temp1_input"; + }; + }; + "memory" = { + position = 1; + settings = { + format = "mem: %percentage_used"; + }; + }; + }; + }; + programs.alacritty.settings.font.size = lib.mkForce 8; services.gpg-agent.pinentry.package = pkgs.pinentry-curses; + programs.zsh.shellAliases.pbcopy = "xclip -selection clipboard"; } diff --git a/hosts/mentat/home.nix b/hosts/mentat/home.nix index 3351cbe..69789b5 100644 --- a/hosts/mentat/home.nix +++ b/hosts/mentat/home.nix @@ -1,10 +1,11 @@ -{ config -, pkgs -, unstablePkgs -, unfreePkgs -, unstableUnfreePkgs -, userOptions -, ... +{ + config, + pkgs, + unstablePkgs, + unfreePkgs, + unstableUnfreePkgs, + userOptions, + ... }: { imports = [ diff --git a/modules/base.nix b/modules/base.nix index bf5efe9..1ebc61a 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -1,8 +1,9 @@ -{ config -, pkgs -, lib -, userOptions -, ... +{ + config, + pkgs, + lib, + userOptions, + ... }: { home.stateVersion = "25.11"; diff --git a/modules/dev-tools.nix b/modules/dev-tools.nix index 77d0410..b94ad0b 100644 --- a/modules/dev-tools.nix +++ b/modules/dev-tools.nix @@ -1,9 +1,10 @@ -{ config -, pkgs -, unstablePkgs -, unfreePkgs -, unstableUnfreePkgs -, ... +{ + config, + pkgs, + unstablePkgs, + unfreePkgs, + unstableUnfreePkgs, + ... }: { home.packages = with pkgs; [ @@ -15,6 +16,7 @@ delta fd fzf + godot git haskell.compiler.ghc912 haskellPackages.cabal-install diff --git a/modules/host-common.nix b/modules/host-common.nix index 83a51e2..cc95807 100644 --- a/modules/host-common.nix +++ b/modules/host-common.nix @@ -1,4 +1,9 @@ -{ config, lib, hostname, ... }: +{ + config, + lib, + hostname, + ... +}: let userOptions = import ../hosts/${hostname}/userOptions.nix; in diff --git a/modules/shell.nix b/modules/shell.nix index bf3b41a..a5c99f2 100644 --- a/modules/shell.nix +++ b/modules/shell.nix @@ -1,9 +1,10 @@ -{ config -, pkgs -, hmLib -, lib -, userOptions -, ... +{ + config, + pkgs, + hmLib, + lib, + userOptions, + ... }: { home.sessionVariables = { diff --git a/modules/term.nix b/modules/term.nix index 3d455d5..d5979db 100644 --- a/modules/term.nix +++ b/modules/term.nix @@ -1,8 +1,9 @@ -{ config -, pkgs -, lib -, userOptions -, ... +{ + config, + pkgs, + lib, + userOptions, + ... }: { home.packages = with pkgs.nerd-fonts; [ -- cgit v1.2.3