summaryrefslogtreecommitdiffstats
path: root/nixos/modules/hardware/kryoflux.nix
blob: 3e3110e5773ae535c3c62dcb7f8368942285b18c (plain)
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
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.hardware.kryoflux;

in
{
  options.hardware.kryoflux = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enables kryoflux udev rules, ensures 'floppy' group exists. This is a
        prerequisite to using devices supported by kryoflux without being root,
        since kryoflux device descriptors will be owned by floppy through udev.
      '';
    };
    package = lib.mkPackageOption pkgs "kryoflux" { };
  };

  config = lib.mkIf cfg.enable {
    services.udev.packages = [ cfg.package ];
    environment.systemPackages = [ cfg.package ];
    users.groups.floppy = { };
  };

  meta.maintainers = with lib.maintainers; [ matthewcroughan ];
}