Skip to content

Commit

Permalink
Move settings around
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Sep 24, 2024
1 parent bf9c864 commit 2460348
Show file tree
Hide file tree
Showing 33 changed files with 188 additions and 219 deletions.
5 changes: 3 additions & 2 deletions modules/kernels/bash/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
, writeTextDir

, bash
, attrs
, extensions

, settings
, settingsSchema
}:

with { inherit (settings) attrs extensions; };

let
kernelName = "bash";

Expand Down
4 changes: 2 additions & 2 deletions modules/kernels/bash/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with lib;
default = ["sh" "bash"];
};

settings.lsp.bash-language-server.enable = mkOption {
lsp.bash-language-server.enable = mkOption {
type = types.bool;
default = true;
description = "Enable Bash language server";
Expand All @@ -33,7 +33,7 @@ with lib;
config = mkIf config.kernels.bash.enable {
builtKernels.bash = config.pkgs.callPackage ./. {
bash = config.pkgs.bash;
inherit (config.kernels.bash) attrs extensions settings;
settings = config.kernels.bash;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.bash;
};
};
Expand Down
5 changes: 2 additions & 3 deletions modules/kernels/clojure/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
, writeTextDir
, symlinkJoin

, bash
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) attrs extensions; };

let
common = callPackage ../common.nix {};

Expand Down
4 changes: 2 additions & 2 deletions modules/kernels/clojure/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with lib;
default = ["clj"];
};

settings.lsp.clojure-lsp.enable = mkOption {
lsp.clojure-lsp.enable = mkOption {
type = types.bool;
default = true;
description = "Enable clojure-lsp language server";
Expand All @@ -33,7 +33,7 @@ with lib;
config = mkIf config.kernels.clojure.enable {
builtKernels.clojure = config.pkgs.callPackage ./. {
clojure = config.pkgs.clojure;
inherit (config.kernels.clojure) attrs extensions settings;
settings = config.kernels.clojure;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.clojure;
};
};
Expand Down
5 changes: 2 additions & 3 deletions modules/kernels/coq/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

, coqPackages

, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

let
common = callPackage ../common.nix {};

Expand Down
3 changes: 1 addition & 2 deletions modules/kernels/coq/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ with lib;
builtKernels.coq = config.pkgs.callPackage ./. {
coqPackages = getAttr config.kernels.coq.coqPackages config.pkgs;

inherit (config.kernels.coq) packages attrs extensions;
settings = {};
settings = config.kernels.coq;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.coq;
};
};
Expand Down
8 changes: 4 additions & 4 deletions modules/kernels/cpp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
, llvmPackages_13
, xeus-cling

, flavor
, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages extensions flavor; };

with lib;

let
attrs = [flavor] ++ settings.attrs;

common = callPackage ../common.nix {};

displayName = "C++";
Expand Down
7 changes: 1 addition & 6 deletions modules/kernels/cpp/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,12 @@ with lib;
type = types.listOf types.str;
default = ["cpp" "hpp" "cxx" "hxx" "c" "h"];
};

settings = {};
};
};

config = mkIf config.kernels.cpp.enable {
builtKernels.cpp = config.pkgs.callPackage ./. {
inherit (config.kernels.cpp) flavor packages extensions settings;

attrs = [config.kernels.cpp.flavor] ++ config.kernels.cpp.attrs;

settings = config.kernels.cpp;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.cpp;
};
};
Expand Down
5 changes: 2 additions & 3 deletions modules/kernels/go/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

, go

, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

with lib;

let
Expand Down
24 changes: 11 additions & 13 deletions modules/kernels/go/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@ with lib;
default = ["go"];
};

settings = {
lsp.gopls.enable = mkOption {
type = types.bool;
description = "Enable gopls language server";
default = true;
};

go.gocache = mkOption {
type = types.str;
description = "Value of GOCACHE environment variable";
default = "/home/.gocache";
};
lsp.gopls.enable = mkOption {
type = types.bool;
description = "Enable gopls language server";
default = true;
};

go.gocache = mkOption {
type = types.str;
description = "Value of GOCACHE environment variable";
default = "/home/.gocache";
};
};
};
Expand All @@ -56,7 +54,7 @@ with lib;
builtKernels.go = config.pkgs.callPackage ./. {
go = getAttr config.kernels.go.goPackage config.pkgs;

inherit (config.kernels.go) packages attrs extensions settings;
settings = config.kernels.go;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.go;
};
};
Expand Down
7 changes: 2 additions & 5 deletions modules/kernels/haskell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
, symlinkJoin
, makeWrapper

, ltsOnly ? true

, compilerName
, snapshot

, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

with lib;

let
Expand Down
43 changes: 21 additions & 22 deletions modules/kernels/haskell/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,26 @@ with lib;
default = ["hs"];
};

settings = {
lsp.haskell-language-server.enable = mkOption {
description = "Enable haskell-language-server";
type = types.bool;
default = true;
};
lsp.haskell-language-server.debug = mkOption {
description = "Haskell-language-server: enable debug output";
type = types.bool;
default = false;
};
lsp.haskell-language-server.super-debug = mkOption {
description = "Haskell-language-server: enable verbose debug output";
type = types.bool;
default = false;
};
enableHlintOutput = mkOption {
description = "Enable hlint warnings in Jupyter kernel output. Normally you don't want this because it is provided by haskell-language-server.";
type = types.bool;
default = false;
};
lsp.haskell-language-server.enable = mkOption {
description = "Enable haskell-language-server";
type = types.bool;
default = true;
};
lsp.haskell-language-server.debug = mkOption {
description = "Haskell-language-server: enable debug output";
type = types.bool;
default = false;
};
lsp.haskell-language-server.super-debug = mkOption {
description = "Haskell-language-server: enable verbose debug output";
type = types.bool;
default = false;
};

enableHlintOutput = mkOption {
description = "Enable hlint warnings in Jupyter kernel output. Normally you don't want this because it is provided by haskell-language-server.";
type = types.bool;
default = false;
};
};
};
Expand All @@ -76,7 +75,7 @@ with lib;
compilerName = config.kernels.haskell.ghcPackage;
snapshot = getAttr config.kernels.haskell.ghcPackage compilers;

inherit (config.kernels.haskell) packages attrs extensions settings;
settings = config.kernels.haskell;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.haskell;
};
};
Expand Down
5 changes: 2 additions & 3 deletions modules/kernels/julia/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

, julia

, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

with lib;

let
Expand Down
43 changes: 21 additions & 22 deletions modules/kernels/julia/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,26 @@ with lib;
default = ["jl"];
};

settings = {
precompile = mkOption {
description = "Precompile Julia environment for faster imports. In some cases, precompilation can make the build fail, so turning this off can help.";
type = types.bool;
default = true;
};
lsp.LanguageServer.enable = mkOption {
description = "Enable LanguageServer language server";
type = types.bool;
default = true;
};
lsp.LanguageServer.index = mkOption {
description = "LanguageServer: auto-index packages when building environment";
type = types.bool;
default = true;
};
lsp.LanguageServer.debug = mkOption {
description = "LanguageServer: log debug messages to stderr";
type = types.bool;
default = false;
};
precompile = mkOption {
description = "Precompile Julia environment for faster imports. In some cases, precompilation can make the build fail, so turning this off can help.";
type = types.bool;
default = true;
};

lsp.LanguageServer.enable = mkOption {
description = "Enable LanguageServer language server";
type = types.bool;
default = true;
};
lsp.LanguageServer.index = mkOption {
description = "LanguageServer: auto-index packages when building environment";
type = types.bool;
default = true;
};
lsp.LanguageServer.debug = mkOption {
description = "LanguageServer: log debug messages to stderr";
type = types.bool;
default = false;
};
};
};
Expand All @@ -68,7 +67,7 @@ with lib;
builtKernels.julia = config.pkgs.callPackage ./. {
julia = getAttr config.kernels.julia.juliaPackage config.pkgs;

inherit (config.kernels.julia) packages attrs extensions settings;
settings = config.kernels.julia;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.julia;
};
};
Expand Down
6 changes: 3 additions & 3 deletions modules/kernels/octave/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
, symlinkJoin
, writeTextDir

, packages
, attrs
, extensions
, octave

, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

with lib;

let
Expand Down
4 changes: 2 additions & 2 deletions modules/kernels/octave/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ with lib;
default = ["m"];
};

settings.extraJupyterConfig = mkOption {
extraJupyterConfig = mkOption {
type = types.str;
default = "";
description = "Extra Jupyter configuration.";
Expand All @@ -38,7 +38,7 @@ with lib;
config = mkIf config.kernels.octave.enable {
builtKernels.octave = config.pkgs.callPackage ./. {
octave = config.pkgs.octave;
inherit (config.kernels.octave) packages attrs extensions settings;
settings = config.kernels.octave;
settingsSchema = nixosOptionsToSettingsSchema { componentsToDrop = 2; } options.kernels.octave;
};
};
Expand Down
5 changes: 2 additions & 3 deletions modules/kernels/postgres/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
, writeTextDir
, symlinkJoin

, packages
, attrs
, extensions
, settings
, settingsSchema
}:

with { inherit (settings) packages attrs extensions; };

let
common = callPackage ../common.nix {};

Expand Down
Loading

0 comments on commit 2460348

Please sign in to comment.