Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

HM support darwin

+47 -23
+47 -23
nix/home-module.nix
··· 28 28 29 29 type = lib.mkOption { 30 30 type = lib.types.enum [ 31 - "nixos" 32 31 "home-manager" 33 32 "nix-darwin" 33 + "nixos" 34 34 ]; 35 35 default = "home-manager"; 36 36 }; ··· 42 42 }; 43 43 }; 44 44 45 - config = lib.mkIf cfg.enable { 46 - assertions = [ 45 + config = lib.mkIf cfg.enable ( 46 + lib.mkMerge [ 47 47 { 48 - assertion = cfg.config.url != null; 49 - message = "Sower URL is required"; 48 + assertions = [ 49 + { 50 + assertion = cfg.config.url != null; 51 + message = "Sower URL is required"; 52 + } 53 + ]; 54 + 55 + xdg.configFile."sower/config.toml".source = lib.mkIf (cfg.config != null) ( 56 + toml.generate "sower-config.toml" cfg.config 57 + ); 50 58 } 51 - ]; 52 59 53 - systemd.user.services.sower = { 54 - Service = { 55 - Environment = [ "PATH=${lib.makeBinPath [ pkgs.nix ]}" ]; 56 - ExecStart = "${lib.getExe cfg.package} tree upgrade"; 57 - }; 58 - }; 60 + (lib.mkIf pkgs.stdenv.isLinux { 61 + systemd.user.services.sower = { 62 + Service = { 63 + Environment = [ "PATH=${lib.makeBinPath [ pkgs.nix ]}" ]; 64 + ExecStart = "${lib.getExe cfg.package} tree upgrade"; 65 + }; 66 + }; 59 67 60 - systemd.user.timers.sower = { 61 - Install.WantedBy = [ "timers.target" ]; 68 + systemd.user.timers.sower = { 69 + Install.WantedBy = [ "timers.target" ]; 62 70 63 - Timer = { 64 - OnCalendar = "daily"; 65 - Persistent = true; 66 - }; 67 - }; 71 + Timer = { 72 + OnCalendar = "daily"; 73 + Persistent = true; 74 + }; 75 + }; 76 + }) 68 77 69 - xdg.configFile."sower/config.toml".source = lib.mkIf (cfg.config != null) ( 70 - toml.generate "sower-config.toml" cfg.config 71 - ); 72 - }; 78 + (lib.mkIf pkgs.stdenv.isDarwin { 79 + launchd = { 80 + agents.sower = { 81 + enable = true; 82 + config = { 83 + KeepAlive = false; 84 + ProgramArguments = [ "${lib.getExe cfg.package} tree upgrade" ]; 85 + StartCalendarInterval = [ 86 + { 87 + Hour = 1; 88 + Minute = 0; 89 + } 90 + ]; 91 + }; 92 + }; 93 + }; 94 + }) 95 + ] 96 + ); 73 97 }