-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
48 lines (47 loc) · 1.79 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
description = "turns thinkpad trackpoint buttons into keyboard thumb clusters";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
in
flake-utils.lib.eachDefaultSystem (
system: rec {
packages = {
trackpoint-clusters = nixpkgs.legacyPackages.${system}.callPackage ./package.nix { };
default = packages.trackpoint-clusters;
};
}
) // rec { # not system dependent
overlay = final: prev: {
trackpoint-clusters = final.callPackage ./package.nix { };
};
nixosModules.default = { lib, pkgs, config, ... }:
let cfg = config.services.trackpoint-clusters; in
{
options.services.trackpoint-clusters = {
enable = lib.mkEnableOption "trackpoint-clusters";
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${pkgs.system}.trackpoint-clusters;
};
};
config.systemd.user.services.trackpoint-clusters = lib.mkIf (cfg.enable) {
Unit = {
Description = "turns thinkpad trackpoint buttons into keyboard thumb clusters";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type="simple";
ExecStart="${cfg.package}/bin/trackpoint-clusters";
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
# I think the same module works for both nixos and home-manager
hmModules.default = nixosModules.default;
};
}