Skip to content

Commit

Permalink
[hosts] Add stopgap for ghost host to suspend instead of suspend-then…
Browse files Browse the repository at this point in the history
…-hibernate
  • Loading branch information
aeolyus committed Jan 6, 2025
1 parent d5f41d4 commit f8613d3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ home-gui: ## Configure home-manager, including GUI configs
nix run home-manager/master switch -- --flake ".#$${USER}.home.gui" \
--option accept-flake-config true

.PHONY: home-gui-host
home-gui-host: ## Configure a host specific home-manager, including GUI configs
nix run home-manager/master switch -- \
--flake ".#aeolyus.${HOST}.home.gui" \
--option accept-flake-config true

.PHONY: update
update: ## Update flake lock file
nix flake update \
Expand Down
6 changes: 6 additions & 0 deletions nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
inherit inputs vars;
};

homeConfigurations."aeolyus.ghost.home.gui" =
import ./outputs/hosts/ghost/default.nix {
inherit inputs vars;
};


darwinConfigurations."aarch64-darwin" = import ./outputs/hosts/darwin {
inherit inputs vars;
};
Expand Down
21 changes: 21 additions & 0 deletions nix/outputs/hosts/ghost/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ inputs, vars, ... }:
let
self = inputs.self;
homeManagerConfiguration = inputs.home-manager.lib.homeManagerConfiguration;
user = vars.users.aeolyus;
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
in
homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit self inputs user; };
modules = [
../../../common/nix.nix
../../../home/linux/gui
../../../overlays
./disable-sleep.nix
{
targets.genericLinux.enable = true;
xdg.mime.enable = true;
}
];
}
25 changes: 25 additions & 0 deletions nix/outputs/hosts/ghost/disable-sleep.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This module makes it so that we use suspend instead of suspend-then-hibernate
#
# My Arch Linux installation on this host has an issue with
# suspend-then-hibernate where during the transition from suspended state to
# hibernation, the computer hangs indefinitely. Separately, suspend and
# hibernate function as intended...
#
# This is a stopgap until this host is migrated to NixOS where hopefully the
# issue does not persist
{ pkgs, config, lib, ... }:
let
cfg = config.services.screen-locker;
in
{
systemd.user.services.xautolock-session = lib.mkForce {
Service = lib.mkForce {
ExecStart = lib.concatStringsSep " " ([
"${cfg.xautolock.package}/bin/xautolock"
"-time 30" # minutes
"-locker '${pkgs.systemd}/bin/systemctl suspend'"
] ++ lib.optional cfg.xautolock.detectSleep "-detectsleep"
++ cfg.xautolock.extraOptions);
};
};
}

0 comments on commit f8613d3

Please sign in to comment.