make use of mkEnableOption

This commit is contained in:
Moritz Böhme 2022-10-15 20:00:09 +02:00
parent a98589b6f8
commit 5c0752b891
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
43 changed files with 73 additions and 329 deletions

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.adb;
in
{
options.my.programs.adb = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.adb.enable = mkEnableOption "adb";
config = mkIf cfg.enable {
programs.adb.enable = true;

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.bspwm;
in
{
options.my.programs.bspwm = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.bspwm.enable = mkEnableOption "true";
config = lib.mkIf cfg.enable {
services = {

View file

@ -9,13 +9,8 @@ let
cfg = config.my.programs.code;
in
{
options.my.programs.code = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.code.enable = mkEnableOption "code";
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.vscode = {

View file

@ -11,7 +11,6 @@
./code.nix
./direnv.nix
./emacs.nix
./email.nix
./firefox.nix
./fish.nix
./git.nix

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.direnv;
in
{
options.my.programs.direnv = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
options.my.programs.direnv.enable = mkEnableOption "direnv";
config = mkIf cfg.enable {
home-manager.users.moritz.programs.direnv = {

View file

@ -12,13 +12,8 @@ let
(epkgs: [ epkgs.vterm ]));
in
{
options.my.programs.emacs = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.emacs.enable = mkEnableOption "emacs";
config = mkIf cfg.enable {
my.shell.aliases = {
emacs = "emacsclient -t -a 'emacs -t'";

View file

@ -1,25 +0,0 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.email;
in
{
options.my.programs.email = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
config = mkIf cfg.enable {
# Email Applications
users.users.moritz.packages = with pkgs; [ thunderbird ];
networking.firewall.allowedTCPPorts = [ 33728 1025 1143 ];
};
}

View file

@ -12,11 +12,7 @@ let
in
{
options.my.programs.firefox = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
enable = mkEnableOption "firefox";
arkenfox = {
enable = mkEnableOption "arkenfox";
overrides = mkOption {

View file

@ -14,13 +14,7 @@ let
exportedVariables = lib.concatStringsSep "\n" exportVariables;
in
{
options.my.programs.fish = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.fish.enable = mkEnableOption "fish";
config = lib.mkIf cfg.enable {
# set as default shell

View file

@ -10,11 +10,7 @@ let
in
{
options.my.programs.git = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
enable = mkEnableOption "git";
signing = mkOption {
default = false;
type = types.bool;

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.gnome;
in
{
options.my.programs.gnome = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.gnome.enable = mkEnableOption "gnome";
config = lib.mkIf cfg.enable {
hardware = {

View file

@ -9,13 +9,8 @@ let
cfg = config.my.programs.gpg;
in
{
options.my.programs.gpg = {
enable = mkOption {
default = true;
type = types.bool;
example = true;
};
};
options.my.programs.gpg.enable = mkEnableOption "gpg";
config = mkIf cfg.enable {
home-manager.users.moritz.programs.gpg.enable = true;
environment.shellInit = ''

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.helix;
in
{
options.my.programs.helix = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
options.my.programs.helix.enable = mkEnableOption "helix";
config = mkIf cfg.enable {
home-manager.users.moritz.programs.helix = {

View file

@ -9,13 +9,8 @@ let
cfg = config.my.programs.hub;
in
{
options.my.programs.hub = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
options.my.programs.hub.enable = mkEnableOption "hub";
config = mkIf cfg.enable {
age.secrets = {
github = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.kakoune;
in
{
options.my.programs.kakoune = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
options.my.programs.kakoune.enable = mkEnableOption "kakoune";
config = mkIf cfg.enable {
home-manager.users.moritz = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.kitty;
in
{
options.my.programs.kitty = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.kitty.enable = mkEnableOption "kitty";
config = mkIf cfg.enable {
my.shell.aliases.ssh = "kitty +kitten ssh";

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.ledger;
in
{
options.my.programs.ledger = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.ledger.enable = mkEnableOption "ledger";
config = mkIf cfg.enable {
my.shell = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.logseq;
in
{
options.my.programs.logseq = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.logseq.enable = mkEnableOption "logseq";
config = mkIf cfg.enable {
users.users.moritz.packages = with pkgs; [

View file

@ -30,7 +30,14 @@ in
example = [ "python39" ];
};
packages = mkOption {
default = [ "isort" "pytest" "flake8" "python-lsp-server" ];
default = [
"flake8"
"isort"
"mypy"
"poetry"
"pytest"
"python-lsp-server"
];
type = with types; listOf (enum commonPackages);
};
};

View file

@ -7,49 +7,9 @@
with lib;
let
cfg = config.my.programs.rofi;
rofi-bluetooth = with pkgs; stdenv.mkDerivation rec {
pname = "rofi-bluetooth";
version = "unstable-2021-03-05";
src = fetchFromGitHub {
repo = pname;
owner = "nickclyde";
# https://github.com/nickclyde/rofi-bluetooth/issues/19
rev = "893db1f2b549e7bc0e9c62e7670314349a29cdf2";
sha256 = "sha256-3oROJKEQCuSnLfbJ+JSSc9hcmJTPrLHRQJsrUcaOMss=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
install -D --target-directory=$out/bin/ ./rofi-bluetooth
wrapProgram $out/bin/rofi-bluetooth \
--prefix PATH ":" ${lib.makeBinPath [ rofi-unwrapped bluez ] }
runHook postInstall
'';
meta = with lib; {
description = "Rofi-based interface to connect to bluetooth devices and display status info";
homepage = "https://github.com/nickclyde/rofi-bluetooth";
license = licenses.gpl3Only;
maintainers = with maintainers; [ MoritzBoehme ];
platforms = platforms.linux;
};
};
in
{
options.my.programs.rofi = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.rofi.enable = mkEnableOption "rofi";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.spotify;
in
{
options.my.programs.spotify = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.spotify.enable = mkEnableOption "spotify";
config = mkIf cfg.enable {
age.secrets.spotifyd = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.sway;
in
{
options.my.programs.sway = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.sway.enable = mkEnableOption "sway";
config = lib.mkIf cfg.enable {
hardware.opengl = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.thunar;
in
{
options.my.programs.thunar = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.thunar.enable = mkEnableOption "thunar";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.xmonad;
in
{
options.my.programs.xmonad = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.xmonad.enable = mkEnableOption "xmonad";
config = lib.mkIf cfg.enable {
services = {

View file

@ -9,13 +9,7 @@ let
cfg = config.my.programs.zathura;
in
{
options.my.programs.zathura = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.zathura.enable = mkEnableOption "zathura";
config = mkIf cfg.enable {
home-manager.users.moritz.programs.zathura = {

View file

@ -11,13 +11,7 @@ let
shellConfig = config.my.shell;
in
{
options.my.programs.zsh = {
enable = mkOption {
default = false;
type = types.bool;
example = true;
};
};
options.my.programs.zsh.enable = mkEnableOption "zsh";
config = lib.mkIf cfg.enable {
environment.pathsToLink = [ "/share/zsh" ];