home: basic i3 setup

This commit is contained in:
Antoine Martin 2021-04-19 14:29:38 +02:00
parent 5c86bdd16a
commit 73e1ff6c0f
5 changed files with 100 additions and 0 deletions

View file

@ -1,5 +1,9 @@
{ ... }: { ... }:
{ {
imports = [
./x
];
home.stateVersion = "20.09"; home.stateVersion = "20.09";
home.username = "alarsyo"; home.username = "alarsyo";

10
home/x/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
imports = [
./i3.nix
];
options.my.home.x = with lib; {
enable = mkEnableOption "X server configuration";
};
}

77
home/x/i3.nix Normal file
View file

@ -0,0 +1,77 @@
{ config, lib, pkgs, ... }:
let
isEnabled = config.my.home.x.enable;
myTerminal =
# FIXME: fix when terminal is setup in home
# if config.my.home.terminal.program != null
if true
then "alacritty"
else "i3-sensible-terminal";
alt = "Mod1"; # `Alt` key
modifier = "Mod4"; # `Super` key
logoutMode = "[L]ogout, [S]uspend, [P]oweroff, [R]eboot";
in
{
config = lib.mkIf isEnabled {
# FIXME: enable flameshot when added
# my.home = {};
xsession.windowManager.i3 = {
enable = true;
config = {
inherit modifier;
bars =
[
{
statusCommand = "i3status";
position = "top";
}
];
focus = {
followMouse = true;
mouseWarping = true;
};
fonts = [
"DejaVu Sans Mono 8"
];
keybindings = lib.mkOptionDefault {
"${modifier}+Shift+e" = ''mode "${logoutMode}"'';
};
modes =
let
makeModeBindings = attrs: attrs // {
"Escape" = "mode default";
"Return" = "mode default";
};
in
{
"${logoutMode}" = makeModeBindings {
"l" = "exec --no-startup-id i3-msg exit, mode default";
"s" = "exec --no-startup-id systemctl suspend, mode default";
"p" = "exec --no-startup-id systemctl poweroff, mode default";
"r" = "exec --no-startup-id systemctl reboot, mode default";
};
};
startup = [
# FIXME: make it conditional on "nvidia" being part of video drivers
{
command = "nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'";
notification = false;
}
];
terminal = myTerminal;
};
};
};
}

View file

@ -10,6 +10,8 @@ in
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./home.nix
]; ];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.

7
hosts/boreal/home.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }:
{
home-manager.users.alarsyo = {
# Keyboard settings & i3 settings
my.home.x.enable = true;
};
}