mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-08-19 02:56:17 +02:00
meta: Handle postgres at the system level
This makes sense since postgres is a service that runs on the system.
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs) fish;
|
||||
inherit (lib) mkEnableOption mkIf mkMerge singleton;
|
||||
inherit (cfg) postgres;
|
||||
inherit (config.modules.system) username;
|
||||
inherit (lib) mkMerge;
|
||||
inherit (builtins) attrValues;
|
||||
|
||||
cfg = config.modules.shell;
|
||||
in
|
||||
{
|
||||
options.modules.shell = {
|
||||
postgres = mkEnableOption "postgres database and pgcli for containers";
|
||||
};
|
||||
|
||||
config = {
|
||||
users.defaultUserShell = fish;
|
||||
environment.shells = [ fish ];
|
||||
@@ -84,6 +76,7 @@ in
|
||||
visidata
|
||||
zellij
|
||||
diskonaut
|
||||
pgcli
|
||||
;
|
||||
inherit (pkgs)
|
||||
p7zip
|
||||
@@ -105,22 +98,8 @@ in
|
||||
nix-search-cli
|
||||
;
|
||||
})
|
||||
|
||||
(mkIf postgres (attrValues {
|
||||
inherit (pkgs) pgcli;
|
||||
}))
|
||||
];
|
||||
|
||||
services.postgresql = mkIf postgres {
|
||||
enable = true;
|
||||
|
||||
ensureUsers = singleton {
|
||||
name = username;
|
||||
};
|
||||
|
||||
ensureDatabases = [ username ];
|
||||
};
|
||||
|
||||
programs = {
|
||||
fish.enable = true;
|
||||
neovim.enable = true;
|
||||
|
Reference in New Issue
Block a user