mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-14 08:32:39 +02:00
refactor: start i3/hyprland in home-manager instead of NixOS
This commit is contained in:
@@ -36,9 +36,6 @@ history:
|
|||||||
repl:
|
repl:
|
||||||
nix repl -f flake:nixpkgs
|
nix repl -f flake:nixpkgs
|
||||||
|
|
||||||
eye:
|
|
||||||
systemctl --user start gammastep.service
|
|
||||||
|
|
||||||
gc:
|
gc:
|
||||||
# remove all generations older than 7 days
|
# remove all generations older than 7 days
|
||||||
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
||||||
@@ -156,6 +153,3 @@ fmt:
|
|||||||
# format the nix files in this repo
|
# format the nix files in this repo
|
||||||
nix fmt
|
nix fmt
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf result
|
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ Other dotfiles that inspired me:
|
|||||||
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc.
|
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc.
|
||||||
- Modularized NixOS Configuration
|
- Modularized NixOS Configuration
|
||||||
- [hlissner/dotfiles](https://github.com/hlissner/dotfiles)
|
- [hlissner/dotfiles](https://github.com/hlissner/dotfiles)
|
||||||
|
- [viperML/dotfiles](https://github.com/viperML/dotfiles)
|
||||||
- Hyprland(wayland)
|
- Hyprland(wayland)
|
||||||
- [notwidow/hyprland](https://github.com/notwidow/hyprland): This is where I start my hyprland journey.
|
- [notwidow/hyprland](https://github.com/notwidow/hyprland): This is where I start my hyprland journey.
|
||||||
- [HeinzDev/Hyprland-dotfiles](https://github.com/HeinzDev/Hyprland-dotfiles): Refer to the waybar configuration here.
|
- [HeinzDev/Hyprland-dotfiles](https://github.com/HeinzDev/Hyprland-dotfiles): Refer to the waybar configuration here.
|
||||||
|
|||||||
Generated
+3
-3
@@ -952,11 +952,11 @@
|
|||||||
"wallpapers": {
|
"wallpapers": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694759298,
|
"lastModified": 1703310017,
|
||||||
"narHash": "sha256-eSDBX6aA7zxodUq3MmV99JS0vr+aUwbEuLPoKnU5kHg=",
|
"narHash": "sha256-SL3PIDa4BNz2rDZ/9KwnJCAfhelIoqpLtQ/FSYgfusI=",
|
||||||
"owner": "ryan4yin",
|
"owner": "ryan4yin",
|
||||||
"repo": "wallpapers",
|
"repo": "wallpapers",
|
||||||
"rev": "f59f49a44042d2c669e18da07e652e00c431e9e9",
|
"rev": "20dea02ee2c0bb74dadcc3d4ec5efe78d00520dc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
|
./wallpaper
|
||||||
|
|
||||||
./creative.nix
|
./creative.nix
|
||||||
./gtk.nix
|
./gtk.nix
|
||||||
./immutable-file.nix
|
./immutable-file.nix
|
||||||
./media.nix
|
./media.nix
|
||||||
./ssh.nix
|
./ssh.nix
|
||||||
./wallpaper.nix
|
|
||||||
./xdg.nix
|
./xdg.nix
|
||||||
./eye-protection.nix
|
./eye-protection.nix
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{wallpapers, ...}: {
|
|
||||||
# https://github.com/ryan4yin/wallpapers
|
|
||||||
xdg.configFile."wallpapers".source = wallpapers;
|
|
||||||
home.file.".local/bin/wallpaper_random" = {
|
|
||||||
source = "${wallpapers}/wallpaper_random.py";
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
wallpapers,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
systemd.user.services.wallpaper = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Wallpaper Switcher daemon";
|
||||||
|
After = ["graphical-session-pre.target" "xdg-desktop-autostart.target"];
|
||||||
|
Wants = ["graphical-session-pre.target"];
|
||||||
|
};
|
||||||
|
Install.WantedBy = ["graphical-session.target"];
|
||||||
|
Service = {
|
||||||
|
ExecStart = lib.getExe (pkgs.writeShellApplication {
|
||||||
|
name = "wallpaper";
|
||||||
|
runtimeInputs = with pkgs; [procps feh swaybg python3];
|
||||||
|
text = ''
|
||||||
|
export WALLPAPERS_DIR="${wallpapers}"
|
||||||
|
export WALLPAPERS_STATE_FILEPATH="${config.xdg.stateHome}/wallpaper-switcher/switcher_state"
|
||||||
|
export WALLPAPER_WAIT_MIN=10
|
||||||
|
export WALLPAPER_WAIT_MAX=20
|
||||||
|
exec ${./wallpaper-switcher.py}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
RestartSec = 3;
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+169
@@ -0,0 +1,169 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script will randomly select a wallpaper from the wallpapers directory.
|
||||||
|
It will skip the last wallpaper used, so that you don't get the same wallpaper.
|
||||||
|
|
||||||
|
It will also set the wallpaper using `feh` for X11, or `swaybg` for Wayland.
|
||||||
|
|
||||||
|
Maintainer: ryan4yin [xiaoyin_c@qq.com]
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Union
|
||||||
|
import subprocess
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class WallpaperSwitcher:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
wait_min,
|
||||||
|
wait_max,
|
||||||
|
wallpapers_dir: Path,
|
||||||
|
state_filepath: Path,
|
||||||
|
image_extensions: Union[tuple, list],
|
||||||
|
) -> None:
|
||||||
|
self.wallpapers_dir = wallpapers_dir
|
||||||
|
self.image_extensions = image_extensions
|
||||||
|
self.state_filepath = state_filepath
|
||||||
|
self.wait_min = wait_min
|
||||||
|
self.wait_max = wait_max
|
||||||
|
|
||||||
|
# initialize the state file
|
||||||
|
self.state_filepath.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.current_state = self.state_filepath.open("a+", encoding="utf-8")
|
||||||
|
self.current_wallpaper_list = list()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""
|
||||||
|
Iterate on all wallpapers in the wallpapers directory, cycling through them in a random order.
|
||||||
|
"""
|
||||||
|
self.initialize_state()
|
||||||
|
while True:
|
||||||
|
for i, w in enumerate(self.current_wallpaper_list):
|
||||||
|
if i < self.current_wallpaper_index:
|
||||||
|
continue
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
f"Setting wallpaper {i+1}/{len(self.current_wallpaper_list)}: {w}"
|
||||||
|
)
|
||||||
|
self.set_wallpaper(w)
|
||||||
|
|
||||||
|
# update the state
|
||||||
|
self.current_wallpaper_index = i
|
||||||
|
self.save_state()
|
||||||
|
|
||||||
|
wait_time = random.randint(self.wait_min, self.wait_max)
|
||||||
|
logger.info(f"Waiting {wait_time} seconds...")
|
||||||
|
time.sleep(wait_time)
|
||||||
|
|
||||||
|
# reset the state
|
||||||
|
self.reset_state()
|
||||||
|
|
||||||
|
def save_state(self):
|
||||||
|
wallpaper_list = [w.as_posix() for w in self.current_wallpaper_list]
|
||||||
|
state = {
|
||||||
|
"current_wallpaper_list": wallpaper_list,
|
||||||
|
"current_wallpaper_index": self.current_wallpaper_index,
|
||||||
|
}
|
||||||
|
self.current_state.truncate(0)
|
||||||
|
self.current_state.write(json.dumps(state, indent=4))
|
||||||
|
self.current_state.flush()
|
||||||
|
|
||||||
|
def initialize_state(self):
|
||||||
|
self.current_state.seek(0)
|
||||||
|
data = self.current_state.read()
|
||||||
|
if not data:
|
||||||
|
logger.info("No state found, resetting...")
|
||||||
|
self.reset_state()
|
||||||
|
else:
|
||||||
|
logger.info("State found, reloading...")
|
||||||
|
state = json.loads(data)
|
||||||
|
wallpapers = [Path(w) for w in state["current_wallpaper_list"]]
|
||||||
|
self.current_wallpaper_list = wallpapers
|
||||||
|
self.current_wallpaper_index = state["current_wallpaper_index"]
|
||||||
|
|
||||||
|
def reset_state(self):
|
||||||
|
logger.info(f"Rescanning & shuffle wallpapers in {self.wallpapers_dir} ...")
|
||||||
|
wallpapers = list(
|
||||||
|
filter(
|
||||||
|
lambda x: x.suffix in self.image_extensions,
|
||||||
|
self.wallpapers_dir.iterdir(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
random.shuffle(wallpapers)
|
||||||
|
self.current_wallpaper_list = wallpapers
|
||||||
|
self.current_wallpaper_index = 0
|
||||||
|
|
||||||
|
def set_wallpaper(self, path: Path):
|
||||||
|
# check if we are running under x11 or wayland
|
||||||
|
if (
|
||||||
|
"WAYLAND_DISPLAY" in os.environ
|
||||||
|
or os.environ.get("XDG_SESSION_TYPE") == "wayland"
|
||||||
|
):
|
||||||
|
self.set_wallpaper_wayland(path)
|
||||||
|
else:
|
||||||
|
self.set_wallpaper_x11(path)
|
||||||
|
|
||||||
|
def set_wallpaper_x11(self, path: Path):
|
||||||
|
subprocess.run(["feh", "--bg-fill", path])
|
||||||
|
|
||||||
|
def set_wallpaper_wayland(self, path: Path):
|
||||||
|
# find all swaybg processes
|
||||||
|
swaybg_pids = subprocess.run(
|
||||||
|
["pgrep", "-f", "swaybg"], stdout=subprocess.PIPE
|
||||||
|
).stdout.decode("utf-8")
|
||||||
|
|
||||||
|
# run swaybg in the background, and make it running even after the parent process exits
|
||||||
|
subprocess.Popen(
|
||||||
|
["swaybg", "--output", "*", "--mode", "fill", "--image", path],
|
||||||
|
start_new_session=True,
|
||||||
|
)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# kill all old swaybg processes
|
||||||
|
for pid in swaybg_pids.splitlines():
|
||||||
|
try:
|
||||||
|
os.kill(int(pid), 9)
|
||||||
|
except ProcessLookupError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
wallpapers_dir = os.getenv("WALLPAPERS_DIR")
|
||||||
|
state_filepath = os.getenv("WALLPAPERS_STATE_FILEPATH")
|
||||||
|
if not wallpapers_dir:
|
||||||
|
raise Exception("WALLPAPERS_DIR not set")
|
||||||
|
if not state_filepath:
|
||||||
|
raise Exception("WALLPAPERS_STATE_FILEPATH not set")
|
||||||
|
|
||||||
|
image_postfix = (
|
||||||
|
".jpg",
|
||||||
|
".jpeg",
|
||||||
|
".png",
|
||||||
|
# ".gif",
|
||||||
|
# ".webp"
|
||||||
|
)
|
||||||
|
wait_min = int(os.getenv("WALLPAPER_WAIT_MIN", 60))
|
||||||
|
wait_max = int(os.getenv("WALLPAPER_WAIT_MAX", 300))
|
||||||
|
wallpaper_switcher = WallpaperSwitcher(
|
||||||
|
wait_min,
|
||||||
|
wait_max,
|
||||||
|
Path(wallpapers_dir).expanduser(),
|
||||||
|
Path(state_filepath).expanduser(),
|
||||||
|
image_postfix,
|
||||||
|
)
|
||||||
|
wallpaper_switcher.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -12,9 +12,14 @@
|
|||||||
xdg-user-dirs
|
xdg-user-dirs
|
||||||
];
|
];
|
||||||
|
|
||||||
|
xdg.configFile."mimeapps.list".force = true;
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cacheHome = config.home.homeDirectory + "/.local/cache";
|
|
||||||
|
cacheHome = "${config.home.homeDirectory}/.cache";
|
||||||
|
configHome = "${config.home.homeDirectory}/.config";
|
||||||
|
dataHome = "${config.home.homeDirectory}/.local/share";
|
||||||
|
stateHome = "${config.home.homeDirectory}/.local/state";
|
||||||
|
|
||||||
# manage $XDG_CONFIG_HOME/mimeapps.list
|
# manage $XDG_CONFIG_HOME/mimeapps.list
|
||||||
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
|
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
|
||||||
@@ -51,7 +56,7 @@
|
|||||||
"x-scheme-handler/unknown" = browser;
|
"x-scheme-handler/unknown" = browser;
|
||||||
|
|
||||||
"x-scheme-handler/discord" = ["discord.desktop"];
|
"x-scheme-handler/discord" = ["discord.desktop"];
|
||||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
|
||||||
|
|
||||||
"audio/*" = ["mpv.desktop"];
|
"audio/*" = ["mpv.desktop"];
|
||||||
"video/*" = ["mpv.dekstop"];
|
"video/*" = ["mpv.dekstop"];
|
||||||
|
|||||||
@@ -11,17 +11,25 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
# NOTE:
|
# NOTE:
|
||||||
# (Required) NixOS Module: enables critical components needed to run Hyprland properly
|
# We have to enable hyprland/i3's systemd user service in home-manager,
|
||||||
# (Optional) Home-manager module: lets you declaratively configure Hyprland
|
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
||||||
|
# they are all depending on hyprland/i3's user graphical-session
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = hyprland.packages.${pkgs.system}.hyprland;
|
package = hyprland.packages.${pkgs.system}.hyprland;
|
||||||
settings = lib.mkForce {};
|
settings = lib.mkForce {};
|
||||||
extraConfig = builtins.readFile ./hypr-conf/hyprland.conf;
|
extraConfig = builtins.readFile ./hypr-conf/hyprland.conf;
|
||||||
# programs.grammastep need this to be enabled.
|
# gammastep/wallpaper-switcher need this to be enabled.
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NOTE: this executable is used by greetd to start a wayland session when system boot up
|
||||||
|
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config in NixOS module
|
||||||
|
home.file.".wayland-session" = {
|
||||||
|
source = "${pkgs.hyprland}/bin/Hyprland";
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# hyprland configs, based on https://github.com/notwidow/hyprland
|
# hyprland configs, based on https://github.com/notwidow/hyprland
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"hypr/mako" = {
|
"hypr/mako" = {
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ for _prs in "${_ps[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Set wallpaper
|
# Set wallpaper via a wallpaper.service
|
||||||
swaybg --output '*' --mode fill --image ~/.config/wallpapers/default_wallpaper &
|
# it will by start by home-manager automatically, do not need to restart it here.
|
||||||
|
# systemctl --user restart wallpaper.service
|
||||||
|
|
||||||
# Lauch notification daemon (mako)
|
# Lauch notification daemon (mako)
|
||||||
~/.config/hypr/scripts/notifications &
|
~/.config/hypr/scripts/notifications &
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
waybar # the status bar
|
||||||
|
swaybg # the wallpaper
|
||||||
|
swayidle # the idle timeout
|
||||||
|
swaylock # locking the screen
|
||||||
|
wlogout # logout menu
|
||||||
|
wl-clipboard # copying and pasting
|
||||||
|
hyprpicker # color picker
|
||||||
|
|
||||||
|
wf-recorder # creen recording
|
||||||
|
grim # taking screenshots
|
||||||
|
slurp # selecting a region to screenshot
|
||||||
|
# TODO replace by `flameshot gui --raw | wl-copy`
|
||||||
|
|
||||||
|
mako # the notification daemon, the same as dunst
|
||||||
|
|
||||||
|
yad # a fork of zenity, for creating dialogs
|
||||||
|
|
||||||
|
# audio
|
||||||
|
alsa-utils # provides amixer/alsamixer/...
|
||||||
|
mpd # for playing system sounds
|
||||||
|
mpc-cli # command-line mpd client
|
||||||
|
ncmpcpp # a mpd client with a UI
|
||||||
|
networkmanagerapplet # provide GUI app: nm-connection-editor
|
||||||
|
];
|
||||||
|
}
|
||||||
Regular → Executable
Executable
+1
@@ -0,0 +1 @@
|
|||||||
|
i3-msg exit
|
||||||
@@ -261,8 +261,7 @@ exec --no-startup-id dex --autostart --environment i3
|
|||||||
exec --no-startup-id ~/.screenlayout/monitor.sh
|
exec --no-startup-id ~/.screenlayout/monitor.sh
|
||||||
|
|
||||||
# set wallpaper
|
# set wallpaper
|
||||||
# exec --no-startup-id sleep 2 && nitrogen --restore
|
exec --no-startup-id sleep 1 && systemctl --user restart wallpaper.service
|
||||||
exec --no-startup-id sleep 1 && feh --bg-fill ~/.config/wallpapers/default_wallpaper
|
|
||||||
|
|
||||||
# set powersavings for display:
|
# set powersavings for display:
|
||||||
exec --no-startup-id xset s 480 dpms 600 600 600
|
exec --no-startup-id xset s 480 dpms 600 600 600
|
||||||
|
|||||||
@@ -1,35 +1,55 @@
|
|||||||
{pkgs, ...}: {
|
_: {
|
||||||
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
./packages.nix
|
||||||
./x11-apps.nix
|
./x11-apps.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.file = {
|
# NOTE:
|
||||||
".config/i3/config".source = ./config;
|
# We have to enable hyprland/i3's systemd user service in home-manager,
|
||||||
".config/i3/i3blocks.conf".source = ./i3blocks.conf;
|
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
||||||
".config/i3/scripts" = {
|
# they are all depending on hyprland/i3's user graphical-session
|
||||||
|
xsession = {
|
||||||
|
enable = true;
|
||||||
|
windowManager.i3 = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = builtins.readFile ./config;
|
||||||
|
};
|
||||||
|
# Path, relative to HOME, where Home Manager should write the X session script.
|
||||||
|
# and NixOS will use it to start xorg session when system boot up
|
||||||
|
scriptPath = ".xsession";
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile = {
|
||||||
|
"i3/i3blocks.conf".source = ./i3blocks.conf;
|
||||||
|
"i3/scripts" = {
|
||||||
source = ./scripts;
|
source = ./scripts;
|
||||||
# copy the scripts directory recursively
|
# copy the scripts directory recursively
|
||||||
recursive = true;
|
recursive = true;
|
||||||
executable = true; # make all scripts executable
|
executable = true; # make all scripts executable
|
||||||
};
|
};
|
||||||
".config/i3/layouts" = {
|
"i3/layouts" = {
|
||||||
source = ./layouts;
|
source = ./layouts;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# rofi is a application launcher and dmenu replacement
|
# rofi is a application launcher and dmenu replacement
|
||||||
".config/rofi" = {
|
"rofi" = {
|
||||||
source = ./rofi-conf;
|
source = ./rofi-conf;
|
||||||
# copy the scripts directory recursively
|
# copy the scripts directory recursively
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.file = {
|
||||||
".local/bin/bright" = {
|
".local/bin/bright" = {
|
||||||
source = ./bin/bright;
|
source = ./bin/bright;
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
".local/bin/logout" = {
|
||||||
|
source = ./bin/logout;
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# xrandr - set primary screen
|
# xrandr - set primary screen
|
||||||
".screenlayout/monitor.sh".source = ./dual-monitor-4k-1080p.sh;
|
".screenlayout/monitor.sh".source = ./dual-monitor-4k-1080p.sh;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
rofi # application launcher, the same as dmenu
|
||||||
|
dunst # notification daemon
|
||||||
|
i3blocks # status bar
|
||||||
|
i3lock # default i3 screen locker
|
||||||
|
xautolock # lock screen after some time
|
||||||
|
i3status # provide information to i3bar
|
||||||
|
i3-gaps # i3 with gaps
|
||||||
|
picom # transparency and shadows
|
||||||
|
feh # set wallpaper
|
||||||
|
xcolor # color picker
|
||||||
|
|
||||||
|
acpi # battery information
|
||||||
|
arandr # screen layout manager
|
||||||
|
dex # autostart applications
|
||||||
|
xbindkeys # bind keys to commands
|
||||||
|
xorg.xbacklight # control screen brightness, the same as light
|
||||||
|
xorg.xdpyinfo # get screen information
|
||||||
|
scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot
|
||||||
|
sysstat # get system information
|
||||||
|
alsa-utils # provides amixer/alsamixer/...
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
{pkgs, ...}: {
|
|
||||||
####################################################################
|
|
||||||
#
|
|
||||||
# NixOS's Configuration for I3 Window Manager
|
|
||||||
#
|
|
||||||
####################################################################
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./base/i18n.nix
|
|
||||||
./base/misc.nix
|
|
||||||
./base/networking.nix
|
|
||||||
./base/remote-building.nix
|
|
||||||
./base/user-group.nix
|
|
||||||
./base/visualisation.nix
|
|
||||||
|
|
||||||
./desktop
|
|
||||||
../base.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# i3 related options
|
|
||||||
services = {
|
|
||||||
gvfs.enable = true; # Mount, trash, and other functionalities
|
|
||||||
tumbler.enable = true; # Thumbnail support for images
|
|
||||||
|
|
||||||
xserver = {
|
|
||||||
enable = true;
|
|
||||||
displayManager = {
|
|
||||||
lightdm.enable = true;
|
|
||||||
autoLogin = {
|
|
||||||
enable = true;
|
|
||||||
user = "ryan";
|
|
||||||
};
|
|
||||||
defaultSession = "none+i3";
|
|
||||||
};
|
|
||||||
# Configure keymap in X11
|
|
||||||
xkb.layout = "us";
|
|
||||||
|
|
||||||
windowManager.i3 = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
rofi # application launcher, the same as dmenu
|
|
||||||
dunst # notification daemon
|
|
||||||
i3blocks # status bar
|
|
||||||
i3lock # default i3 screen locker
|
|
||||||
xautolock # lock screen after some time
|
|
||||||
i3status # provide information to i3bar
|
|
||||||
i3-gaps # i3 with gaps
|
|
||||||
picom # transparency and shadows
|
|
||||||
feh # set wallpaper
|
|
||||||
xcolor # color picker
|
|
||||||
|
|
||||||
acpi # battery information
|
|
||||||
arandr # screen layout manager
|
|
||||||
dex # autostart applications
|
|
||||||
xbindkeys # bind keys to commands
|
|
||||||
xorg.xbacklight # control screen brightness, the same as light
|
|
||||||
xorg.xdpyinfo # get screen information
|
|
||||||
scrot # minimal screen capture tool, used by i3 blur lock to take a screenshot
|
|
||||||
sysstat # get system information
|
|
||||||
alsa-utils # provides amixer/alsamixer/...
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -28,48 +28,23 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
xserver.enable = false;
|
xserver.enable = false; # disable xorg server
|
||||||
# https://wiki.archlinux.org/title/Greetd
|
# https://wiki.archlinux.org/title/Greetd
|
||||||
greetd = {
|
greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
default_session = {
|
default_session = {
|
||||||
user = "ryan"; # Hyprland is installed only for user ryan via home-manager!
|
# Wayland Desktop Manager is installed only for user ryan via home-manager!
|
||||||
command = "Hyprland"; # start Hyprland directly without a login manager
|
user = "ryan";
|
||||||
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
|
# .wayland-session is a script generated by home-manager, which links to the current wayland compositor(sway/hyprland or others).
|
||||||
|
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config here.
|
||||||
|
command = "$HOME/.wayland-session"; # start a wayland session directly without a login manager
|
||||||
|
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd $HOME/.wayland-session"; # start wayland session with a TUI login manager
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
|
||||||
# $ nix search wget
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
waybar # the status bar
|
|
||||||
swaybg # the wallpaper
|
|
||||||
swayidle # the idle timeout
|
|
||||||
swaylock # locking the screen
|
|
||||||
wlogout # logout menu
|
|
||||||
wl-clipboard # copying and pasting
|
|
||||||
hyprpicker # color picker
|
|
||||||
|
|
||||||
wf-recorder # creen recording
|
|
||||||
grim # taking screenshots
|
|
||||||
slurp # selecting a region to screenshot
|
|
||||||
# TODO replace by `flameshot gui --raw | wl-copy`
|
|
||||||
|
|
||||||
mako # the notification daemon, the same as dunst
|
|
||||||
|
|
||||||
yad # a fork of zenity, for creating dialogs
|
|
||||||
|
|
||||||
# audio
|
|
||||||
alsa-utils # provides amixer/alsamixer/...
|
|
||||||
mpd # for playing system sounds
|
|
||||||
mpc-cli # command-line mpd client
|
|
||||||
ncmpcpp # a mpd client with a UI
|
|
||||||
networkmanagerapplet # provide GUI app: nm-connection-editor
|
|
||||||
];
|
|
||||||
|
|
||||||
# fix https://github.com/ryan4yin/nix-config/issues/10
|
# fix https://github.com/ryan4yin/nix-config/issues/10
|
||||||
security.pam.services.swaylock = {};
|
security.pam.services.swaylock = {};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
####################################################################
|
||||||
|
#
|
||||||
|
# NixOS's Configuration for Xorg Server
|
||||||
|
#
|
||||||
|
####################################################################
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./base/i18n.nix
|
||||||
|
./base/misc.nix
|
||||||
|
./base/networking.nix
|
||||||
|
./base/remote-building.nix
|
||||||
|
./base/user-group.nix
|
||||||
|
./base/visualisation.nix
|
||||||
|
|
||||||
|
./desktop
|
||||||
|
../base.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
gvfs.enable = true; # Mount, trash, and other functionalities
|
||||||
|
tumbler.enable = true; # Thumbnail support for images
|
||||||
|
|
||||||
|
xserver = {
|
||||||
|
enable = true;
|
||||||
|
displayManager = {
|
||||||
|
lightdm.enable = true;
|
||||||
|
autoLogin = {
|
||||||
|
enable = true;
|
||||||
|
user = "ryan";
|
||||||
|
};
|
||||||
|
# use a fake session to skip desktop manager
|
||||||
|
# and let Home Manager take care of the X session
|
||||||
|
defaultSession = "hm-session";
|
||||||
|
};
|
||||||
|
desktopManager = {
|
||||||
|
runXdgAutostartIfNone = true;
|
||||||
|
session = [
|
||||||
|
{
|
||||||
|
name = "hm-session";
|
||||||
|
manage = "window";
|
||||||
|
start = ''
|
||||||
|
${pkgs.runtimeShell} $HOME/.xsession &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# Configure keymap in X11
|
||||||
|
xkb.layout = "us";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
nixos-modules = [
|
nixos-modules = [
|
||||||
../hosts/idols/ai
|
../hosts/idols/ai
|
||||||
../secrets/nixos.nix
|
../secrets/nixos.nix
|
||||||
../modules/nixos/i3.nix
|
../modules/nixos/xorg.nix
|
||||||
];
|
];
|
||||||
home-module = import ../home/linux/desktop-i3.nix;
|
home-module = import ../home/linux/desktop-i3.nix;
|
||||||
};
|
};
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
nixos-modules = [
|
nixos-modules = [
|
||||||
../hosts/idols/ai
|
../hosts/idols/ai
|
||||||
../secrets/nixos.nix
|
../secrets/nixos.nix
|
||||||
../modules/nixos/hyprland.nix
|
../modules/nixos/wayland.nix
|
||||||
];
|
];
|
||||||
home-module = import ../home/linux/desktop-hyprland.nix;
|
home-module = import ../home/linux/desktop-hyprland.nix;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user