mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 14:19:58 +03:00
0a37316d6c
This commit replaces a lot of usages of `mkOption` with the package type, to be `mkPackageOption`, in order to reduce the amount of code.
33 lines
635 B
Nix
33 lines
635 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.programs.k40-whisperer;
|
|
pkg = cfg.package.override {
|
|
udevGroup = cfg.group;
|
|
};
|
|
in
|
|
{
|
|
options.programs.k40-whisperer = {
|
|
enable = mkEnableOption (lib.mdDoc "K40-Whisperer");
|
|
|
|
group = mkOption {
|
|
type = types.str;
|
|
description = lib.mdDoc ''
|
|
Group assigned to the device when connected.
|
|
'';
|
|
default = "k40";
|
|
};
|
|
|
|
package = mkPackageOption pkgs "k40-whisperer" { };
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
users.groups.${cfg.group} = {};
|
|
|
|
environment.systemPackages = [ pkg ];
|
|
services.udev.packages = [ pkg ];
|
|
};
|
|
}
|