From 912073bee6040306f21f7618422e4a9504934524 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 11 Jan 2022 16:08:21 +0100 Subject: [PATCH] nix: exorcise all `with ;` uses --- base/gui-programs.nix | 56 ++++++++++-------- base/networking.nix | 8 ++- base/programs.nix | 71 ++++++++++++----------- home/alacritty.nix | 14 +++-- home/bat.nix | 9 ++- home/emacs.nix | 24 +++++--- home/firefox.nix | 9 ++- home/fish/default.nix | 9 ++- home/flameshot.nix | 9 ++- home/git.nix | 9 ++- home/laptop.nix | 7 ++- home/lorri.nix | 9 ++- home/rofi.nix | 9 ++- home/secrets/default.nix | 8 ++- home/ssh.nix | 9 ++- home/themes/alacritty.nix | 6 +- home/themes/bat.nix | 7 ++- home/themes/color.nix | 7 ++- home/themes/default.nix | 8 ++- home/themes/i3.nix | 6 +- home/themes/i3bar.nix | 6 +- home/themes/solarizedLight/alacritty.nix | 20 ++++++- home/themes/solarizedLight/i3.nix | 12 +++- home/themes/solarizedLight/i3bar.nix | 11 +++- home/tmux.nix | 11 +++- home/tridactyl.nix | 9 ++- home/x/cursor.nix | 9 ++- home/x/default.nix | 7 ++- home/x/i3.nix | 15 +++-- home/x/i3bar.nix | 30 ++++++---- hosts/boreal/default.nix | 4 +- hosts/boreal/home.nix | 8 ++- hosts/poseidon/hardware-configuration.nix | 8 ++- hosts/zephyrus/default.nix | 4 +- hosts/zephyrus/hardware-configuration.nix | 8 ++- hosts/zephyrus/home.nix | 20 ++++--- modules/sddm.nix | 26 ++++++--- modules/wakeonwlan.nix | 13 ++++- pkgs/grafana-dashboards/nginx.nix | 6 +- pkgs/grafana-dashboards/node-exporter.nix | 6 +- pkgs/kaleidoscope-udev-rules/default.nix | 6 +- secrets/borg-backup/default.nix | 9 ++- secrets/default.nix | 26 +++++---- secrets/paperless/default.nix | 9 ++- secrets/restic-backup/default.nix | 7 ++- services/borg-backup.nix | 12 ++-- services/fail2ban.nix | 6 +- services/fava.nix | 13 +++-- services/gitea/default.nix | 10 +++- services/jellyfin.nix | 9 ++- services/lohr.nix | 16 ++--- services/matrix.nix | 16 +++-- services/media.nix | 16 +++-- services/miniflux.nix | 10 +++- services/monitoring.nix | 10 +++- services/navidrome.nix | 13 +++-- services/nextcloud.nix | 11 +++- services/nginx.nix | 7 ++- services/nuage.nix | 9 ++- services/paperless.nix | 12 ++-- services/pipewire.nix | 12 ++-- services/postgresql-backup.nix | 7 ++- services/restic-backup.nix | 22 ++++--- services/tailscale.nix | 11 ++-- services/tgv.nix | 9 ++- services/transmission.nix | 10 +++- services/vaultwarden.nix | 10 +++- 67 files changed, 576 insertions(+), 259 deletions(-) diff --git a/base/gui-programs.nix b/base/gui-programs.nix index 2925b64..c1dbbc6 100644 --- a/base/gui-programs.nix +++ b/base/gui-programs.nix @@ -1,11 +1,18 @@ { pkgs, lib, config, options, ... }: +let + inherit (lib) + mkEnableOption + mkIf + optional + ; +in { options.my.gui = { - enable = lib.mkEnableOption "System has some kind of screen attached"; - isNvidia = lib.mkEnableOption "System a NVIDIA GPU"; + enable = mkEnableOption "System has some kind of screen attached"; + isNvidia = mkEnableOption "System a NVIDIA GPU"; }; - config = lib.mkIf config.my.gui.enable { + config = mkIf config.my.gui.enable { my.displayManager.sddm.enable = true; services = { @@ -21,27 +28,30 @@ }; }; - environment.systemPackages = with pkgs; [ - element-desktop - feh - firefox - ffmpeg - gimp - gnome.nautilus - imagemagick - mpv - obs-studio - pavucontrol - slack - spotify - tdesktop - teams - thunderbird - virt-manager - zathura + environment.systemPackages = builtins.attrValues { + inherit (pkgs) + element-desktop + feh + firefox + ffmpeg + gimp + imagemagick + mpv + obs-studio + pavucontrol + slack + spotify + tdesktop + teams + thunderbird + virt-manager + zathura + ; - unstable.discord - ]; + inherit (pkgs.gnome) nautilus; + + inherit (pkgs.unstable) discord; + }; networking.networkmanager.enable = true; programs.nm-applet.enable = true; diff --git a/base/networking.nix b/base/networking.nix index c17ed76..e059f5e 100644 --- a/base/networking.nix +++ b/base/networking.nix @@ -1,6 +1,12 @@ { lib, ... }: +let + inherit (lib) + mkOption + types + ; +in { - options.my.networking.externalInterface = with lib; mkOption { + options.my.networking.externalInterface = mkOption { type = types.nullOr types.str; default = null; example = "eth0"; diff --git a/base/programs.nix b/base/programs.nix index b573d97..86a0668 100644 --- a/base/programs.nix +++ b/base/programs.nix @@ -19,40 +19,45 @@ bandwhich.enable = true; }; - environment.systemPackages = with pkgs; [ - # shell usage - fd - ripgrep - sd - tmux - tokei - tree - wget + environment.systemPackages = builtins.attrValues { + inherit (pkgs) + # shell usage + fd + ripgrep + sd + tmux + tokei + tree + wget - # development - git - git-crypt - git-lfs - gnumake - gnupg - kakoune - pinentry-curses - python3 - vim - clang_11 - llvmPackages_11.bintools + # development + git + git-crypt + git-lfs + gnumake + gnupg + kakoune + pinentry-curses + python3 + vim - # terminal utilities - bottom - dogdns - du-dust - htop - ldns # drill - tealdeer - unzip - zip + # terminal utilities + bottom + dogdns + du-dust + htop + ldns # drill + tealdeer + unzip + zip - # nix pkgs lookup - nix-index - ]; + # nix pkgs lookup + nix-index + ; + + inherit (pkgs.llvmPackages_11) + bintools + clang + ; + }; } diff --git a/home/alacritty.nix b/home/alacritty.nix index 44f08cb..bf9665b 100644 --- a/home/alacritty.nix +++ b/home/alacritty.nix @@ -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; }; diff --git a/home/bat.nix b/home/bat.nix index 6d496e8..2349985 100644 --- a/home/bat.nix +++ b/home/bat.nix @@ -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; diff --git a/home/emacs.nix b/home/emacs.nix index 154e79b..c9ed8f6 100644 --- a/home/emacs.nix +++ b/home/emacs.nix @@ -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; diff --git a/home/firefox.nix b/home/firefox.nix index 6bfe377..1cfce8a 100644 --- a/home/firefox.nix +++ b/home/firefox.nix @@ -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 { diff --git a/home/fish/default.nix b/home/fish/default.nix index 9175f57..3f50c71 100644 --- a/home/fish/default.nix +++ b/home/fish/default.nix @@ -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; }; diff --git a/home/flameshot.nix b/home/flameshot.nix index 359fc8c..043d2ce 100644 --- a/home/flameshot.nix +++ b/home/flameshot.nix @@ -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; }; } diff --git a/home/git.nix b/home/git.nix index 1b5adb5..61e8171 100644 --- a/home/git.nix +++ b/home/git.nix @@ -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; diff --git a/home/laptop.nix b/home/laptop.nix index ef4d266..8d30003 100644 --- a/home/laptop.nix +++ b/home/laptop.nix @@ -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"; }; } diff --git a/home/lorri.nix b/home/lorri.nix index df4d23d..e2c5ebb 100644 --- a/home/lorri.nix +++ b/home/lorri.nix @@ -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; diff --git a/home/rofi.nix b/home/rofi.nix index 30022d7..b5a9e91 100644 --- a/home/rofi.nix +++ b/home/rofi.nix @@ -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; diff --git a/home/secrets/default.nix b/home/secrets/default.nix index 71b63a9..b149dde 100644 --- a/home/secrets/default.nix +++ b/home/secrets/default.nix @@ -1,5 +1,11 @@ { lib, ... }: -with lib; +let + inherit (lib) + fileContents + mkOption + types + ; +in { options.my.secrets = mkOption { type = types.attrs; diff --git a/home/ssh.nix b/home/ssh.nix index cf8d877..fc5884e 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -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; diff --git a/home/themes/alacritty.nix b/home/themes/alacritty.nix index 0e1aeb3..cc6943b 100644 --- a/home/themes/alacritty.nix +++ b/home/themes/alacritty.nix @@ -1,6 +1,10 @@ { lib }: -with lib; let + inherit (lib) + mkOption + types + ; + mkColorOption = import ./color.nix { inherit lib; }; primaryColorModule = types.submodule { diff --git a/home/themes/bat.nix b/home/themes/bat.nix index 5c14c5f..df9565e 100644 --- a/home/themes/bat.nix +++ b/home/themes/bat.nix @@ -1,5 +1,10 @@ { lib }: -with lib; +let + inherit (lib) + mkOption + types + ; +in types.submodule { options = { name = mkOption { diff --git a/home/themes/color.nix b/home/themes/color.nix index 46ce77e..5c63963 100644 --- a/home/themes/color.nix +++ b/home/themes/color.nix @@ -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}"; diff --git a/home/themes/default.nix b/home/themes/default.nix index 96fc994..e19a474 100644 --- a/home/themes/default.nix +++ b/home/themes/default.nix @@ -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 = { diff --git a/home/themes/i3.nix b/home/themes/i3.nix index 450f26a..6e5b3eb 100644 --- a/home/themes/i3.nix +++ b/home/themes/i3.nix @@ -1,6 +1,10 @@ { lib }: -with lib; let + inherit (lib) + mkOption + types + ; + mkColorOption = import ./color.nix { inherit lib; }; barColorSetModule = types.submodule { diff --git a/home/themes/i3bar.nix b/home/themes/i3bar.nix index 990c6d5..3701116 100644 --- a/home/themes/i3bar.nix +++ b/home/themes/i3bar.nix @@ -1,6 +1,10 @@ { lib }: -with lib; let + inherit (lib) + mkOption + types + ; + mkColorOption = import ./color.nix { inherit lib; }; in types.submodule { diff --git a/home/themes/solarizedLight/alacritty.nix b/home/themes/solarizedLight/alacritty.nix index 9f2149f..fb22436 100644 --- a/home/themes/solarizedLight/alacritty.nix +++ b/home/themes/solarizedLight/alacritty.nix @@ -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; diff --git a/home/themes/solarizedLight/i3.nix b/home/themes/solarizedLight/i3.nix index 3eab85d..df9634a 100644 --- a/home/themes/solarizedLight/i3.nix +++ b/home/themes/solarizedLight/i3.nix @@ -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; diff --git a/home/themes/solarizedLight/i3bar.nix b/home/themes/solarizedLight/i3bar.nix index 69594f4..5b37775 100644 --- a/home/themes/solarizedLight/i3bar.nix +++ b/home/themes/solarizedLight/i3bar.nix @@ -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"; diff --git a/home/tmux.nix b/home/tmux.nix index cff3070..86d6995 100644 --- a/home/tmux.nix +++ b/home/tmux.nix @@ -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 = '' diff --git a/home/tridactyl.nix b/home/tridactyl.nix index b179812..9be9906 100644 --- a/home/tridactyl.nix +++ b/home/tridactyl.nix @@ -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; }; } diff --git a/home/x/cursor.nix b/home/x/cursor.nix index 76226b4..aa4ead7 100644 --- a/home/x/cursor.nix +++ b/home/x/cursor.nix @@ -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"; diff --git a/home/x/default.nix b/home/x/default.nix index 9473fc3..4953b9a 100644 --- a/home/x/default.nix +++ b/home/x/default.nix @@ -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"; }; } diff --git a/home/x/i3.nix b/home/x/i3.nix index 9827bc2..4dde0c4 100644 --- a/home/x/i3.nix +++ b/home/x/i3.nix @@ -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"; diff --git a/home/x/i3bar.nix b/home/x/i3bar.nix index e3f0af7..335ba68 100644 --- a/home/x/i3bar.nix +++ b/home/x/i3bar.nix @@ -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"; # } diff --git a/hosts/boreal/default.nix b/hosts/boreal/default.nix index e41608f..f1b3d81 100644 --- a/hosts/boreal/default.nix +++ b/hosts/boreal/default.nix @@ -105,9 +105,7 @@ in "rfkill-release" ]; - services.udev.packages = with pkgs; [ - packages.kaleidoscope-udev-rules - ]; + services.udev.packages = [ pkgs.packages.kaleidoscope-udev-rules ]; hardware.bluetooth = { enable = true; diff --git a/hosts/boreal/home.nix b/hosts/boreal/home.nix index 6dd86d3..aabbe6d 100644 --- a/hosts/boreal/home.nix +++ b/hosts/boreal/home.nix @@ -10,7 +10,8 @@ my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; - home.packages = with pkgs; [ + home.packages = builtins.attrValues { + inherit (pkgs) # some websites only work there :( chromium @@ -19,8 +20,9 @@ # keyboard goodness chrysalis + ; - packages.spot - ]; + inherit (pkgs.packages) spot; + }; }; } diff --git a/hosts/poseidon/hardware-configuration.nix b/hosts/poseidon/hardware-configuration.nix index bd2bc7a..847f37a 100644 --- a/hosts/poseidon/hardware-configuration.nix +++ b/hosts/poseidon/hardware-configuration.nix @@ -2,7 +2,11 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: - +let + inherit (lib) + mkDefault + ; +in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") @@ -32,5 +36,5 @@ [ { device = "/dev/disk/by-uuid/381a9c5e-4d71-45b4-ac62-e7414b3768fc"; } ]; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + powerManagement.cpuFreqGovernor = mkDefault "ondemand"; } diff --git a/hosts/zephyrus/default.nix b/hosts/zephyrus/default.nix index 659a6bb..231692f 100644 --- a/hosts/zephyrus/default.nix +++ b/hosts/zephyrus/default.nix @@ -56,9 +56,7 @@ in }; my.gui.enable = true; - environment.systemPackages = with pkgs; [ - arandr - ]; + environment.systemPackages = [ pkgs.arandr ]; hardware.bluetooth = { enable = true; diff --git a/hosts/zephyrus/hardware-configuration.nix b/hosts/zephyrus/hardware-configuration.nix index cc55acf..48d6162 100644 --- a/hosts/zephyrus/hardware-configuration.nix +++ b/hosts/zephyrus/hardware-configuration.nix @@ -2,7 +2,11 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { config, lib, pkgs, modulesPath, ... }: - +let + inherit (lib) + mkDefault + ; +in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") @@ -40,7 +44,7 @@ swapDevices = [ ]; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + powerManagement.cpuFreqGovernor = mkDefault "powersave"; hardware.enableRedistributableFirmware = true; } diff --git a/hosts/zephyrus/home.nix b/hosts/zephyrus/home.nix index 1b38985..4618fe3 100644 --- a/hosts/zephyrus/home.nix +++ b/hosts/zephyrus/home.nix @@ -12,18 +12,20 @@ my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; - home.packages = with pkgs; [ - # some websites only work there :( - chromium + home.packages = builtins.attrValues { + inherit (pkgs) + # some websites only work there :( + chromium - wineWowPackages.stable + darktable - darktable + # dev + rustup + ; - # dev - rustup + inherit (pkgs.packages) spot; - packages.spot - ]; + inherit (pkgs.wineWowPackages) stable; + }; }; } diff --git a/modules/sddm.nix b/modules/sddm.nix index 785a681..9c66ddc 100644 --- a/modules/sddm.nix +++ b/modules/sddm.nix @@ -1,23 +1,31 @@ { config, lib, pkgs, ... }: let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.displayManager.sddm; in { - options.my.displayManager.sddm.enable = lib.mkEnableOption "SDDM setup"; + options.my.displayManager.sddm.enable = mkEnableOption "SDDM setup"; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver.displayManager.sddm = { enable = true; theme = "sugar-candy"; }; - environment.systemPackages = with pkgs; [ - packages.sddm-sugar-candy + environment.systemPackages = builtins.attrValues { + inherit (pkgs.packages) + sddm-sugar-candy + ; - # dependencies for sugar-candy theme - libsForQt5.qt5.qtgraphicaleffects - libsForQt5.qt5.qtquickcontrols2 - libsForQt5.qt5.qtsvg - ]; + inherit (pkgs.libsForQt5.qt5) + qtgraphicaleffects + qtquickcontrols2 + qtsvg + ; + }; }; } diff --git a/modules/wakeonwlan.nix b/modules/wakeonwlan.nix index 8243671..096515d 100644 --- a/modules/wakeonwlan.nix +++ b/modules/wakeonwlan.nix @@ -1,8 +1,15 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + concatStringsSep + literalExample + mapAttrs' + mkIf + mkOption + nameValuePair + ; + cfg = config.my.wakeonwlan; mkWowlanService = name: cfg: @@ -20,7 +27,7 @@ let }; in { - options.my.wakeonwlan = { + options.my.wakeonwlan = let inherit (lib) types; in { interfaces = mkOption { default = { }; description = "Wireless interfaces where you want to enable WoWLAN"; diff --git a/pkgs/grafana-dashboards/nginx.nix b/pkgs/grafana-dashboards/nginx.nix index 5e7c4bd..e707159 100644 --- a/pkgs/grafana-dashboards/nginx.nix +++ b/pkgs/grafana-dashboards/nginx.nix @@ -1,5 +1,9 @@ { stdenv, fetchFromGitHub, lib, ... }: let + inherit (lib) + licenses + ; + version = "0.9.0"; in stdenv.mkDerivation { @@ -20,7 +24,7 @@ stdenv.mkDerivation { cp grafana/dashboard.json $out/dashboard.json ''; - meta = with lib; { + meta = { description = "grafana dashboard for NGINX exporter"; homepage = "https://github.com/nginxinc/nginx-prometheus-exporter"; license = licenses.asl20; diff --git a/pkgs/grafana-dashboards/node-exporter.nix b/pkgs/grafana-dashboards/node-exporter.nix index 98054a0..55fbb6d 100644 --- a/pkgs/grafana-dashboards/node-exporter.nix +++ b/pkgs/grafana-dashboards/node-exporter.nix @@ -1,5 +1,9 @@ { stdenv, fetchFromGitHub, lib, ... }: let + inherit (lib) + licenses + ; + version = "7d61c79619e5749e629758ecd96748c010028120"; in stdenv.mkDerivation { @@ -20,7 +24,7 @@ stdenv.mkDerivation { cp prometheus/node-exporter-full.json $out/node-exporter-full.json ''; - meta = with lib; { + meta = { description = "grafana dashboard for node exporter"; homepage = "https://github.com/rfrail3/grafana-dashboards"; license = licenses.lgpl3Only; diff --git a/pkgs/kaleidoscope-udev-rules/default.nix b/pkgs/kaleidoscope-udev-rules/default.nix index 2ab2118..aaeaea9 100644 --- a/pkgs/kaleidoscope-udev-rules/default.nix +++ b/pkgs/kaleidoscope-udev-rules/default.nix @@ -1,6 +1,10 @@ { stdenv, lib, fetchFromGitHub }: let + inherit (lib) + licenses + ; + version = "1.99.3"; in stdenv.mkDerivation { @@ -21,7 +25,7 @@ stdenv.mkDerivation { cp etc/60-kaleidoscope.rules $out/lib/udev/rules.d/ ''; - meta = with lib; { + meta = { description = "udev rules for kaleidoscope firmware keyboards"; homepage = "https://github.com/keyboardio/Kaleidoscope"; license = licenses.gpl3Only; diff --git a/secrets/borg-backup/default.nix b/secrets/borg-backup/default.nix index 11dad25..b611715 100644 --- a/secrets/borg-backup/default.nix +++ b/secrets/borg-backup/default.nix @@ -1,5 +1,10 @@ { lib }: +let + inherit (lib) + fileContents + ; +in { - boreal-repo = lib.fileContents ./boreal-repo.secret; - poseidon-repo = lib.fileContents ./poseidon-repo.secret; + boreal-repo = fileContents ./boreal-repo.secret; + poseidon-repo = fileContents ./poseidon-repo.secret; } diff --git a/secrets/default.nix b/secrets/default.nix index 4b7baca..12f8a19 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -1,20 +1,24 @@ { pkgs, lib, config, ... }: -with lib; -{ - options.my.secrets = mkOption { +let + inherit (lib) + fileContents + mkOption + ; +in { + options.my.secrets = let inherit (lib) types; in mkOption { type = types.attrs; }; config.my.secrets = { - matrix-registration-shared-secret = lib.fileContents ./matrix-registration-shared-secret.secret; - shadow-hashed-password-alarsyo = lib.fileContents ./shadow-hashed-password-alarsyo.secret; - shadow-hashed-password-root = lib.fileContents ./shadow-hashed-password-root.secret; - miniflux-admin-credentials = lib.fileContents ./miniflux-admin-credentials.secret; - transmission-password = lib.fileContents ./transmission.secret; + matrix-registration-shared-secret = fileContents ./matrix-registration-shared-secret.secret; + shadow-hashed-password-alarsyo = fileContents ./shadow-hashed-password-alarsyo.secret; + shadow-hashed-password-root = fileContents ./shadow-hashed-password-root.secret; + miniflux-admin-credentials = fileContents ./miniflux-admin-credentials.secret; + transmission-password = fileContents ./transmission.secret; nextcloud-admin-pass = ./nextcloud-admin-pass.secret; - nextcloud-admin-user = lib.fileContents ./nextcloud-admin-user.secret; - lohr-shared-secret = lib.fileContents ./lohr-shared-secret.secret; - gandiKey = lib.fileContents ./gandi-api-key.secret; + nextcloud-admin-user = fileContents ./nextcloud-admin-user.secret; + lohr-shared-secret = fileContents ./lohr-shared-secret.secret; + gandiKey = fileContents ./gandi-api-key.secret; borg-backup = import ./borg-backup { inherit lib; }; paperless = import ./paperless { inherit lib; }; diff --git a/secrets/paperless/default.nix b/secrets/paperless/default.nix index 968404d..69c4008 100644 --- a/secrets/paperless/default.nix +++ b/secrets/paperless/default.nix @@ -1,5 +1,10 @@ { lib }: +let + inherit (lib) + fileContents + ; +in { - secretKey = lib.fileContents ./secret-key-file.secret; - adminPassword = lib.fileContents ./admin-password.secret; + secretKey = fileContents ./secret-key-file.secret; + adminPassword = fileContents ./admin-password.secret; } diff --git a/secrets/restic-backup/default.nix b/secrets/restic-backup/default.nix index 1d6b630..e9a3e7a 100644 --- a/secrets/restic-backup/default.nix +++ b/secrets/restic-backup/default.nix @@ -1,4 +1,9 @@ { lib }: +let + inherit (lib) + fileContents + ; +in { - poseidon-repo = lib.fileContents ./poseidon-repo.secret; + poseidon-repo = fileContents ./poseidon-repo.secret; } diff --git a/services/borg-backup.nix b/services/borg-backup.nix index 23300a4..92b91b0 100644 --- a/services/borg-backup.nix +++ b/services/borg-backup.nix @@ -1,10 +1,14 @@ { config, lib, pkgs, ... }: -with lib; - -let cfg = config.my.services.borg-backup; +let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.borg-backup; in { - options.my.services.borg-backup = { + options.my.services.borg-backup = let inherit (lib) types; in { enable = mkEnableOption "Enable Borg backups for this host"; repo = mkOption { diff --git a/services/fail2ban.nix b/services/fail2ban.nix index 8f61796..ccc12f2 100644 --- a/services/fail2ban.nix +++ b/services/fail2ban.nix @@ -1,7 +1,11 @@ { config, lib, pkgs, ... }: -with lib; let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.fail2ban; in { options.my.services.fail2ban = { diff --git a/services/fava.nix b/services/fava.nix index de0d2d9..e283022 100644 --- a/services/fava.nix +++ b/services/fava.nix @@ -1,16 +1,20 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.fava; my = config.my; domain = config.networking.domain; secrets = config.my.secrets; in { - options.my.services.fava = { - enable = lib.mkEnableOption "Fava"; + options.my.services.fava = let inherit (lib) types; in { + enable = mkEnableOption "Fava"; home = mkOption { type = types.str; @@ -43,7 +47,6 @@ in User = "fava"; Group = "fava"; }; - path = with pkgs; []; }; users.users.fava = { diff --git a/services/gitea/default.nix b/services/gitea/default.nix index fc6b501..408d29d 100644 --- a/services/gitea/default.nix +++ b/services/gitea/default.nix @@ -1,14 +1,18 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.gitea; my = config.my; domain = config.networking.domain; in { - options.my.services.gitea = { + options.my.services.gitea = let inherit (lib) types; in { enable = mkEnableOption "Personal Git hosting with Gitea"; privatePort = mkOption { diff --git a/services/jellyfin.nix b/services/jellyfin.nix index 8a4df98..f485d65 100644 --- a/services/jellyfin.nix +++ b/services/jellyfin.nix @@ -1,8 +1,11 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.jellyfin; my = config.my; @@ -15,7 +18,7 @@ in { enable = mkEnableOption "Jellyfin"; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.jellyfin = { enable = true; group = "media"; diff --git a/services/lohr.nix b/services/lohr.nix index 6d760a3..d7442e8 100644 --- a/services/lohr.nix +++ b/services/lohr.nix @@ -1,8 +1,12 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.lohr; my = config.my; domain = config.networking.domain; @@ -14,8 +18,8 @@ let flake.defaultPackage."x86_64-linux"; # FIXME: use correct system in { - options.my.services.lohr = { - enable = lib.mkEnableOption "Lohr Mirroring Daemon"; + options.my.services.lohr = let inherit (lib) types; in { + enable = mkEnableOption "Lohr Mirroring Daemon"; home = mkOption { type = types.str; @@ -49,9 +53,7 @@ in User = "lohr"; Group = "lohr"; }; - path = with pkgs; [ - git - ]; + path = [ pkgs.git ]; }; users.users.lohr = { diff --git a/services/matrix.nix b/services/matrix.nix index dea5a4c..d5780b6 100644 --- a/services/matrix.nix +++ b/services/matrix.nix @@ -9,9 +9,13 @@ # { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.matrix; my = config.my; @@ -19,10 +23,10 @@ let clientPort = { public = 443; private = 11339; }; domain = config.networking.domain; in { - options.my.services.matrix = { - enable = lib.mkEnableOption "Matrix Synapse"; + options.my.services.matrix = let inherit (lib) types; in { + enable = mkEnableOption "Matrix Synapse"; - registration_shared_secret = lib.mkOption { + registration_shared_secret = mkOption { type = types.str; default = null; example = "deadbeef"; @@ -61,7 +65,7 @@ in { }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.postgresql = { enable = true; }; diff --git a/services/media.nix b/services/media.nix index 5b6b9ae..175319e 100644 --- a/services/media.nix +++ b/services/media.nix @@ -1,11 +1,17 @@ { config, lib, ... }: let - mediaServices = with config.my.services; [ - jellyfin - transmission - ]; + inherit (lib) + mkIf + ; + + mediaServices = builtins.attrValues { + inherit (config.my.services) + jellyfin + transmission + ; + }; needed = builtins.any (service: service.enable) mediaServices; in { - config.users.groups.media = lib.mkIf needed { }; + config.users.groups.media = mkIf needed { }; } diff --git a/services/miniflux.nix b/services/miniflux.nix index 43e51ca..0670711 100644 --- a/services/miniflux.nix +++ b/services/miniflux.nix @@ -1,14 +1,18 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.miniflux; my = config.my; domain = config.networking.domain; in { - options.my.services.miniflux = { + options.my.services.miniflux = let inherit (lib) types; in { enable = mkEnableOption "Serve a Miniflux instance"; adminCredentialsFile = mkOption { diff --git a/services/monitoring.nix b/services/monitoring.nix index 930743e..82e20fd 100644 --- a/services/monitoring.nix +++ b/services/monitoring.nix @@ -1,12 +1,16 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.monitoring; domain = config.networking.domain; in { - options.my.services.monitoring = { + options.my.services.monitoring = let inherit (lib) types; in { enable = mkEnableOption "Enable monitoring"; domain = mkOption { diff --git a/services/navidrome.nix b/services/navidrome.nix index b245ed5..bb350ff 100644 --- a/services/navidrome.nix +++ b/services/navidrome.nix @@ -1,12 +1,17 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + optional + ; + cfg = config.my.services.navidrome; domain = config.networking.domain; in { - options.my.services.navidrome = { + options.my.services.navidrome = let inherit (lib) types; in { enable = mkEnableOption "Navidrome"; musicFolder = { path = mkOption { @@ -17,7 +22,7 @@ in { }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.navidrome = { enable = true; settings = { diff --git a/services/nextcloud.nix b/services/nextcloud.nix index ec7627a..89a6bf5 100644 --- a/services/nextcloud.nix +++ b/services/nextcloud.nix @@ -3,6 +3,11 @@ # TODO: setup prometheus exporter let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.nextcloud; my = config.my; domain = config.networking.domain; @@ -10,10 +15,10 @@ let in { options.my.services.nextcloud = { - enable = lib.mkEnableOption "NextCloud"; + enable = mkEnableOption "NextCloud"; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.postgresql = { enable = true; @@ -73,7 +78,7 @@ in my.services.restic-backup = let nextcloudHome = config.services.nextcloud.home; - in lib.mkIf cfg.enable { + in mkIf cfg.enable { paths = [ nextcloudHome ]; exclude = [ # borg can fail if *.part files disappear during backup diff --git a/services/nginx.nix b/services/nginx.nix index cfb7da1..c765643 100644 --- a/services/nginx.nix +++ b/services/nginx.nix @@ -2,10 +2,15 @@ # # https://github.com/delroth/infra.delroth.net { config, lib, pkgs, ... }: +let + inherit (lib) + mkIf + ; +in { # Whenever something defines an nginx vhost, ensure that nginx defaults are # properly set. - config = lib.mkIf ((builtins.attrNames config.services.nginx.virtualHosts) != [ "localhost" ]) { + config = mkIf ((builtins.attrNames config.services.nginx.virtualHosts) != [ "localhost" ]) { services.nginx = { enable = true; statusPage = true; # For monitoring scraping. diff --git a/services/nuage.nix b/services/nuage.nix index 42aa36f..4c2e65a 100644 --- a/services/nuage.nix +++ b/services/nuage.nix @@ -1,14 +1,17 @@ { config, lib, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.nuage; my = config.my; in { options.my.services.nuage = { - enable = lib.mkEnableOption "Nuage redirect"; + enable = mkEnableOption "Nuage redirect"; }; config = mkIf cfg.enable { diff --git a/services/paperless.nix b/services/paperless.nix index b56450d..142ee13 100644 --- a/services/paperless.nix +++ b/services/paperless.nix @@ -1,8 +1,12 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.paperless; my = config.my; domain = config.networking.domain; @@ -10,8 +14,8 @@ let secretKeyFile = pkgs.writeText "paperless-secret-key-file.env" my.secrets.paperless.secretKey; in { - options.my.services.paperless = { - enable = lib.mkEnableOption "Paperless"; + options.my.services.paperless = let inherit (lib) types; in { + enable = mkEnableOption "Paperless"; port = mkOption { type = types.port; diff --git a/services/pipewire.nix b/services/pipewire.nix index e48ec2c..7f9a162 100644 --- a/services/pipewire.nix +++ b/services/pipewire.nix @@ -1,14 +1,18 @@ { config, lib, pkgs, options, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + optionalAttrs + ; + cfg = config.my.services.pipewire; my = config.my; in { options.my.services.pipewire = { - enable = lib.mkEnableOption "Pipewire sound backend"; + enable = mkEnableOption "Pipewire sound backend"; }; # HACK: services.pipewire.alsa doesn't exist on 20.09, avoid evaluating this @@ -69,6 +73,6 @@ in # FIXME: a shame pactl isn't available by itself, eventually this should be # replaced by pw-cli or a wrapper, I guess? - environment.systemPackages = with pkgs; [ pulseaudio ]; + environment.systemPackages = [ pkgs.pulseaudio ]; }); } diff --git a/services/postgresql-backup.nix b/services/postgresql-backup.nix index 94a60ef..c3642b7 100644 --- a/services/postgresql-backup.nix +++ b/services/postgresql-backup.nix @@ -1,8 +1,11 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.postgresql-backup; in { options.my.services.postgresql-backup = { diff --git a/services/restic-backup.nix b/services/restic-backup.nix index e83fdbc..a4ee271 100644 --- a/services/restic-backup.nix +++ b/services/restic-backup.nix @@ -1,16 +1,22 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + attrsets + concatStringsSep + mkEnableOption + mkIf + mkOption + optional + ; + cfg = config.my.services.restic-backup; secrets = config.my.secrets; - excludeArg = with builtins; with pkgs; - "--exclude-file=" + (writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); + excludeArg = "--exclude-file=" + (pkgs.writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); makePruneOpts = pruneOpts: attrsets.mapAttrsToList (name: value: "--keep-${name} ${toString value}") pruneOpts; in { - options.my.services.restic-backup = { + options.my.services.restic-backup = let inherit (lib) types; in { enable = mkEnableOption "Enable Restic backups for this host"; repo = mkOption { @@ -22,7 +28,7 @@ in { }; paths = mkOption { - type = with types; listOf str; + type = types.listOf types.str; default = [ ]; example = [ "/var/lib" @@ -32,7 +38,7 @@ in { }; exclude = mkOption { - type = with types; listOf str; + type = types.listOf types.str; default = [ ]; example = [ # very large paths @@ -71,7 +77,7 @@ in { environmentFile = "/root/restic/creds"; extraBackupArgs = [ "--verbose=2" ] - ++ optional (builtins.length cfg.exclude != 0) excludeArg; + ++ optional (builtins.length cfg.exclude != 0) excludeArg; timerConfig = { OnCalendar = "daily"; diff --git a/services/tailscale.nix b/services/tailscale.nix index d97af62..4da1d6b 100644 --- a/services/tailscale.nix +++ b/services/tailscale.nix @@ -1,16 +1,19 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.tailscale; in { options.my.services.tailscale = { - enable = lib.mkEnableOption "Tailscale"; + enable = mkEnableOption "Tailscale"; # NOTE: still have to do `tailscale up --advertise-exit-node` - exitNode = lib.mkEnableOption "Use as exit node"; + exitNode = mkEnableOption "Use as exit node"; }; config = mkIf cfg.enable { diff --git a/services/tgv.nix b/services/tgv.nix index eb6107e..295a672 100644 --- a/services/tgv.nix +++ b/services/tgv.nix @@ -1,14 +1,17 @@ { config, lib, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + ; + cfg = config.my.services.tgv; my = config.my; in { options.my.services.tgv = { - enable = lib.mkEnableOption "TGV redirect"; + enable = mkEnableOption "TGV redirect"; }; config = mkIf cfg.enable { diff --git a/services/transmission.nix b/services/transmission.nix index b55e0b8..5c6826b 100644 --- a/services/transmission.nix +++ b/services/transmission.nix @@ -1,5 +1,11 @@ { config, lib, ... }: let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.transmission; domain = config.networking.domain; @@ -11,7 +17,7 @@ let downloadBase = "/media/torrents/"; in { - options.my.services.transmission = with lib; { + options.my.services.transmission = let inherit (lib) types; in { enable = mkEnableOption "Transmission torrent client"; username = mkOption { @@ -28,7 +34,7 @@ in }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.transmission = { enable = true; group = "media"; diff --git a/services/vaultwarden.nix b/services/vaultwarden.nix index 751f51d..505678c 100644 --- a/services/vaultwarden.nix +++ b/services/vaultwarden.nix @@ -1,14 +1,18 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption + mkIf + mkOption + ; + cfg = config.my.services.vaultwarden; my = config.my; domain = config.networking.domain; in { - options.my.services.vaultwarden = { + options.my.services.vaultwarden = let inherit (lib) types; in { enable = mkEnableOption "Vaultwarden"; privatePort = mkOption {