diff options
author | Linnnus <[email protected]> | 2023-09-10 10:01:23 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2023-09-10 10:01:23 +0200 |
commit | 1c5de21b1f5ad12c2f21a988cc36ee97fcbe4bbe (patch) | |
tree | 8c43800704f7e83d5895e6fdc2d59fc423b49044 /pkgs/still-awake/default.nix | |
parent | c8eea83573983e201a4c6a6d5bce2627662a8aca (diff) |
Add still-awake package
Diffstat (limited to 'pkgs/still-awake/default.nix')
-rw-r--r-- | pkgs/still-awake/default.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/still-awake/default.nix b/pkgs/still-awake/default.nix new file mode 100644 index 0000000..a83dd63 --- /dev/null +++ b/pkgs/still-awake/default.nix @@ -0,0 +1,38 @@ +{ 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"; + platforms = platforms.darwin; + }; +} |