format all code with alejandra

This commit is contained in:
Antoine Martin 2022-04-10 11:54:58 +02:00
parent fa0cda2673
commit 4f0d45e4d5
89 changed files with 1605 additions and 1298 deletions

View file

@ -1,15 +1,19 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.alacritty;
alacrittyTheme = config.my.theme.alacrittyTheme;
in
{
options.my.home.alacritty.enable = (mkEnableOption "Alacritty terminal") // { default = config.my.home.x.enable; };
in {
options.my.home.alacritty.enable = (mkEnableOption "Alacritty terminal") // {default = config.my.home.x.enable;};
config = mkIf cfg.enable {
programs.alacritty = {
@ -39,7 +43,7 @@ in
};
};
home.packages = [ pkgs.iosevka-bin ];
home.packages = [pkgs.iosevka-bin];
# make sure font is discoverable
fonts.fontconfig.enable = true;

View file

@ -1,16 +1,19 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.bat;
batTheme = config.my.theme.batTheme;
in
{
in {
options.my.home.bat = {
enable = (mkEnableOption "bat code display tool") // { default = true; };
enable = (mkEnableOption "bat code display tool") // {default = true;};
};
config = mkIf cfg.enable {

View file

@ -1,5 +1,4 @@
{ ... }:
{
{...}: {
imports = [
./alacritty.nix
./bat.nix

View file

@ -1,30 +1,35 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
in
{
;
in {
options.my.home.emacs = {
enable = mkEnableOption "Emacs daemon configuration";
};
config = mkIf config.my.home.emacs.enable {
home.sessionPath = [ "${config.xdg.configHome}/emacs/bin" ];
home.sessionPath = ["${config.xdg.configHome}/emacs/bin"];
home.sessionVariables = {
EDITOR = "emacsclient -t";
};
home.packages = builtins.attrValues {
inherit (pkgs)
inherit
(pkgs)
sqlite # needed by org-roam
# fonts used by my config
emacs-all-the-icons-fonts
iosevka-bin
;
;
};
# make sure above fonts are discoverable
fonts.fontconfig.enable = true;

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
{config, ...}: {
home.sessionPath = [
"${config.home.homeDirectory}/.cargo/bin"
"${config.home.homeDirectory}/.local/bin"

View file

@ -1,15 +1,19 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.firefox;
in
{
in {
options.my.home.firefox = {
enable = (mkEnableOption "firefox config") // { default = config.my.home.x.enable; };
enable = (mkEnableOption "firefox config") // {default = config.my.home.x.enable;};
};
config = mkIf cfg.enable {

View file

@ -1,14 +1,17 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.fish;
in
{
options.my.home.fish.enable = (mkEnableOption "Fish shell") // { default = true; };
in {
options.my.home.fish.enable = (mkEnableOption "Fish shell") // {default = true;};
config = mkIf cfg.enable {
home.sessionVariables = {
@ -21,6 +24,6 @@ in
enable = true;
};
xdg.configFile."fish/functions" = { source = ./. + "/functions"; };
xdg.configFile."fish/functions" = {source = ./. + "/functions";};
};
}

View file

@ -1,13 +1,16 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.flameshot;
in
{
in {
options.my.home.flameshot = {
enable = mkEnableOption "flameshot autolaunch";
};

View file

@ -1,14 +1,18 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.git;
in
{
options.my.home.git.enable = (mkEnableOption "Git configuration") // { default = true; };
in {
options.my.home.git.enable = (mkEnableOption "Git configuration") // {default = true;};
config = mkIf cfg.enable {
programs.git = {
@ -26,11 +30,11 @@ in
userName = "Antoine Martin";
extraConfig = {
commit = { verbose = true; };
core = { editor = "vim"; };
init = { defaultBranch = "main"; };
pull = { rebase = true; };
rerere = { enabled = true; };
commit = {verbose = true;};
core = {editor = "vim";};
init = {defaultBranch = "main";};
pull = {rebase = true;};
rerere = {enabled = true;};
};
aliases = {
@ -42,15 +46,15 @@ in
includes = [
{
condition = "gitdir:~/work/lrde/";
contents = { user = { email = "amartin@lrde.epita.fr"; }; };
contents = {user = {email = "amartin@lrde.epita.fr";};};
}
{
condition = "gitdir:~/work/prologin/";
contents = { user = { email = "antoine.martin@prologin.org"; }; };
contents = {user = {email = "antoine.martin@prologin.org";};};
}
{
condition = "gitdir:~/work/epita/";
contents = { user = { email = "antoine4.martin@epita.fr"; }; };
contents = {user = {email = "antoine4.martin@epita.fr";};};
}
];
};

View file

@ -1,10 +1,13 @@
{ config, lib, ... }:
let
inherit (lib)
mkEnableOption
;
in
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
;
in {
options.my.home.laptop = {
enable = mkEnableOption "Laptop settings";
};

View file

@ -1,25 +1,28 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.lorri;
in
{
in {
options.my.home.lorri = {
enable = (mkEnableOption "lorri daemon setup") // { default = true; };
enable = (mkEnableOption "lorri daemon setup") // {default = true;};
};
config = mkIf cfg.enable {
services.lorri.enable = true;
programs.direnv = {
enable = true;
# FIXME: proper file, not lorri.nix
nix-direnv = {
enable = true;
# FIXME: proper file, not lorri.nix
nix-direnv = {
enable = true;
};
};
};
};
}

View file

@ -1,22 +1,26 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
myName = "Antoine Martin";
email_perso = "antoine@alarsyo.net";
email_lrde = "amartin@lrde.epita.fr";
cfg = config.my.home.mail;
in
{
in {
options.my.home.mail = {
# I *could* read email in a terminal emacs client on a server, but in
# practice I don't think it'll happen very often, so let's enable this only
# when I'm on a machine with a Xorg server.
enable = (mkEnableOption "email configuration") // { default = config.my.home.x.enable; };
enable = (mkEnableOption "email configuration") // {default = config.my.home.x.enable;};
};
config = mkIf cfg.enable {

View file

@ -1,14 +1,18 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.mail;
in
{
in {
options.my.home.rbw = {
enable = (mkEnableOption "rbw configuration");
enable = mkEnableOption "rbw configuration";
};
config = mkIf cfg.enable {

View file

@ -1,15 +1,19 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.rofi;
in
{
in {
options.my.home.rofi = {
enable = (mkEnableOption "rofi configuration") // { default = config.my.home.x.enable; };
enable = (mkEnableOption "rofi configuration") // {default = config.my.home.x.enable;};
};
config = mkIf cfg.enable {

View file

@ -1,15 +1,18 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.ssh;
in
{
in {
options.my.home.ssh = {
enable = (mkEnableOption "ssh configuration") // { default = true; };
enable = (mkEnableOption "ssh configuration") // {default = true;};
};
config = mkIf cfg.enable {
@ -17,8 +20,8 @@ in
enable = true;
matchBlocks = {
boreal = { hostname = "boreal.alarsyo.net"; };
poseidon = { hostname = "poseidon.alarsyo.net"; };
boreal = {hostname = "boreal.alarsyo.net";};
poseidon = {hostname = "poseidon.alarsyo.net";};
pi = {
hostname = "pi.alarsyo.net";
user = "pi";

View file

@ -1,11 +1,11 @@
{ lib }:
let
inherit (lib)
{lib}: let
inherit
(lib)
mkOption
types
;
;
mkColorOption = import ./color.nix { inherit lib; };
mkColorOption = import ./color.nix {inherit lib;};
primaryColorModule = types.submodule {
options = {
@ -34,60 +34,60 @@ let
};
};
in
types.submodule {
options = {
primary = mkOption {
type = primaryColorModule;
default = {
foreground = "#c5c8c6";
background = "#1d1f21";
types.submodule {
options = {
primary = mkOption {
type = primaryColorModule;
default = {
foreground = "#c5c8c6";
background = "#1d1f21";
};
};
cursor = mkOption {
type = cursorColorModule;
default = {
text = "#1d1f21";
cursor = "#c5c8c6";
};
};
normal = mkOption {
type = rainbowColorModule;
default = {
black = "#1d1f21";
red = "#cc6666";
green = "#b5bd68";
yellow = "#f0c674";
blue = "#81a2be";
magenta = "#b294bb";
cyan = "#8abeb7";
white = "#c5c8c6";
};
};
bright = mkOption {
type = rainbowColorModule;
default = {
black = "#666666";
red = "#d54e53";
green = "#b9ca4a";
yellow = "#e7c547";
blue = "#7aa6da";
magenta = "#c397d8";
cyan = "#70c0b1";
white = "#eaeaea";
};
};
dim = mkOption {
type = rainbowColorModule;
default = {
black = "#131415";
red = "#864343";
green = "#777c44";
yellow = "#9e824c";
blue = "#556a7d";
magenta = "#75617b";
cyan = "#5b7d78";
white = "#828482";
};
};
};
cursor = mkOption {
type = cursorColorModule;
default = {
text = "#1d1f21";
cursor = "#c5c8c6";
};
};
normal = mkOption {
type = rainbowColorModule;
default = {
black = "#1d1f21";
red = "#cc6666";
green = "#b5bd68";
yellow = "#f0c674";
blue = "#81a2be";
magenta = "#b294bb";
cyan = "#8abeb7";
white = "#c5c8c6";
};
};
bright = mkOption {
type = rainbowColorModule;
default = {
black = "#666666";
red = "#d54e53";
green = "#b9ca4a";
yellow = "#e7c547";
blue = "#7aa6da";
magenta = "#c397d8";
cyan = "#70c0b1";
white = "#eaeaea";
};
};
dim = mkOption {
type = rainbowColorModule;
default = {
black = "#131415";
red = "#864343";
green = "#777c44";
yellow = "#9e824c";
blue = "#556a7d";
magenta = "#75617b";
cyan = "#5b7d78";
white = "#828482";
};
};
};
}
}

View file

@ -1,15 +1,15 @@
{ lib }:
let
inherit (lib)
{lib}: let
inherit
(lib)
mkOption
types
;
;
in
types.submodule {
options = {
name = mkOption {
type = types.str;
default = "";
types.submodule {
options = {
name = mkOption {
type = types.str;
default = "";
};
};
};
}
}

View file

@ -1,14 +1,18 @@
{ lib }:
let
inherit (lib)
{lib}: let
inherit
(lib)
mkOption
types
;
;
mkColorOption = {default ? "#000000", description ? "" }: mkOption {
inherit description default;
example = "#abcdef";
type = types.strMatching "#[0-9a-f]{6}";
};
mkColorOption = {
default ? "#000000",
description ? "",
}:
mkOption {
inherit description default;
example = "#abcdef";
type = types.strMatching "#[0-9a-f]{6}";
};
in
mkColorOption
mkColorOption

View file

@ -1,35 +1,38 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkOption
types
;
;
themeType = types.submodule {
options = {
alacrittyTheme = mkOption {
type = import ./alacritty.nix { inherit lib; };
type = import ./alacritty.nix {inherit lib;};
default = {};
};
batTheme = mkOption {
type = import ./bat.nix { inherit lib; };
type = import ./bat.nix {inherit lib;};
default = {};
};
i3Theme = mkOption {
type = import ./i3.nix { inherit lib; };
type = import ./i3.nix {inherit lib;};
default = {};
};
i3BarTheme = mkOption {
type = import ./i3bar.nix { inherit lib; };
type = import ./i3bar.nix {inherit lib;};
default = {};
};
};
};
in
{
in {
options.my.theme = mkOption {
type = themeType;
default = {};
type = themeType;
default = {};
};
options.my.themes = mkOption {

View file

@ -1,11 +1,11 @@
{ lib }:
let
inherit (lib)
{lib}: let
inherit
(lib)
mkOption
types
;
;
mkColorOption = import ./color.nix { inherit lib; };
mkColorOption = import ./color.nix {inherit lib;};
barColorSetModule = types.submodule {
options = {
@ -25,165 +25,164 @@ let
};
};
in
types.submodule {
options = {
bar = mkOption {
type = types.submodule {
options = {
background = mkColorOption {
default = "#000000";
description = "Background color of the bar.";
};
statusline = mkColorOption {
default = "#ffffff";
description = "Text color to be used for the statusline.";
};
separator = mkColorOption {
default = "#666666";
description = "Text color to be used for the separator.";
};
focusedWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
types.submodule {
options = {
bar = mkOption {
type = types.submodule {
options = {
background = mkColorOption {
default = "#000000";
description = "Background color of the bar.";
};
description = ''
Border, background and text color for a workspace button when the workspace has focus.
'';
};
activeWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
statusline = mkColorOption {
default = "#ffffff";
description = "Text color to be used for the statusline.";
};
description = ''
Border, background and text color for a workspace button when the workspace is active.
'';
};
inactiveWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#333333";
background = "#222222";
text = "#888888";
separator = mkColorOption {
default = "#666666";
description = "Text color to be used for the separator.";
};
description = ''
Border, background and text color for a workspace button when the workspace does not
have focus and is not active.
'';
};
urgentWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
focusedWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
};
description = ''
Border, background and text color for a workspace button when the workspace has focus.
'';
};
description = ''
Border, background and text color for a workspace button when the workspace contains
a window with the urgency hint set.
'';
};
bindingMode = mkOption {
type = barColorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
activeWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
};
description = ''
Border, background and text color for a workspace button when the workspace is active.
'';
};
inactiveWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#333333";
background = "#222222";
text = "#888888";
};
description = ''
Border, background and text color for a workspace button when the workspace does not
have focus and is not active.
'';
};
urgentWorkspace = mkOption {
type = barColorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
description = ''
Border, background and text color for a workspace button when the workspace contains
a window with the urgency hint set.
'';
};
bindingMode = mkOption {
type = barColorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
description = "Border, background and text color for the binding mode indicator";
};
description =
"Border, background and text color for the binding mode indicator";
};
};
default = {};
};
default = {};
};
background = mkOption {
type = types.str;
default = "#ffffff";
description = ''
Background color of the window. Only applications which do not cover
the whole area expose the color.
'';
};
focused = mkOption {
type = colorSetModule;
default = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
indicator = "#2e9ef4";
childBorder = "#285577";
background = mkOption {
type = types.str;
default = "#ffffff";
description = ''
Background color of the window. Only applications which do not cover
the whole area expose the color.
'';
};
description = "A window which currently has the focus.";
};
focusedInactive = mkOption {
type = colorSetModule;
default = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
indicator = "#484e50";
childBorder = "#5f676a";
focused = mkOption {
type = colorSetModule;
default = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
indicator = "#2e9ef4";
childBorder = "#285577";
};
description = "A window which currently has the focus.";
};
description = ''
A window which is the focused one of its container,
but it does not have the focus at the moment.
'';
};
unfocused = mkOption {
type = colorSetModule;
default = {
border = "#333333";
background = "#222222";
text = "#888888";
indicator = "#292d2e";
childBorder = "#222222";
focusedInactive = mkOption {
type = colorSetModule;
default = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
indicator = "#484e50";
childBorder = "#5f676a";
};
description = ''
A window which is the focused one of its container,
but it does not have the focus at the moment.
'';
};
description = "A window which is not focused.";
};
urgent = mkOption {
type = colorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
indicator = "#900000";
childBorder = "#900000";
unfocused = mkOption {
type = colorSetModule;
default = {
border = "#333333";
background = "#222222";
text = "#888888";
indicator = "#292d2e";
childBorder = "#222222";
};
description = "A window which is not focused.";
};
description = "A window which has its urgency hint activated.";
};
placeholder = mkOption {
type = colorSetModule;
default = {
border = "#000000";
background = "#0c0c0c";
text = "#ffffff";
indicator = "#000000";
childBorder = "#0c0c0c";
urgent = mkOption {
type = colorSetModule;
default = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
indicator = "#900000";
childBorder = "#900000";
};
description = "A window which has its urgency hint activated.";
};
placeholder = mkOption {
type = colorSetModule;
default = {
border = "#000000";
background = "#0c0c0c";
text = "#ffffff";
indicator = "#000000";
childBorder = "#0c0c0c";
};
description = ''
Background and text color are used to draw placeholder window
contents (when restoring layouts). Border and indicator are ignored.
'';
};
description = ''
Background and text color are used to draw placeholder window
contents (when restoring layouts). Border and indicator are ignored.
'';
};
};
}
}

View file

@ -1,28 +1,28 @@
{ lib }:
let
inherit (lib)
{lib}: let
inherit
(lib)
mkOption
types
;
;
mkColorOption = import ./color.nix { inherit lib; };
mkColorOption = import ./color.nix {inherit lib;};
in
types.submodule {
options = {
theme = mkOption {
type = types.submodule {
options = {
name = mkOption {
type = types.str;
default = "plain";
};
overrides = mkOption {
type = types.attrsOf types.str;
default = {};
types.submodule {
options = {
theme = mkOption {
type = types.submodule {
options = {
name = mkOption {
type = types.str;
default = "plain";
};
overrides = mkOption {
type = types.attrsOf types.str;
default = {};
};
};
};
default = {};
};
default = {};
};
};
}
}

View file

@ -1,5 +1,6 @@
let
inherit (import ./colors.nix)
inherit
(import ./colors.nix)
base0
base00
base01
@ -16,9 +17,8 @@ let
red
violet
yellow
;
in
{
;
in {
primary = {
background = base3;
foreground = base00;

View file

@ -1,18 +1,18 @@
{
base03 = "#002b36"; # brblack
base02 = "#073642"; # black
base01 = "#586e75"; # brgreen
base00 = "#657b83"; # bryellow
base0 = "#839496"; # brblue
base1 = "#93a1a1"; # brcyan
base2 = "#eee8d5"; # white
base3 = "#fdf6e3"; # brwhite
yellow = "#b58900"; # yellow
orange = "#cb4b16"; # brred
red = "#dc322f"; # red
base03 = "#002b36"; # brblack
base02 = "#073642"; # black
base01 = "#586e75"; # brgreen
base00 = "#657b83"; # bryellow
base0 = "#839496"; # brblue
base1 = "#93a1a1"; # brcyan
base2 = "#eee8d5"; # white
base3 = "#fdf6e3"; # brwhite
yellow = "#b58900"; # yellow
orange = "#cb4b16"; # brred
red = "#dc322f"; # red
magenta = "#d33682"; # magenta
violet = "#6c71c4"; # brmagenta
blue = "#268bd2"; # blue
cyan = "#2aa198"; # cyan
green = "#859900"; # green
violet = "#6c71c4"; # brmagenta
blue = "#268bd2"; # blue
cyan = "#2aa198"; # cyan
green = "#859900"; # green
}

View file

@ -1,5 +1,6 @@
let
inherit (import ./colors.nix)
inherit
(import ./colors.nix)
base00
base2
base3
@ -8,9 +9,8 @@ let
orange
red
yellow
;
in
{
;
in {
bar = {
background = base3;
statusline = yellow;

View file

@ -1,5 +1,6 @@
let
inherit (import ./colors.nix)
inherit
(import ./colors.nix)
base00
base2
base3
@ -7,9 +8,8 @@ let
green
red
yellow
;
in
{
;
in {
theme = {
name = "solarized-light";
overrides = {

View file

@ -1,15 +1,19 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.tmux;
in
{
in {
options.my.home.tmux = {
enable = (mkEnableOption "tmux dotfiles") // { default = true; };
enable = (mkEnableOption "tmux dotfiles") // {default = true;};
};
config = mkIf cfg.enable {
@ -19,7 +23,9 @@ in
terminal = "screen-256color";
clock24 = true;
plugins = let inherit (pkgs) tmuxPlugins; in [
plugins = let
inherit (pkgs) tmuxPlugins;
in [
{
plugin = tmuxPlugins.cpu;
extraConfig = ''

View file

@ -1,15 +1,18 @@
{ config, lib, ... }:
let
inherit (lib)
{
config,
lib,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.tridactyl;
in
{
in {
options.my.home.tridactyl = {
enable = (mkEnableOption "tridactyl code display tool") // { default = config.my.home.firefox.enable; };
enable = (mkEnableOption "tridactyl code display tool") // {default = config.my.home.firefox.enable;};
};
config = mkIf cfg.enable {

View file

@ -1,14 +1,18 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
;
;
cfg = config.my.home.x.cursor;
in
{
options.my.home.x.cursor.enable = (mkEnableOption "X cursor") // { default = config.my.home.x.enable; };
in {
options.my.home.x.cursor.enable = (mkEnableOption "X cursor") // {default = config.my.home.x.enable;};
config = mkIf cfg.enable {
xsession.pointerCursor = {

View file

@ -1,10 +1,14 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
;
in
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
;
in {
imports = [
./cursor.nix
./i3.nix

View file

@ -1,9 +1,14 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkIf
mkOptionDefault
;
;
isEnabled = config.my.home.x.enable;
@ -20,14 +25,13 @@ let
logoutMode = "[L]ogout, [S]uspend, [P]oweroff, [R]eboot";
i3Theme = config.my.theme.i3Theme;
in
{
in {
config = mkIf isEnabled {
my.home = {
flameshot.enable = true;
};
home.packages = [ pkgs.betterlockscreen ];
home.packages = [pkgs.betterlockscreen];
xsession.windowManager.i3 = {
enable = true;
@ -35,39 +39,38 @@ in
config = {
inherit modifier;
bars =
let
barConfigPath =
config.xdg.configFile."i3status-rust/config-top.toml".target;
in
[
{
statusCommand = "i3status-rs ${barConfigPath}";
position = "top";
fonts = {
names = [ "DejaVuSansMono" "FontAwesome5Free" ];
size = 9.0;
};
bars = let
barConfigPath =
config.xdg.configFile."i3status-rust/config-top.toml".target;
in [
{
statusCommand = "i3status-rs ${barConfigPath}";
position = "top";
fonts = {
names = ["DejaVuSansMono" "FontAwesome5Free"];
size = 9.0;
};
colors = i3Theme.bar;
colors = i3Theme.bar;
trayOutput = "primary";
trayOutput = "primary";
# disable mouse scroll wheel in bar
extraConfig = ''
bindsym button4 nop
bindsym button5 nop
'';
}
];
# disable mouse scroll wheel in bar
extraConfig = ''
bindsym button4 nop
bindsym button5 nop
'';
}
];
colors = {
inherit (i3Theme)
inherit
(i3Theme)
focused
focusedInactive
unfocused
urgent
;
;
};
focus = {
@ -78,7 +81,7 @@ in
workspaceAutoBackAndForth = true;
fonts = {
names = [ "DejaVu Sans Mono" ];
names = ["DejaVu Sans Mono"];
size = 8.0;
};
@ -104,40 +107,44 @@ in
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show run";
};
modes =
let
makeModeBindings = attrs: attrs // {
modes = let
makeModeBindings = attrs:
attrs
// {
"Escape" = "mode default";
"Return" = "mode default";
};
in
mkOptionDefault {
"${logoutMode}" = makeModeBindings {
"l" = "exec --no-startup-id i3-msg exit, mode default";
"s" = "exec --no-startup-id betterlockscreen --suspend, mode default";
"p" = "exec --no-startup-id systemctl poweroff, mode default";
"r" = "exec --no-startup-id systemctl reboot, mode default";
};
in
mkOptionDefault {
"${logoutMode}" = makeModeBindings {
"l" = "exec --no-startup-id i3-msg exit, mode default";
"s" = "exec --no-startup-id betterlockscreen --suspend, mode default";
"p" = "exec --no-startup-id systemctl poweroff, mode default";
"r" = "exec --no-startup-id systemctl reboot, mode default";
};
};
terminal = myTerminal;
assigns = {
"10" = [
{ class = "Slack"; }
{ class = "discord"; }
{class = "Slack";}
{class = "discord";}
];
};
window.commands = [
{ command = "border pixel 2"; criteria = { class = "Alacritty"; }; }
{
command = "border pixel 2";
criteria = {class = "Alacritty";};
}
# NOTE: should be done with an assign command, but Spotify doesn't set
# its class until after initialization, so has to be done this way.
#
# See https://i3wm.org/docs/userguide.html#assign_workspace
{
criteria = { class = "Spotify"; };
criteria = {class = "Spotify";};
command = "move --no-auto-back-and-forth to workspace 8";
}
];

View file

@ -1,18 +1,22 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
lists
mkIf
mkOption
optional
types
;
;
isEnabled = config.my.home.x.enable;
i3BarTheme = config.my.theme.i3BarTheme;
cfg = config.my.home.x.i3bar;
in
{
in {
options.my.home.x.i3bar = {
temperature.chip = mkOption {
type = types.str;
@ -27,17 +31,19 @@ in
networking.throughput_interfaces = mkOption {
type = types.listOf types.str;
example = [ "wlp1s0" ];
default = [ ];
example = ["wlp1s0"];
default = [];
};
};
config = mkIf isEnabled {
home.packages = builtins.attrValues {
inherit (pkgs)
inherit
(pkgs)
# FIXME: is this useful?
font-awesome
;
;
};
programs.i3status-rust = {
@ -49,81 +55,86 @@ in
theme = i3BarTheme.theme.name;
settings = i3BarTheme;
blocks = [
{
block = "pomodoro";
length = 60;
break_length = 10;
notifier = "i3nag";
}
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used;G}/{mem_total;G}";
warning_mem = 70.0;
critical_mem = 90.0;
# don't show swap
clickable = false;
}
{
block = "cpu";
interval = 1;
format = "{barchart}";
}
{
block = "temperature";
collapsed = false;
interval = 10;
format = "{max}";
chip = cfg.temperature.chip;
inputs = cfg.temperature.inputs;
}
] ++ (lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
(map
(interface:
{
blocks =
[
{
block = "pomodoro";
length = 60;
break_length = 10;
notifier = "i3nag";
}
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used;G}/{mem_total;G}";
warning_mem = 70.0;
critical_mem = 90.0;
# don't show swap
clickable = false;
}
{
block = "cpu";
interval = 1;
format = "{barchart}";
}
{
block = "temperature";
collapsed = false;
interval = 10;
format = "{max}";
chip = cfg.temperature.chip;
inputs = cfg.temperature.inputs;
}
]
++ (
lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
(map
(interface: {
block = "net";
device = interface;
interval = 1;
hide_inactive = true;
})
cfg.networking.throughput_interfaces)
) ++ [
{
block = "networkmanager";
primary_only = true;
}
{
block = "sound";
driver = "pulseaudio";
}
] ++ (optional config.my.home.laptop.enable
{
block = "battery";
}
) ++ [
# {
# block = "notify";
# }
{
block = "time";
interval = 5;
format = "%a %d/%m %T";
locale = "fr_FR";
timezone = "Europe/Paris";
}
];
cfg.networking.throughput_interfaces)
)
++ [
{
block = "networkmanager";
primary_only = true;
}
{
block = "sound";
driver = "pulseaudio";
}
]
++ (
optional config.my.home.laptop.enable
{
block = "battery";
}
)
++ [
# {
# block = "notify";
# }
{
block = "time";
interval = 5;
format = "%a %d/%m %T";
locale = "fr_FR";
timezone = "Europe/Paris";
}
];
};
};
};