mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
treewide: remove with lib (#6512)
* nixos: remove with lib * nix-darwin: remove with lib * home-manager: remove with lib * modules/accounts: remove with lib * modules/config: remove with lib * modules/i18n: remove with lib * modules/misc: remove with lib * modules: remove with lib * modules/targets: remove with lib * tests/modules/firefox: remove with lib * tests/modules/services: remove with lib
This commit is contained in:
parent
83f4629364
commit
95711f9266
62 changed files with 618 additions and 666 deletions
|
|
@ -1,8 +1,7 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (lib) mkDefault mkEnableOption mkOption types;
|
||||
|
||||
cfg = config.home.pointerCursor;
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ let
|
|||
options = {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
example = literalExpression "pkgs.vanilla-dmz";
|
||||
example = lib.literalExpression "pkgs.vanilla-dmz";
|
||||
description = "Package providing the cursor theme.";
|
||||
};
|
||||
|
||||
|
|
@ -64,8 +63,9 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${
|
||||
escapeShellArg cfg.x11.defaultCursor
|
||||
cursorPath =
|
||||
"${cfg.package}/share/icons/${lib.escapeShellArg cfg.name}/cursors/${
|
||||
lib.escapeShellArg cfg.x11.defaultCursor
|
||||
}";
|
||||
|
||||
defaultIndexThemePackage = pkgs.writeTextFile {
|
||||
|
|
@ -83,25 +83,25 @@ let
|
|||
};
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.league ];
|
||||
meta.maintainers = [ lib.maintainers.league ];
|
||||
|
||||
imports = [
|
||||
(mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [
|
||||
(lib.mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [
|
||||
"home"
|
||||
"pointerCursor"
|
||||
"package"
|
||||
])
|
||||
(mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [
|
||||
(lib.mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [
|
||||
"home"
|
||||
"pointerCursor"
|
||||
"name"
|
||||
])
|
||||
(mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [
|
||||
(lib.mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [
|
||||
"home"
|
||||
"pointerCursor"
|
||||
"size"
|
||||
])
|
||||
(mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
|
||||
(lib.mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
|
||||
"home"
|
||||
"pointerCursor"
|
||||
"x11"
|
||||
|
|
@ -109,8 +109,8 @@ in {
|
|||
])
|
||||
|
||||
({ ... }: {
|
||||
warnings = optional (any (x:
|
||||
getAttrFromPath
|
||||
warnings = lib.optional (lib.any (x:
|
||||
lib.getAttrFromPath
|
||||
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
|
||||
options) [ "package" "name" "size" "defaultCursor" ]) ''
|
||||
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
|
||||
|
|
@ -144,10 +144,11 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg != null) (mkMerge [
|
||||
config = lib.mkIf (cfg != null) (lib.mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
(hm.assertions.assertPlatform "home.pointerCursor" pkgs platforms.linux)
|
||||
(lib.hm.assertions.assertPlatform "home.pointerCursor" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package defaultIndexThemePackage ];
|
||||
|
|
@ -178,7 +179,7 @@ in {
|
|||
"${cfg.package}/share/icons/${cfg.name}";
|
||||
}
|
||||
|
||||
(mkIf cfg.x11.enable {
|
||||
(lib.mkIf cfg.x11.enable {
|
||||
xsession.profileExtra = ''
|
||||
${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${
|
||||
toString cfg.size
|
||||
|
|
@ -191,11 +192,11 @@ in {
|
|||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.gtk.enable {
|
||||
(lib.mkIf cfg.gtk.enable {
|
||||
gtk.cursorTheme = mkDefault { inherit (cfg) package name size; };
|
||||
})
|
||||
|
||||
(mkIf cfg.hyprcursor.enable {
|
||||
(lib.mkIf cfg.hyprcursor.enable {
|
||||
home.sessionVariables = {
|
||||
HYPRCURSOR_THEME = cfg.name;
|
||||
HYPRCURSOR_SIZE =
|
||||
|
|
@ -203,7 +204,7 @@ in {
|
|||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.sway.enable {
|
||||
(lib.mkIf cfg.sway.enable {
|
||||
wayland.windowManager.sway = {
|
||||
config = {
|
||||
seat = {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (config.i18n) glibcLocales;
|
||||
|
||||
|
|
@ -27,19 +25,19 @@ let
|
|||
archivePath = "${glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
# lookup the version of glibcLocales and set the appropriate environment vars
|
||||
localeVars = if versionAtLeast version "2.27" then {
|
||||
localeVars = if lib.versionAtLeast version "2.27" then {
|
||||
LOCALE_ARCHIVE_2_27 = archivePath;
|
||||
} else if versionAtLeast version "2.11" then {
|
||||
} else if lib.versionAtLeast version "2.11" then {
|
||||
LOCALE_ARCHIVE_2_11 = archivePath;
|
||||
} else
|
||||
{ };
|
||||
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ midchildan ];
|
||||
meta.maintainers = with lib.maintainers; [ midchildan ];
|
||||
|
||||
options = {
|
||||
i18n.glibcLocales = mkOption {
|
||||
type = types.path;
|
||||
i18n.glibcLocales = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
Customized `glibcLocales` package providing
|
||||
the `LOCALE_ARCHIVE_*` environment variable.
|
||||
|
|
@ -50,7 +48,7 @@ in {
|
|||
will be set to {var}`i18n.glibcLocales` from the
|
||||
system configuration.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
pkgs.glibcLocales.override {
|
||||
allLocales = false;
|
||||
locales = [ "en_US.UTF-8/UTF-8" ];
|
||||
|
|
@ -58,11 +56,11 @@ in {
|
|||
'';
|
||||
# NB. See nixos/default.nix for NixOS default.
|
||||
default = pkgs.glibcLocales;
|
||||
defaultText = literalExpression "pkgs.glibcLocales";
|
||||
defaultText = lib.literalExpression "pkgs.glibcLocales";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
|
||||
config = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
|
||||
# For shell sessions.
|
||||
home.sessionVariables = localeVars;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue