Skip to content

Commit

Permalink
Modularise services config.
Browse files Browse the repository at this point in the history
  • Loading branch information
attilaolah committed Mar 6, 2024
1 parent c7ae039 commit 024d655
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 49 deletions.
1 change: 0 additions & 1 deletion hosts/home/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
./networking.nix
./programs.nix
./services.nix
./services/xserver/xkb.nix
./systemd.nix
./users.nix
];
Expand Down
56 changes: 8 additions & 48 deletions hosts/home/services.nix
Original file line number Diff line number Diff line change
@@ -1,50 +1,10 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
regreet = lib.getExe config.programs.regreet.package;
hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland;

# 1st Hyperland only runs "command" (regreet) and exits.
# ReGreet itself will then run a second session with the user's config.
hyprland-greet = "${hyprland}/bin/Hyprland --config ${pkgs.writeText "hyprland.greet.conf" ''
${(builtins.readFile ./hyprland/greet.conf)}
${(import ./hyprland/input.nix {inherit config;}).hyprconf}
${(import ./hyprland/monitors.nix {inherit lib;}).hyprconf}
exec-once = ${regreet} -l debug; ${hyprland}/bin/hyprctl dispatch exit
''}";
in {
services = {
blueman.enable = true;
dbus.enable = true;
pipewire = {
enable = true;

alsa.enable = true;
jack.enable = true;
pulse.enable = true;
};

openssh = {
enable = true;
startWhenNeeded = true; # make it socket-activated
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};

greetd = {
enable = true;
settings = {
default_session = {
command = hyprland-greet;
user = "greeter";
};
};
};
};
imports = [
./services/blueman.nix
./services/dbus.nix
./services/greetd.nix
./services/openssh.nix
./services/pipewire.nix
./services/xserver/xkb.nix
];
}
1 change: 1 addition & 0 deletions hosts/home/services/blueman.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{services.blueman.enable = true;}
1 change: 1 addition & 0 deletions hosts/home/services/dbus.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{services.dbus.enable = true;}
29 changes: 29 additions & 0 deletions hosts/home/services/greetd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
regreet = lib.getExe config.programs.regreet.package;
hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland;

# 1st Hyperland only runs "command" (regreet) and exits.
# ReGreet itself will then run a second session with the user's config.
hyprland-greet = "${hyprland}/bin/Hyprland --config ${pkgs.writeText "hyprland.greet.conf" ''
${(builtins.readFile ../hyprland/greet.conf)}
${(import ../hyprland/input.nix {inherit config;}).hyprconf}
${(import ../hyprland/monitors.nix {inherit lib;}).hyprconf}
exec-once = ${regreet} -l debug; ${hyprland}/bin/hyprctl dispatch exit
''}";
in {
services.greetd = {
enable = true;
settings = {
default_session = {
command = hyprland-greet;
user = "greeter";
};
};
};
}
10 changes: 10 additions & 0 deletions hosts/home/services/openssh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
services.openssh = {
enable = true;
startWhenNeeded = true; # make it socket-activated
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
}
9 changes: 9 additions & 0 deletions hosts/home/services/pipewire.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
services.pipewire = {
enable = true;

alsa.enable = true;
jack.enable = true;
pulse.enable = true;
};
}

0 comments on commit 024d655

Please sign in to comment.