refactored
This commit is contained in:
parent
346c1fd1de
commit
85eaf56a0c
8 changed files with 166 additions and 272 deletions
|
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
t = config.theme;
|
||||
in {
|
||||
environment.shellInit = ''
|
||||
if [ -d "$HOME/.cargo/bin" ]; then
|
||||
export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
|
@ -13,6 +16,9 @@
|
|||
EDITOR = "nvim";
|
||||
VISUAL = "nvim";
|
||||
TERM = "ghostty";
|
||||
BROWSER = "thorium";
|
||||
XCURSOR_THEME = t.cursorName;
|
||||
XCURSOR_SIZE = toString t.cursorSize;
|
||||
CC = "${pkgs.gcc}/bin/gcc";
|
||||
LUA_PATH = "${pkgs.luajit}/share/lua/5.1/?.lua;${pkgs.luajit}/share/lua/5.1/?/init.lua;;";
|
||||
LUA_CPATH = "${pkgs.luajit}/lib/lua/5.1/?.so;;";
|
||||
|
|
@ -54,6 +60,8 @@
|
|||
environment.pathsToLink = [
|
||||
"/share/fish"
|
||||
"/bin"
|
||||
"/share/icons"
|
||||
"/share/pixmaps"
|
||||
];
|
||||
|
||||
programs.direnv = {
|
||||
|
|
|
|||
52
hosts/modules/gtk.nix
Normal file
52
hosts/modules/gtk.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
t = config.theme;
|
||||
cursorName = t.cursorName;
|
||||
cursorSize = toString t.cursorSize;
|
||||
gtkTheme = t.gtkTheme;
|
||||
iconTheme = t.iconTheme;
|
||||
fontName = t.fontName;
|
||||
in {
|
||||
environment.etc = {
|
||||
"gtk-2.0/gtkrc".text = ''
|
||||
gtk-theme-name=${gtkTheme}
|
||||
gtk-icon-theme-name=${iconTheme}
|
||||
gtk-font-name=${fontName}
|
||||
gtk-cursor-theme-name=${cursorName}
|
||||
gtk-cursor-theme-size=${cursorSize}
|
||||
'';
|
||||
"gtk-3.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=1
|
||||
gtk-theme-name=${gtkTheme}
|
||||
gtk-icon-theme-name=${iconTheme}
|
||||
gtk-font-name=${fontName}
|
||||
gtk-cursor-theme-name=${cursorName}
|
||||
gtk-cursor-theme-size=${cursorSize}
|
||||
'';
|
||||
"gtk-4.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=1
|
||||
gtk-theme-name=${gtkTheme}
|
||||
gtk-icon-theme-name=${iconTheme}
|
||||
gtk-font-name=${fontName}
|
||||
gtk-cursor-theme-name=${cursorName}
|
||||
gtk-cursor-theme-size=${cursorSize}
|
||||
'';
|
||||
};
|
||||
|
||||
programs.dconf.enable = true;
|
||||
programs.dconf.profiles.user.databases = [
|
||||
{
|
||||
settings."org/gnome/desktop/interface" = {
|
||||
gtk-theme = gtkTheme;
|
||||
icon-theme = iconTheme;
|
||||
cursor-theme = cursorName;
|
||||
font-name = fontName;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
i3dotfiles,
|
||||
...
|
||||
}: let
|
||||
wallpaperDir = "/home/cobray/wallpapers";
|
||||
|
||||
randomWallpaper = pkgs.writeShellScript "wallpaper.sh" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -e
|
||||
BG_DIR="/var/lib/lightdm-background"
|
||||
BG_LINK="''$BG_DIR/random-wallpaper.png"
|
||||
LAST_WALLPAPER="''$BG_DIR/.last-wallpaper"
|
||||
WALLPAPER_DIR="${wallpaperDir}"
|
||||
|
||||
mkdir -p "''$BG_DIR"
|
||||
rm -f "''$BG_LINK"
|
||||
mapfile -t WALLPAPERS < <(${pkgs.findutils}/bin/find "''$WALLPAPER_DIR" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \))
|
||||
COUNT=''${#WALLPAPERS[@]}
|
||||
if [[ "''$COUNT" -eq 0 ]]; then
|
||||
cp -f "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" "''$BG_LINK"
|
||||
echo "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" > "''$LAST_WALLPAPER"
|
||||
chown lightdm:lightdm "''$BG_LINK" "''$LAST_WALLPAPER"
|
||||
exit 0
|
||||
fi
|
||||
RAND=$(${pkgs.coreutils}/bin/shuf -i 0-''$((COUNT - 1)) -n 1)
|
||||
SELECT=''${WALLPAPERS[''$RAND]}
|
||||
cp -f "''$SELECT" "''$BG_LINK"
|
||||
echo "''$SELECT" > "''$LAST_WALLPAPER"
|
||||
chown lightdm:lightdm "''$BG_LINK" "''$LAST_WALLPAPER"
|
||||
'';
|
||||
in {
|
||||
services.xserver.enable = true;
|
||||
services.xserver.xkb = {
|
||||
layout = "us";
|
||||
variant = "";
|
||||
};
|
||||
|
||||
services.xserver.windowManager.i3 = {
|
||||
enable = true;
|
||||
package = pkgs.i3-gaps;
|
||||
extraSessionCommands = ''
|
||||
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
|
||||
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
|
||||
fi
|
||||
|
||||
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
|
||||
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface gtk-theme "Tokyonight-Dark"
|
||||
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface icon-theme "candy-icons"
|
||||
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface cursor-theme "capitaine-cursors"
|
||||
cat > $HOME/.config/xsettingsd << EOF
|
||||
Net/ThemeName "Tokyonight-Dark"
|
||||
Net/IconThemeName "candy-icons"
|
||||
Gtk/CursorThemeName "capitaine-cursors"
|
||||
EOF
|
||||
killall xsettingsd || true
|
||||
${pkgs.xsettingsd}/bin/xsettingsd &
|
||||
'';
|
||||
};
|
||||
|
||||
services.xserver.desktopManager.xfce = {
|
||||
enable = true;
|
||||
noDesktop = true;
|
||||
enableXfwm = false;
|
||||
};
|
||||
|
||||
services.xserver.displayManager.lightdm = {
|
||||
enable = true;
|
||||
background = "/var/lib/lightdm-background/random-wallpaper.png";
|
||||
greeters.gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
package = pkgs.tokyonight-gtk-theme;
|
||||
name = "Tokyonight-Dark";
|
||||
};
|
||||
iconTheme = {
|
||||
package = pkgs.candy-icons;
|
||||
name = "candy-icons";
|
||||
};
|
||||
cursorTheme = {
|
||||
package = pkgs.capitaine-cursors;
|
||||
name = "capitaine-cursors";
|
||||
};
|
||||
extraConfig = ''
|
||||
[greeter]
|
||||
greeting = Welcome back, Traveller
|
||||
font-name=Clear Sans 10
|
||||
cursor-theme-name=capitaine-cursors
|
||||
icon-theme-name=candy-icons
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/lightdm-background 0755 lightdm lightdm - -"
|
||||
"d ${wallpaperDir} 0755 cobray users - -"
|
||||
"f /var/log/random-wallpaper.log 0644 root root - -"
|
||||
];
|
||||
|
||||
systemd.services.random-wallpaper = {
|
||||
description = "Update wallpaper to a random image";
|
||||
before = ["display-manager.service"];
|
||||
wantedBy = ["display-manager.service"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${randomWallpaper}";
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.random-wallpaper = {
|
||||
description = "Daily wallpaper refresh for LightDM";
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.displayManager.defaultSession = "xfce+i3";
|
||||
services.displayManager.autoLogin = {
|
||||
enable = true;
|
||||
user = "cobray";
|
||||
};
|
||||
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme = "qt5ct";
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"xdg/i3/config" = {
|
||||
source = "${i3dotfiles}/i3/config";
|
||||
mode = "0644";
|
||||
};
|
||||
"gtk-2.0/gtkrc".text = ''
|
||||
gtk-theme-name="Tokyonight-Dark"
|
||||
gtk-icon-theme-name="candy-icons"
|
||||
gtk-font-name="Clear Sans 10"
|
||||
gtk-cursor-theme-name="capitaine-cursors"
|
||||
gtk-cursor-theme-size=24
|
||||
'';
|
||||
"gtk-3.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=1
|
||||
gtk-theme-name=Tokyonight-Dark
|
||||
gtk-icon-theme-name=candy-icons
|
||||
gtk-font-name=Clear Sans 10
|
||||
gtk-cursor-theme-name=capitaine-cursors
|
||||
gtk-cursor-theme-size=24
|
||||
'';
|
||||
"gtk-4.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-application-prefer-dark-theme=1
|
||||
gtk-theme-name=Tokyonight-Dark
|
||||
gtk-icon-theme-name=candy-icons
|
||||
gtk-font-name=Clear Sans 10
|
||||
gtk-cursor-theme-name=capitaine-cursors
|
||||
gtk-cursor-theme-size=24
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
dmenu
|
||||
i3status
|
||||
i3lock-color
|
||||
i3blocks
|
||||
picom
|
||||
feh
|
||||
rofi
|
||||
dunst
|
||||
polybar
|
||||
i3-auto-layout
|
||||
mpv
|
||||
yt-dlp
|
||||
flameshot
|
||||
imagemagick
|
||||
slop
|
||||
ghostscript
|
||||
via
|
||||
arandr
|
||||
xclip
|
||||
xsettingsd
|
||||
lxappearance
|
||||
gsettings-desktop-schemas
|
||||
adwaita-qt
|
||||
candy-icons
|
||||
capitaine-cursors
|
||||
tokyonight-gtk-theme
|
||||
hicolor-icon-theme
|
||||
adwaita-icon-theme
|
||||
kdePackages.breeze-icons
|
||||
gnome-themes-extra
|
||||
findutils
|
||||
coreutils
|
||||
];
|
||||
|
||||
environment.pathsToLink = [
|
||||
"/share/icons"
|
||||
"/share/pixmaps"
|
||||
];
|
||||
|
||||
services.xserver.desktopManager.session = [
|
||||
{
|
||||
name = "xfce+i3";
|
||||
start = ''
|
||||
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
|
||||
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
|
||||
fi
|
||||
export XDG_DATA_DIRS="${pkgs.tokyonight-gtk-theme}/share:${pkgs.candy-icons}/share:${pkgs.hicolor-icon-theme}/share:${pkgs.adwaita-icon-theme}/share:$XDG_DATA_DIRS"
|
||||
${pkgs.xfce.xfce4-session}/bin/xfce4-session --with-ck-launch &
|
||||
${pkgs.i3-gaps}/bin/i3
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
programs.dconf.enable = true;
|
||||
programs.dconf.profiles.user.databases = [
|
||||
{
|
||||
settings = {
|
||||
"org/gnome/desktop/interface" = {
|
||||
icon-theme = "candy-icons";
|
||||
gtk-theme = "Tokyonight-Dark";
|
||||
cursor-theme = "capitaine-cursors";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
69
hosts/modules/i3.nix
Normal file
69
hosts/modules/i3.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{pkgs, ...}: {
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
xkb = {
|
||||
layout = "us";
|
||||
variant = "";
|
||||
};
|
||||
|
||||
windowManager.i3 = {
|
||||
enable = true;
|
||||
package = pkgs.i3-gaps;
|
||||
extraSessionCommands = ''
|
||||
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
|
||||
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# this is actually here because i get peeved personally when I see a none in "none+i3"
|
||||
desktopManager.xfce = {
|
||||
enable = true;
|
||||
noDesktop = true;
|
||||
enableXfwm = false;
|
||||
};
|
||||
|
||||
desktopManager.session = [
|
||||
{
|
||||
name = "xfce+i3";
|
||||
start = ''
|
||||
if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then
|
||||
${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)"
|
||||
fi
|
||||
export XDG_DATA_DIRS="${pkgs.tokyonight-gtk-theme}/share:${pkgs.candy-icons}/share:${pkgs.hicolor-icon-theme}/share:${pkgs.adwaita-icon-theme}/share:$XDG_DATA_DIRS"
|
||||
${pkgs.xfce.xfce4-session}/bin/xfce4-session --with-ck-launch &
|
||||
${pkgs.i3-gaps}/bin/i3
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
dmenu
|
||||
i3status
|
||||
i3lock-color
|
||||
i3blocks
|
||||
picom
|
||||
feh
|
||||
i3-auto-layout
|
||||
yt-dlp
|
||||
flameshot
|
||||
imagemagick
|
||||
slop
|
||||
ghostscript
|
||||
via
|
||||
arandr
|
||||
xsettingsd
|
||||
lxappearance
|
||||
gsettings-desktop-schemas
|
||||
adwaita-qt
|
||||
candy-icons
|
||||
tokyonight-gtk-theme
|
||||
hicolor-icon-theme
|
||||
adwaita-icon-theme
|
||||
gnome-themes-extra
|
||||
findutils
|
||||
coreutils
|
||||
hu-tao-animated-cursor
|
||||
];
|
||||
}
|
||||
25
hosts/modules/settings.nix
Normal file
25
hosts/modules/settings.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{lib, ...}:
|
||||
with lib; {
|
||||
options.theme = {
|
||||
cursorName = mkOption {
|
||||
type = types.str;
|
||||
default = "Hu-Tao-Animated-Cursor";
|
||||
};
|
||||
cursorSize = mkOption {
|
||||
type = types.int;
|
||||
default = 24;
|
||||
};
|
||||
gtkTheme = mkOption {
|
||||
type = types.str;
|
||||
default = "Tokyonight-Dark";
|
||||
};
|
||||
iconTheme = mkOption {
|
||||
type = types.str;
|
||||
default = "candy-icons";
|
||||
};
|
||||
fontName = mkOption {
|
||||
type = types.str;
|
||||
default = "Clear Sans 10";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue