-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.nix
55 lines (54 loc) · 1.45 KB
/
module.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
49
50
51
52
53
54
55
{ lib, pkgs, config, ... }:
with lib;
let
# Shorter name to access final settings a
# user of hello.nix module HAS ACTUALLY SET.
# cfg is a typical convention.
cfg = config.services.spotify-midi-control;
in {
# Declare what settings a user of this "hello.nix" module CAN SET.
options.services.spotify-midi-control = {
enable = mkEnableOption "Spotify MIDI Control";
midi_config = {
thing1 = mkOption {
type = types.integer;
default = 128;
};
status = mkOption {
type = types.integer;
default = 0b1011;
};
channel = mkOption {
type = types.integer;
default = 0b0;
};
controls = {
play = mkOption {
type = types.integer;
default = 41;
};
pause = mkOption {
type = types.integer;
default = 42;
};
previous = mkOption {
type = types.integer;
default = 58;
};
next = mkOption {
type = types.integer;
default = 59;
};
};
};
};
# Define what other settings, services and resources should be active IF
# a user of this "hello.nix" module ENABLED this module
# by setting "services.hello.enable = true;".
config = mkIf cfg.enable {
systemd.services.spotify-midi-control = {
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.spotify-midi-control}/bin/spotify-midi-config";
};
};
}