{ description = "Currents, a weather alert daemon"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; }; outputs = { self, nixpkgs, home-manager }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; in { packages.${system}.default = pkgs.rustPlatform.buildRustPackage { pname = "currents"; version = "0.1.0"; src = ./.; cargoLock.lockFile = ./Cargo.lock; }; # NixOS module (existing) nixosModules.currents = { config, lib, pkgs, ... }: with lib; let cfg = config.services.currents; in { options.services.currents = { enable = mkEnableOption "Currents, a weather alert daemon"; }; config = mkIf cfg.enable { systemd.services."currents@" = { # ... existing service config }; }; }; # Home Manager module (new) homeManagerModules.currents = { config, lib, pkgs, ... }: with lib; let cfg = config.services.currents; in { options.services.currents = { enable = mkEnableOption "Currents, a weather alert daemon"; }; config = mkIf cfg.enable { home.packages = [ self.packages.${system}.default ]; systemd.user.services.currents = { Unit.Description = "Currents, a weather alert daemon"; Service = { Type = "simple"; ExecStart = "${self.packages.${system}.default}/bin/currents"; Restart = "always"; RestartSec = 10; Environment = "RUST_LOG=info"; }; Install.WantedBy = [ "default.target" ]; }; }; }; }; }