Compare commits

..

No commits in common. "f92b66ae1e7ed3b25f0b6c0e799d9d35372275fa" and "e0006a5ff4798ec504f94fea5da601546e5ca5e9" have entirely different histories.

3 changed files with 3 additions and 67 deletions

View File

@ -10,7 +10,6 @@
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./suspend-and-hibernate.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
@ -95,9 +94,6 @@
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
home-manager = { home-manager = {
extraSpecialArgs = {inherit inputs;}; extraSpecialArgs = {inherit inputs;};
users = { users = {
@ -105,6 +101,9 @@
}; };
}; };
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -123,7 +122,6 @@
clang-tools clang-tools
alejandra alejandra
libnotify libnotify
gnomeExtensions.hibernate-status-button
]; ];
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are

View File

@ -8,8 +8,6 @@
home.username = "max"; home.username = "max";
home.homeDirectory = "/home/max"; home.homeDirectory = "/home/max";
nixpkgs.config.allowUnfree = true;
# This value determines the Home Manager release that your configuration is # This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release # compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes. # introduces backwards incompatible changes.
@ -37,18 +35,6 @@
firefox firefox
thunderbird thunderbird
xournalpp xournalpp
kicad
prismlauncher
steam
blender
mpd
mpdris2
mpc-cli
ymuse
flip-link
bacon
probe-rs
betaflight-configurator
]; ];
# Home Manager is pretty good at managing dotfiles. The primary way to manage # Home Manager is pretty good at managing dotfiles. The primary way to manage
@ -148,13 +134,6 @@
services.nextcloud-client.enable = true; services.nextcloud-client.enable = true;
services.mpd = {
enable = true;
musicDirectory = "/home/max/Music/";
};
services.mpdris2.enable = true;
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }

View File

@ -1,41 +0,0 @@
{
config,
pkgs,
...
}: let
hibernateEnvironment = {
HIBERNATE_SECONDS = "300";
HIBERNATE_LOCK = "/var/run/autohibernate.lock";
};
in {
systemd.services."awake-after-suspend-for-a-time" = {
description = "Sets up the suspend so that it'll wake for hibernation";
wantedBy = ["suspend.target"];
before = ["systemd-suspend.service"];
environment = hibernateEnvironment;
script = ''
curtime=$(date +%s)
echo "$curtime $1" >> /tmp/autohibernate.log
echo "$curtime" > $HIBERNATE_LOCK
${pkgs.utillinux}/bin/rtcwake -m no -s $HIBERNATE_SECONDS
'';
serviceConfig.Type = "simple";
};
systemd.services."hibernate-after-recovery" = {
description = "Hibernates after a suspend recovery due to timeout";
wantedBy = ["suspend.target"];
after = ["systemd-suspend.service"];
environment = hibernateEnvironment;
script = ''
curtime=$(date +%s)
sustime=$(cat $HIBERNATE_LOCK)
rm $HIBERNATE_LOCK
if [ $(($curtime - $sustime)) -ge $HIBERNATE_SECONDS ] ; then
systemctl hibernate
else
${pkgs.utillinux}/bin/rtcwake -m no -s 1
fi
'';
serviceConfig.Type = "simple";
};
}