Skip to content

Commit

Permalink
Use greetd for laptop
Browse files Browse the repository at this point in the history
  • Loading branch information
iynaix committed Dec 6, 2024
1 parent e7e35d7 commit f7a5f97
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
9 changes: 6 additions & 3 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
];

options.custom = with lib; {
autologinCommand = mkOption {
type = types.nullOr types.str;
default = null;
description = "Command to run after autologin";
};
fonts = {
regular = mkOption {
type = types.str;
Expand Down Expand Up @@ -81,9 +86,7 @@
let
normalizeHome = p: if (lib.hasPrefix "/home" p) then p else "${config.home.homeDirectory}/${p}";
in
lib.mapAttrsToList (
dest: src: "L+ ${normalizeHome dest} - - - - ${normalizeHome src}"
) config.custom.symlinks;
lib.mapAttrsToList (dest: src: "L+ ${normalizeHome dest} - - - - ${src}") config.custom.symlinks;

xdg = {
enable = true;
Expand Down
4 changes: 2 additions & 2 deletions home-manager/hyprland/keybinds.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ in
# $1 is string to search for in window title
# $2 is the command to run if the window isn't found
text = ''
address=$(hyprctl clients -j | jq -r ".[] | select(.title | contains(\"$1\")) | \"address:\(.address)\"")
address=$(hyprctl clients -j | jq -r ".[] | select(.title | contains(\"$1\")) | .address")
if [ -z "$address" ]; then
eval "$2"
else
hyprctl dispatch focuswindow "$address"
hyprctl dispatch focuswindow "address:$address"
fi
'';
};
Expand Down
2 changes: 2 additions & 0 deletions home-manager/hyprland/startup.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ let
openOnWorkspace = workspace: program: "[workspace ${toString workspace} silent] ${program}";
in
lib.mkIf config.custom.hyprland.enable {
custom.autologinCommand = lib.getExe config.wayland.windowManager.hyprland.package;

# start hyprland
programs.bash.profileExtra = ''
if [ "$(tty)" = "/dev/tty1" ]; then
Expand Down
22 changes: 19 additions & 3 deletions nixos/users.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,25 @@
{
# autologin
services = {
displayManager.autoLogin.user = lib.mkDefault (
if config.boot.zfs.requestEncryptionCredentials then user else null
);
greetd =
let
inherit (config.hm.custom) autologinCommand;
in
lib.mkIf (config.boot.zfs.requestEncryptionCredentials && autologinCommand != null) {
enable = true;

settings = {
default_session = {
command = autologinCommand;
};

initial_session = {
inherit user;
command = autologinCommand;
};
};
};

getty.autologinUser = config.services.displayManager.autoLogin.user;
};

Expand Down

0 comments on commit f7a5f97

Please sign in to comment.