nixfmt: reformat all files

This commit is contained in:
Ingolf Wagner 2019-12-20 17:54:26 +13:00
parent fccbc04336
commit 42d30d7edf
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
192 changed files with 5276 additions and 5151 deletions

View file

@ -1,6 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
imports = [
@ -16,9 +14,7 @@
custom.samba-share = {
enable = false;
folders = {
public = "/home/palo/movies";
};
folders = { public = "/home/palo/movies"; };
};
system.custom.wifi.interfaces = [ "wlp3s0" ];
@ -62,4 +58,3 @@
}

View file

@ -4,11 +4,10 @@
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.availableKernelModules =
[ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
@ -41,23 +40,17 @@
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
# lvm volume group
# ----------------
boot.initrd.luks.devices = [
{
boot.initrd.luks.devices = [{
name = "secure_vg";
device = "/dev/sda2";
preLVM = true;
}
];
}];
# NTFS support
# ------------
environment.systemPackages = [
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.ntfs3g ];
# root
# ----
@ -74,5 +67,4 @@
fsType = "ext4";
};
}

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
}

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
test.services.syncthing = {
enable = true;

View file

@ -7,9 +7,8 @@ let
servedAddressRange = "10.123.145.2,10.123.145.150,12h";
ssid = "bumbumbum";
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
in
{
in {
# todo only open needed ports
networking.firewall.trustedInterfaces = [ wifi ];
@ -35,10 +34,17 @@ in
# start manual
# wantedBy = [ "network.target" ];
after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ];
after = [
"${wifi}-cfg.service"
"nat.service"
"bind.service"
"dhcpd.service"
"sys-subsystem-net-devices-${wifi}.device"
];
serviceConfig = {
ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" ''
ExecStart = "${pkgs.hostapd}/bin/hostapd ${
pkgs.writeText "hostapd.conf" ''
interface=${wifi}
hw_mode=g
channel=10
@ -53,7 +59,8 @@ in
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=${wifiPassword}
''}";
''
}";
Restart = "always";
};
};

View file

@ -1,5 +1,4 @@
{ pkgs, lib, config, ... }:
{
{ pkgs, lib, config, ... }: {
imports = [
<system/server>

View file

@ -1,10 +1,8 @@
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
{ config, lib, pkgs, ... }: {
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.availableKernelModules =
[ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
@ -19,19 +17,15 @@
# lvm volume group
# ----------------
boot.initrd.luks.devices = [
{
boot.initrd.luks.devices = [{
name = "vg";
device = "/dev/sda2";
preLVM = true;
}
];
}];
# NTFS support
# ------------
environment.systemPackages = [
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.ntfs3g ];
# root
# ----
@ -59,16 +53,14 @@
#"x-systemd.device-timeout=1ms"
];
};
systemd.mounts = [
{
systemd.mounts = [{
enable = true;
options = "nofail,noauto";
type = "ext4";
wantedBy = [ "multi-user.target" ];
what = "/dev/disk/by-uuid/162c2f9e-8baa-4433-99fd-bb7e7b69472f";
where = "/media";
}
];
}];
swapDevices = [ ];

View file

@ -1,6 +1,5 @@
{ pkgs, config, lib, ... }:
let
unstablePkgs = import <nixpkgs-unstable> {};
let unstablePkgs = import <nixpkgs-unstable> { };
in {
imports = [
@ -15,7 +14,6 @@ in {
./home-assistant/zigbee2mqtt.nix
];
services.homeAssistantConfig = {
# turn on to edit GUI
@ -26,15 +24,11 @@ in {
longitude = 6.967006;
elevation = 116;
auth_providers = [
{
auth_providers = [{
type = "trusted_networks";
trusted_networks = [
config.module.cluster.services.tinc."private".networkSubnet
];
}
];
trusted_networks =
[ config.module.cluster.services.tinc."private".networkSubnet ];
}];
};
prometheus.namespace = "hass";
@ -111,10 +105,7 @@ in {
control = "hidden";
name = "Today";
view = false;
entities = [
"sensor.weather_temperature"
"sun.sun"
];
entities = [ "sensor.weather_temperature" "sun.sun" ];
};
all_lights = {
name = "All Lights";
@ -154,7 +145,8 @@ in {
sensor = [
# Weather prediction
{ platform = "zamg";
{
platform = "zamg";
name = "Weather";
}
];
@ -180,7 +172,6 @@ in {
};
services.home-assistant = {
enable = true;
package = unstablePkgs.home-assistant.override {
@ -203,15 +194,13 @@ in {
src = python.fetchPypi {
inherit pname version;
sha256 = "9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f";
sha256 =
"9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f";
};
doCheck = false;
buildInputs = [ pkgs.dateutils ];
propagatedBuildInputs = [
python."python-dateutil"
python."six"
];
propagatedBuildInputs = [ python."python-dateutil" python."six" ];
meta = with pkgs.stdenv.lib; {
homepage = "https://github.com/dr-prodigy/python-holidays";
license = licenses.mit;

View file

@ -43,10 +43,7 @@ in {
"${name}" = {
name = "ChaosPott (Essen)";
control = "hidden";
entities = [
"sensor.${name}_aerie"
"sensor.${name}_cellar"
];
entities = [ "sensor.${name}_aerie" "sensor.${name}_cellar" ];
};
view_overview.entities = [ "group.${name}" ];
};
@ -62,7 +59,8 @@ in {
Type = "oneshot";
};
description = "set ${name} for homeassistant";
script = /* sh */ ''
script = # sh
''
${pkgs.curl}/bin/curl -Ls https://status.chaospott.de/api \
| ${pkgs.jq}/bin/jq --compact-output \
'.sensors.door_locked |
@ -81,5 +79,4 @@ in {
};
};
}

View file

@ -7,13 +7,12 @@ let
in {
services.homeAssistantConfig = {
sensor = [
{ platform = "file";
sensor = [{
platform = "file";
name = "day_of_week";
file_path = filePath;
value_template = "{{ value_json.dayOfWeek }}";
}
];
}];
homeassistant = {
whitelist_external_dirs = [ folderPath ];
@ -23,11 +22,7 @@ in {
};
};
group = {
overview.entities = [
"sensor.day_of_week"
];
};
group = { overview.entities = [ "sensor.day_of_week" ]; };
};
@ -40,7 +35,8 @@ in {
Type = "oneshot";
};
description = "set day of wek for homeassistant";
script = /* sh */ ''
script = # sh
''
date +'{"dayOfWeek":"%A"}' >> ${filePath}
'';
};
@ -53,5 +49,4 @@ in {
};
};
}

View file

@ -13,12 +13,14 @@ in {
# todo : use the python tool
sensor = [
{ platform = "file";
{
platform = "file";
name = "${name}_date";
file_path = filePath;
value_template = "{{ value_json.date }}";
}
{ platform = "file";
{
platform = "file";
name = "${name}_name";
file_path = filePath;
value_template = "{{ value_json.name }}";
@ -45,10 +47,7 @@ in {
name = "Feiertage";
view = false;
control = "hidden";
entities = [
"sensor.${name}_date"
"sensor.${name}_name"
];
entities = [ "sensor.${name}_date" "sensor.${name}_name" ];
};
view_overview.entities = [ "group.holidays" ];
@ -66,7 +65,8 @@ in {
Type = "oneshot";
};
description = "set ${name} for homeassistant";
script = /* sh */ ''
script = # sh
''
${pkgs.curl}/bin/curl \
-Ls "https://feiertage-api.de/api/?jahr=$( date +%Y )&nur_land=${state}" \
| ${pkgs.jq}/bin/jq --compact-output '
@ -89,5 +89,4 @@ in {
};
};
}

View file

@ -1,23 +1,19 @@
{ pkgs, config, lib, ... }:
{
{ pkgs, config, lib, ... }: {
services.homeAssistantConfig = {
group.view_overview.entities = [
"media_player.kodi"
];
group.view_overview.entities = [ "media_player.kodi" ];
media_player = [
{
media_player = [{
platform = "kodi";
host = "127.0.0.1";
turn_on_action.service = "script.watch_tv";
turn_off_action.service = "script.stop_watch_tv";
}
];
}];
shell_command = {
start_display = "sudo ${pkgs.systemd}/bin/systemctl start display-manager";
start_display =
"sudo ${pkgs.systemd}/bin/systemctl start display-manager";
stop_display = "sudo ${pkgs.systemd}/bin/systemctl stop display-manager";
};

View file

@ -3,24 +3,18 @@
{
services.homeAssistantConfig = {
group.view_overview.entities = [
"media_player.mpd"
];
group.view_overview.entities = [ "media_player.mpd" ];
media_player = [
{
media_player = [{
platform = "mpd";
host = "localhost";
}
];
}];
script.turn_all_off.sequence = [
{
script.turn_all_off.sequence = [{
alias = "turn mpd off";
service = "media_player.turn_off";
data.entity_id = "media_player.mpd";
}
];
}];
script.turn_all_on.sequence = [
{

View file

@ -1,22 +1,44 @@
{ pkgs, config, lib, ... }:
let
unstablePkgs = import <nixpkgs-unstable> {};
let unstablePkgs = import <nixpkgs-unstable> { };
in {
services.homeAssistantConfig =
let
services.homeAssistantConfig = let
sonoffSwitches = {
"pal01" = { label = "Bett"; icon = "mdi:lightbulb-on"; };
"pal02" = { label = "Lampe"; icon = "mdi:lightbulb-on"; };
"pal03" = { label = "Couche"; icon = "mdi:lightbulb-on"; };
"pal06" = { label = "Küche"; icon = "mdi:lightbulb-on"; };
"pal05" = { label = "TV"; icon = "mdi:television"; };
"pal01" = {
label = "Bett";
icon = "mdi:lightbulb-on";
};
"pal02" = {
label = "Lampe";
icon = "mdi:lightbulb-on";
};
"pal03" = {
label = "Couche";
icon = "mdi:lightbulb-on";
};
"pal06" = {
label = "Küche";
icon = "mdi:lightbulb-on";
};
"pal05" = {
label = "TV";
icon = "mdi:television";
};
"pal04" = { label = "Nummer 4"; icon = "mdi:power-plug-off"; };
"pal07" = { label = "Nummer 7"; icon = "mdi:power-plug-off"; };
"pal08" = { label = "Nummer 8"; icon = "mdi:power-plug-off"; };
"pal04" = {
label = "Nummer 4";
icon = "mdi:power-plug-off";
};
"pal07" = {
label = "Nummer 7";
icon = "mdi:power-plug-off";
};
"pal08" = {
label = "Nummer 8";
icon = "mdi:power-plug-off";
};
};
toSwitch = name: "switch.${name}";
@ -24,16 +46,13 @@ in {
in {
homeassistant = {
customize = lib.mapAttrs' (
entity: value:
{
customize = lib.mapAttrs' (entity: value: {
name = toSwitch entity;
value = {
friendly_name = value.label;
icon = value.icon;
};
}
) sonoffSwitches;
}) sonoffSwitches;
};
script.turn_all_off.sequence = [
@ -49,27 +68,17 @@ in {
}
];
script.turn_all_on.sequence = [
{
script.turn_all_on.sequence = [{
alias = "turn on all lights";
service = "switch.turn_on";
data.entity_id = "group.all_lights";
}
];
}];
group = {
bed_room = {
entities = builtins.map toSwitch [ "pal01" ];
};
living_room = {
entities = builtins.map toSwitch [ "pal03" "pal02" ];
};
tv = {
entities = builtins.map toSwitch [ "pal05" ];
};
kitchen = {
entities = builtins.map toSwitch [ "pal06" ];
};
bed_room = { entities = builtins.map toSwitch [ "pal01" ]; };
living_room = { entities = builtins.map toSwitch [ "pal03" "pal02" ]; };
tv = { entities = builtins.map toSwitch [ "pal05" ]; };
kitchen = { entities = builtins.map toSwitch [ "pal06" ]; };
unknown = {
entities = builtins.map toSwitch [ "pal04" "pal07" "pal08" ];
};
@ -78,10 +87,8 @@ in {
};
};
switch =
let
sonoffConfigurations = builtins.map (name:
{
switch = let
sonoffConfigurations = builtins.map (name: {
name = name;
platform = "mqtt";
command_topic = "cmnd/${lib.toUpper name}/POWER";
@ -91,28 +98,23 @@ in {
state_on = "ON";
state_off = "OFF";
}) (builtins.attrNames sonoffSwitches);
in
sonoffConfigurations;
in sonoffConfigurations;
# discover state on init
automation = [
{
automation = [{
alias = "Sonoff initial Power state";
trigger = {
platform = "homeassistant";
event = "start";
};
action = builtins.map ( name:
{
action = builtins.map (name: {
service = "mqtt.publish";
data = {
topic = "cmnd/${lib.toUpper name}/power";
payload = "";
};
})
(builtins.attrNames sonoffSwitches);
}
];
}) (builtins.attrNames sonoffSwitches);
}];
};
}

View file

@ -1,19 +1,13 @@
{ config, ... }:
{
{ config, ... }: {
imports = [ ./mpd.nix ];
services.homeAssistantConfig = {
sensor = [
{
sensor = [{
platform = "time_date";
display_options = [
"time"
"date"
];
}
];
display_options = [ "time" "date" ];
}];
input_datetime = {
wakeup = {
@ -101,30 +95,21 @@
view = false;
name = "Leave Time";
control = "hidden";
entities = [
"input_boolean.leave"
"input_datetime.leave"
];
entities = [ "input_boolean.leave" "input_datetime.leave" ];
};
timer_return = {
view = false;
name = "Nach Hause kommen";
control = "hidden";
entities = [
"input_boolean.return"
"input_datetime.return"
];
entities = [ "input_boolean.return" "input_datetime.return" ];
};
timer_sleep = {
view = false;
name = "Einschlafen";
control = "hidden";
entities = [
"input_boolean.sleep"
"input_datetime.sleep"
];
entities = [ "input_boolean.sleep" "input_datetime.sleep" ];
};
timers.entities = [
@ -136,10 +121,7 @@
"binary_sensor.daytime"
];
today.entities = [
"sensor.date"
"sensor.time"
];
today.entities = [ "sensor.date" "sensor.time" ];
view_overview.entities = [
"group.timer_wakeup"
@ -199,21 +181,17 @@
};
condition = {
condition = "and";
conditions = [
{
conditions = [{
condition = "state";
entity_id = "input_boolean.leave";
state = "on";
}
];
}];
};
action = [
{
action = [{
alias = "turn all off";
service = "script.turn_on";
entity_id = "script.turn_all_off";
}
];
}];
}
{
@ -225,21 +203,17 @@
};
condition = {
condition = "and";
conditions = [
{
conditions = [{
condition = "state";
entity_id = "input_boolean.return";
state = "on";
}
];
}];
};
action = [
{
action = [{
alias = "turn all on";
service = "script.turn_on";
entity_id = "script.turn_all_on";
}
];
}];
}
{
@ -251,21 +225,17 @@
};
condition = {
condition = "and";
conditions = [
{
conditions = [{
condition = "state";
entity_id = "input_boolean.sleep";
state = "on";
}
];
}];
};
action = [
{
action = [{
alias = "turn all off";
service = "script.turn_on";
entity_id = "script.turn_all_off";
}
];
}];
}
];

View file

@ -17,9 +17,7 @@ let
"temperature_sensor_1".id = "0x00158d0002d79220";
"temperature_sensor_2".id = "0x00158d0002d7913d";
};
motion = {
"motion_sensor_1".id = "0x00158d0002fbd451";
};
motion = { "motion_sensor_1".id = "0x00158d0002fbd451"; };
};
# todo : rename with allSensors
@ -52,21 +50,19 @@ let
disable_led = true;
};
devices = lib.mapAttrs' (
name: { id , ... }:
{
devices = lib.mapAttrs' (name:
{ id, ... }: {
name = id;
value = {
retain = false;
friendly_name = name;
};
}
) allSensors;
}) allSensors;
};
configurationYaml = pkgs.writeText "configuration.yml" (builtins.toJSON zigBee2MqttConfig);
in
{
configurationYaml =
pkgs.writeText "configuration.yml" (builtins.toJSON zigBee2MqttConfig);
in {
imports = [ ./mqtt.nix ];
services.homeAssistantConfig = {
@ -74,22 +70,20 @@ in
# group.unknown.entities = [ "sensor.button_1" ];
sensor = let
buttons = with lib; mapAttrsToList (
name: {...}:
{
buttons = with lib;
mapAttrsToList (name:
{ ... }: {
platform = "mqtt";
name = name;
icon = "mdi:toggle-switch";
state_topic = "zigbee2mqtt/${name}";
availability_topic = "zigbee2mqtt/bridge/state";
value_template = "{{ value_json.click }}";
}
) sensors.buttons;
}) sensors.buttons;
temperature = with lib; mapAttrsToList (
name: {...}:
[
temperature = with lib;
mapAttrsToList (name:
{ ... }: [
{
platform = "mqtt";
name = name;
@ -117,12 +111,10 @@ in
device_class = "pressure";
value_template = "{{ value_json.pressure }}";
}
]
) sensors.temperature;
]) sensors.temperature;
informations = lib.mapAttrsToList (
name: {...}:
[
informations = lib.mapAttrsToList (name:
{ ... }: [
{
platform = "mqtt";
name = "battery_${name}";
@ -140,17 +132,14 @@ in
unit_of_measurement = "-";
value_template = "{{ value_json.linkquality }}";
}
]
) allSensors;
]) allSensors;
in
lib.flatten ( buttons ++ temperature ++ informations );
in lib.flatten (buttons ++ temperature ++ informations);
binary_sensor = let
motion = lib.mapAttrsToList (
name: { ... }:
{
motion = lib.mapAttrsToList (name:
{ ... }: {
name = name;
platform = "mqtt";
device_class = "motion";
@ -160,31 +149,24 @@ in
payload_on = true;
payload_off = false;
value_template = "{{ value_json.occupancy }}";
}
) sensors.motion;
in
lib.flatten ( motion );
}) sensors.motion;
in lib.flatten (motion);
group = let
information = name: [ "sensor.battery_${name}" "sensor.link_${name}" ];
sensor = lib.mapAttrs' (
name: {...}:
{
sensor = lib.mapAttrs' (name:
{ ... }: {
name = name;
value = {
control = "hidden";
entities = [ "sensor.${name}" ] ++ (information name);
};
}
) (sensors.buttons);
}) (sensors.buttons);
sensorTemperature = lib.mapAttrs' (
name: { ... }:
{
sensorTemperature = lib.mapAttrs' (name:
{ ... }: {
name = name;
value = {
control = "hidden";
@ -194,36 +176,31 @@ in
"sensor.pressure_${name}"
] ++ (information name);
};
}
) (sensors.temperature);
}) (sensors.temperature);
binarySensor = lib.mapAttrs' (
name: { ... }:
{
binarySensor = lib.mapAttrs' (name:
{ ... }: {
name = name;
value = {
control = "hidden";
entities = [ "binary_sensor.${name}" ] ++ (information name);
};
}
) (sensors.motion);
}) (sensors.motion);
views = {
view_sensors = {
name = "Sensoren";
control = "hidden";
view = true;
entities = lib.mapAttrsToList (name: { ... }: "group.${name}") allSensors;
entities =
lib.mapAttrsToList (name: { ... }: "group.${name}") allSensors;
};
};
in
views // sensor // binarySensor // sensorTemperature ;
in views // sensor // binarySensor // sensorTemperature;
automation =
let
lights = map (button:
{
automation = let
lights = map (button: {
alias = "Toggle all lights, on click";
trigger = {
platform = "mqtt";
@ -238,8 +215,7 @@ in
entity_id = "group.all_lights";
};
}) [ "button_1" "button_2" "button_3" ];
mpd = map (button:
{
mpd = map (button: {
alias = "Toggle mpd, on double click";
trigger = {
platform = "mqtt";
@ -255,8 +231,7 @@ in
entity_id = "media_player.mpd";
};
}) [ "button_1" "button_2" "button_3" ];
in
lights ++ mpd;
in lights ++ mpd;
# click = double => music an aus
@ -270,7 +245,8 @@ in
systemd.services."zigbee2mqtt" = {
enable = true;
description = "Allows you to use your Zigbee devices without the vendors bridge/gateway.";
description =
"Allows you to use your Zigbee devices without the vendors bridge/gateway.";
after = [ "docker.service" ];
requires = [ "docker.service" ];
# todo : udev rule erstellen, die diesen service erst startet, dieses wanted by ist labil
@ -300,5 +276,4 @@ in
'';
};
}

View file

@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
services.xserver = {
enable = true;

View file

@ -1,5 +1,4 @@
{ config, lib, ... }:
{
{ config, lib, ... }: {
sound.enable = true;

View file

@ -1,7 +1,5 @@
{ pkgs, ... }:
{
{ pkgs, ... }: {
environment.systemPackages = [
];
environment.systemPackages = [ ];
}

View file

@ -1,11 +1,11 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
custom.samba-share = {
enable = true;
folders = {
movies = config.test.services.syncthing.declarative.folders.movies.path;
series = config.test.services.syncthing.declarative.folders.series.path;
music = config.test.services.syncthing.declarative.folders.music-library.path;
music =
config.test.services.syncthing.declarative.folders.music-library.path;
};
};

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
module.cluster.services.tinc = {
"private" = {

View file

@ -7,9 +7,8 @@ let
servedAddressRange = "10.23.45.2,10.23.45.150,12h";
ssid = "palosiot";
wifiPassword = lib.fileContents <secrets/iot_wifi>;
in
{
in {
# todo only open needed ports
networking.firewall.trustedInterfaces = [ wifi ];
@ -17,7 +16,8 @@ in
networking.dhcpcd.denyInterfaces = [ wifi ];
networking.interfaces."${wifi}".ipv4.addresses = [{
address = ipAddress; prefixLength = prefixLength;
address = ipAddress;
prefixLength = prefixLength;
}];
systemd.services.hostapd = {
@ -25,10 +25,17 @@ in
path = [ pkgs.hostapd ];
wantedBy = [ "network.target" ];
after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ];
after = [
"${wifi}-cfg.service"
"nat.service"
"bind.service"
"dhcpd.service"
"sys-subsystem-net-devices-${wifi}.device"
];
serviceConfig = {
ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" ''
ExecStart = "${pkgs.hostapd}/bin/hostapd ${
pkgs.writeText "hostapd.conf" ''
interface=${wifi}
hw_mode=g
channel=10
@ -43,7 +50,8 @@ in
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=${wifiPassword}
''}";
''
}";
Restart = "always";
};
};

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
imports = [
<system/proxy>
@ -31,7 +30,8 @@
balance = false;
};
services.custom.ssh.sshd.rootKeyFiles = [ (toString <secrets/ssh/jenkins_rsa.pub>) ];
services.custom.ssh.sshd.rootKeyFiles =
[ (toString <secrets/ssh/jenkins_rsa.pub>) ];
# make sure ssh is only available trough the tinc
networking.firewall.extraCommands = ''
@ -40,4 +40,3 @@
}

View file

@ -4,16 +4,15 @@
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ];
boot.initrd.availableKernelModules =
[ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8f2986a3-d2b0-4735-be98-9ec081b87984";
fileSystems."/" = {
device = "/dev/disk/by-uuid/8f2986a3-d2b0-4735-be98-9ec081b87984";
fsType = "ext4";
};

View file

@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
imports = [
(builtins.fetchTarball {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz";
url =
"https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz";
sha256 = "03d49v8qnid9g9rha0wg2z6vic06mhp0b049s3whccn1axvs2zzx";
})
];
@ -16,14 +16,13 @@
# nix-shell -p mkpasswd --run 'mkpasswd -m sha-512 "super secret password"'
loginAccounts = {
"root@gaykraft.com" = {
hashedPassword = lib.fileContents <secrets/mailserver/hashedPasswords/root_at_gaykraft.com>;
hashedPassword = lib.fileContents
<secrets/mailserver/hashedPasswords/root_at_gaykraft.com>;
#aliases = [
# "postmaster@gaykraft.com"
#];
# Make this user the catchAll address for domains
catchAll = [
"gaykraft.com"
];
catchAll = [ "gaykraft.com" ];
};
};

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
networking.firewall.allowedTCPPorts = [ 80 443 ];
@ -9,26 +8,38 @@
"git.ingolf-wagner.de" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://workhorse.private:3000";
};
locations."/" = { proxyPass = "http://workhorse.private:3000"; };
};
"paste.ingolf-wagner.de" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://workhorse.private:8000";
};
locations."/" = { proxyPass = "http://workhorse.private:8000"; };
};
#"landing.ingolf-wagner.de" = {
@ -46,8 +57,16 @@
"tech.ingolf-wagner.de" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
@ -63,8 +82,16 @@
"terranix.org" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
@ -78,11 +105,18 @@
};
};
"seafile.gaykraft.com" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
@ -105,14 +139,20 @@
"gaykraft.com" = {
listen = [
{ addr = "0.0.0.0"; port = 4443; ssl = true; }
{ addr = "0.0.0.0"; port = 80; ssl = false; }
{
addr = "0.0.0.0";
port = 4443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
forceSSL = true;
enableACME = true;
locations."/" = {
root = "/srv/www/gaykraft";
};
locations."/" = { root = "/srv/www/gaykraft"; };
};
};
@ -124,7 +164,8 @@
port = 443;
verbose = false;
transparent = true;
appendConfig = /* json */ ''
appendConfig = # json
''
protocols:
(
{ name: "ssh"; service: "ssh"; host: "localhost"; port: "2222"; probe: "builtin"; },

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
module.cluster.services.tinc = {
"private" = {
enable = true;

View file

@ -1,6 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
imports = [
@ -71,4 +69,3 @@
}

View file

@ -5,11 +5,10 @@
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.availableKernelModules =
[ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
@ -43,19 +42,15 @@
# lvm volume group
# ----------------
boot.initrd.luks.devices = [
{
boot.initrd.luks.devices = [{
name = "vg";
device = "/dev/sda2";
preLVM = true;
}
];
}];
# NTFS support
# ------------
environment.systemPackages = [
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.ntfs3g ];
# root
# ----
@ -88,5 +83,4 @@
fsType = "vfat";
};
}

View file

@ -1,9 +1,5 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs ; [
bitwig-studio
sononym
];
environment.systemPackages = with pkgs; [ bitwig-studio sononym ];
}

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
test.services.syncthing = {
enable = true;

View file

@ -7,9 +7,8 @@ let
servedAddressRange = "10.123.145.2,10.123.145.150,12h";
ssid = "bumbumbum";
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
in
{
in {
# todo only open needed ports
networking.firewall.trustedInterfaces = [ wifi ];
@ -35,10 +34,17 @@ in
# start manual
# wantedBy = [ "network.target" ];
after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ];
after = [
"${wifi}-cfg.service"
"nat.service"
"bind.service"
"dhcpd.service"
"sys-subsystem-net-devices-${wifi}.device"
];
serviceConfig = {
ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" ''
ExecStart = "${pkgs.hostapd}/bin/hostapd ${
pkgs.writeText "hostapd.conf" ''
interface=${wifi}
hw_mode=g
channel=10
@ -53,7 +59,8 @@ in
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=${wifiPassword}
''}";
''
}";
Restart = "always";
};
};

View file

@ -1,8 +1,7 @@
{ config, pkgs, lib, ... }:
with lib;
let
port = 8000;
let port = 8000;
in {
# configure nginx
@ -18,7 +17,9 @@ in {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_redirect http://localhost:${toString port} https://paste.workhorse.private/;
proxy_redirect http://localhost:${
toString port
} https://paste.workhorse.private/;
'';
};
};
@ -38,19 +39,20 @@ in {
secretKeyFile = config.krops.userKeys."bepasty".target;
extraConfig = ''
PERMISSIONS = {
'${lib.fileContents <common_secrets/bepasty/admin-password>}': 'admin,list,create,read,delete',
'${
lib.fileContents <common_secrets/bepasty/admin-password>
}': 'admin,list,create,read,delete',
}
'';
};
};
/* fix bepasty service */
# fix bepasty service
nixpkgs.overlays = let
overlay = self: super:
{
bepasty = super.bepasty.override { python3Packages = pkgs.python27Packages; };
overlay = self: super: {
bepasty =
super.bepasty.override { python3Packages = pkgs.python27Packages; };
};
in
[ overlay ];
in [ overlay ];
}

View file

@ -1,5 +1,4 @@
{ lib, config, pkgs, ... }:
{
{ lib, config, pkgs, ... }: {
imports = [
<system/server>

View file

@ -1,5 +1,4 @@
{ config, lib, ... }:
{
{ config, lib, ... }: {
services.nginx = {
enable = true;
@ -8,7 +7,9 @@
"gogs.${config.networking.hostName}.private" = {
serverAliases = [ "git.${config.networking.hostName}.private" ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.services.gogs.httpPort}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.services.gogs.httpPort
}";
};
};
};

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
{ config, ... }: {
services.nginx = {
enable = true;
statusPage = true;
@ -7,7 +6,9 @@
"grafana.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.services.grafana.port}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.services.grafana.port
}";
};
};
};
@ -16,7 +17,8 @@
services.grafana = {
enable = true;
port = 5656;
addr = config.module.cluster.services.tinc."private".hosts."${config.networking.hostName}".tincIp;
addr =
config.module.cluster.services.tinc."private".hosts."${config.networking.hostName}".tincIp;
auth.anonymous = {
enable = true;
org_role = "Editor";
@ -24,14 +26,12 @@
};
provision = {
enable = true;
datasources = [
{
datasources = [{
type = "prometheus";
isDefault = true;
name = "Prometheus Workhorse";
url = "http://workhorse.private:9090";
}
];
}];
};
};

View file

@ -1,8 +1,6 @@
{ config, lib, pkgs, ... }:
let
port = 9000;
in
{
let port = 9000;
in {
# configure nginx
services.nginx = {
enable = true;
@ -16,7 +14,9 @@ in
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_redirect http://localhost:${toString port} https://graylog.workhorse.private/;
proxy_redirect http://localhost:${
toString port
} https://graylog.workhorse.private/;
'';
};
};
@ -27,7 +27,8 @@ in
services.mongodb.enable = true;
services.graylog.enable = true;
services.graylog.elasticsearchHosts = [ "http://${config.services.elasticsearch.listenAddress}:9200" ];
services.graylog.elasticsearchHosts =
[ "http://${config.services.elasticsearch.listenAddress}:9200" ];
# https://docs.graylog.org/en/3.0/pages/configuration/server.conf.html
services.graylog.extraConfig = ''
@ -39,10 +40,12 @@ in
services.graylog.nodeIdFile = "/var/lib/graylog/node-id";
# pwgen -N 1 -s 96
services.graylog.passwordSecret = lib.fileContents <secrets/graylog/password-secret>;
services.graylog.passwordSecret =
lib.fileContents <secrets/graylog/password-secret>;
# echo -n yourpassword | shasum -a 256
services.graylog.rootPasswordSha2 = lib.fileContents <secrets/graylog/root-password-hash>;
services.graylog.rootPasswordSha2 =
lib.fileContents <secrets/graylog/root-password-hash>;
environment.etc."graylog/server/GeoLite2-City.mmdb" = {
enable = true;

View file

@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
let
mainUserHome = "/home/palo";
in
{
let mainUserHome = "/home/palo";
in {
# grub configuration
# ------------------
@ -15,19 +13,15 @@ in
# lvm volume group
# ----------------
boot.initrd.luks.devices = [
{
boot.initrd.luks.devices = [{
name = "vg";
device = "/dev/sda2";
preLVM = true;
}
];
}];
# NTFS support
# ------------
environment.systemPackages = [
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.ntfs3g ];
# root
# ----
@ -83,16 +77,14 @@ in
#"x-systemd.device-timeout=1ms"
];
};
systemd.mounts = [
{
systemd.mounts = [{
enable = true;
options = "nofail,noauto";
type = "ext4";
wantedBy = [ "multi-user.target" ];
what = "/dev/disk/by-uuid/f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89";
where = "/media";
}
];
}];
}

View file

@ -18,7 +18,8 @@ in {
virtualHosts = {
"jenkins.${config.networking.hostName}.private" = {
locations."/" = {
proxyPass = "http://localhost:${toString config.services.jenkins.port}";
proxyPass =
"http://localhost:${toString config.services.jenkins.port}";
extraConfig = ''
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
@ -26,7 +27,9 @@ in {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_redirect http://localhost:${toString config.services.jenkins.port} https://jenkins.${config.networking.hostName}.private/;
proxy_redirect http://localhost:${
toString config.services.jenkins.port
} https://jenkins.${config.networking.hostName}.private/;
'';
};
};
@ -56,8 +59,7 @@ in {
accessUser = "admin";
# https://docs.openstack.org/infra/jenkins-job-builder/definition.html#modules
nixJobs =
let
nixJobs = let
# ssh username + key
gogs-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2";
# ssh username + key
@ -65,131 +67,126 @@ in {
# ssh username + key
sshSputnik = "d91eb57c-5bff-434c-b317-68aad46848d7";
sync-to-github =
name: source: target:
sync-repo name
{
sync-to-github = name: source: target:
sync-repo name {
url = source;
credentialsId = gogs-id;
}
{
} {
url = target;
credentialsId = github-id;
};
in [
(job "deploy-gaykraft"
{ url = "ssh://gogs@workhorse.private:2222/palo/gaykraft.git";
credentialsId = gogs-id; }
[
{ "build" = [
"nix-shell --run build"
];
}
{ "publish" = [
{
script = "nix-shell --run publish";
credentialsId = sshSputnik;
}
];
}
]
)
(job "deploy-techblock"
{ url = "ssh://gogs@workhorse.private:2222/palo/tech.ingolf-wagner.de.git";
credentialsId = gogs-id; }
[
(job "deploy-gaykraft" {
url = "ssh://gogs@workhorse.private:2222/palo/gaykraft.git";
credentialsId = gogs-id;
} [
{ "build" = [ "nix-shell --run build" ]; }
{ "publish" = [
{
"publish" = [{
script = "nix-shell --run publish";
credentialsId = sshSputnik;
}];
}
];}
])
(job "deploy-terranix"
{ url = "ssh://gogs@workhorse.private:2222/terranix/terranix.org.git";
credentialsId = gogs-id; }
[
(job "deploy-techblock" {
url =
"ssh://gogs@workhorse.private:2222/palo/tech.ingolf-wagner.de.git";
credentialsId = gogs-id;
} [
{ "build" = [ "nix-shell --run build" ]; }
{ "publish" = [
{
"publish" = [{
script = "nix-shell --run publish";
credentialsId = sshSputnik;
}];
}
];}
])
(job "sync-retiolum"
{ url = "git@github.com:krebs/retiolum.git";
(job "deploy-terranix" {
url = "ssh://gogs@workhorse.private:2222/terranix/terranix.org.git";
credentialsId = gogs-id;
} [
{ "build" = [ "nix-shell --run build" ]; }
{
"publish" = [{
script = "nix-shell --run publish";
credentialsId = sshSputnik;
}];
}
])
(job "sync-retiolum" {
url = "git@github.com:krebs/retiolum.git";
credentialsId = github-id;
triggers = [ { timed = "H/30 * * * *"; } ];}
[
{ "Download Files" = [
''chmod 755 hosts''
''chmod 755 -R hosts''
''nix-shell -p curl -p gnutar -p bzip2 --run "curl https://lassul.us/retiolum-hosts.tar.bz2 | tar xvjf - || true"''
''chmod 755 -R etc.hosts''
''nix-shell -p curl --run "curl https://lassul.us/retiolum.hosts > etc.hosts || true"''
];}
{ "update repo" = [
triggers = [{ timed = "H/30 * * * *"; }];
} [
{
"Download Files" = [
"chmod 755 hosts"
"chmod 755 -R hosts"
''
nix-shell -p curl -p gnutar -p bzip2 --run "curl https://lassul.us/retiolum-hosts.tar.bz2 | tar xvjf - || true"''
"chmod 755 -R etc.hosts"
''
nix-shell -p curl --run "curl https://lassul.us/retiolum.hosts > etc.hosts || true"''
];
}
{
"update repo" = [
''nix-shell -p git --run "git add ."''
''nix-shell -p git --run "git -c user.name=\'Ingolf Wagner\' -c user.email=\'contact@ingolf-wagner.de\' commit -m update-`date +%Y-%m-%dT%H:%M:%S` || exit 0"''
];}
{ Push = [
{ script = ''nix-shell -p git --run "git push origin master"'';
credentialsId = github-id; }
];}
])
(job "test-terranix"
{ url = "ssh://gogs@workhorse.private:2222/terranix/terranix.git";
''
nix-shell -p git --run "git -c user.name=\'Ingolf Wagner\' -c user.email=\'contact@ingolf-wagner.de\' commit -m update-`date +%Y-%m-%dT%H:%M:%S` || exit 0"''
];
}
{
Push = [{
script = ''nix-shell -p git --run "git push origin master"'';
credentialsId = github-id;
branch = "develop";}
[
{ "run Tests" = [
''nix-shell tests/shell.nix --run "test-terranix"''
];}
}];
}
])
(job "test-taskninja"
{ url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git";
credentialsId = gogs-id; }
[
{ "Create Shell" = [
''nix-shell -p cabal2nix --run "cabal2nix --shell file://. > jenkins.nix"''
];}
{ Update = [
''nix-shell ./jenkins.nix --run "cabal update"''
];}
{ Configure = [
(job "test-terranix" {
url = "ssh://gogs@workhorse.private:2222/terranix/terranix.git";
credentialsId = github-id;
branch = "develop";
} [{
"run Tests" = [ ''nix-shell tests/shell.nix --run "test-terranix"'' ];
}])
(job "test-taskninja" {
url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git";
credentialsId = gogs-id;
} [
{
"Create Shell" = [
''
nix-shell -p cabal2nix --run "cabal2nix --shell file://. > jenkins.nix"''
];
}
{ Update = [ ''nix-shell ./jenkins.nix --run "cabal update"'' ]; }
{
Configure = [
''nix-shell ./jenkins.nix --run "cabal configure --enable-tests"''
''nix-shell ./jenkins.nix --run "cabal install --only-dependencies"''
];}
{ Build = [
''nix-shell ./jenkins.nix --run "cabal build"''
];}
{ Test = [
''nix-shell ./jenkins.nix --run "cabal test"''
];}
''
nix-shell ./jenkins.nix --run "cabal install --only-dependencies"''
];
}
{ Build = [ ''nix-shell ./jenkins.nix --run "cabal build"'' ]; }
{ Test = [ ''nix-shell ./jenkins.nix --run "cabal test"'' ]; }
])
# sync to me
# ----------
(sync-to-github "sync-nixwriters"
"https://cgit.krebsco.de/nix-writers/"
(sync-to-github "sync-nixwriters" "https://cgit.krebsco.de/nix-writers/"
"ssh://gogs@workhorse.private:2222/krebs/nix-writers.git")
(sync-to-github "sync-krops"
"https://cgit.krebsco.de/krops/"
(sync-to-github "sync-krops" "https://cgit.krebsco.de/krops/"
"ssh://gogs@workhorse.private:2222/krebs/krops.git")
# sync to github
# --------------
(sync-to-github "sync-radiodj"

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
{ config, ... }: {
services.nginx = {
enable = true;
statusPage = true;
@ -7,7 +6,9 @@
"kibana.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.services.kibana.port}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.services.kibana.port
}";
};
};
};

View file

@ -16,7 +16,8 @@ in {
"${containerName}.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString port}";
proxyPass =
"http://${config.networking.hostName}.private:${toString port}";
};
};
};
@ -32,9 +33,7 @@ in {
};
autoStart = true;
config =
{ config, pkgs, ... }:
{
config = { config, pkgs, ... }: {
imports = [ <system/all> ];
services.lektor = {
enable = true;
@ -42,13 +41,15 @@ in {
sshKey = sshKey;
repository = repository;
port = port;
additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
additionalScript =
pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
};
};
};
# it might take some time will this thing is up
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity";
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec =
lib.mkForce "infinity";
}

View file

@ -4,7 +4,8 @@ let
containerName = "techblog";
port = 5002;
repository = "ssh://gogs@git.ingolf-wagner.de:443/palo/tech.ingolf-wagner.de.git";
repository =
"ssh://gogs@git.ingolf-wagner.de:443/palo/tech.ingolf-wagner.de.git";
sshKey = toString <secrets/lektor/techblog>;
in {
@ -16,7 +17,8 @@ in {
"${containerName}.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString port}";
proxyPass =
"http://${config.networking.hostName}.private:${toString port}";
};
};
};
@ -32,9 +34,7 @@ in {
};
autoStart = true;
config =
{ config, pkgs, ... }:
{
config = { config, pkgs, ... }: {
imports = [ <system/all> ];
services.lektor = {
enable = true;
@ -42,13 +42,15 @@ in {
sshKey = sshKey;
repository = repository;
port = port;
additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
additionalScript =
pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
};
};
};
# it might take some time will this thing is up
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity";
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec =
lib.mkForce "infinity";
}

View file

@ -16,7 +16,8 @@ in {
"${containerName}.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString port}";
proxyPass =
"http://${config.networking.hostName}.private:${toString port}";
};
};
};
@ -32,9 +33,7 @@ in {
};
autoStart = true;
config =
{ config, pkgs, ... }:
{
config = { config, pkgs, ... }: {
imports = [ <system/all> ];
services.lektor = {
enable = true;
@ -42,13 +41,15 @@ in {
sshKey = sshKey;
repository = repository;
port = port;
additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
additionalScript =
pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build";
};
};
};
# it might take some time will this thing is up
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity";
systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec =
lib.mkForce "infinity";
}

View file

@ -1,15 +1,14 @@
# fetches mails for me
{ lib, pkgs, config, ... }:
{
{ lib, pkgs, config, ... }: {
users.users.mailUser = {
isNormalUser = true;
description = "collects mails for me";
hashedPassword = "!";
name = "mailfetcher";
openssh.authorizedKeys.keyFiles = config.users.users.root.openssh.authorizedKeys.keyFiles;
openssh.authorizedKeys.keyFiles =
config.users.users.root.openssh.authorizedKeys.keyFiles;
};
# configure passwords
krops.userKeys = {
"gmail.palipalo9" = {
@ -60,7 +59,8 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "palo_van_dalo@gmx.de";
passwordCommand = "cat ${toString config.krops.userKeys."gmx.palo_van_dalo".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."gmx.palo_van_dalo".target}";
imap = {
host = "imap.gmx.net";
port = 993;
@ -77,7 +77,8 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "ingolf.wagner@gmx.de";
passwordCommand = "cat ${toString config.krops.userKeys."gmx.ingolf_wagner".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."gmx.ingolf_wagner".target}";
imap = {
host = "imap.gmx.net";
@ -136,7 +137,8 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "pali_palo@web.de";
passwordCommand = "cat ${toString config.krops.userKeys."web.pali_palo".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."web.pali_palo".target}";
imap = {
host = "imap.web.de";
port = 993;
@ -153,13 +155,13 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "palo";
passwordCommand = "cat ${toString config.krops.userKeys."c-base.palo".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."c-base.palo".target}";
imap = {
host = "c-mail.c-base.org";
port = 993;
# fetched using : nix-shell -p openssl --run "openssl s_client -connect c-mail.c-base.org:993 -showcerts"
tls.certificatesFile =
pkgs.writeText "c-base.pem" ''
tls.certificatesFile = pkgs.writeText "c-base.pem" ''
-----BEGIN CERTIFICATE-----
MIIFKDCCAxCgAwIBAgIDAtwrMA0GCSqGSIb3DQEBDQUAMFQxFDASBgNVBAoTC0NB
Y2VydCBJbmMuMR4wHAYDVQQLExVodHRwOi8vd3d3LkNBY2VydC5vcmcxHDAaBgNV
@ -204,7 +206,8 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "palipalo9@googlemail.com";
passwordCommand = "cat ${toString config.krops.userKeys."gmail.palipalo9".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."gmail.palipalo9".target}";
imap = {
host = "imap.gmail.com";
port = 993;
@ -221,7 +224,8 @@
aliases = [ ];
realName = "Ingolf Wagner";
userName = "contact@ingolf-wagner.de";
passwordCommand = "cat ${toString config.krops.userKeys."siteground.contact".target}";
passwordCommand =
"cat ${toString config.krops.userKeys."siteground.contact".target}";
imap = {
host = "securees5.sgcpanel.com";
port = 143;
@ -261,15 +265,13 @@
};
};
# configure mbsync
home-manager.users.mailUser.programs.mbsync.enable = true;
systemd.services.fetchmail = {
enable = true;
serviceConfig = {
User = config.users.users.mailUser.name;
};
environment.NOTMUCH_CONFIG = "${config.users.users.mailUser.home}/.config/notmuch/notmuchrc";
serviceConfig = { User = config.users.users.mailUser.name; };
environment.NOTMUCH_CONFIG =
"${config.users.users.mailUser.home}/.config/notmuch/notmuchrc";
script = ''
echo "run mbsync"
${pkgs.isync}/bin/mbsync \
@ -306,9 +308,11 @@
# a few config
home-manager.users.mailUser.programs.afew = {
enable = true;
extraConfig = with lib; let
extraConfig = with lib;
let
template = index: { tags, query, message ? "generic", ... }: ''
template = index:
{ tags, query, message ? "generic", ... }: ''
[Filter.${toString index}]
query = ${query}
tags = ${concatStringsSep ";" tags}
@ -317,99 +321,338 @@
filters = [
{query = "from:linkedin.com"; tags = [ "+linked" "+jobs" ];}
{query = "from:computerfutures.com OR from:computerfutures.de"; tags = [ "+jobs" "-inbox" ];}
{query = "from:seek.com.au"; tags = [ "+jobs" ];}
{query = "from:xing.com"; tags = [ "+jobs" "-inbox" ];}
{query = "from:no-reply@backtrace.io"; tags = ["+sononym" "-inbox" "-unread"];}
{query = "from:ebay.com OR from:ebay.de OR from:ebay.net"; tags = [ "+ebay" "+shop" "+billing"];}
{query = "from:bahn.de"; tags = [ "+billing" "+bahn" ];}
{query = "from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com"; tags = [ "+mia" "+work" "-unread" "-inbox"];}
{query = "from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:getdigital.de"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:digitalo.de"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:puppet.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:mixcloudmail.com AND subject:Weekly Update"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:facebook.com OR from:facebookmail.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:getpocket.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:oknotify2.com"; tags = [ "+okcupid" ];}
{query = "from:oknotify2.com AND NOT subject:New message"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:paulaschoice.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:immobilienscout24.de"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:magix.net"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:booking.com"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:hackster.io"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:trade4less.de"; tags = [ "-inbox" "-unread" "+junk" ];}
{query = "from:taxback.de OR to:taxback.de"; tags = ["+steuer"] ;}
{query = "from:campact.de"; tags = ["+campact" "+politics"] ;}
{query = "from:menospese.com"; tags = ["+junk" "-unread" "-inbox"] ;}
{query = "from:aliexpress.com"; tags = ["+shop" "+aliexpress"] ;}
{query = "from:congstar.de"; tags = ["+billing" "+congstar" "-inbox" "-unread"] ;}
{query = "from:congstarnews.de"; tags = ["+congstar" "-inbox" "-unread" "+junk"] ;}
{query = "from:fitnessfirst.de"; tags = ["-inbox" "-unread" "+junk"] ;}
{query = "from:steampowered.com AND NOT ( subject:purchase OR subject:received )"; tags = ["-inbox" "-unread" ] ;}
{query = "from:steampowered.com AND ( subject:purchase OR subject:received )"; tags = ["+billing" "+steam" ] ;}
{query = "from:gog.com AND NOT subject:Bestellung"; tags = ["-inbox" "-unread" ] ;}
{query = "from:gog.com AND subject:Bestellung"; tags = ["+billing" "+gog" ] ;}
{query = "from:drive-now.com"; tags = ["+billing" "+drivenow" "-inbox" "-unread"] ;}
{query = "from:mindfactory.de"; tags = ["+shop" "+billing"] ;}
{query = "from:zalando.de"; tags = ["+shop" "+billing" "+zalando"] ;}
{query = "from:ing.de"; tags = ["+bank" "+ingdiba"] ;}
{query = "from:nab.com.au"; tags = ["+bank" "+nab" "-inbox" "-unread"] ;}
{query = "from:dkb.de"; tags = ["+bank" "+dkb"] ;}
{query = "from:o2online.de"; tags = ["+billing" "+o2"] ;}
{query = "from:betfair.com"; tags = ["+work" "+betfair"] ;}
{query = "from:ghostinspector.com"; tags = ["-unread" "-inbox" "+junk"] ;}
{query = "from:travis-ci.org AND subject:csv-to-qif"; tags = ["+development" "+csv-to-qif"] ;}
{query = "to:proaudio@lists.tuxfamily.org"; tags = ["-inbox" "-unread"] ;}
{query = "tag:lists AND from:nixos1@discoursemail.com"; tags = ["+nixos" "+discourse"] ;}
{query = "from:limebike.com AND (subject:Funds OR subject:Receipt)" ; tags = ["-inbox" "-unread" "+billing" "+limebike"] ;}
{query = "from:hetzner.com OR from:hetzner.de" ; tags = ["+hetzner"] ;}
{query = "from:freemusicarchive.org" ; tags = ["+FMA"] ;}
{query = "from:namecheap.com" ; tags = ["+namecheap" "+billing"] ;}
{query = "from:nintendo.com" ; tags = ["+nintendo" "+billing"] ;}
{query = "from:oculus.com AND subject:receipt" ; tags = ["+oculus" "+billing"] ;}
{query = "from:vstbuzz.com" ; tags = ["+junk" "-inbox" ] ;}
{query = "from:runtastic.com" ; tags = ["+junk" "-inbox" ] ;}
{query = "from:letterboxd.com" ; tags = ["+junk" "-inbox" ] ;}
{query = "from::microsoftstoreemail.com" ; tags = ["+junk" "-inbox" ] ;}
{query = "from:car2go.com" ; tags = ["-inbox" "-unread" ] ;}
{query = "from:sixt.de" ; tags = ["-inbox" "-unread" ] ;}
{query = "from:meetup.com" ; tags = ["-inbox" "-unread" "+meetup"] ;}
{query = "from:slack.com" ; tags = ["+slack"] ;}
{query = "from:keybase.io" ; tags = ["+keybase"] ;}
{query = "from:tumblr.com" ; tags = ["+junk" "-inbox" "-unread"];}
{query = "from:jobs2web.com" ; tags = ["+newzealand" "+jobs" "-inbox" ];}
{query = "from:mailings.gmx.net" ; tags = ["+junk" "-inbox" "-unread"];}
{query = "from:paypal.de AND subject:Bestätigung"; tags = ["-unread" "+paypal" "+billing"] ;}
{query = "to:c-base.org" ; tags = ["+cbase"] ;}
{query = "to:c-base.org AND subject=[auto-report]"; tags = ["-unread" "-inbox"] ;}
{query = "to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com"; tags = ["+renoise"] ;}
{query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com"; tags = ["+shop" "+amazon" "+billing"];}
{
query = "to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )";
query = "from:linkedin.com";
tags = [ "+linked" "+jobs" ];
}
{
query = "from:computerfutures.com OR from:computerfutures.de";
tags = [ "+jobs" "-inbox" ];
}
{
query = "from:seek.com.au";
tags = [ "+jobs" ];
}
{
query = "from:xing.com";
tags = [ "+jobs" "-inbox" ];
}
{
query = "from:no-reply@backtrace.io";
tags = [ "+sononym" "-inbox" "-unread" ];
}
{
query = "from:ebay.com OR from:ebay.de OR from:ebay.net";
tags = [ "+ebay" "+shop" "+billing" ];
}
{
query = "from:bahn.de";
tags = [ "+billing" "+bahn" ];
}
{
query =
"from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com";
tags = [ "+mia" "+work" "-unread" "-inbox" ];
}
{
query =
"from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:getdigital.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:digitalo.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:puppet.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:mixcloudmail.com AND subject:Weekly Update";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:facebook.com OR from:facebookmail.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:getpocket.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:oknotify2.com";
tags = [ "+okcupid" ];
}
{
query = "from:oknotify2.com AND NOT subject:New message";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:paulaschoice.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query =
"from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:immobilienscout24.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:magix.net";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:booking.com";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:hackster.io";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:trade4less.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query = "from:taxback.de OR to:taxback.de";
tags = [ "+steuer" ];
}
{
query = "from:campact.de";
tags = [ "+campact" "+politics" ];
}
{
query = "from:menospese.com";
tags = [ "+junk" "-unread" "-inbox" ];
}
{
query = "from:aliexpress.com";
tags = [ "+shop" "+aliexpress" ];
}
{
query = "from:congstar.de";
tags = [ "+billing" "+congstar" "-inbox" "-unread" ];
}
{
query = "from:congstarnews.de";
tags = [ "+congstar" "-inbox" "-unread" "+junk" ];
}
{
query = "from:fitnessfirst.de";
tags = [ "-inbox" "-unread" "+junk" ];
}
{
query =
"from:steampowered.com AND NOT ( subject:purchase OR subject:received )";
tags = [ "-inbox" "-unread" ];
}
{
query =
"from:steampowered.com AND ( subject:purchase OR subject:received )";
tags = [ "+billing" "+steam" ];
}
{
query = "from:gog.com AND NOT subject:Bestellung";
tags = [ "-inbox" "-unread" ];
}
{
query = "from:gog.com AND subject:Bestellung";
tags = [ "+billing" "+gog" ];
}
{
query = "from:drive-now.com";
tags = [ "+billing" "+drivenow" "-inbox" "-unread" ];
}
{
query = "from:mindfactory.de";
tags = [ "+shop" "+billing" ];
}
{
query = "from:zalando.de";
tags = [ "+shop" "+billing" "+zalando" ];
}
{
query = "from:ing.de";
tags = [ "+bank" "+ingdiba" ];
}
{
query = "from:nab.com.au";
tags = [ "+bank" "+nab" "-inbox" "-unread" ];
}
{
query = "from:dkb.de";
tags = [ "+bank" "+dkb" ];
}
{
query = "from:o2online.de";
tags = [ "+billing" "+o2" ];
}
{
query = "from:betfair.com";
tags = [ "+work" "+betfair" ];
}
{
query = "from:ghostinspector.com";
tags = [ "-unread" "-inbox" "+junk" ];
}
{
query = "from:travis-ci.org AND subject:csv-to-qif";
tags = [ "+development" "+csv-to-qif" ];
}
{
query = "to:proaudio@lists.tuxfamily.org";
tags = [ "-inbox" "-unread" ];
}
{
query = "tag:lists AND from:nixos1@discoursemail.com";
tags = [ "+nixos" "+discourse" ];
}
{
query = "from:limebike.com AND (subject:Funds OR subject:Receipt)";
tags = [ "-inbox" "-unread" "+billing" "+limebike" ];
}
{
query = "from:hetzner.com OR from:hetzner.de";
tags = [ "+hetzner" ];
}
{
query = "from:freemusicarchive.org";
tags = [ "+FMA" ];
}
{
query = "from:namecheap.com";
tags = [ "+namecheap" "+billing" ];
}
{
query = "from:nintendo.com";
tags = [ "+nintendo" "+billing" ];
}
{
query = "from:oculus.com AND subject:receipt";
tags = [ "+oculus" "+billing" ];
}
{
query = "from:vstbuzz.com";
tags = [ "+junk" "-inbox" ];
}
{
query = "from:runtastic.com";
tags = [ "+junk" "-inbox" ];
}
{
query = "from:letterboxd.com";
tags = [ "+junk" "-inbox" ];
}
{
query = "from::microsoftstoreemail.com";
tags = [ "+junk" "-inbox" ];
}
{
query = "from:car2go.com";
tags = [ "-inbox" "-unread" ];
}
{
query = "from:sixt.de";
tags = [ "-inbox" "-unread" ];
}
{
query = "from:meetup.com";
tags = [ "-inbox" "-unread" "+meetup" ];
}
{
query = "from:slack.com";
tags = [ "+slack" ];
}
{
query = "from:keybase.io";
tags = [ "+keybase" ];
}
{
query = "from:tumblr.com";
tags = [ "+junk" "-inbox" "-unread" ];
}
{
query = "from:jobs2web.com";
tags = [ "+newzealand" "+jobs" "-inbox" ];
}
{
query = "from:mailings.gmx.net";
tags = [ "+junk" "-inbox" "-unread" ];
}
{
query = "from:paypal.de AND subject:Bestätigung";
tags = [ "-unread" "+paypal" "+billing" ];
}
{
query = "to:c-base.org";
tags = [ "+cbase" ];
}
{
query = "to:c-base.org AND subject=[auto-report]";
tags = [ "-unread" "-inbox" ];
}
{
query =
"to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com";
tags = [ "+renoise" ];
}
{
query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com";
tags = [ "+shop" "+amazon" "+billing" ];
}
{
query =
"to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )";
tags = [ "-inbox" "-unread" "+junk" "+renoise" ];
}
# final rules to make imap sync stuff easier
# there can only be one output folder tag, and theses rules are prioritized
{ query = "tag:fraud" ; tags = ["-inbox" "-archive" "-junk" "-unread" ]; message = "clean up tag fraud";}
{ query = "tag:junk" ; tags = ["-inbox" "-archive" "-fraud" "-unread" ]; message = "clean up tag junk";}
{ query = "tag:archive" ; tags = ["-inbox" "-junk" "-fraud" "-unread" ]; message = "clean up tag archive";}
{ query = "tag:inbox" ; tags = ["-archive" "-junk" "-fraud"]; message = "clean up inbox";}
{ query = "tag:killed"; tags = ["-inbox" "-unread"]; message = "clean up tag killed" ;}
{
query = "tag:fraud";
tags = [ "-inbox" "-archive" "-junk" "-unread" ];
message = "clean up tag fraud";
}
{
query = "tag:junk";
tags = [ "-inbox" "-archive" "-fraud" "-unread" ];
message = "clean up tag junk";
}
{
query = "tag:archive";
tags = [ "-inbox" "-junk" "-fraud" "-unread" ];
message = "clean up tag archive";
}
{
query = "tag:inbox";
tags = [ "-archive" "-junk" "-fraud" ];
message = "clean up inbox";
}
{
query = "tag:killed";
tags = [ "-inbox" "-unread" ];
message = "clean up tag killed";
}
# remove new tag at the end
{ query = "tag:new"; tags = ["-new"]; message = "remove new tag at the end" ;}
{
query = "tag:new";
tags = [ "-new" ];
message = "remove new tag at the end";
}
];
in
''
in ''
# Tag mails which are mailing lists
[ListMailsFilter]
@ -421,7 +664,4 @@
'';
};
}

View file

@ -1,7 +1,3 @@
{ config, pkgs, ... }:
let
unstable = import <nixpkgs-unstable> {};
in {
environment.systemPackages = with pkgs ; [
];
}
let unstable = import <nixpkgs-unstable> { };
in { environment.systemPackages = with pkgs; [ ]; }

View file

@ -1,14 +1,11 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
services.nginx = {
enable = true;
statusPage = true;
virtualHosts = {
"prometheus.workhorse.private" = {
locations."/" = {
proxyPass = "http://workhorse.private:9090";
};
locations."/" = { proxyPass = "http://workhorse.private:9090"; };
};
};
};
@ -77,30 +74,26 @@
metrics_path = "/-/metrics";
params.format = [ "prometheus" ];
scrape_interval = "10s";
static_configs = [
{
static_configs = [{
targets = [ "workhorse.private:3000" ];
labels = {
service = "gogs";
server = "kruck";
};
}
];
}];
}
{
job_name = "home-assistant";
scrape_interval = "60s";
metrics_path = "/api/prometheus";
static_configs = [
{
static_configs = [{
targets = [ "porani.private:8123" ];
labels = {
service = "hass";
server = "porani";
city = "essen";
};
}
];
}];
}
];
};

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
{ config, ... }: {
backup.services.restic = {
"on-porani".enable = false;

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
services.nginx = {
enable = true;
@ -8,7 +7,9 @@
"seafile.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.custom.services.seafile.port}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.custom.services.seafile.port
}";
};
};
};

View file

@ -1,12 +1,12 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
custom.samba-share = {
enable = true;
folders = {
movies = config.test.services.syncthing.declarative.folders.movies.path;
series = config.test.services.syncthing.declarative.folders.series.path;
music = config.test.services.syncthing.declarative.folders.music-library.path;
music =
config.test.services.syncthing.declarative.folders.music-library.path;
};
};

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
services.taskserver = {
enable = true;

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
module.cluster.services.tinc = {
"private" = {

View file

@ -4,12 +4,10 @@ with lib;
let
allTincNetworks =
builtins.attrNames config.module.cluster.services.tinc;
allTincNetworks = builtins.attrNames config.module.cluster.services.tinc;
ipAddresses =
flatten (mapAttrsToList (_: data:
mapAttrsToList (_: hostConfig: hostConfig.tincIp) data.hosts)
ipAddresses = flatten (mapAttrsToList
(_: data: mapAttrsToList (_: hostConfig: hostConfig.tincIp) data.hosts)
config.module.cluster.services.tinc);
in {
@ -21,7 +19,9 @@ in {
"transmission.${config.networking.hostName}.private" = {
serverAliases = [ "torrent.${config.networking.hostName}.private" ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.services.transmission.port}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.services.transmission.port
}";
};
};
};
@ -36,7 +36,8 @@ in {
enable = true;
home = "/home/torrent";
store = "/home/torrent";
hosts = concatStringsSep "," (map (name: "${config.networking.hostName}.${name}") allTincNetworks);
hosts = concatStringsSep ","
(map (name: "${config.networking.hostName}.${name}") allTincNetworks);
whitelist = concatStringsSep "," ipAddresses;
user = "palo";
password = lib.fileContents <secrets/transmission/password>;

View file

@ -9,9 +9,7 @@
{
# configure weechat
services.weechat = {
enable = true;
};
services.weechat = { enable = true; };
# configure bitlbee
services.bitlbee = {
@ -28,17 +26,12 @@
pkgs.telegram-purple
#pkgs.purple-lurch
];
plugins = [
pkgs.bitlbee-facebook
pkgs.bitlbee-steam
];
plugins = [ pkgs.bitlbee-facebook pkgs.bitlbee-steam ];
};
# otherwise xterm is the only thing that works
environment.systemPackages = [ pkgs.rxvt_unicode ];
backup.all.restic.dirs = [
config.services.weechat.root
];
backup.all.restic.dirs = [ config.services.weechat.root ];
}

View file

@ -1,5 +1,4 @@
{ lib, config, pkgs, ... }:
{
{ lib, config, pkgs, ... }: {
imports = [
<system/desktop>

View file

@ -1,33 +1,41 @@
{ config, lib, pkgs, ... }:
let
mainUserHome = "/home/palo";
in
{
let mainUserHome = "/home/palo";
in {
# fix fileSystems.<name>.encrypted - false overwrite
# --------------------------------------------------
boot.initrd.luks.cryptoModules = [ "aes" "aes_generic" "blowfish" "twofish" "serpent" "cbc" "xts" "lrw" "sha1" "sha256" "sha512" "aes_x86_64" ];
boot.initrd.luks.cryptoModules = [
"aes"
"aes_generic"
"blowfish"
"twofish"
"serpent"
"cbc"
"xts"
"lrw"
"sha1"
"sha256"
"sha512"
"aes_x86_64"
];
# todo : why should I use this here
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.kernelModules = [ "kvm-intel" ];
nix.maxJobs = lib.mkDefault 8;
# lvm volume group
# ----------------
boot.initrd.luks.devices = [
{
boot.initrd.luks.devices = [{
name = "vg";
device = "/dev/sda2";
preLVM = true;
}
];
}];
# NTFS support
# ------------
environment.systemPackages = [
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.ntfs3g ];
# root
# ----

View file

@ -1,5 +1,4 @@
{ config, ... }:
{
{ config, ... }: {
services.nginx = {
enable = true;
statusPage = true;
@ -7,16 +6,20 @@
"kibana.${config.networking.hostName}.private" = {
serverAliases = [ ];
locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${toString config.services.kibana.port}";
proxyPass = "http://${config.networking.hostName}.private:${
toString config.services.kibana.port
}";
};
};
};
};
services.elasticsearch.enable = true;
services.elasticsearch.listenAddress = "${config.networking.hostName}.private";
services.elasticsearch.listenAddress =
"${config.networking.hostName}.private";
services.kibana.enable = true;
services.kibana.elasticsearch.hosts = [ "http://${config.networking.hostName}.private:9200" ];
services.kibana.elasticsearch.hosts =
[ "http://${config.networking.hostName}.private:9200" ];
services.kibana.listenAddress = "${config.networking.hostName}.private";
services.kibana.port = 5601;

View file

@ -1,15 +1,16 @@
{ config, pkgs, ... }:
let
unstable = import <nixpkgs-unstable> {};
let unstable = import <nixpkgs-unstable> { };
in {
nixpkgs.config.packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
nur = import (builtins.fetchTarball
"https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
};
environment.systemPackages = with pkgs ; [
environment.systemPackages = with pkgs;
[
bitwig-studio
#unstable.pypi2nix
#nur.repos.mic92.nixos-shell

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
programs.custom.slack = {
enable = true;
@ -7,7 +6,8 @@
};
programs.custom.browser.configList.google-chrome = {
inherit (config.programs.custom.browser.configList.development) home homeBackup user;
inherit (config.programs.custom.browser.configList.development)
home homeBackup user;
sudoUsers = [ "slack" ];
};

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
test.services.syncthing = {
enable = true;

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
module.cluster.services.tinc = {
"private" = {
enable = true;

View file

@ -2,21 +2,15 @@
# cat ~/.ssh/id_rsa.pub
publicSshKey ? "",
# remote-install-get-hiddenReceiver
hiddenReceiver ? "",
}:
{ config, lib, pkgs, ... }:
{
hiddenReceiver ? "", }:
{ config, lib, pkgs, ... }: {
imports = [
{ # system setup
networking.hostName = "liveos";
users.extraUsers = {
root = {
openssh.authorizedKeys.keys = [
publicSshKey
];
};
root = { openssh.authorizedKeys.keys = [ publicSshKey ]; };
};
}
{ # installed packages

View file

@ -1,8 +1,10 @@
{ pkgs, lib, ... }: let
{ pkgs, lib, ... }:
let
remote-access = import ../lib/remote-access.nix {
# cat ~/.ssh/id_rsa.pub
publicSshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
publicSshKey =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
# remote-install-get-hiddenReceiver
hiddenReceiver = "";

View file

@ -3,9 +3,7 @@
services.tor = {
enable = true;
client.enable = true;
hiddenServices.liveos.map = [
{ port = 1337; }
];
hiddenServices.liveos.map = [{ port = 1337; }];
};
environment.systemPackages = [

View file

@ -1,23 +1,22 @@
# NixOS livesystem to reset windows passwords
# Step by step guide : https://opensource.com/article/18/3/how-reset-windows-password-linux
# $ nixos-generator -f iso -c config.nix
{ pkgs, ... }: let
{ pkgs, ... }:
let
wifi = {
ssid = "";
plainTextPassword = "";
};
remote-access = import ../lib/remote-access.nix {
publicSshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
publicSshKey =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw==";
hiddenReceiver = "";
};
in {
imports = [ remote-access ];
environment.systemPackages = [
pkgs.chntpw
pkgs.ntfs3g
];
environment.systemPackages = [ pkgs.chntpw pkgs.ntfs3g ];
networking.dhcpcd.enable = true;
networking.wireless = {

View file

@ -7,10 +7,13 @@
if [ ! -d $GNUPGHOME ]; then
mkdir $GNUPGHOME
fi
cp ${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/drduh/config/662c16404eef04f506a6a208f1253fee2f4895d9/gpg.conf";
cp ${
pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/drduh/config/662c16404eef04f506a6a208f1253fee2f4895d9/gpg.conf";
sha256 = "118fmrsn28fz629y7wwwcx7r1wfn59h3mqz1snyhf8b5yh0sb8la";
}} "$GNUPGHOME/gpg.conf"
}
} "$GNUPGHOME/gpg.conf"
echo "\$GNUPGHOME has been set up for you. Generated keys will be in $GNUPGHOME."
'';
@ -49,7 +52,8 @@
sha256 = "0rzy06a5xgfjpaklxdgrxml24d0vhk78lb577l3z4x7a2p32dbyq";
};
buildInputs = [ pkgs.pandoc ];
installPhase = "pandoc --highlight-style pygments -s --toc README.md -o $out";
installPhase =
"pandoc --highlight-style pygments -s --toc README.md -o $out";
};
in {
default = "xfce";

View file

@ -1,6 +1,6 @@
{ pkgs, lib, ... }:
{
desktopFile = bin: { longName ? "Script", command ? "${bin}/bin/${bin.name}", ... }:
{ pkgs, lib, ... }: {
desktopFile = bin:
{ longName ? "Script", command ? "${bin}/bin/${bin.name}", ... }:
pkgs.writeTextFile {
name = "${bin.name}.desktop";
destination = "/share/applications/${bin.name}.desktop";

View file

@ -4,17 +4,17 @@ with builtins;
{
# source container url and credentialsId
job = name: {
url,
credentialsId,
branch ? "master",
job = name:
{ url, credentialsId, branch ? "master",
# https://docs.openstack.org/infra/jenkins-job-builder/triggers.html
triggers ? [
{ pollscm = {
triggers ? [{
pollscm = {
cron = "H/30 * * * *";
ignore-post-commit-hooks = true;
};}
], ... }: config: { job = {
};
}], ... }:
config: {
job = {
inherit name triggers;
sandbox = true;
project-type = "pipeline";
@ -28,21 +28,17 @@ with builtins;
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
sh '${toString stage}'
}'';
set =
let
set = let
script = ''
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
sh '${toString stage.script}'
}
'';
in
if (stage.credentialsId != null)
then ''
in if (stage.credentialsId != null) then ''
sshagent(['${stage.credentialsId}']) { ${script} }
''
else script;
}
)( getAttr stageName elem );
'' else
script;
}) (getAttr stageName elem);
in ''
stage('${stageName}') {
steps {
@ -74,7 +70,8 @@ with builtins;
}
}
'';
};};
};
};
# creates a sync job
# source and target container url and credentialsId

View file

@ -13,16 +13,14 @@ let
folders = mapAttrsToList (_: folder: {
inherit (folder) path id label type;
devices = map (device: { deviceId = cfg.declarative.devices.${device}.id; }) folder.devices;
devices = map (device: { deviceId = cfg.declarative.devices.${device}.id; })
folder.devices;
rescanIntervalS = folder.rescanInterval;
fsWatcherEnabled = folder.watch;
fsWatcherDelayS = folder.watchDelay;
ignorePerms = folder.ignorePerms;
versioning = folder.versioning;
}) (filterAttrs (
_: folder:
folder.enable
) cfg.declarative.folders);
}) (filterAttrs (_: folder: folder.enable) cfg.declarative.folders);
# get the api key by parsing the config.xml
getApiKey = pkgs.writers.writeDash "getAPIKey" ''
@ -45,8 +43,12 @@ let
# generate the new config by merging with the nixos config options
NEW_CFG=$(echo "$OLD_CFG" | ${pkgs.jq}/bin/jq -s '.[] as $in | $in * {
"devices": (${builtins.toJSON devices}${optionalString (! cfg.declarative.overrideDevices) " + $in.devices"}),
"folders": (${builtins.toJSON folders}${optionalString (! cfg.declarative.overrideFolders) " + $in.folders"})
"devices": (${builtins.toJSON devices}${
optionalString (!cfg.declarative.overrideDevices) " + $in.devices"
}),
"folders": (${builtins.toJSON folders}${
optionalString (!cfg.declarative.overrideFolders) " + $in.folders"
})
}')
# POST the new config to syncthing
@ -108,7 +110,8 @@ in {
'';
example = {
bigbox = {
id = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
id =
"7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
addresses = [ "tcp://192.168.0.10:51820" ];
};
};
@ -262,14 +265,14 @@ in {
};
}
];
type = with types; nullOr (submodule {
type = with types;
nullOr (submodule {
options = {
type = mkOption {
type = enum [ "external" "simple" "staggered" "trashcan" ];
};
params = mkOption {
type = attrsOf (either str path);
type =
enum [ "external" "simple" "staggered" "trashcan" ];
};
params = mkOption { type = attrsOf (either str path); };
};
});
};
@ -376,8 +379,7 @@ in {
description = ''
Path where the settings and keys will exist.
'';
default =
let
default = let
nixos = config.system.stateVersion;
cond = versionAtLeast nixos "19.03";
in cfg.dataDir + (optionalString cond "/.config/syncthing");
@ -427,8 +429,8 @@ in {
systemd.packages = [ pkgs.syncthing ];
users.users = mkIf (cfg.systemService && cfg.user == defaultUser) {
${defaultUser} =
{ group = cfg.group;
${defaultUser} = {
group = cfg.group;
home = cfg.dataDir;
createHome = true;
uid = config.ids.uids.syncthing;
@ -437,8 +439,7 @@ in {
};
users.groups = mkIf (cfg.systemService && cfg.group == defaultUser) {
${defaultUser}.gid =
config.ids.gids.syncthing;
${defaultUser}.gid = config.ids.gids.syncthing;
};
systemd.services = {
@ -457,17 +458,23 @@ in {
RestartForceExitStatus = "3 4";
User = cfg.user;
Group = cfg.group;
ExecStartPre = mkIf (cfg.declarative.cert != null || cfg.declarative.key != null)
"+${pkgs.writers.writeBash "syncthing-copy-keys" ''
ExecStartPre =
mkIf (cfg.declarative.cert != null || cfg.declarative.key != null)
"+${
pkgs.writers.writeBash "syncthing-copy-keys" ''
install -dm700 -o ${cfg.user} -g ${cfg.group} ${cfg.configDir}
${optionalString (cfg.declarative.cert != null) ''
install -Dm400 -o ${cfg.user} -g ${cfg.group} ${toString cfg.declarative.cert} ${cfg.configDir}/cert.pem
install -Dm400 -o ${cfg.user} -g ${cfg.group} ${
toString cfg.declarative.cert
} ${cfg.configDir}/cert.pem
''}
${optionalString (cfg.declarative.key != null) ''
install -Dm400 -o ${cfg.user} -g ${cfg.group} ${toString cfg.declarative.key} ${cfg.configDir}/key.pem
install -Dm400 -o ${cfg.user} -g ${cfg.group} ${
toString cfg.declarative.key
} ${cfg.configDir}/key.pem
''}
''}"
;
''
}";
ExecStart = ''
${cfg.package}/bin/syncthing \
-no-browser \
@ -476,9 +483,8 @@ in {
'';
};
};
syncthing-init = mkIf (
cfg.declarative.devices != {} || cfg.declarative.folders != {}
) {
syncthing-init = mkIf
(cfg.declarative.devices != { } || cfg.declarative.folders != { }) {
after = [ "syncthing.service" ];
wantedBy = [ "multi-user.target" ];
@ -490,9 +496,7 @@ in {
};
};
syncthing-resume = {
wantedBy = [ "suspend.target" ];
};
syncthing-resume = { wantedBy = [ "suspend.target" ]; };
};
};
}

View file

@ -14,12 +14,11 @@ let
firefoxBin = "${pkgs.firefox}/bin/firefox";
tarBin = "${pkgs.gnutar}/bin/tar";
# desktop file
# ------------
# makes it possible to be used by other programs
desktopFile = bin: let
browserName = bin.name;
desktopFile = bin:
let browserName = bin.name;
in pkgs.writeTextFile {
name = "${browserName}.desktop";
destination = "/share/applications/${browserName}.desktop";
@ -43,8 +42,8 @@ let
backupFile = "${homeBackup}.tar.lzma";
rolloutFile = "${home}.tar.lzma";
lockFile = "${home}-lock";
in
pkgs.writeShellScriptBin "${name}-clean" /* sh */ ''
in pkgs.writeShellScriptBin "${name}-clean" # sh
''
sudo killall -9 -u ${name}
sudo rm ${lockFile}
sudo rm -rf ${home}
@ -55,8 +54,8 @@ let
backupFile = "${homeBackup}.tar.lzma";
rolloutFile = "${home}.tar.lzma";
lockFile = "${home}-lock";
in
pkgs.writeShellScriptBin "${name}" /* sh */ ''
in pkgs.writeShellScriptBin "${name}" # sh
''
# set -x
if [[ ! -e ${lockFile} ]]
then
@ -79,29 +78,27 @@ let
sudo -u ${user} ${browser}
'';
browserExecutableList =
browserExecutableList = let
allBrowser = flip mapAttrsToList cfg.configList (name: config:
let
allBrowser = flip mapAttrsToList cfg.configList (
name: config:
let
browser = if config.browserType == "chrome"
then "${chromiumBin} \"$@\""
else if config.browserType == "google"
then "${chromeBin} \"$@\""
else "${firefoxBin} \"$@\"";
in
createBrowser name config.user browser config.home config.homeBackup
);
browser = if config.browserType == "chrome" then
''${chromiumBin} "$@"''
else if config.browserType == "google" then
''${chromeBin} "$@"''
else
''${firefoxBin} "$@"'';
in createBrowser name config.user browser config.home config.homeBackup);
xclipBrowser = [
(pkgs.writeShellScriptBin "copy-to-xclip" /* sh */''
(pkgs.writeShellScriptBin "copy-to-xclip" # sh
''
echo "$*" | ${pkgs.xclip}/bin/xclip
'')
];
in
allBrowser ++ xclipBrowser;
in allBrowser ++ xclipBrowser;
createBackupScript = name: home: backupHome:
pkgs.writeShellScriptBin "${name}-backup" /* sh */ ''
pkgs.writeShellScriptBin "${name}-backup" # sh
''
sudo -u ${name} \
${tarBin} \
--exclude=.cache \
@ -116,54 +113,48 @@ let
cp ${home}.tar.lzma ${backupHome}.tar.lzma
'';
allBackupScripts =
let
allBackupScripts = let
filteredConfigs =
filterAttrs
(name: browserConfig: browserConfig.homeBackup != null)
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
cfg.configList;
in
mapAttrsToList
(name: browserConfig: createBackupScript name browserConfig.home browserConfig.homeBackup)
in mapAttrsToList (name: browserConfig:
createBackupScript name browserConfig.home browserConfig.homeBackup)
filteredConfigs;
allCleanScripts =
let
allCleanScripts = let
filteredConfigs =
filterAttrs
(name: browserConfig: browserConfig.homeBackup != null)
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
cfg.configList;
in
mapAttrsToList
(name: browserConfig: cleanBrowser name name browserConfig.home browserConfig.homeBackup)
in mapAttrsToList (name: browserConfig:
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
filteredConfigs;
# browser chooser
# ---------------
browserSelect = pkgs.writeScriptBin "browser-select" ''
# select a browser using dmenu
# ----------------------------
BROWSER=$( echo -e "${lib.concatMapStringsSep "\\n" (bin: bin.name) browserExecutableList}" \
BROWSER=$( echo -e "${
lib.concatMapStringsSep "\\n" (bin: bin.name) browserExecutableList
}" \
| ${pkgs.rofi}/bin/rofi -dmenu )
# start selected browser
# ----------------------
case $BROWSER in
${lib.concatStringsSep "\n"
(flip map browserExecutableList (bin: "${bin.name}) export BIN=${bin}/bin/${bin.name} ;;"))
}
${lib.concatStringsSep "\n" (flip map browserExecutableList
(bin: "${bin.name}) export BIN=${bin}/bin/${bin.name} ;;"))}
esac
$BIN "$@"
'';
in {
options.programs.custom.browser = {
enable = mkEnableOption "enable browsers";
configList = mkOption {
type = with types; attrsOf (submodule ({ name , ... }: {
type = with types;
attrsOf (submodule ({ name, ... }: {
options = {
browserType = mkOption {
type = with types; enum [ "firefox" "chrome" "google" ];
@ -210,16 +201,15 @@ in {
config = mkIf cfg.enable {
# add sudo rights
security.sudo.extraConfig =
let
security.sudo.extraConfig = let
extraRules = flip mapAttrsToList cfg.configList (name: values:
concatStringsSep "\n" (map (sudoUser: "${sudoUser} ALL=(${values.user}) NOPASSWD: ALL") values.sudoUsers)) ;
in
lib.concatStringsSep "\n" extraRules;
concatStringsSep "\n"
(map (sudoUser: "${sudoUser} ALL=(${values.user}) NOPASSWD: ALL")
values.sudoUsers));
in lib.concatStringsSep "\n" extraRules;
# create users
users.users = flip mapAttrs cfg.configList (name: config:
{
users.users = flip mapAttrs cfg.configList (name: config: {
home = config.home;
createHome = true;
initialPassword = "${name}-browser";
@ -228,19 +218,14 @@ in {
group = "users";
# enable video usage
extraGroups = [ "video" "audio" ];
}
);
});
# add groups to mainUser
system.custom.mainUser.extraGroups = builtins.attrNames cfg.configList;
environment.systemPackages = [
browserSelect
( desktopFile browserSelect )
]
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
++ browserExecutableList
++ (map (bin: desktopFile bin) browserExecutableList)
++ allBackupScripts
++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts
++ allCleanScripts;
};

View file

@ -11,7 +11,8 @@ let
xdotool = "${pkgs.xdotool}/bin/xdotool";
dmenu = "${pkgs.dmenu}/bin/dmenu";
citateScript = file: suffix: pkgs.writeShellScriptBin "citate-${suffix}" ''
citateScript = file: suffix:
pkgs.writeShellScriptBin "citate-${suffix}" ''
${xdotool} - <<<"type -- $( cat ${file} | ${dmenu} -l 10 -i | sed -e "s/\(.*\)/'\1'/" )"
'';
@ -27,9 +28,15 @@ in {
config = mkIf cfg.enable {
environment.systemPackages = [
scriptAxel
(library.desktopFile scriptAxel { longName = "Citate Axel"; command = "citate-axel"; })
(library.desktopFile scriptAxel {
longName = "Citate Axel";
command = "citate-axel";
})
scriptSiw
(library.desktopFile scriptSiw { longName = "Citate Sinnlos im Weltall"; command = "citate-siw"; })
(library.desktopFile scriptSiw {
longName = "Citate Sinnlos im Weltall";
command = "citate-siw";
})
];
};
}

View file

@ -20,15 +20,12 @@ let
in {
options.programs.custom.curlScripts.enable = mkEnableOption "enable curl scripts";
options.programs.custom.curlScripts.enable =
mkEnableOption "enable curl scripts";
config = mkIf cfg.enable {
environment.systemPackages = [
weatherScript
qrCodeScript
cheatSheetScript
];
environment.systemPackages =
[ weatherScript qrCodeScript cheatSheetScript ];
};
}

View file

@ -8,13 +8,11 @@ let
in {
options.programs.custom.easytag.enable = mkEnableOption "install easytag with dependencies";
options.programs.custom.easytag.enable =
mkEnableOption "install easytag with dependencies";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
easytag
gnome3.dconf
];
environment.systemPackages = with pkgs; [ easytag gnome3.dconf ];
};
}

View file

@ -36,7 +36,8 @@ let
in {
options.programs.custom.espeak.enable = mkEnableOption "enable espeak scripts";
options.programs.custom.espeak.enable =
mkEnableOption "enable espeak scripts";
config = mkIf cfg.enable {
@ -51,4 +52,3 @@ in {
};
}

View file

@ -4,7 +4,8 @@ let
cfg = config.programs.custom.ffmpeg;
ffmpegTemplate = name: { profile, preset, tune ? null}:
ffmpegTemplate = name:
{ profile, preset, tune ? null }:
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
if [ $# -eq 0 ]
@ -70,7 +71,9 @@ let
ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; };
ffmpegDescriptiveTune = profile: preset: tune:
ffmpegTemplate "${profile}-${preset}-${tune}-720p" { inherit profile preset tune; };
ffmpegTemplate "${profile}-${preset}-${tune}-720p" {
inherit profile preset tune;
};
# https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
profiles = [
@ -92,21 +95,11 @@ let
#"slower"
"veryslow"
];
tunes = [
"film"
"animation"
"grain"
"stillimage"
"fastdecode"
];
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
ffmpegs = lib.crossLists
ffmpegDescriptive
[ profiles presets ];
ffmpegs = lib.crossLists ffmpegDescriptive [ profiles presets ];
ffmpegsTune = lib.crossLists
ffmpegDescriptiveTune
[ profiles presets tunes ];
ffmpegsTune = lib.crossLists ffmpegDescriptiveTune [ profiles presets tunes ];
in {
@ -114,7 +107,6 @@ in {
enable = mkEnableOption "enable programs.custom.ffmpeg";
};
config = mkIf cfg.enable {
environment.systemPackages = ffmpegs ++ ffmpegsTune;
};
config =
mkIf cfg.enable { environment.systemPackages = ffmpegs ++ ffmpegsTune; };
}

View file

@ -8,7 +8,8 @@ let
in {
options.programs.custom.git.enable = mkEnableOption "install git and all its tools";
options.programs.custom.git.enable =
mkEnableOption "install git and all its tools";
config = mkIf cfg.enable {

View file

@ -1,6 +1,5 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.custom.bash;
let cfg = config.programs.custom.bash;
in {
options.programs.custom.bash.enable = lib.mkEnableOption "enable bash config";
@ -15,7 +14,8 @@ in {
# Configure Shell
# ---------------
interactiveShellInit = /* sh */ ''
interactiveShellInit = # sh
''
# use vi shortcuts
# ----------------
set -o vi
@ -27,7 +27,8 @@ in {
# Configure Prompt
# ----------------
promptInit = /* sh */ ''
promptInit = # sh
''
# PS1 content functions
# ---------------------
function nonzero_return() {
@ -71,8 +72,8 @@ in {
df = "df -h";
nix-search = "nix-env -qaP";
nix-list = "nix-env -qaP \"*\" --description";
nix-list-haskell = "nix-env -f \"<nixpkgs>\" -qaP -A haskellPackages";
nix-list = ''nix-env -qaP "*" --description'';
nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
@ -83,5 +84,3 @@ in {
};
}

View file

@ -5,7 +5,8 @@ with lib;
let
xterm-colors = pkgs.writeShellScriptBin "256-xterm-colors"
/* sh */ ''
# sh
''
for i in {0..255} ; do
printf "\x1b[38;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
@ -14,8 +15,10 @@ let
done
'';
xterm-background-colors = pkgs.writeShellScriptBin "256-xterm-colors-background"
/* sh */ ''
xterm-background-colors = pkgs.writeShellScriptBin
"256-xterm-colors-background"
# sh
''
for i in {0..255} ; do
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
@ -24,20 +27,16 @@ let
done
'';
cfg = config.programs.custom.shellTools;
in {
options.programs.custom.shellTools.enable = mkEnableOption "enable shell tools";
options.programs.custom.shellTools.enable =
mkEnableOption "enable shell tools";
config = mkIf cfg.enable {
environment.systemPackages = [
xterm-colors
xterm-background-colors
];
environment.systemPackages = [ xterm-colors xterm-background-colors ];
};
}

View file

@ -72,10 +72,10 @@ in {
timestamp = "date +%Y%m%d%H%M%S";
nix-search = "nix-env -qaP";
nix-list = "nix-env -qaP \"*\" --description";
nix-list-haskell = "nix-env -f \"<nixpkgs>\" -qaP -A haskellPackages";
nix-list-node = "nix-env -f \"<nixpkgs>\" -qaP -A nodePackages";
nix-list-beam = "nix-env -f \"<nixpkgs>\" -qaP -A beamPackages";
nix-list = ''nix-env -qaP "*" --description'';
nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
nix-list-node = ''nix-env -f "<nixpkgs>" -qaP -A nodePackages'';
nix-list-beam = ''nix-env -f "<nixpkgs>" -qaP -A beamPackages'';
# nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w";
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
@ -90,25 +90,24 @@ in {
# only used to make quick config changes
# --------------------------------------
environment.etc."zshcustom/mainuser.zsh".source =
pkgs.writeText "mainuser-zsh" (
if ( cfg.mainUser != null )
then
''
pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then ''
source ${config.users.users.mainUser.home}/.zshrc
''
else '' # programs.custom.zsh.mainUser not set '' );
'' else
"# programs.custom.zsh.mainUser not set ");
# Theme
# -----
# make sure powerline-fonts is set in `fonts.fonts`
environment.etc."zshcustom/themes/powerlevel9k".source = pkgs.fetchFromGitHub {
environment.etc."zshcustom/themes/powerlevel9k".source =
pkgs.fetchFromGitHub {
owner = "bhilburn";
repo = "powerlevel9k";
rev = "v0.6.4";
sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5";
};
environment.etc."zshcustom/powerlevel9kpatch.zsh".source = pkgs.writeText "powerlevel9kpatch.zsh" ''
environment.etc."zshcustom/powerlevel9kpatch.zsh".source =
pkgs.writeText "powerlevel9kpatch.zsh" ''
# this shows all the colors which are available
# ---------------------------------------------
@ -176,4 +175,3 @@ in {
};
}

View file

@ -14,12 +14,10 @@ let
# ---------------------------
command = "${pkgs.slack}/bin/slack";
desktopFile =
let
desktopFile = let
name = program;
comment = "Chat Programm";
in
pkgs.writeTextFile {
in pkgs.writeTextFile {
name = "${name}.desktop";
destination = "/share/applications/${name}.desktop";
text = ''
@ -35,16 +33,13 @@ let
'';
};
# the script
# ----------
bin =
let
bin = let
backupFile = "${cfg.homeBackup}.tar.lzma";
rolloutFile = "${cfg.home}.tar.lzma";
lockFile = "${cfg.home}-lock";
in
pkgs.writeShellScriptBin "${program}" ''
in pkgs.writeShellScriptBin "${program}" ''
# set -x
if [[ ! -e ${lockFile} ]]
then
@ -61,10 +56,7 @@ let
sudo -u ${program} ${command}
'';
backupScript =
pkgs.writeShellScriptBin "${program}-backup" ''
backupScript = pkgs.writeShellScriptBin "${program}-backup" ''
sudo -u ${program} \
${tarBin} \
--exclude=.cache \
@ -108,8 +100,7 @@ in {
config = mkIf cfg.enable {
security.sudo.extraConfig =
''
security.sudo.extraConfig = ''
${config.users.users.mainUser.name} ALL=(${program}) NOPASSWD: ALL
'';
@ -125,11 +116,7 @@ in {
extraGroups = [ "video" "audio" ];
};
environment.systemPackages = [
bin
backupScript
desktopFile
];
environment.systemPackages = [ bin backupScript desktopFile ];
};
}

View file

@ -6,7 +6,8 @@ let
cfg = config.programs.custom.taskwarrior;
taskNextWeek = pkgs.writeShellScriptBin "taskweek" /* sh */ ''
taskNextWeek = pkgs.writeShellScriptBin "taskweek" # sh
''
${pkgs.taskwarrior}/bin/task \
export \
status:pending and \( due.before:6days \) \
@ -14,13 +15,15 @@ let
| ${pkgs.miller}/bin/mlr --ijson --opprint put "\$Day = strftime(strptime(\$Day,\"%Y%m%dT%H%M%SZ\")$(date +%z)00,\"%A\")"
'';
tsak = pkgs.writeShellScriptBin "tsak" /* sh */ ''
tsak = pkgs.writeShellScriptBin "tsak" # sh
''
${pkgs.taskwarrior}/bin/task "$@"
'';
in {
options.programs.custom.taskwarrior.enable = mkEnableOption "Enable Taskwarrior services";
options.programs.custom.taskwarrior.enable =
mkEnableOption "Enable Taskwarrior services";
config = mkIf cfg.enable {

View file

@ -65,14 +65,19 @@ in {
"X11/Xresource.d/urxvt-font".source = let
fontFamily = "terminus";
normalFont = fontSize: "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
boldFont = fontSize: "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
normalFont = fontSize:
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
boldFont = fontSize:
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
italicFont = normalFont;
itallicBoldFont = boldFont;
backupFont = fontSize: "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
backupFont = fontSize:
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
fontCommand = key: fontSize: ''
URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${backupFont fontSize}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${
backupFont fontSize
}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
'';
in pkgs.writeText "Xresource-urxvt-font" ''
@ -81,10 +86,18 @@ in {
URxvt.xftAntialias: true
!! use xfontsel or fontmatrix to choose line
!URxvt.font: ${normalFont cfg.fontSize},${backupFont cfg.fontSize}
!URxvt.boldFont: ${boldFont cfg.fontSize},${backupFont cfg.fontSize}
!URxvt.italicFont: ${italicFont cfg.fontSize},${backupFont cfg.fontSize}
!URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${backupFont cfg.fontSize}
!URxvt.font: ${normalFont cfg.fontSize},${
backupFont cfg.fontSize
}
!URxvt.boldFont: ${boldFont cfg.fontSize},${
backupFont cfg.fontSize
}
!URxvt.italicFont: ${italicFont cfg.fontSize},${
backupFont cfg.fontSize
}
!URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${
backupFont cfg.fontSize
}
URxvt.font: ${normalFont cfg.fontSize}
URxvt.boldFont: ${boldFont cfg.fontSize}
@ -97,8 +110,7 @@ in {
${fontCommand "F4" (cfg.fontSize + 20)}
'';
"X11/Xresource.d/urxvt-colors".source =
let
"X11/Xresource.d/urxvt-colors".source = let
colorTheme = if (cfg.colorTheme == "dark") then ''
#define S_base03 #002b36
#define S_base02 #073642
@ -166,4 +178,3 @@ in {
};
}

View file

@ -7,7 +7,8 @@ let
nix-xptemplates = pkgs.writeTextFile {
name = "nix-xptemplates";
destination = "/ftplugin/nix/nix.xpt.vim";
text = /* vim */ ''
text = # vim
''
XPTemplate priority=personal
XPT option " tips
@ -129,14 +130,16 @@ profile = ${"''"}
vim-tv-plugin = with lib;
((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" {
"/syntax/haskell.vim".text = /* vim */ ''
"/syntax/haskell.vim".text = # vim
''
syn region String start=+\[[[:alnum:]]*|+ end=+|]+
hi link ConId Identifier
hi link VarId Identifier
hi link hsDelimiter Delimiter
'';
"/syntax/nix.vim".text = /* vim */ ''
"/syntax/nix.vim".text = # vim
''
"" Quit when a (custom) syntax file was already loaded
"if exists("b:current_syntax")
" finish
@ -190,17 +193,13 @@ profile = ${"''"}
syn cluster nix_ind_strings contains=NixIND_STRING
syn cluster nix_strings contains=NixSTRING
${concatStringsSep "\n" (mapAttrsToList (name: {
extraStart ? null,
lang ? name
}:
${concatStringsSep "\n" (mapAttrsToList (name:
{ extraStart ? null, lang ? name }:
let
startAlts = filter isString [
''/\* ${name} \*/''
extraStart
];
sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*'';
in /* vim */ ''
startAlts = filter isString [ "/\\* ${name} \\*/" extraStart ];
sigil = "\\(${concatStringsSep "\\|" startAlts}\\)[ \\t\\r\\n]*";
# vim
in ''
syn include @nix_${lang}_syntax syntax/${lang}.vim
if exists("b:current_syntax")
unlet b:current_syntax
@ -246,13 +245,14 @@ profile = ${"''"}
python = { };
lua = { };
sed.extraStart = ''writeSed[^ \t\r\n]*[ \t\r\n]*"[^"]*"'';
sh.extraStart = concatStringsSep ''\|'' [
''write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''
''[a-z]*Phase[ \t\r\n]*=''
sh.extraStart = concatStringsSep "\\|" [
''
write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''
"[a-z]*Phase[ \\t\\r\\n]*="
];
yaml = { };
vim.extraStart =
''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"'';
vim.extraStart = ''
write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"'';
xdefaults = { };
})}
@ -275,7 +275,7 @@ profile = ${"''"}
\ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly
\ transparent
syn match NixQuote /'''\(''$\|\\.\)/he=s+2
syn match NixQuote /'''\($\|\\.\)/he=s+2
\ containedin=@nix_ind_strings
\ contained
@ -293,7 +293,8 @@ profile = ${"''"}
set isk=@,48-57,_,192-255,-,'
'';
"/syntax/sed.vim".text = /* vim */ ''
"/syntax/sed.vim".text = # vim
''
syn region sedBranch
\ matchgroup=sedFunction start="T"
\ matchgroup=sedSemicolon end=";\|$"
@ -301,10 +302,10 @@ profile = ${"''"}
'';
}));
# active plugins
# --------------
extra-runtimepath = with pkgs; lib.concatMapStringsSep "," (pkg: "${pkg.rtp}") [
extra-runtimepath = with pkgs;
lib.concatMapStringsSep "," (pkg: "${pkg.rtp}") [
vimPlugins.Syntastic
vimPlugins.ack-vim
vimPlugins.airline
@ -392,9 +393,7 @@ in {
# install vim
# -----------
environment.systemPackages = [
pkgs.vim
];
environment.systemPackages = [ pkgs.vim ];
};
}

View file

@ -43,21 +43,32 @@ in {
"X11/Xresource.d/xterm-font".source = let
fontFamily = "terminus";
normalFont = fontSize: "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
boldFont = fontSize: "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
normalFont = fontSize:
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
boldFont = fontSize:
"-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
italicFont = normalFont;
itallicBoldFont = boldFont;
backupFont = fontSize: "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
backupFont = fontSize:
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
in pkgs.writeText "Xresource-xterm-font" ''
XTerm.allow_bold: true
XTerm.xftAntialias: true
!! use xfontsel or fontmatrix to choose line
!XTerm.*.font: ${normalFont cfg.fontSize},${backupFont cfg.fontSize}
!XTerm.*.boldFont: ${boldFont cfg.fontSize},${backupFont cfg.fontSize}
!XTerm.*.italicFont: ${italicFont cfg.fontSize},${backupFont cfg.fontSize}
!XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize},${backupFont cfg.fontSize}
!XTerm.*.font: ${normalFont cfg.fontSize},${
backupFont cfg.fontSize
}
!XTerm.*.boldFont: ${boldFont cfg.fontSize},${
backupFont cfg.fontSize
}
!XTerm.*.italicFont: ${italicFont cfg.fontSize},${
backupFont cfg.fontSize
}
!XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize},${
backupFont cfg.fontSize
}
XTerm.*.font: ${normalFont cfg.fontSize}
XTerm.*.boldFont: ${boldFont cfg.fontSize}
@ -65,9 +76,7 @@ in {
XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize}
'';
"X11/Xresource.d/xterm-colors".source =
let
"X11/Xresource.d/xterm-colors".source = let
colorTheme = if (cfg.colorTheme == "dark") then ''
#define S_base03 #002b36
#define S_base02 #073642
@ -78,8 +87,7 @@ in {
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
''
else ''
'' else ''
#define S_base03 #fdf6e3
#define S_base02 #eee8d5
#define S_base01 #93a1a1
@ -141,4 +149,3 @@ in {
};
}

View file

@ -11,7 +11,8 @@ in {
options.custom.services.castget = {
enable = mkEnableOption "enable custom.services.castget";
feeds = mkOption {
type = with types; attrsOf (submodule {
type = with types;
attrsOf (submodule {
options = {
url = mkOption {
type = with types; str;
@ -39,9 +40,7 @@ in {
};
timerConfig = mkOption {
type = with types; attrsOf str;
default = {
OnCalendar = "daily";
};
default = { OnCalendar = "daily"; };
example = {
OnCalendar = "00:05";
RandomizedDelaySec = "5h";
@ -68,27 +67,25 @@ in {
restartIfChanged = false;
serviceConfig.User = cfg.user;
preStart =
let
mkSpools = mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
in
concatStringsSep "\n" mkSpools;
script =
let
preStart = let
mkSpools =
mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
in concatStringsSep "\n" mkSpools;
script = let
channels = mapAttrsToList (key: ignore: key) cfg.feeds;
castget = "${pkgs.castget}/bin/castget";
configurationFile =
let
configurationFile = let
configurations = mapAttrsToList (key: value: ''
[${key}]
url=${value.url}
spool=${value.spool}
'') cfg.feeds;
in
(pkgs.writeText "castget-configuration" (concatStringsSep "" configurations));
in
(concatMapStringsSep "\n" (channel: "${castget} --rcfile ${configurationFile} ${channel}") channels);
in (pkgs.writeText "castget-configuration"
(concatStringsSep "" configurations));
in (concatMapStringsSep "\n"
(channel: "${castget} --rcfile ${configurationFile} ${channel}")
channels);
};
systemd.timers."${cfg.serviceName}" = {

View file

@ -10,11 +10,19 @@ in {
options.services.homeAssistantConfig = mkOption {
default = null;
type = with types; nullOr (submodule { options = {
type = with types;
nullOr (submodule {
options = {
group = mkOption {
default = null;
example = { schlafzimmer = { view = false; entities = [ "switch.pal01" ]; }; };
type = with types; nullOr (attrsOf ( submodule {
example = {
schlafzimmer = {
view = false;
entities = [ "switch.pal01" ];
};
};
type = with types;
nullOr (attrsOf (submodule {
options = {
name = mkOption {
default = null;
@ -62,7 +70,9 @@ in {
}));
};
homeassistant = mkOption {
type = with types; (submodule { options = {
type = with types;
(submodule {
options = {
name = mkOption {
default = "Home";
type = with types; str;
@ -96,10 +106,10 @@ in {
type = with types; nullOr (listOf attrs);
};
customize = mkOption {
type = with types; attrsOf (submodule{ options = {
friendly_name = mkOption {
type = with types; str;
};
type = with types;
attrsOf (submodule {
options = {
friendly_name = mkOption { type = with types; str; };
entity_picture = mkOption {
default = null;
type = with types; nullOr str;
@ -108,9 +118,11 @@ in {
default = null;
type = with types; nullOr str;
};
};});
};
};});
});
};
};
});
};
introduction = mkOption {
default = { };
@ -191,7 +203,8 @@ in {
};
script = mkOption {
default = null;
type = with types; nullOr (attrsOf (submodule {
type = with types;
nullOr (attrsOf (submodule {
options = {
alias = mkOption {
default = null;
@ -233,42 +246,35 @@ in {
type = with types; nullOr (attrsOf str);
};
};});
};
});
description = ''
home-assistant configuration
'';
};
config = mkIf (cfg != null) {
services.home-assistant.config =
let
services.home-assistant.config = let
sanitize = configuration: lib.getAttr (builtins.typeOf configuration) {
sanitize = configuration:
lib.getAttr (builtins.typeOf configuration) {
bool = configuration;
int = configuration;
string = configuration;
str = configuration;
float = configuration;
list = map sanitize configuration;
set =
let
stripped = lib.flip lib.filterAttrs configuration
(name: value:
name != "_module"
&& name != "_ref"
&& value != null
);
set = let
stripped = lib.flip lib.filterAttrs configuration (name: value:
name != "_module" && name != "_ref" && value != null);
recursiveSanitized = lib.mapAttrs (lib.const sanitize) stripped;
in
if ( length ( attrNames configuration ) == 0 )
then
in if (length (attrNames configuration) == 0) then
null
else
recursiveSanitized;
};
in
sanitize cfg ;
in sanitize cfg;
};
}

View file

@ -104,10 +104,10 @@ in {
serviceConfig = {
User = cfg.user;
# todo : this is not working properly
TimeoutStartSec = "infinity"; # it might take some time will this thing is up
TimeoutStartSec =
"infinity"; # it might take some time will this thing is up
ExecStartPre =
let
ExecStartPre = let
sshKeyTarget = "/run/keys.lektor/id_rsa";
@ -126,7 +126,8 @@ in {
ControlPersist no
'';
sshKeyScript = pkgs.writers.writeDash "keyfile-gen" /* sh */ ''
sshKeyScript = pkgs.writers.writeDash "keyfile-gen" # sh
''
set -x
# setup ~/.ssh
@ -146,7 +147,8 @@ in {
chmod 500 ${sshKeyTarget}
'';
cloneScript = pkgs.writers.writeDash "clone" /* sh */ ''
cloneScript = pkgs.writers.writeDash "clone" # sh
''
set -x
if [[ `ls ~/${cfg.user} | wc -l` == 0 ]]
then
@ -155,19 +157,19 @@ in {
${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user}
'';
in [
"+${sshKeyScript}"
"-${cloneScript}"
];
in [ "+${sshKeyScript}" "-${cloneScript}" ];
};
# todo : add restart ruling
script = /* sh */ ''
script = # sh
''
cd ~/${cfg.user} && \
${pkgs.git}/bin/git pull && \
${optionalString (cfg.additionalScript != null) "${cfg.additionalScript} &&"} \
${
optionalString (cfg.additionalScript != null)
"${cfg.additionalScript} &&"
} \
${pkgs.python36Packages.lektor}/bin/lektor server \
--host ${cfg.bind} \
--port ${toString cfg.port}

View file

@ -15,9 +15,7 @@ in {
description = ''
folders to share as readonly
'';
example = {
public = "/srv/downloads/movies";
};
example = { public = "/srv/downloads/movies"; };
};
};
@ -42,9 +40,7 @@ in {
disable spoolss = yes
'';
shares =
mapAttrs' (name: path:
{
shares = mapAttrs' (name: path: {
name = name;
value = {
browsable = "yes";

View file

@ -47,7 +47,8 @@ in {
after = [ "network.target" "docker.service" ];
requires = [ "docker.service" ];
wantedBy = [ "multi-user.target" ];
script = /* sh */''
script = # sh
''
# delete old instance to ensure update
${pkgs.docker}/bin/docker stop seafile || true && ${pkgs.docker}/bin/docker rm -f seafile || true
# start instance
@ -55,7 +56,9 @@ in {
--name seafile \
--env SEAFILE_SERVER_HOSTNAME=${cfg.hostname} \
--env SEAFILE_ADMIN_EMAIL="root@${cfg.hostname}" \
--env SEAFILE_ADMIN_PASSWORD="${lib.fileContents <secrets/seafile/root>}" \
--env SEAFILE_ADMIN_PASSWORD="${
lib.fileContents <secrets/seafile/root>
}" \
--volume ${cfg.home}:/shared \
--publish ${toString cfg.port}:80 \
seafileltd/seafile:latest
@ -66,12 +69,9 @@ in {
}
# ! todo
# requires = [ "${config.module.backup.services.encfs."seafile".serviceName}.service" ];
# krops.keys."seafile".path = toString <keys/seafile/encfs>;
#
# module.backup.services.encfs = {
@ -84,4 +84,3 @@ in {
# };
# };

View file

@ -20,11 +20,11 @@ in {
};
};
config = mkMerge [
(mkIf cfg.tools.enable {
environment.systemPackages = with pkgs; [
environment.systemPackages = with pkgs;
[
# sshuttle
sshfs
];
@ -44,8 +44,7 @@ in {
Banner /etc/sshd/banner-line
'';
environment.etc."sshd/banner-line".text =
let
environment.etc."sshd/banner-line".text = let
text = config.networking.hostName;
size = 80 - (lib.stringLength text);
space = lib.fixedWidthString size " " "";
@ -54,9 +53,7 @@ in {
${space}${text}
'';
}
)
})
];

View file

@ -3,12 +3,10 @@
with lib;
let
cfg = config.services.custom.transmission;
in {
options.services.custom.transmission = {
enable = lib.mkEnableOption "transmission";
home = lib.mkOption {

View file

@ -7,7 +7,8 @@ let
cfg = config.service.videoencoder;
# todo : escape output and input File
createEncoder = tmpFolder: inputFile: outputFile: /* sh */ ''
createEncoder = tmpFolder: inputFile: outputFile: # sh
''
mkdir -p ${tmpFolder}
rm -rf ${tmpFolder}/*
TMP_FILE=`mktemp --dry-run ${tmpFolder}/XXXXXXXX.${cfg.format}`
@ -43,7 +44,8 @@ in {
};
tune = mkOption {
type = with types; nullOr (enum [ "film" "animation" "grain" "stillimage" ]);
type = with types;
nullOr (enum [ "film" "animation" "grain" "stillimage" ]);
default = null;
description = ''
-tune
@ -59,7 +61,8 @@ in {
};
fileConfig = mkOption {
type = with types; listOf (submodule {
type = with types;
listOf (submodule {
options = {
inputFile = mkOption {
# todo make this path
@ -88,11 +91,10 @@ in {
systemd.services."videoEncoding" = {
wantedBy = [ "multi-user.target" ];
enable = true;
script =
let
script = let
myList = map (value:
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile
) cfg.fileConfig;
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile)
cfg.fileConfig;
in ''
set -x
${concatStringsSep "\n" myList}

View file

@ -6,7 +6,8 @@ let
ladspaPath = "${pkgs.ladspaPlugins}/lib/ladspa";
jackScript = pkgs.writeShellScriptBin "jack" (lib.fileContents <assets/jack.sh>);
jackScript =
pkgs.writeShellScriptBin "jack" (lib.fileContents <assets/jack.sh>);
queueElement = {
options = {
@ -66,12 +67,14 @@ in {
# LADSPA
# ------
programs.bash.interactiveShellInit = /* sh */ ''
programs.bash.interactiveShellInit = # sh
''
# set ladspa library path
# about testing the plugins check analyseplugin command
export LADSPA_PATH=${ladspaPath}
'';
programs.zsh.interactiveShellInit = /* sh */ ''
programs.zsh.interactiveShellInit = # sh
''
# set ladspa library path
# about testing the plugins check analyseplugin command
export LADSPA_PATH=${ladspaPath}
@ -101,15 +104,23 @@ in {
${builtins.toString (flip map cfg.sinks (sink: ''
# ladspa sink : ${sink.name}
# -------------
${builtins.toString (flip imap0 (reverseList sink.queue) (index : queua:
${builtins.toString (flip imap0 (reverseList sink.queue)
(index: queua:
let
sinkName = suffix: "${sink.name}${builtins.toString suffix}";
sinkValue = "sink_name=${sinkName index}";
sinkDescription = "sink_properties=device.description=${sinkName index}-${queua.label}";
masterValue = if (index == 0) then "" else "master=${sinkName (index - 1)}";
sinkDescription = "sink_properties=device.description=${
sinkName index
}-${queua.label}";
masterValue =
if (index == 0) then "" else "master=${sinkName (index - 1)}";
pluginValue = "plugin=${ladspaPath}/${queua.plugin}";
labelValue = "label=${queua.label}";
controlValue = "control=${builtins.toString (foldl (a: b: "${a},${b}") (head queua.control) (tail queua.control))}";
controlValue = "control=${
builtins.toString
(foldl (a: b: "${a},${b}") (head queua.control)
(tail queua.control))
}";
in ''
# ${sinkName index} : ${queua.label}
load-module module-ladspa-sink ${sinkValue} ${sinkDescription} ${masterValue} ${pluginValue} ${labelValue} ${controlValue}
@ -132,7 +143,6 @@ in {
# qjackctl
# LADSPA
# ------
ladspaPlugins

View file

@ -6,7 +6,8 @@ let
in {
options.system.custom.bluetooth.enable = lib.mkEnableOption "enable bluetooth support";
options.system.custom.bluetooth.enable =
lib.mkEnableOption "enable bluetooth support";
config = lib.mkIf cfg.enable {

View file

@ -39,9 +39,7 @@ in {
};
enable = true;
antialias = true;
defaultFonts = {
monospace = [ "inconsolata" ];
};
defaultFonts = { monospace = [ "inconsolata" ]; };
};
fonts = with pkgs; [
@ -73,4 +71,3 @@ in {
}

View file

@ -7,14 +7,12 @@ let
cfg = config.system.custom.mainUser;
dockerGroup =
if (config.virtualisation.docker.enable)
then [ "docker" ]
else [];
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
vboxGroup =
if (config.virtualisation.virtualbox.host.enable)
then [ "vboxusers" ]
else [];
vboxGroup = if (config.virtualisation.virtualbox.host.enable) then
[ "vboxusers" ]
else
[ ];
in {
@ -68,7 +66,8 @@ in {
uid = cfg.uid;
home = "/home/${cfg.userName}";
initialPassword = cfg.userName;
extraGroups = [ "wheel" "networkmanager" "transmission" "wireshark" ] ++ dockerGroup ++ vboxGroup ++ cfg.extraGroups;
extraGroups = [ "wheel" "networkmanager" "transmission" "wireshark" ]
++ dockerGroup ++ vboxGroup ++ cfg.extraGroups;
openssh.authorizedKeys.keyFiles = cfg.authorizedKeyFiles;
};
};

View file

@ -1,12 +1,12 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.system.permown;
let cfg = config.system.permown;
in {
options.system.permown = mkOption {
default = { };
type = with types; attrsOf (submodule ({ config, ... }: {
type = with types;
attrsOf (submodule ({ config, ... }: {
options = {
directory-mode = mkOption {
default = "=rwx";
@ -21,9 +21,7 @@ in {
default = null;
type = types.nullOr types.str;
};
owner = mkOption {
type = types.str;
};
owner = mkOption { type = types.str; };
path = mkOption {
default = config._module.args.name;
type = types.path;
@ -36,19 +34,15 @@ in {
}));
};
config =
let
plans = lib.attrValues cfg;
in
mkIf (plans != []) {
config = let plans = lib.attrValues cfg;
in mkIf (plans != [ ]) {
system.activationScripts.permown = let
mkdir = plan: /* sh */ ''
mkdir = plan: # sh
''
${pkgs.coreutils}/bin/mkdir -p ${plan.path}
'';
in
concatMapStrings mkdir plans;
in concatMapStrings mkdir plans;
# genAttrs' = names: f: listToAttrs (map f names);
@ -61,11 +55,7 @@ in {
OWNER_GROUP = "${plan.owner}:${plan.group}";
ROOT_PATH = plan.path;
};
path = [
pkgs.coreutils
pkgs.findutils
pkgs.inotifyTools
];
path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ];
serviceConfig = {
ExecStart = pkgs.writers.writeDash "permown" ''
set -efu

View file

@ -73,4 +73,3 @@ in {
}

View file

@ -47,7 +47,6 @@ in {
default = "xmonad";
};
# mouse/touchpad
# --------------
libinput = {

View file

@ -1,12 +1,9 @@
{ lib, pkgs, pythonPackages, fetchFromGitHub, ... }:
with pythonPackages; buildPythonPackage rec {
with pythonPackages;
buildPythonPackage rec {
name = "bepasty-client-cli";
propagatedBuildInputs = [
python_magic
click
requests
];
propagatedBuildInputs = [ python_magic click requests ];
src = fetchFromGitHub {
owner = "bepasty";
@ -16,7 +13,7 @@ with pythonPackages; buildPythonPackage rec {
};
meta = {
homepage = https://github.com/bepasty/bepasty-client-cli;
homepage = "https://github.com/bepasty/bepasty-client-cli";
description = "CLI client for bepasty-server";
license = lib.licenses.bsd2;
};

View file

@ -4,7 +4,6 @@
# this is a script to start Bitwig Studio.
# it is necessary because without my VSTs won't run.
# function header
# ---------------
{ pkgs ? import <nixpkgs> { } }:
@ -21,7 +20,8 @@
# ---------------------
# these are packages which are compiled for the target
# system architecture
targetPkgs = pkgs: with pkgs; [
targetPkgs = pkgs:
with pkgs; [
# todo : check if they are needed
coreutils
@ -72,8 +72,7 @@
# -----------------
# these are packages compiled for multiple system
# architectures (32bit/64bit)
multiPkgs = pkgs: with pkgs; [
];
multiPkgs = pkgs: with pkgs; [ ];
# command
# -------

Some files were not shown because too many files have changed in this diff Show more