refactor: start i3/hyprland in home-manager instead of NixOS

This commit is contained in:
Ryan Yin
2023-12-23 13:33:47 +08:00
parent 82cfa4c6f7
commit 73e3707570
20 changed files with 370 additions and 134 deletions

View File

@@ -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/...
];
};
};
};
}

View File

@@ -28,48 +28,23 @@
};
services = {
xserver.enable = false;
xserver.enable = false; # disable xorg server
# https://wiki.archlinux.org/title/Greetd
greetd = {
enable = true;
settings = {
default_session = {
user = "ryan"; # Hyprland is installed only for user ryan via home-manager!
command = "Hyprland"; # start Hyprland directly without a login manager
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
# Wayland Desktop Manager is installed only for user ryan via home-manager!
user = "ryan";
# .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
security.pam.services.swaylock = {};
}

53
modules/nixos/xorg.nix Normal file
View File

@@ -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";
};
};
}