Skip to content

Commit

Permalink
fix: Temporarily rely on parent module name to get the homeModules
Browse files Browse the repository at this point in the history
…working
  • Loading branch information
shivaraj-bh committed Feb 14, 2025
1 parent d421ffe commit 7b5d728
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
16 changes: 7 additions & 9 deletions nix/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# where module filename is of form `${name}.nix`. The submodule takes this
# 'name' parameter, and is expected to set the final process-compose config in
# its `outputs.settings` option.
multiService = process-manager-name: mod:
multiService = name: mod:
{ config, pkgs, lib, ... }:
let
# Derive name from filename
Expand Down Expand Up @@ -87,19 +87,17 @@
});
};
};
config = lib.optionalAttrs (process-manager-name == "launchd")
config = lib.optionalAttrs (name == "homeModules")
{
systemd.user.services = lib.pipe config.services.${service} [
(lib.filterAttrs (_: cfg: cfg.enable))
(lib.concatMapAttrs (_: cfg: cfg.outputs.systemd))
];
launchd.agents = lib.pipe config.services.${service} [
(lib.concatMapAttrs (_: cfg: lib.mapAttrs (_: cf: { ... }: { imports = [ cf ]; }) cfg.outputs.launchd))
];
}
// lib.optionalAttrs (process-manager-name == "systemd") {
systemd.user.services = lib.pipe config.services.${service} [
(lib.filterAttrs (_: cfg: cfg.enable))
(lib.concatMapAttrs (_: cfg: cfg.outputs.systemd))
];
}
// lib.optionalAttrs (process-manager-name == "process-compose") {
// lib.optionalAttrs (name == "processComposeModules") {
settings = {
imports =
lib.pipe config.services.${service} [
Expand Down
9 changes: 7 additions & 2 deletions nix/services/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ let
in
{
processComposeModules = {
imports = (builtins.map (multiService "process-compose") services) ++ [ ./devShell.nix ];
imports = (builtins.map (multiService "processComposeModules") services) ++ [ ./devShell.nix ];
};

homeModules = {
imports = (builtins.map (multiService "systemd") services) ++ (builtins.map (multiService "launchd") services);
imports = (builtins.map (multiService "homeModules") services);
# imports = lib.pipe services [
# (map (multiService "systemd"))
# (map (multiService "launchd"))
# ];
# imports = (builtins.map (multiService "systemd") services) ++ (builtins.map (multiService "launchd") services);
};
}

0 comments on commit 7b5d728

Please sign in to comment.