Add ActivityWatch

This commit is contained in:
Paul-Henri Froidmont 2022-09-15 23:49:33 +02:00
parent c02af259e2
commit 546bc7e2e7
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
7 changed files with 89 additions and 24 deletions

19
flake.lock generated
View file

@ -35,22 +35,6 @@
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1663067291,
"narHash": "sha256-1BTrqhLMamWf53sJobtMiUDI91PEw6xF8YEwg2VE8w4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d86a4619b7e80bddb6c01bc01a954f368c56d1df",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1662996720,
@ -70,8 +54,7 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs": "nixpkgs_2"
}
},
"utils": {

View file

@ -17,6 +17,7 @@
./users
(
{
nixpkgs.overlays = [ (import ./overlay.nix { }) ];
networking.hostName = "nixos-desktop";
# Allow to externally control MPD
networking.firewall.allowedTCPPorts = [ 6600 ];
@ -40,6 +41,7 @@
./users
(
{
nixpkgs.overlays = [ (import ./overlay.nix { }) ];
networking.hostName = "froidmpa-laptop";
nix.registry.nixpkgs.flake = nixpkgs;

17
overlay.nix Normal file
View file

@ -0,0 +1,17 @@
{}:
final: prev:
{
ncmpcpp = prev.ncmpcpp.override { visualizerSupport = true; };
firefox = prev.firefox.override { pkcs11Modules = [ prev.eid-mw ]; };
exodus = prev.exodus.overrideDerivation (old: {
src = prev.fetchurl {
url = "https://downloads.exodus.com/releases/${old.pname}-linux-x64-${old.version}.zip";
sha256 = "sha256-rizVb3Yckd0ionRunT7VRq+wJvtNffkk3QzxTYQgvnY=";
};
unpackCmd = ''
${prev.unzip}/bin/unzip "$src" -x "Exodus*/lib*so"
'';
});
activitywatch-bin = prev.callPackage ./packages/activitywatch.nix { };
}

View file

@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchzip
, autoPatchelfHook
, libGL
, freetype
, libdrm
, fontconfig
}:
stdenv.mkDerivation rec {
pname = "activitywatch-bin";
version = "0.11.0";
src = fetchzip {
url =
"https://github.com/ActivityWatch/activitywatch/releases/download/v${version}/activitywatch-v${version}-linux-x86_64.zip";
sha256 = "CYLhSxlKMHuIEMmqtN8o/lhwTfcR+DInFxVjZOJ1fHc=";
};
nativeBuildInputs = [ autoPatchelfHook libGL freetype libdrm fontconfig ];
installPhase = ''
mkdir -p $out/bin
cp -r * $out/
ln -s $out/aw-qt $out/bin/aw-qt
ln -s $out/aw-server/aw-server $out/bin/aw-server
ln -s $out/aw-watcher-afk/aw-watcher-afk $out/bin/aw-watcher-afk
ln -s $out/aw-watcher-window/aw-watcher-window $out/bin/aw-watcher-window
'';
meta = with lib; {
homepage = "https://activitywatch.net/";
description = "The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.";
license = licenses.mpl20;
platforms = [ "x86_64-linux" ];
};
}

View file

@ -14,11 +14,10 @@
./froidmpa/vscode.nix
];
nixpkgs.config = {
nixpkgs = {
overlays = [ (import ../overlay.nix { }) ];
config = {
allowUnfree = true;
packageOverrides = pkgs: {
ncmpcpp = pkgs.ncmpcpp.override { visualizerSupport = true; };
firefox = pkgs.firefox.override { pkcs11Modules = [ pkgs.eid-mw ]; };
};
};
@ -215,5 +214,31 @@
dolphinEmu
];
};
systemd.user.services.activitywatch = {
Unit.Description = "Start ActivityWatch";
Service.Type = "simple";
Service.ExecStart = "${pkgs.activitywatch-bin}/bin/aw-server";
Install.WantedBy = [ "default.target" ];
Service.Restart = "on-failure";
Service.RestartSec = 5;
};
systemd.user.services.activitywatch-afk = {
Unit.Description = "Start ActivityWatch AFK";
Service.Type = "simple";
Service.ExecStart = "${pkgs.activitywatch-bin}/bin/aw-watcher-afk";
Install.WantedBy = [ "default.target" ];
Service.Restart = "on-failure";
Service.RestartSec = 5;
};
systemd.user.services.activitywatch-window = {
Unit.Description = "Start ActivityWatch Window";
Service.Type = "simple";
Service.ExecStart = "${pkgs.activitywatch-bin}/bin/aw-watcher-window";
Install.WantedBy = [ "default.target" ];
Service.Restart = "on-failure";
Service.RestartSec = 5;
};
};
}

View file

@ -55,7 +55,7 @@ myFocusFollowsMouse = True
main = do
xmproc <- spawnPipe "xmobar .xmonad/xmobarrc"
xmonad $ docks $ myConfig xmproc
xmonad $ ewmh . docks $ myConfig xmproc
myConfig xmproc = azertyConfig {
terminal = myTerminal,

View file

@ -31,6 +31,7 @@
};
};
window = {
title = "Alacritty";
padding = {
x = 5;
y = 5;