blob: 4bcd3ca95b9c53f68ace19874ba9588abe76f9a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{
stdenv,
pypy3,
lib,
}: let
# Needs python interpreter with tkinter support.
python3' = pypy3;
in
stdenv.mkDerivation {
pname = "still-awake";
version = "10-09-2023";
src = builtins.readFile ./still_awake.py;
passAsFile = ["buildCommand" "src"];
# Building basically boils down to writing source to a file
# and making it executable.
buildCommand = ''
mkdir -p $out/bin
echo "#!${python3'.interpreter}" >$out/bin/still-awake
if [ -e "$srcPath" ]; then
cat "$srcPath" >>$out/bin/still-awake
else
echo -n "$src" >>$out/bin/still-awake
fi
chmod +x $out/bin/still-awake
'';
# It doesn't make sense to do this remotely.
preferLocalBuild = true;
allowSubstitute = false;
meta = with lib; {
description = "Small program which shuts down Mac, if user is asleep";
license = licenses.unlicense;
platforms = platforms.darwin;
};
}
|