mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-09 15:38:12 +01:00
meta: Merge postgres module with shell
Realistically this might be more related to "system" than shell, however it may also be advantageous to keep system as minimal as possible since it could also be argued that interpreted programming languages are a part of the system.
This commit is contained in:
parent
721ead4572
commit
6f1b17a600
@ -1,25 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "user";
|
||||
}
|
||||
{
|
||||
name = "cooldbname";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
|
||||
ensureDatabases = [
|
||||
"cooldbname"
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pgcli
|
||||
];
|
||||
}
|
@ -2,15 +2,19 @@
|
||||
|
||||
let
|
||||
inherit (pkgs) fish htop-vim;
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
inherit (lib) mkEnableOption mkIf mkMerge singleton;
|
||||
inherit (builtins) attrValues;
|
||||
inherit (cfg) postgres;
|
||||
inherit (config.modules.system) username;
|
||||
|
||||
cfg = config.modules.shell;
|
||||
in
|
||||
{
|
||||
options.modules.shell = {
|
||||
postgres = mkEnableOption "postgres database and pgcli for containers";
|
||||
};
|
||||
|
||||
config = with cfg; {
|
||||
config = {
|
||||
users.defaultUserShell = fish;
|
||||
environment.shells = [ fish ];
|
||||
|
||||
@ -24,8 +28,24 @@ in
|
||||
VISUAL = "nvim";
|
||||
};
|
||||
|
||||
environment.systemPackages = builtins.attrValues {
|
||||
inherit (pkgs) wget jq eza fd fzf ripgrep;
|
||||
environment.systemPackages = mkMerge [
|
||||
(attrValues {
|
||||
inherit (pkgs) wget jq eza fd fzf ripgrep;
|
||||
})
|
||||
|
||||
(mkIf postgres (attrValues {
|
||||
inherit (pkgs) pgcli;
|
||||
}))
|
||||
];
|
||||
|
||||
services.postgresql = mkIf postgres {
|
||||
enable = true;
|
||||
|
||||
ensureUsers = singleton {
|
||||
name = username;
|
||||
};
|
||||
|
||||
ensureDatabases = [ username ];
|
||||
};
|
||||
|
||||
programs = {
|
||||
|
Loading…
Reference in New Issue
Block a user