Skip to content

Commit

Permalink
treewide: replace pkgs.lib with libEx
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Dec 31, 2023
1 parent 4612f1e commit f552d1f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions home-manager/desktop/i3/i3status-rust.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, libEx, pkgs, ... }:

let
cfg = config.home-manager.desktop.i3.i3status-rust;
Expand Down Expand Up @@ -95,7 +95,7 @@ in
block = "disk_space";
path = m;
info_type = "available";
format = " $icon ${pkgs.lib.shortPath m} $available ";
format = " $icon ${libEx.shortPath m} $available ";
})
cfg.mountPoints;

Expand Down
4 changes: 2 additions & 2 deletions home-manager/desktop/i3/picom.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, pkgs, lib, osConfig, ... }:
{ config, lib, libEx, osConfig, ... }:

{
options.home-manager.desktop.i3.picom.enable = lib.mkEnableOption "picom config" // {
Expand All @@ -8,7 +8,7 @@
config = lib.mkIf config.home-manager.desktop.i3.picom.enable {
services.picom = {
enable = true;
backend = if (pkgs.lib.isNvidia osConfig) then "glx" else "egl";
backend = if (libEx.isNvidia osConfig) then "glx" else "egl";
fade = true;
fadeDelta = 2;
vSync = true;
Expand Down
4 changes: 2 additions & 2 deletions home-manager/desktop/sway/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, osConfig, ... }:
{ config, lib, libEx, pkgs, osConfig, ... }:
let
# Aliases
alt = "Mod1";
Expand Down Expand Up @@ -124,7 +124,7 @@ in
gtk = true;
};

extraOptions = lib.optionals (pkgs.lib.isNvidia osConfig) [
extraOptions = lib.optionals (libEx.isNvidia osConfig) [
"--unsupported-gpu"
];
};
Expand Down
8 changes: 4 additions & 4 deletions home-manager/desktop/sway/waybar.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ pkgs, lib, config, ... }:
{ pkgs, lib, libEx, config, ... }:

let
cfg = config.home-manager.desktop.sway.waybar;
shortPathName = path: "disk#${pkgs.lib.shortPathWithSep "_" path}";
shortPathName = path: "disk#${libEx.shortPathWithSep "_" path}";
in
{
options.home-manager.desktop.sway.waybar = {
Expand Down Expand Up @@ -96,12 +96,12 @@ in
format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ];
};
} //
(pkgs.lib.recursiveMergeAttrs
(libEx.recursiveMergeAttrs
(map
(m: {
"${shortPathName m}" = {
inherit (cfg) interval;
format = " ${pkgs.lib.shortPath m}: {free}";
format = " ${libEx.shortPath m}: {free}";
path = m;
states = {
warning = 75;
Expand Down
16 changes: 9 additions & 7 deletions lib/flake-helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ in
nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ../hosts/${hostname} ] ++ extraModules;
lib = nixpkgs.lib.extend (final: prev:
(import ../lib { lib = final; })
);
specialArgs.flake = self;
specialArgs = {
flake = self;
libEx = nixpkgs.lib.extend (final: prev:
(import ../lib { lib = final; })
);
};
};

apps.${pkgs.system} = {
Expand Down Expand Up @@ -107,11 +109,11 @@ in
imports = [ configuration ];
})
] ++ extraModules;
lib = nixpkgs.lib.extend (final: prev:
(import ../lib { lib = final; })
);
extraSpecialArgs = {
flake = self;
libEx = nixpkgs.lib.extend (final: prev:
(import ../lib { lib = final; })
);
osConfig = {
device.type = deviceType;
mainUser.username = username;
Expand Down
6 changes: 4 additions & 2 deletions nixos/home.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, flake, pkgs, ... }:
{ config, lib, libEx, flake, pkgs, ... }:

let
cfg = config.nixos.home;
Expand All @@ -25,7 +25,9 @@ in
users.${config.mainUser.username} = {
inherit (config.nixos.home) imports;
};
extraSpecialArgs = { inherit flake; };
extraSpecialArgs = {
inherit flake libEx;
};
};

# Define a user account. Don't forget to set a password with ‘passwd’.
Expand Down
2 changes: 1 addition & 1 deletion overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ final: prev:

{
# namespaces
lib = prev.lib.extend (finalLib: prevLib:
libEx = prev.lib.extend (finalLib: prevLib:
(import ../lib { lib = finalLib; })
);

Expand Down

0 comments on commit f552d1f

Please sign in to comment.