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,12 +1,17 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.alacritty;
alacrittyTheme = config.my.theme.alacrittyTheme;
in
{
options.my.home.alacritty.enable = (lib.mkEnableOption "Alacritty terminal") // { default = config.my.home.x.enable; };
options.my.home.alacritty.enable = (mkEnableOption "Alacritty terminal") // { default = config.my.home.x.enable; };
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
programs.alacritty = {
enable = true;
@ -34,9 +39,8 @@ in
};
};
home.packages = with pkgs; [
iosevka-bin
];
home.packages = [ pkgs.iosevka-bin ];
# make sure font is discoverable
fonts.fontconfig.enable = true;
};

View file

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

View file

@ -1,23 +1,31 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
in
{
options.my.home.emacs = with lib; {
options.my.home.emacs = {
enable = mkEnableOption "Emacs daemon configuration";
};
config = lib.mkIf config.my.home.emacs.enable {
config = mkIf config.my.home.emacs.enable {
home.sessionPath = [ "${config.xdg.configHome}/emacs/bin" ];
home.sessionVariables = {
EDITOR = "emacsclient -t";
};
home.packages = with pkgs; [
sqlite # needed by org-roam
home.packages = builtins.attrValues {
inherit (pkgs)
sqlite # needed by org-roam
# fonts used by my config
emacs-all-the-icons-fonts
iosevka-bin
];
# 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,13 +1,18 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.firefox;
in
{
options.my.home.firefox = with lib; {
options.my.home.firefox = {
enable = (mkEnableOption "firefox config") // { default = config.my.home.x.enable; };
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
programs.firefox = {
enable = true;
package = pkgs.firefox.override {

View file

@ -1,11 +1,16 @@
{ config, lib, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.fish;
in
{
options.my.home.fish.enable = (lib.mkEnableOption "Fish shell") // { default = true; };
options.my.home.fish.enable = (mkEnableOption "Fish shell") // { default = true; };
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
programs.fish = {
enable = true;
};

View file

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

View file

@ -1,11 +1,16 @@
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.git;
in
{
options.my.home.git.enable = (lib.mkEnableOption "Git configuration") // { default = true; };
options.my.home.git.enable = (mkEnableOption "Git configuration") // { default = true; };
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
programs.git = {
enable = true;

View file

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

View file

@ -1,13 +1,18 @@
{ config, lib, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.lorri;
in
{
options.my.home.lorri = with lib; {
options.my.home.lorri = {
enable = (mkEnableOption "lorri daemon setup") // { default = true; };
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
services.lorri.enable = true;
programs.direnv = {
enable = true;

View file

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

View file

@ -1,5 +1,11 @@
{ lib, ... }:
with lib;
let
inherit (lib)
fileContents
mkOption
types
;
in
{
options.my.secrets = mkOption {
type = types.attrs;

View file

@ -1,13 +1,18 @@
{ config, lib, ... }:
let
inherit (lib)
mkEnableOption
mkIf
;
cfg = config.my.home.ssh;
in
{
options.my.home.ssh = with lib; {
options.my.home.ssh = {
enable = (mkEnableOption "ssh configuration") // { default = true; };
};
config = lib.mkIf cfg.enable {
config = mkIf cfg.enable {
programs.ssh = {
enable = true;

View file

@ -1,6 +1,10 @@
{ lib }:
with lib;
let
inherit (lib)
mkOption
types
;
mkColorOption = import ./color.nix { inherit lib; };
primaryColorModule = types.submodule {

View file

@ -1,5 +1,10 @@
{ lib }:
with lib;
let
inherit (lib)
mkOption
types
;
in
types.submodule {
options = {
name = mkOption {

View file

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

View file

@ -1,6 +1,10 @@
{ config, lib, ... }:
with lib;
let
inherit (lib)
mkOption
types
;
themeType = types.submodule {
options = {
alacrittyTheme = mkOption {
@ -29,7 +33,7 @@ in
};
options.my.themes = mkOption {
type = with types; attrsOf themeType;
type = types.attrsOf themeType;
};
config.my.themes = {

View file

@ -1,6 +1,10 @@
{ lib }:
with lib;
let
inherit (lib)
mkOption
types
;
mkColorOption = import ./color.nix { inherit lib; };
barColorSetModule = types.submodule {

View file

@ -1,6 +1,10 @@
{ lib }:
with lib;
let
inherit (lib)
mkOption
types
;
mkColorOption = import ./color.nix { inherit lib; };
in
types.submodule {

View file

@ -1,7 +1,23 @@
let
colors = import ./colors.nix;
inherit (import ./colors.nix)
base0
base00
base01
base02
base03
base1
base2
base3
blue
cyan
green
magenta
orange
red
violet
yellow
;
in
with colors;
{
primary = {
background = base3;

View file

@ -1,7 +1,15 @@
let
colors = import ./colors.nix;
inherit (import ./colors.nix)
base00
base2
base3
blue
magenta
orange
red
yellow
;
in
with colors;
{
bar = {
background = base3;

View file

@ -1,7 +1,14 @@
let
colors = import ./colors.nix;
inherit (import ./colors.nix)
base00
base2
base3
blue
green
red
yellow
;
in
with colors;
{
theme = {
name = "solarized-light";

View file

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

View file

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

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";
# }