summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-09-06 11:12:24 +0200
committermakefu <github@syntax-fehler.de>2017-09-06 11:12:24 +0200
commit4399e8ee64864596d1a5062a78cf405e2c5d6221 (patch)
tree0bcc67e7d0f4ff22ca7e4840608f72015a49fbdd
parentd12b4d86310ab56ac87f4ba768e49fd6423a9f37 (diff)
parent99ecdb4dab32d5a5044cd439a9ce639801d1398b (diff)
Merge remote-tracking branch 'lass/master'
-rw-r--r--krebs/2configs/default.nix1
-rw-r--r--krebs/3modules/announce-activation.nix60
-rw-r--r--krebs/3modules/default.nix1
-rw-r--r--krebs/3modules/nin/default.nix5
-rw-r--r--krebs/3modules/rtorrent.nix23
-rw-r--r--nin/1systems/onondaga/config.nix65
6 files changed, 88 insertions, 67 deletions
diff --git a/krebs/2configs/default.nix b/krebs/2configs/default.nix
index e7ece87b..c3400e17 100644
--- a/krebs/2configs/default.nix
+++ b/krebs/2configs/default.nix
@@ -5,6 +5,7 @@ with import <stockholm/lib>;
imports = [
./backup.nix
];
+ krebs.announce-activation.enable = true;
krebs.enable = true;
krebs.tinc.retiolum.enable = true;
diff --git a/krebs/3modules/announce-activation.nix b/krebs/3modules/announce-activation.nix
new file mode 100644
index 00000000..5a3a788c
--- /dev/null
+++ b/krebs/3modules/announce-activation.nix
@@ -0,0 +1,60 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: let
+ cfg = config.krebs.announce-activation;
+ announce-activation = pkgs.writeDash "announce-activation" ''
+ set -efu
+ message=$(${cfg.get-message})
+ exec ${pkgs.irc-announce}/bin/irc-announce \
+ ${shell.escape cfg.irc.server} \
+ ${shell.escape (toString cfg.irc.port)} \
+ ${shell.escape cfg.irc.nick} \
+ ${shell.escape cfg.irc.channel} \
+ "$message"
+ '';
+ default-get-message = pkgs.writeDash "announce-activation-get-message" ''
+ set -efu
+ PATH=${makeBinPath [
+ pkgs.coreutils
+ pkgs.gawk
+ pkgs.gnused
+ pkgs.nix
+ ]}
+ profile=/nix/var/nix/profiles/system
+ gen_info=$(nix-env -p "$profile" --list-generations | tail -1)
+ gen_no=$(echo "$gen_info" | awk '{print$1}')
+ pretty_name=$(sed -n '/^PRETTY_NAME=/{s/.*="//;s/"$//;p}' /etc/os-release)
+ echo "activating generation $gen_no $pretty_name"
+ '';
+in {
+ options.krebs.announce-activation = {
+ enable = mkEnableOption "announce-activation";
+ get-message = mkOption {
+ default = default-get-message;
+ type = types.package;
+ };
+ irc = {
+ # TODO rename channel to target?
+ channel = mkOption {
+ default = "#retiolum";
+ type = types.str; # TODO types.irc-channel
+ };
+ nick = mkOption {
+ default = config.krebs.build.host.name;
+ type = types.label;
+ };
+ port = mkOption {
+ default = 6667;
+ type = types.int;
+ };
+ server = mkOption {
+ default = "ni.r";
+ type = types.hostname;
+ };
+ };
+ };
+ config = mkIf cfg.enable {
+ system.activationScripts.announce-activation = ''
+ ${announce-activation}
+ '';
+ };
+}
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index abb3d37e..42df3f05 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -6,6 +6,7 @@ let
out = {
imports = [
+ ./announce-activation.nix
./apt-cacher-ng.nix
./backup.nix
./bepasty-server.nix
diff --git a/krebs/3modules/nin/default.nix b/krebs/3modules/nin/default.nix
index d5d13cd1..aab56835 100644
--- a/krebs/3modules/nin/default.nix
+++ b/krebs/3modules/nin/default.nix
@@ -3,7 +3,10 @@
with import <stockholm/lib>;
{
- hosts = mapAttrs (_: setAttr "owner" config.krebs.users.nin) {
+ hosts = mapAttrs (_: recursiveUpdate {
+ owner = config.krebs.users.nin;
+ ci = true;
+ }) {
hiawatha = {
cores = 2;
nets = {
diff --git a/krebs/3modules/rtorrent.nix b/krebs/3modules/rtorrent.nix
index d8551899..472accef 100644
--- a/krebs/3modules/rtorrent.nix
+++ b/krebs/3modules/rtorrent.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, options, ... }:
with import <stockholm/lib>;
let
@@ -73,6 +73,15 @@ let
# authentication also applies to rtorrent.rutorrent
enable = mkEnableOption "rtorrent nginx web RPC";
+ addr = mkOption {
+ type = types.addr4;
+ default = "0.0.0.0";
+ description = ''
+ the address to listen on
+ default is 0.0.0.0
+ '';
+ };
+
port = mkOption {
type = types.nullOr types.int;
description =''
@@ -290,7 +299,7 @@ let
services.nginx.enable = mkDefault true;
services.nginx.virtualHosts.rtorrent = {
default = mkDefault true;
- inherit (webcfg) basicAuth port;
+ inherit (webcfg) basicAuth;
root = optionalString rucfg.enable webdir;
locations = {
@@ -310,7 +319,15 @@ let
include ${pkgs.nginx}/conf/fastcgi.conf;
''; }
);
- };
+ # workaround because upstream nginx api changed
+ # TODO remove when nobody uses 17.03 anymore
+ } // (if hasAttr "port" (head options.services.nginx.virtualHosts.type.getSubModules).submodule.options then {
+ port = webcfg.port;
+ } else {
+ listen = [
+ { inherit (webcfg) addr port; }
+ ];
+ });
};
rutorrent-imp = {
diff --git a/nin/1systems/onondaga/config.nix b/nin/1systems/onondaga/config.nix
index 242d67c2..3cd0773a 100644
--- a/nin/1systems/onondaga/config.nix
+++ b/nin/1systems/onondaga/config.nix
@@ -7,7 +7,6 @@
{
imports = [
<stockholm/nin>
- <nixpkgs/nixos/modules/profiles/qemu-guest.nix>
<stockholm/nin/2configs/retiolum.nix>
<stockholm/nin/2configs/weechat.nix>
<stockholm/nin/2configs/git.nix>
@@ -15,70 +14,10 @@
krebs.build.host = config.krebs.hosts.onondaga;
- boot.loader.grub.enable = true;
- boot.loader.grub.version = 2;
- # boot.loader.grub.efiSupport = true;
- # boot.loader.grub.efiInstallAsRemovable = true;
- # boot.loader.efi.efiSysMountPoint = "/boot/efi";
- # Define on which hard drive you want to install Grub.
- boot.loader.grub.device = "/dev/sda";
+ boot.isContainer = true;
+ networking.useDHCP = false;
- # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
-
- # Select internationalisation properties.
- # i18n = {
- # consoleFont = "Lat2-Terminus16";
- # consoleKeyMap = "us";
- # defaultLocale = "en_US.UTF-8";
- # };
-
- # Set your time zone.
time.timeZone = "Europe/Amsterdam";
- # List packages installed in system profile. To search by name, run:
- # $ nix-env -qaP | grep wget
- # environment.systemPackages = with pkgs; [
- # wget
- # ];
-
- # List services that you want to enable:
-
- # Enable the OpenSSH daemon.
services.openssh.enable = true;
-
- # Enable CUPS to print documents.
- # services.printing.enable = true;
-
- # Enable the X11 windowing system.
- # services.xserver.enable = true;
- # services.xserver.layout = "us";
- # services.xserver.xkbOptions = "eurosign:e";
-
- # Enable the KDE Desktop Environment.
- # services.xserver.displayManager.kdm.enable = true;
- # services.xserver.desktopManager.kde4.enable = true;
-
- # Define a user account. Don't forget to set a password with ‘passwd’.
- # users.extraUsers.guest = {
- # isNormalUser = true;
- # uid = 1000;
- # };
-
- # The NixOS release to be compatible with for stateful data such as databases.
- system.stateVersion = "16.09";
-
- boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "sd_mod" "sr_mod" ];
-
- fileSystems."/" =
- { device = "/dev/disk/by-uuid/7238cc6e-4bea-4e52-9408-32d8aa05abff";
- fsType = "ext4";
- };
-
- fileSystems."/boot" =
- { device = "/dev/disk/by-uuid/5e923175-854b-4bcf-97c8-f3a91806fa22";
- fsType = "ext2";
- };
-
- nix.maxJobs = lib.mkDefault 1;
-
}