autoimport 3*/{krebs,$(LOGNAME)}

This commit is contained in:
tv 2015-07-24 17:34:08 +02:00
parent faf5f6c172
commit f1ebbc7339
13 changed files with 58 additions and 39 deletions

View File

@ -22,14 +22,12 @@ in
}; };
} }
{ {
imports = [ ../../3modules/tv/ejabberd.nix ];
tv.ejabberd = { tv.ejabberd = {
enable = true; enable = true;
hosts = [ "jabber.viljetic.de" ]; hosts = [ "jabber.viljetic.de" ];
}; };
} }
{ {
imports = [ ../../3modules/krebs/github-hosts-sync.nix ];
krebs.github-hosts-sync.enable = true; krebs.github-hosts-sync.enable = true;
tv.iptables.input-internet-accept-new-tcp = tv.iptables.input-internet-accept-new-tcp =
singleton config.krebs.github-hosts-sync.port; singleton config.krebs.github-hosts-sync.port;
@ -39,7 +37,6 @@ in
tv.identity.self = config.tv.identity.hosts.cd; tv.identity.self = config.tv.identity.hosts.cd;
} }
{ {
imports = [ ../../3modules/tv/iptables.nix ];
tv.iptables = { tv.iptables = {
enable = true; enable = true;
input-internet-accept-new-tcp = [ input-internet-accept-new-tcp = [
@ -55,19 +52,11 @@ in
}; };
} }
{ {
imports = [
../../3modules/tv/iptables.nix
../../3modules/krebs/nginx.nix
];
tv.iptables.input-internet-accept-new-tcp = singleton "http"; tv.iptables.input-internet-accept-new-tcp = singleton "http";
krebs.nginx.servers.cgit.server-names = singleton "cgit.cd.viljetic.de"; krebs.nginx.servers.cgit.server-names = singleton "cgit.cd.viljetic.de";
} }
{ {
# TODO make public_html also available to cd, cd.retiolum (AKA default) # TODO make public_html also available to cd, cd.retiolum (AKA default)
imports = [
../../3modules/tv/iptables.nix
../../3modules/krebs/nginx.nix
];
tv.iptables.input-internet-accept-new-tcp = singleton "http"; tv.iptables.input-internet-accept-new-tcp = singleton "http";
krebs.nginx.servers.public_html = { krebs.nginx.servers.public_html = {
server-names = singleton "cd.viljetic.de"; server-names = singleton "cd.viljetic.de";
@ -86,7 +75,6 @@ in
}; };
} }
{ {
imports = [ ../../3modules/krebs/retiolum.nix ];
krebs.retiolum = { krebs.retiolum = {
enable = true; enable = true;
connectTo = [ connectTo = [

View File

@ -15,7 +15,6 @@ with lib;
tv.identity.self = config.tv.identity.hosts.mkdir; tv.identity.self = config.tv.identity.hosts.mkdir;
} }
{ {
imports = [ ../../3modules/tv/iptables.nix ];
tv.iptables = { tv.iptables = {
enable = true; enable = true;
input-internet-accept-new-tcp = [ input-internet-accept-new-tcp = [
@ -29,7 +28,6 @@ with lib;
}; };
} }
{ {
imports = [ ../../3modules/krebs/retiolum.nix ];
krebs.retiolum = { krebs.retiolum = {
enable = true; enable = true;
connectTo = [ connectTo = [

View File

@ -14,7 +14,6 @@ with lib;
tv.identity.self = config.tv.identity.hosts.nomic; tv.identity.self = config.tv.identity.hosts.nomic;
} }
{ {
imports = [ ../../3modules/tv/iptables.nix ];
tv.iptables = { tv.iptables = {
enable = true; enable = true;
input-internet-accept-new-tcp = [ input-internet-accept-new-tcp = [
@ -26,7 +25,6 @@ with lib;
}; };
} }
{ {
imports = [ ../../3modules/krebs/nginx.nix ];
krebs.nginx = { krebs.nginx = {
enable = true; enable = true;
servers.default.locations = [ servers.default.locations = [
@ -37,7 +35,6 @@ with lib;
}; };
} }
{ {
imports = [ ../../3modules/krebs/retiolum.nix ];
krebs.retiolum = { krebs.retiolum = {
enable = true; enable = true;
connectTo = [ connectTo = [

View File

@ -15,7 +15,6 @@ with lib;
tv.identity.self = config.tv.identity.hosts.rmdir; tv.identity.self = config.tv.identity.hosts.rmdir;
} }
{ {
imports = [ ../../3modules/tv/iptables.nix ];
tv.iptables = { tv.iptables = {
enable = true; enable = true;
input-internet-accept-new-tcp = [ input-internet-accept-new-tcp = [
@ -29,7 +28,6 @@ with lib;
}; };
} }
{ {
imports = [ ../../3modules/krebs/retiolum.nix ];
krebs.retiolum = { krebs.retiolum = {
enable = true; enable = true;
connectTo = [ connectTo = [

View File

@ -24,7 +24,7 @@ in
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# shitment # stockholm
git git
gnumake gnumake
parallel parallel
@ -122,7 +122,6 @@ in
]; ];
} }
{ {
imports = [ ../../3modules/tv/iptables.nix ];
tv.iptables = { tv.iptables = {
enable = true; enable = true;
input-internet-accept-new-tcp = [ input-internet-accept-new-tcp = [
@ -134,7 +133,6 @@ in
}; };
} }
{ {
imports = [ ../../3modules/krebs/nginx.nix ];
krebs.nginx = { krebs.nginx = {
enable = true; enable = true;
servers.default.locations = [ servers.default.locations = [
@ -145,7 +143,6 @@ in
}; };
} }
{ {
imports = [ ../../3modules/krebs/retiolum.nix ];
krebs.retiolum = { krebs.retiolum = {
enable = true; enable = true;
connectTo = [ connectTo = [
@ -155,7 +152,6 @@ in
}; };
} }
{ {
imports = [ ../../3modules/krebs/urlwatch.nix ];
krebs.urlwatch = { krebs.urlwatch = {
enable = true; enable = true;
mailto = "tv@wu.retiolum"; # TODO mailto = "tv@wu.retiolum"; # TODO

View File

@ -1,7 +1,6 @@
{ config, ... }: { config, ... }:
{ {
imports = [ ../../3modules/tv/consul.nix ];
tv.consul = rec { tv.consul = rec {
enable = true; enable = true;

View File

@ -3,7 +3,6 @@ with import ../../4lib/tv { inherit lib pkgs; };
let let
out = { out = {
imports = [ ../../3modules/krebs/git.nix ];
krebs.git = { krebs.git = {
enable = true; enable = true;
root-title = "public repositories at ${config.tv.identity.self.name}"; root-title = "public repositories at ${config.tv.identity.self.name}";

View File

@ -1,7 +1,6 @@
{ config, ... }: { config, ... }:
{ {
imports = [ ../../3modules/tv/identity.nix ];
tv.identity = { tv.identity = {
enable = true; enable = true;
search = "retiolum"; search = "retiolum";

View File

@ -0,0 +1,11 @@
_:
{
imports = [
./github-hosts-sync.nix
./git.nix
./nginx.nix
./retiolum.nix
./urlwatch.nix
];
}

View File

@ -10,7 +10,6 @@ let
cfg = config.tv.consul; cfg = config.tv.consul;
out = { out = {
imports = [ ../../3modules/tv/iptables.nix ];
options.tv.consul = api; options.tv.consul = api;
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
imp imp

10
3modules/tv/default.nix Normal file
View File

@ -0,0 +1,10 @@
_:
{
imports = [
./consul.nix
./ejabberd.nix
./identity.nix
./iptables.nix
];
}

View File

@ -41,13 +41,14 @@ deploy:;@
"$$src/" "$$deploy_host:$$dst" "$$src/" "$$deploy_host:$$dst"
)} )}
prepush /root/src/shitment "$$PWD" prepush /root/src/stockholm "$$PWD"
prepush /root/src/secrets "$$secrets_dir" prepush /root/src/secrets "$$secrets_dir"
ssh -S none "$$deploy_host" -T env \ ssh -S none "$$deploy_host" -T env \
nixpkgs_url="$$nixpkgs_url" \ nixpkgs_url="$$nixpkgs_url" \
nixpkgs_rev="$$nixpkgs_rev" \ nixpkgs_rev="$$nixpkgs_rev" \
system_name="$$system_name" \ system_name="$$system_name" \
user_name="$$LOGNAME" \
sh -euf \ sh -euf \
<<-\EOF <<-\EOF
prefetch(){( prefetch(){(
@ -77,26 +78,30 @@ deploy:;@
prefetch /root/src/nixpkgs "$$nixpkgs_url" "$$nixpkgs_rev" prefetch /root/src/nixpkgs "$$nixpkgs_url" "$$nixpkgs_rev"
echo build system... echo build system...
NIXOS_CONFIG=/root/src/shitment/1systems/$(LOGNAME)/$$system_name.nix \ NIX_PATH=/root/src \
NIX_PATH=src \ nix-build \
nix-build -Q -A system '<nixpkgs/nixos>' -Q \
-A system \
'<stockholm>' \
--argstr user-name "$$user_name" \
--argstr system-name "$$system_name"
result/bin/switch-to-configuration switch result/bin/switch-to-configuration switch
EOF EOF
.PHONY: eval .PHONY: eval
eval: eval:
@nix-instantiate \ @
NIX_PATH=stockholm=$$PWD:$$NIX_PATH \
nix-instantiate \
--json \ --json \
--eval \ --eval \
--strict \ --strict \
-A "$$get" \ -A "$$get" \
-E ' '<stockholm>' \
import <nixpkgs/nixos/lib/eval-config.nix> { --argstr user-name "$$LOGNAME" \
system = builtins.currentSystem; --argstr system-name "$$system" \
modules = [ ./1systems/$(LOGNAME)/$(system).nix ]; | jq -r .
}
' | jq -r .
else else
$(error unbound variable: system[s]) $(error unbound variable: system[s])
endif endif

20
default.nix Normal file
View File

@ -0,0 +1,20 @@
{ user-name, system-name }:
let
eval = import <nixpkgs/nixos/lib/eval-config.nix> {
system = builtins.currentSystem;
modules = [
(./1systems + "/${user-name}/${system-name}.nix")
(./3modules/krebs)
(./3modules + "/${user-name}")
];
};
in
{
inherit (eval) config options;
system = eval.config.system.build.toplevel;
}