mize daemon service and some timetrack stuff as well

This commit is contained in:
Sebastian Moser
2026-05-14 07:43:47 +02:00
parent 193c3ce3e0
commit 55c85ad716
9 changed files with 167 additions and 17 deletions

View File

@@ -43,7 +43,7 @@ let
};
in {
in rec {
############################## PACKAGES ##############################
packages = rec {
@@ -109,6 +109,52 @@ in {
libsoup_3
];
};
mize = osCrane.buildPackage {
src = fileSetForCrate ./packages/mize;
cargoExtraArgs = "-p mize";
nativeBuildInputs = [
pkgs.pkg-config
pkgs.gobject-introspection
pkgs.gobject-introspection.dev
];
buildInputs = with pkgs; [
git # needed to build spacetimedb as it needs to get it's git hash for setting it's version
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
wasm-bindgen-cli
lld_20
xdotool
];
LD_LIBRARY_PATH = with pkgs; pkgs.lib.makeLibraryPath [
xdotool
webkitgtk_4_1
pango
openssl
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
];
};
};
############################## DEV SHELLS ##############################
@@ -264,6 +310,49 @@ in {
};
};
############################## NIXOS MODULES ##############################
nixosModules.default = { system, lib, config, ... }: {
options.mize = {
debuginary = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "/home/user/here/mize";
description = "If set to NOT null, the mize daemon service will use this path instead of $${self.packages.system.mize}/bin/mize''";
};
debugConfigFile = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "/home/user/here/mize.toml";
description = "If set to NOT null, the mize daemon service will use the config file at this path instead of one written to the nix store";
};
config = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = {};
example = {
dat_dir = "home/user/my_mize_data";
spacetime.url = "spacetime.example.com";
};
description = "mize config for the daemon";
};
};
systemd.user.services.mize = {
description = "the mize daemon";
wantedBy = [ "default.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; # this should mean DISPLAY and WAYLAND_DISPLAY are set in the service env...
environment = {
MIZE_CONFIG_FILES = let fileInStore = (pkgs.formats.toml {}).generate "mize-daemon-config.toml" config.mize.config; in if config.mize.debugConfigFile then "${config.mize.debugConfigFile}" else "${fileInStore}";
};
serviceConfig = {
Restart = "on-failure";
ExecStart = if config.mize.debuginary == null then "${self.packages.${system}.mize}/bin/mize daemon" else "${config.mize.debugBinary} daemon";
};
};
};
# for what we do the nixos and home-manager api is identical
homeModules.default = nixosModules.default;
}) // {