Add estivate; autolock suspend

This commit is contained in:
Sridhar Ratnakumar 2021-04-13 19:14:08 -04:00
parent 770a8f7142
commit 4c796a775a
3 changed files with 22 additions and 5 deletions

View file

@ -13,4 +13,21 @@
killtime = 10; # mins
killer = "${pkgs.systemd}/bin/systemctl suspend";
};
environment.systemPackages = [
# A script to disable auto-suspend until unlocking the computer the next
# time. The idea is to leave this running on desktop, whilst taking my
# laptop to another room and ssh to the desktop.
(pkgs.writeScriptBin "estivate"
''
#!${pkgs.runtimeShell}
set -xe
date
${pkgs.xautolock}/bin/xautolock -disable
${pkgs.xlockmore}/bin/xlock
date
${pkgs.xautolock}/bin/xautolock -enable
${pkgs.cowsay}/bin/cowsay "Welcome back!"
'')
];
}

8
flake.lock generated
View file

@ -167,17 +167,17 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1618260938,
"narHash": "sha256-sRIKbJKplnAY9uN4QGGVtq4dasRKzmZhjleCUtPvTa8=",
"lastModified": 1618251784,
"narHash": "sha256-/IG7op2hUVnjzKt2UXL152+YsL0gdPakk6/RxondIJ0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e8893cc489de8ffbe8125fb0d37f05e8023a2d99",
"rev": "311ceed827f531f88f46222920cd1ebb2c101f73",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e8893cc489de8ffbe8125fb0d37f05e8023a2d99",
"rev": "311ceed827f531f88f46222920cd1ebb2c101f73",
"type": "github"
}
},

View file

@ -6,7 +6,7 @@
# https://status.nixos.org/
#
# This ensures that we always use the official # cache.
nixpkgs.url = "github:nixos/nixpkgs/e8893cc489de8ffbe8125fb0d37f05e8023a2d99";
nixpkgs.url = "github:nixos/nixpkgs/311ceed827f531f88f46222920cd1ebb2c101f73";
nixos-hardware.url = github:NixOS/nixos-hardware/master;
home-manager.url = "github:nix-community/home-manager";