mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-09 12:06:04 +01:00
lazysql: add module (#7231)
This commit is contained in:
parent
980aece33a
commit
bd8946c773
6 changed files with 101 additions and 0 deletions
|
|
@ -174,6 +174,7 @@ let
|
||||||
./programs/lapce.nix
|
./programs/lapce.nix
|
||||||
./programs/lazydocker.nix
|
./programs/lazydocker.nix
|
||||||
./programs/lazygit.nix
|
./programs/lazygit.nix
|
||||||
|
./programs/lazysql.nix
|
||||||
./programs/ledger.nix
|
./programs/ledger.nix
|
||||||
./programs/less.nix
|
./programs/less.nix
|
||||||
./programs/lesspipe.nix
|
./programs/lesspipe.nix
|
||||||
|
|
|
||||||
41
modules/programs/lazysql.nix
Normal file
41
modules/programs/lazysql.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.lazysql;
|
||||||
|
|
||||||
|
formatter = pkgs.formats.toml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
|
||||||
|
options.programs.lazysql = {
|
||||||
|
enable = mkEnableOption "lazysql";
|
||||||
|
package = mkPackageOption pkgs "lazysql" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
type = formatter.type;
|
||||||
|
default = { };
|
||||||
|
example = { };
|
||||||
|
description = ''
|
||||||
|
Configuration settings for lazysql.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
xdg.configFile."lazysql/config.toml" = mkIf (cfg.settings != { }) {
|
||||||
|
source = formatter.generate "lazysql-config" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -236,6 +236,7 @@ import nmtSrc {
|
||||||
./modules/programs/kubecolor
|
./modules/programs/kubecolor
|
||||||
./modules/programs/lapce
|
./modules/programs/lapce
|
||||||
./modules/programs/lazydocker
|
./modules/programs/lazydocker
|
||||||
|
./modules/programs/lazysql
|
||||||
./modules/programs/ledger
|
./modules/programs/ledger
|
||||||
./modules/programs/less
|
./modules/programs/less
|
||||||
./modules/programs/lesspipe
|
./modules/programs/lesspipe
|
||||||
|
|
|
||||||
1
tests/modules/programs/lazysql/default.nix
Normal file
1
tests/modules/programs/lazysql/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ lazysql-example-config = ./example-config.nix; }
|
||||||
38
tests/modules/programs/lazysql/example-config.nix
Normal file
38
tests/modules/programs/lazysql/example-config.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
programs.lazysql = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
database = [
|
||||||
|
{
|
||||||
|
Name = "Production database";
|
||||||
|
Provider = "postgres";
|
||||||
|
DBName = "foo";
|
||||||
|
URL = "postgres://postgres:urlencodedpassword@localhost:$${port}/foo";
|
||||||
|
Commands = [
|
||||||
|
{
|
||||||
|
Command = "ssh -tt remote-bastion -L $${port}:localhost:5432";
|
||||||
|
WaitForPort = "$${port}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Name = "Development database";
|
||||||
|
Provider = "postgres";
|
||||||
|
DBName = "foo";
|
||||||
|
URL = "postgres://postgres:urlencodedpassword@localhost:5432/foo";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
application = {
|
||||||
|
DefaultPageSize = 300;
|
||||||
|
DisableSidebar = false;
|
||||||
|
SidebarOverlay = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/lazysql/config.toml
|
||||||
|
assertFileContent home-files/.config/lazysql/config.toml \
|
||||||
|
${./example-config.toml}
|
||||||
|
'';
|
||||||
|
}
|
||||||
19
tests/modules/programs/lazysql/example-config.toml
Normal file
19
tests/modules/programs/lazysql/example-config.toml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[application]
|
||||||
|
DefaultPageSize = 300
|
||||||
|
DisableSidebar = false
|
||||||
|
SidebarOverlay = false
|
||||||
|
|
||||||
|
[[database]]
|
||||||
|
DBName = "foo"
|
||||||
|
Name = "Production database"
|
||||||
|
Provider = "postgres"
|
||||||
|
URL = "postgres://postgres:urlencodedpassword@localhost:$${port}/foo"
|
||||||
|
[[database.Commands]]
|
||||||
|
Command = "ssh -tt remote-bastion -L $${port}:localhost:5432"
|
||||||
|
WaitForPort = "$${port}"
|
||||||
|
|
||||||
|
[[database]]
|
||||||
|
DBName = "foo"
|
||||||
|
Name = "Development database"
|
||||||
|
Provider = "postgres"
|
||||||
|
URL = "postgres://postgres:urlencodedpassword@localhost:5432/foo"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue