nix: exorcise all with <expr>; uses

This commit is contained in:
Antoine Martin 2022-01-11 16:08:21 +01:00
parent ef59fd800e
commit 912073bee6
67 changed files with 576 additions and 259 deletions

View file

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

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
;
in
{
imports = [
./cursor.nix
@ -6,7 +11,7 @@
./i3bar.nix
];
options.my.home.x = with lib; {
options.my.home.x = {
enable = mkEnableOption "X server configuration";
};
}

View file

@ -1,5 +1,10 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkIf
mkOptionDefault
;
isEnabled = config.my.home.x.enable;
myTerminal =
@ -17,14 +22,12 @@ let
i3Theme = config.my.theme.i3Theme;
in
{
config = lib.mkIf isEnabled {
config = mkIf isEnabled {
my.home = {
flameshot.enable = true;
};
home.packages = with pkgs; [
betterlockscreen
];
home.packages = [ pkgs.betterlockscreen ];
xsession.windowManager.i3 = {
enable = true;
@ -77,7 +80,7 @@ in
size = 8.0;
};
keybindings = lib.mkOptionDefault {
keybindings = mkOptionDefault {
"${modifier}+Shift+e" = ''mode "${logoutMode}"'';
"${modifier}+i" = "exec emacsclient -c";
@ -106,7 +109,7 @@ in
"Return" = "mode default";
};
in
lib.mkOptionDefault {
mkOptionDefault {
"${logoutMode}" = makeModeBindings {
"l" = "exec --no-startup-id i3-msg exit, mode default";
"s" = "exec --no-startup-id betterlockscreen --suspend, mode default";

View file

@ -1,11 +1,19 @@
{ 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
{
options.my.home.x.i3bar = with lib; {
options.my.home.x.i3bar = {
temperature.chip = mkOption {
type = types.str;
example = "coretemp-isa-*";
@ -24,12 +32,14 @@ in
};
};
config = lib.mkIf isEnabled {
home.packages = with pkgs; [
iw # Used by `net` block
lm_sensors # Used by `temperature` block
font-awesome
];
config = mkIf isEnabled {
home.packages = builtins.attrValues {
inherit (pkgs)
iw # Used by `net` block
lm_sensors # Used by `temperature` block
font-awesome
;
};
programs.i3status-rust = {
enable = true;
@ -79,7 +89,7 @@ in
chip = cfg.temperature.chip;
inputs = cfg.temperature.inputs;
}
] ++ (lib.lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
] ++ (lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)
(map
(interface:
{
@ -105,11 +115,11 @@ in
block = "sound";
driver = "pulseaudio";
}
] ++ (lib.lists.optionals config.my.home.laptop.enable [
] ++ (optional config.my.home.laptop.enable
{
block = "battery";
}
]) ++ [
) ++ [
# {
# block = "notify";
# }