1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 17:11:03 +01:00

treewide: null package support (#6582)

Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
This commit is contained in:
Austin Horstman 2025-03-07 18:17:52 -06:00 committed by GitHub
parent 6c2b79403e
commit d2c014e1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 269 additions and 222 deletions

View file

@ -8,7 +8,7 @@ in {
options.services.clipse = {
enable = lib.mkEnableOption "Enable clipse clipboard manager";
package = lib.mkPackageOption pkgs "clipse" { };
package = lib.mkPackageOption pkgs "clipse" { nullable = true; };
systemdTarget = lib.mkOption {
type = lib.types.str;
@ -130,7 +130,7 @@ in {
lib.platforms.linux)
];
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."clipse/config.json".source =
jsonFormat.generate "settings" {
@ -147,20 +147,21 @@ in {
xdg.configFile."clipse/custom_theme.json".source =
jsonFormat.generate "theme" cfg.theme;
systemd.user.services.clipse = lib.mkIf pkgs.stdenv.isLinux {
Unit = {
Description = "Clipse listener";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
systemd.user.services.clipse =
lib.mkIf (pkgs.stdenv.isLinux && (cfg.package != null)) {
Unit = {
Description = "Clipse listener";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${cfg.package}/bin/clipse -listen";
};
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${cfg.package}/bin/clipse -listen";
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
};
};
}