From 1c41ac13d31a92b3b27758672d3ee987bce18a33 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Mon, 6 Jan 2025 20:18:21 -0800 Subject: [PATCH 1/3] treewide: use lib.singleton reduces indent depth, recommended by [rfc 0166](https://github.com/NixOS/rfcs/blob/master/rfcs/0166-nix-formatting.md#singleton-lists) --- docs/src/options/hm.md | 4 ++-- docs/src/testbeds.md | 4 ++-- modules/alacritty/testbed.nix | 16 +++++++--------- modules/emacs/testbed.nix | 14 ++++++-------- modules/firefox/testbed.nix | 20 +++++++++----------- modules/foot/testbed.nix | 16 +++++++--------- modules/ghostty/testbed.nix | 16 +++++++--------- modules/hyprland/testbed.nix | 16 +++++++--------- modules/kitty/testbed.nix | 16 +++++++--------- modules/qutebrowser/testbed.nix | 16 +++++++--------- modules/vscode/testbed.nix | 16 +++++++--------- modules/wezterm/testbed.nix | 16 +++++++--------- modules/yazi/testbed.nix | 22 ++++++++++------------ modules/zathura/testbed.nix | 16 +++++++--------- 14 files changed, 92 insertions(+), 116 deletions(-) diff --git a/docs/src/options/hm.md b/docs/src/options/hm.md index 99b63fef9..39256cce7 100644 --- a/docs/src/options/hm.md +++ b/docs/src/options/hm.md @@ -6,9 +6,9 @@ If you combined Home Manager with your NixOS configuration, write these options within a Home Manager section, either for all users: ```nix -home-manager.sharedModules = [{ +home-manager.sharedModules = lib.singleton { stylix.targets.xyz.enable = false; -}]; +}; ``` Or for a specific user: diff --git a/docs/src/testbeds.md b/docs/src/testbeds.md index d362ec483..c6f3683ba 100644 --- a/docs/src/testbeds.md +++ b/docs/src/testbeds.md @@ -28,9 +28,9 @@ Home Manager module within the NixOS module using the following format: ```nix { - home-manager.sharedModules = [{ + home-manager.sharedModules = lib.singleton { # Write Home Manager options here - }]; + }; } ``` diff --git a/modules/alacritty/testbed.nix b/modules/alacritty/testbed.nix index 602273f5d..7c78e033c 100644 --- a/modules/alacritty/testbed.nix +++ b/modules/alacritty/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.alacritty; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.alacritty = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.alacritty = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/emacs/testbed.nix b/modules/emacs/testbed.nix index ad4116ba6..9480d0446 100644 --- a/modules/emacs/testbed.nix +++ b/modules/emacs/testbed.nix @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.emacs = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.emacs = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/firefox/testbed.nix b/modules/firefox/testbed.nix index fb10610e4..8738d2e32 100644 --- a/modules/firefox/testbed.nix +++ b/modules/firefox/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.firefox; @@ -11,15 +11,13 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.firefox = { - enable = true; - inherit package; - profiles.stylix.isDefault = true; - }; + home-manager.sharedModules = lib.singleton { + programs.firefox = { + enable = true; + inherit package; + profiles.stylix.isDefault = true; + }; - stylix.targets.firefox.profileNames = [ "stylix" ]; - } - ]; + stylix.targets.firefox.profileNames = [ "stylix" ]; + }; } diff --git a/modules/foot/testbed.nix b/modules/foot/testbed.nix index 072bc27db..fd423558e 100644 --- a/modules/foot/testbed.nix +++ b/modules/foot/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.foot; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.foot = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.foot = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/ghostty/testbed.nix b/modules/ghostty/testbed.nix index 5005de13e..e004e60b9 100644 --- a/modules/ghostty/testbed.nix +++ b/modules/ghostty/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.ghostty; in @@ -9,12 +9,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.ghostty = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.ghostty = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/hyprland/testbed.nix b/modules/hyprland/testbed.nix index 12ce63c95..d216bf264 100644 --- a/modules/hyprland/testbed.nix +++ b/modules/hyprland/testbed.nix @@ -4,14 +4,12 @@ environment.loginShellInit = lib.getExe pkgs.hyprland; programs.hyprland.enable = true; - home-manager.sharedModules = [ - { - wayland.windowManager.hyprland = { - enable = true; + home-manager.sharedModules = lib.singleton { + wayland.windowManager.hyprland = { + enable = true; - # We need something to open a window so that we can check the window borders - settings.bind = [ "ALT, RETURN, exec, ${lib.getExe pkgs.foot}" ]; - }; - } - ]; + # We need something to open a window so that we can check the window borders + settings.bind = [ "ALT, RETURN, exec, ${lib.getExe pkgs.foot}" ]; + }; + }; } diff --git a/modules/kitty/testbed.nix b/modules/kitty/testbed.nix index 3f610764d..dc9f34030 100644 --- a/modules/kitty/testbed.nix +++ b/modules/kitty/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.kitty; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.kitty = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.kitty = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/qutebrowser/testbed.nix b/modules/qutebrowser/testbed.nix index 1ef1c6c77..b7d4363ba 100644 --- a/modules/qutebrowser/testbed.nix +++ b/modules/qutebrowser/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.qutebrowser; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.qutebrowser = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.qutebrowser = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/vscode/testbed.nix b/modules/vscode/testbed.nix index 54085738d..5bb27532c 100644 --- a/modules/vscode/testbed.nix +++ b/modules/vscode/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: # We are using VSCodium because VSCode is an unfree package let @@ -12,12 +12,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.vscode = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.vscode = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/wezterm/testbed.nix b/modules/wezterm/testbed.nix index 67a88638f..9665ec266 100644 --- a/modules/wezterm/testbed.nix +++ b/modules/wezterm/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.wezterm; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.wezterm = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.wezterm = { + enable = true; + inherit package; + }; + }; } diff --git a/modules/yazi/testbed.nix b/modules/yazi/testbed.nix index e7f33260c..9372b3165 100644 --- a/modules/yazi/testbed.nix +++ b/modules/yazi/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.yazi; @@ -11,16 +11,14 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.yazi = { - enable = true; - inherit package; - }; + home-manager.sharedModules = lib.singleton { + programs.yazi = { + enable = true; + inherit package; + }; - home.packages = [ - pkgs.nerd-fonts.fira-mono - ]; - } - ]; + home.packages = [ + pkgs.nerd-fonts.fira-mono + ]; + }; } diff --git a/modules/zathura/testbed.nix b/modules/zathura/testbed.nix index 861bfa088..3989452a2 100644 --- a/modules/zathura/testbed.nix +++ b/modules/zathura/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.zathura; @@ -11,12 +11,10 @@ in inherit package; }; - home-manager.sharedModules = [ - { - programs.zathura = { - enable = true; - inherit package; - }; - } - ]; + home-manager.sharedModules = lib.singleton { + programs.zathura = { + enable = true; + inherit package; + }; + }; } From d82fa0db5ac85bc5dc1b3c8a63d90ed7c788c9cd Mon Sep 17 00:00:00 2001 From: awwpotato Date: Mon, 6 Jan 2025 20:26:48 -0800 Subject: [PATCH 2/3] emacs: forgot to import lib --- modules/emacs/testbed.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/emacs/testbed.nix b/modules/emacs/testbed.nix index 9480d0446..346920bd5 100644 --- a/modules/emacs/testbed.nix +++ b/modules/emacs/testbed.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let package = pkgs.emacs; From d92e3349563b6f47b69ea5ae8f3c30c3594bcc2c Mon Sep 17 00:00:00 2001 From: awwpotato Date: Tue, 7 Jan 2025 12:26:50 -0800 Subject: [PATCH 3/3] docs: don't use lib.singleton --- docs/src/options/hm.md | 4 ++-- docs/src/testbeds.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/options/hm.md b/docs/src/options/hm.md index 39256cce7..99b63fef9 100644 --- a/docs/src/options/hm.md +++ b/docs/src/options/hm.md @@ -6,9 +6,9 @@ If you combined Home Manager with your NixOS configuration, write these options within a Home Manager section, either for all users: ```nix -home-manager.sharedModules = lib.singleton { +home-manager.sharedModules = [{ stylix.targets.xyz.enable = false; -}; +}]; ``` Or for a specific user: diff --git a/docs/src/testbeds.md b/docs/src/testbeds.md index c6f3683ba..d362ec483 100644 --- a/docs/src/testbeds.md +++ b/docs/src/testbeds.md @@ -28,9 +28,9 @@ Home Manager module within the NixOS module using the following format: ```nix { - home-manager.sharedModules = lib.singleton { + home-manager.sharedModules = [{ # Write Home Manager options here - }; + }]; } ```