From 133dc74fb923fac0e2373acdda98a28ca08f3af9 Mon Sep 17 00:00:00 2001 From: Makesesama Date: Sun, 4 May 2025 18:27:44 +0200 Subject: [PATCH] home manager module --- flake.nix | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 28b7d37..ab37b1b 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,8 @@ unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; utils.url = "github:numtide/flake-utils"; fabric.url = "github:wholikeel/fabric-nix"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = @@ -36,5 +38,43 @@ program = "${self.packages.${system}.default}/bin/bar"; }; } - ); + ) + // { + homeManagerModules.makku-bar = + { + config, + lib, + pkgs, + ... + }: + { + options.services.makku-bar = { + enable = lib.mkEnableOption "makku-bar status bar"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.callPackage ./derivation.nix { inherit (pkgs) lib python3Packages; }; + description = "The makku-bar package to use."; + }; + }; + + config = lib.mkIf config.services.makku-bar.enable { + systemd.user.services.makku-bar = { + Unit = { + Description = "Makku Status Bar"; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = "${config.services.makku-bar.package}/bin/bar"; + Restart = "on-failure"; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; + }; + }; }