Compare commits
7 Commits
e0006a5ff4
...
f92b66ae1e
Author | SHA1 | Date | |
---|---|---|---|
f92b66ae1e | |||
839c265ce0 | |||
2efaff82ae | |||
72bfd4eb18 | |||
ec87116356 | |||
b8322e241c | |||
51c535e16e |
@ -10,6 +10,7 @@
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./suspend-and-hibernate.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
|
||||
@ -94,6 +95,9 @@
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
home-manager = {
|
||||
extraSpecialArgs = {inherit inputs;};
|
||||
users = {
|
||||
@ -101,9 +105,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
@ -122,6 +123,7 @@
|
||||
clang-tools
|
||||
alejandra
|
||||
libnotify
|
||||
gnomeExtensions.hibernate-status-button
|
||||
];
|
||||
|
||||
# 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.homeDirectory = "/home/max";
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
@ -35,6 +37,18 @@
|
||||
firefox
|
||||
thunderbird
|
||||
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
|
||||
@ -134,6 +148,13 @@
|
||||
|
||||
services.nextcloud-client.enable = true;
|
||||
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
musicDirectory = "/home/max/Music/";
|
||||
};
|
||||
|
||||
services.mpdris2.enable = true;
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
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