feat: convert the rest of the configs to hjem

This commit is contained in:
uku 2025-05-08 12:20:30 +02:00
parent 689c291762
commit 63d99f2062
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
10 changed files with 361 additions and 293 deletions

View file

@ -1,5 +1,8 @@
{ {
lib,
pkgs, pkgs,
config,
_utils,
... ...
}: }:
{ {
@ -29,9 +32,11 @@
programs.light.enable = true; programs.light.enable = true;
# hyprland stuff # hyprland stuff
# services.blueman = lib.mkIf config.programs.hyprland.enable { enable = true; }; services.blueman = lib.mkIf config.programs.hyprland.enable { enable = true; };
# hm.wayland.windowManager.hyprland.settings.exec-once = with pkgs; [ hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf {
# "${lib.getExe networkmanagerapplet}" exec-once = with pkgs; [
# "${lib.getExe' blueman "blueman-applet"}" "${lib.getExe networkmanagerapplet}"
# ]; "${lib.getExe' blueman "blueman-applet"}"
];
};
} }

View file

@ -111,4 +111,62 @@
alias = builtins.toString (pkgs.writeTextDir filename content) + "/"; alias = builtins.toString (pkgs.writeTextDir filename content) + "/";
tryFiles = "${filename} =${builtins.toString status}"; tryFiles = "${filename} =${builtins.toString status}";
}; };
# https://github.com/nix-community/home-manager/blob/ec71b5162848e6369bdf2be8d2f1dd41cded88e8/modules/lib/generators.nix#L4-L61
toHyprconf =
attrs:
let
inherit (lib)
all
concatMapStringsSep
concatStrings
concatStringsSep
filterAttrs
foldl
generators
hasPrefix
isAttrs
isList
mapAttrsToList
replicate
;
indentLevel = 0;
importantPrefixes = [ "$" ];
initialIndent = concatStrings (replicate indentLevel " ");
toHyprconf' =
indent: attrs:
let
sections = filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs;
mkSection =
n: attrs:
if lib.isList attrs then
(concatMapStringsSep "\n" (a: mkSection n a) attrs)
else
''
${indent}${n} {
${toHyprconf' " ${indent}" attrs}${indent}}
'';
mkFields = generators.toKeyValue {
listsAsDuplicateKeys = true;
inherit indent;
};
allFields = filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) attrs;
isImportantField =
n: _: foldl (acc: prev: if hasPrefix prev n then true else acc) false importantPrefixes;
importantFields = filterAttrs isImportantField allFields;
fields = builtins.removeAttrs allFields (mapAttrsToList (n: _: n) importantFields);
in
mkFields importantFields
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
+ mkFields fields;
in
toHyprconf' initialIndent attrs;
} }

View file

@ -3,24 +3,23 @@
pkgs, pkgs,
... ...
}: }:
{ let
hm.programs.alacritty = toml = pkgs.formats.toml { };
let
theme = pkgs.fetchurl { theme = pkgs.fetchurl {
# url = "https://raw.githubusercontent.com/catppuccin/alacritty/ce476fb41f307d90f841c1a4fd7f0727c21248b2/catppuccin-macchiato.toml"; # url = "https://raw.githubusercontent.com/catppuccin/alacritty/ce476fb41f307d90f841c1a4fd7f0727c21248b2/catppuccin-macchiato.toml";
url = "https://raw.githubusercontent.com/rose-pine/alacritty/3c3e36eb5225b0eb6f1aa989f9d9e783a5b47a83/dist/rose-pine.toml"; url = "https://raw.githubusercontent.com/rose-pine/alacritty/3c3e36eb5225b0eb6f1aa989f9d9e783a5b47a83/dist/rose-pine.toml";
hash = "sha256-MheSmzz02ZLAOS2uaclyazu6E//eikcdFydFfkio0/U="; hash = "sha256-MheSmzz02ZLAOS2uaclyazu6E//eikcdFydFfkio0/U=";
}; };
themeAttr = builtins.fromTOML (builtins.readFile theme); themeAttr = builtins.fromTOML (builtins.readFile theme);
in in
{ {
enable = true; hj.".config/alacritty/alacritty.toml".source = toml.generate "alacritty.toml" (
settings = lib.recursiveUpdate themeAttr { lib.recursiveUpdate themeAttr {
font = { font = {
normal.family = "Iosevka Nerd Font"; normal.family = "Iosevka Nerd Font";
size = 12; size = 12;
}; };
}; }
}; );
} }

View file

@ -1,7 +1,8 @@
{ lib, pkgs, ... }:
{ {
hm.programs.fuzzel = { environment.systemPackages = [ pkgs.fuzzel ];
enable = true;
settings = { hj.".config/fuzzel/fuzzel.ini".text = lib.generators.toINI { } {
main = { main = {
font = "Iosevka Nerd Font:size=16"; font = "Iosevka Nerd Font:size=16";
dpi-aware = false; dpi-aware = false;
@ -20,5 +21,4 @@
selection-match = "40a02bff"; # latte green selection-match = "40a02bff"; # latte green
}; };
}; };
};
} }

View file

@ -1,8 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
# utility packages for hyprland, since you know it's not a DE # utility packages for hyprland, since you know it's not a DE
environment.systemPackages = with pkgs; [
hm.home.packages = with pkgs; [
gnome.gnome-calculator gnome.gnome-calculator
mate.eom mate.eom
nwg-look nwg-look

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
pkgs, pkgs,
_utils,
... ...
}: }:
{ {
@ -23,8 +24,7 @@
xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
hm = { environment.systemPackages = with pkgs; [
home.packages = with pkgs; [
hyprpaper hyprpaper
hyprpicker hyprpicker
wl-clipboard wl-clipboard
@ -36,9 +36,7 @@
polkit_gnome polkit_gnome
]; ];
wayland.windowManager.hyprland = { hj.".config/hypr/hyprland.conf".text =
enable = true;
settings =
let let
inherit (lib) getExe getExe'; inherit (lib) getExe getExe';
keys = [ keys = [
@ -55,7 +53,7 @@
]; ];
in in
with pkgs; with pkgs;
{ _utils.toHyprconf {
"$mod" = "SUPER"; "$mod" = "SUPER";
"$wl-paste" = getExe' wl-clipboard "wl-paste"; "$wl-paste" = getExe' wl-clipboard "wl-paste";
"$wpctl" = getExe' wireplumber "wpctl"; "$wpctl" = getExe' wireplumber "wpctl";
@ -185,6 +183,4 @@
"$mod SHIFT, mouse:272, resizewindow" "$mod SHIFT, mouse:272, resizewindow"
]; ];
}; };
};
};
} }

View file

@ -1,13 +1,24 @@
{ lib, pkgs, ... }:
let
toml = pkgs.formats.toml { };
in
{ {
hm.programs.starship = { environment.systemPackages = [ pkgs.starship ];
enable = true;
settings = { hj = {
".config/starship.toml" =
toml.generate "starship.toml" {
add_newline = false; add_newline = false;
directory = { directory = {
truncation_length = 3; truncation_length = 3;
truncation_symbol = "/"; truncation_symbol = "/";
}; };
} // (import ./nerd-font.nix); }
// (import ./nerd-font.nix);
".config/fish/config.fish".text = lib.mkAfter ''
starship init fish | source
'';
}; };
} }

View file

@ -5,12 +5,12 @@
... ...
}: }:
{ {
hm.programs.waybar = { environment.systemPackages = [ pkgs.waybar ];
enable = true;
style = ./style.css;
settings = [ hj = {
{ ".config/waybar/style.css".source = ./style.css;
".config/waybar/config".text = builtins.toJSON {
position = "bottom"; position = "bottom";
layer = "top"; layer = "top";
height = 24; height = 24;
@ -91,7 +91,6 @@
return-type = ""; return-type = "";
interval = 2; interval = 2;
}; };
} };
];
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, _utils, ... }:
{ {
imports = [ imports = [
./nvidia.nix ./nvidia.nix
@ -11,14 +11,12 @@
wineWowPackages.waylandFull wineWowPackages.waylandFull
]; ];
# hm = { hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf {
# wayland.windowManager.hyprland.settings = { monitor = "DP-1,3840x2160@144,0x0,1.5";
# monitor = "DP-1,3840x2160@144,0x0,1.5"; xwayland.force_zero_scaling = true;
# xwayland.force_zero_scaling = true; env = [
# env = [ "GDK_SCALE,1.5"
# "GDK_SCALE,1.5" "XCURSOR_SIZE,24"
# "XCURSOR_SIZE,24" ];
# ]; };
# };
# };
} }

View file

@ -2,6 +2,7 @@
lib, lib,
pkgs, pkgs,
config, config,
_utils,
... ...
}: }:
{ {
@ -37,10 +38,12 @@
}; };
}; };
# hm.wayland.windowManager.hyprland.settings.env = [ hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf {
# "XDG_SESSION_TYPE,wayland" env = [
# "GBM_BACKEND,nvidia-drm" "XDG_SESSION_TYPE,wayland"
# "__GLX_VENDOR_LIBRARY_NAME,nvidia" "GBM_BACKEND,nvidia-drm"
# "NVD_BACKEND,direct" "__GLX_VENDOR_LIBRARY_NAME,nvidia"
# ]; "NVD_BACKEND,direct"
];
};
} }