Compare commits
7 Commits
e0006a5ff4
...
f92b66ae1e
Author | SHA1 | Date | |
---|---|---|---|
f92b66ae1e | |||
839c265ce0 | |||
2efaff82ae | |||
72bfd4eb18 | |||
ec87116356 | |||
b8322e241c | |||
51c535e16e |
@ -10,6 +10,7 @@
|
|||||||
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
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -94,6 +95,9 @@
|
|||||||
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 = {
|
||||||
@ -101,9 +105,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# 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; [
|
||||||
@ -122,6 +123,7 @@
|
|||||||
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
|
||||||
|
21
home.nix
21
home.nix
@ -8,6 +8,8 @@
|
|||||||
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.
|
||||||
@ -35,6 +37,18 @@
|
|||||||
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
|
||||||
@ -134,6 +148,13 @@
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
41
suspend-and-hibernate.nix
Normal file
41
suspend-and-hibernate.nix
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user