-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
221 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
let | ||
cfg = config.programs.iay; | ||
inherit (lib) mkEnableOption mkIf mkOption mkPackageOption optionalString types; | ||
in { | ||
options.programs.iay = { | ||
enable = mkEnableOption (lib.mdDoc "iay"); | ||
package = mkPackageOption pkgs "iay" {}; | ||
|
||
minimalPrompt = mkOption { | ||
type = types.bool; | ||
default = false; | ||
description = lib.mdDoc "Use minimal one-liner prompt."; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
programs.bash.promptInit = '' | ||
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then | ||
PS1='$(iay ${optionalString cfg.minimalPrompt "-m"})' | ||
fi | ||
''; | ||
|
||
programs.zsh.promptInit = '' | ||
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then | ||
autoload -Uz add-zsh-hook | ||
_iay_prompt() { | ||
PROMPT="$(iay -z ${optionalString cfg.minimalPrompt "-m"})" | ||
} | ||
add-zsh-hook precmd _iay_prompt | ||
fi | ||
''; | ||
}; | ||
|
||
meta.maintainers = pkgs.iay.meta.maintainers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import ./make-test-python.nix ({ pkgs, ... }: | ||
import ./make-test-python.nix ({ lib, pkgs, ... }: | ||
|
||
{ | ||
rec { | ||
name = "wordpress"; | ||
meta = with pkgs.lib.maintainers; { | ||
maintainers = [ | ||
|
@@ -10,67 +10,78 @@ import ./make-test-python.nix ({ pkgs, ... }: | |
]; | ||
}; | ||
|
||
nodes = { | ||
wp_httpd = { ... }: { | ||
nodes = lib.foldl (a: version: let | ||
package = pkgs."wordpress${version}"; | ||
in a // { | ||
"wp${version}_httpd" = _: { | ||
services.httpd.adminAddr = "[email protected]"; | ||
services.httpd.logPerVirtualHost = true; | ||
|
||
services.wordpress.webserver = "httpd"; | ||
services.wordpress.sites = { | ||
"site1.local" = { | ||
database.tablePrefix = "site1_"; | ||
inherit package; | ||
}; | ||
"site2.local" = { | ||
database.tablePrefix = "site2_"; | ||
inherit package; | ||
}; | ||
}; | ||
|
||
networking.firewall.allowedTCPPorts = [ 80 ]; | ||
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; | ||
}; | ||
|
||
wp_nginx = { ... }: { | ||
"wp${version}_nginx" = _: { | ||
services.wordpress.webserver = "nginx"; | ||
services.wordpress.sites = { | ||
"site1.local" = { | ||
database.tablePrefix = "site1_"; | ||
inherit package; | ||
}; | ||
"site2.local" = { | ||
database.tablePrefix = "site2_"; | ||
inherit package; | ||
}; | ||
}; | ||
|
||
networking.firewall.allowedTCPPorts = [ 80 ]; | ||
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; | ||
}; | ||
|
||
wp_caddy = { ... }: { | ||
"wp${version}_caddy" = _: { | ||
services.wordpress.webserver = "caddy"; | ||
services.wordpress.sites = { | ||
"site1.local" = { | ||
database.tablePrefix = "site1_"; | ||
inherit package; | ||
}; | ||
"site2.local" = { | ||
database.tablePrefix = "site2_"; | ||
inherit package; | ||
}; | ||
}; | ||
|
||
networking.firewall.allowedTCPPorts = [ 80 ]; | ||
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; | ||
}; | ||
}; | ||
}) {} [ | ||
"6_1" | ||
]; | ||
|
||
testScript = '' | ||
import re | ||
start_all() | ||
wp_httpd.wait_for_unit("httpd") | ||
wp_nginx.wait_for_unit("nginx") | ||
wp_caddy.wait_for_unit("caddy") | ||
${lib.concatStrings (lib.mapAttrsToList (name: value: '' | ||
${name}.wait_for_unit("${(value null).services.wordpress.webserver}") | ||
'') nodes)} | ||
site_names = ["site1.local", "site2.local"] | ||
for machine in (wp_httpd, wp_nginx, wp_caddy): | ||
for machine in (${lib.concatStringsSep ", " (builtins.attrNames nodes)}): | ||
for site_name in site_names: | ||
machine.wait_for_unit(f"phpfpm-wordpress-{site_name}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.