nixos module needed some fixes

This commit is contained in:
Sebastian Moser
2026-05-14 08:17:01 +02:00
parent 55c85ad716
commit 2907d7e236
3 changed files with 17 additions and 17 deletions

View File

@@ -311,10 +311,16 @@ in rec {
}; };
}; };
}) // rec {
############################## SOME GLOBAL OUTPUTS ##############################
inherit inputs self;
############################## NIXOS MODULES ############################## ############################## NIXOS MODULES ##############################
nixosModules.default = { system, lib, config, ... }: { nixosModules.default = { system, lib, config, pkgs, ... }: {
options.mize = { options.mize = {
debuginary = lib.mkOption { enable = lib.mkEnableOption "enable the mize damon";
debugBinary = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = null; default = null;
example = "/home/user/here/mize"; example = "/home/user/here/mize";
@@ -337,26 +343,24 @@ in rec {
}; };
}; };
systemd.user.services.mize = { config = lib.mkIf config.mize.enable {
systemd.user.services.mize = {
description = "the mize daemon"; description = "the mize daemon";
wantedBy = [ "default.target" ]; 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 = { 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}"; MIZE_CONFIG_FILES = let fileInStore = (pkgs.formats.toml {}).generate "mize-daemon-config.toml" config.mize.config; in if config.mize.debugConfigFile == null then "${fileInStore}" else "${config.mize.debugConfigFile}";
}; };
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
ExecStart = if config.mize.debuginary == null then "${self.packages.${system}.mize}/bin/mize daemon" else "${config.mize.debugBinary} daemon"; ExecStart = if config.mize.debugBinary == null then "${self.packages.${system}.mize}/bin/mize daemon" else "${config.mize.debugBinary} daemon";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; # this should mean DISPLAY and WAYLAND_DISPLAY are set in the service env...
}; };
};
}; };
}; };
# for what we do the nixos and home-manager api is identical # for what we do the nixos and home-manager api is identical
homeModules.default = nixosModules.default; homeModules.default = nixosModules.default;
}) // {
############################## SOME GLOBAL OUTPUTS ##############################
inherit inputs self;
}; };
} }

View File

@@ -68,11 +68,7 @@ pub fn mount(sub_matches: &ArgMatches) -> MizeResult<()> {
pub fn daemon(sub_matches: &ArgMatches) -> MizeResult<()> { pub fn daemon(sub_matches: &ArgMatches) -> MizeResult<()> {
let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?;
// load all parts we need for any mize application... making a fat daemon for now.
// in the future parts should be loaded on demand (from .so files and from parts.mize.works)
ppc
instance.wait(); instance.wait();
return Ok(()); return Ok(());

View File

@@ -39,7 +39,7 @@ fn main() {
// match command // match command
let result = match cli_matches.subcommand() { let result = match cli_matches.subcommand() {
// mi daemon // mi daemon
Some(("daemon", sub_matches)) => cli::run(sub_matches), Some(("daemon", sub_matches)) => cli::daemon(sub_matches),
Some(("is-running", sub_matches)) => cli::is_running(sub_matches), Some(("is-running", sub_matches)) => cli::is_running(sub_matches),