workhorse done and nixpkgs-fmt
This commit is contained in:
parent
87be340dfa
commit
fc33e57a54
124 changed files with 3142 additions and 2590 deletions
|
@ -19,7 +19,8 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
writeCommand = krops.packages.${system}.writeCommand;
|
writeCommand = krops.packages.${system}.writeCommand;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# deploy like this:
|
# deploy like this:
|
||||||
# nix run ".#deploy.sterni"
|
# nix run ".#deploy.sterni"
|
||||||
apps.${system}.deploy = pkgs.callPackage ./nixos/krops.nix {
|
apps.${system}.deploy = pkgs.callPackage ./nixos/krops.nix {
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
rev = "2f5c44f017bdfd8abfe908d419ef26bac300f809";
|
rev = "2f5c44f017bdfd8abfe908d419ef26bac300f809";
|
||||||
sha256 = "0dxhk1ah6wwbsxyk4hd32rz7886w7r5gfy16485gjbvky1qsi8gd";
|
sha256 = "0dxhk1ah6wwbsxyk4hd32rz7886w7r5gfy16485gjbvky1qsi8gd";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
# setup ftp
|
# setup ftp
|
||||||
services.vsftpd = {
|
services.vsftpd = {
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
{ modulesPath, config, lib, pkgs, ... }:
|
{ modulesPath, config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ "${modulesPath}/installer/scan/not-detected.nix"
|
imports = [
|
||||||
|
"${modulesPath}/installer/scan/not-detected.nix"
|
||||||
|
|
||||||
(let mediaUUID = "29ebe5ba-7599-4dd3-99a3-37b9bf8e4d61";
|
(
|
||||||
|
let mediaUUID = "29ebe5ba-7599-4dd3-99a3-37b9bf8e4d61";
|
||||||
in {
|
in {
|
||||||
fileSystems."/media" = {
|
fileSystems."/media" = {
|
||||||
device = "/dev/disk/by-uuid/${mediaUUID}";
|
device = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
|
@ -25,7 +27,8 @@
|
||||||
what = "/dev/disk/by-uuid/${mediaUUID}";
|
what = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
where = "/media";
|
where = "/media";
|
||||||
}];
|
}];
|
||||||
})
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
boot.initrd.availableKernelModules =
|
||||||
|
|
|
@ -154,7 +154,8 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
alias = "reset everything when back home";
|
alias = "reset everything when back home";
|
||||||
trigger = map (entity_id: {
|
trigger = map
|
||||||
|
(entity_id: {
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = entity_id;
|
entity_id = entity_id;
|
||||||
from = "off";
|
from = "off";
|
||||||
|
@ -185,7 +186,8 @@
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
group = let
|
group =
|
||||||
|
let
|
||||||
create_room = { name, description }: {
|
create_room = { name, description }: {
|
||||||
"${name}" = {
|
"${name}" = {
|
||||||
name = "${description}";
|
name = "${description}";
|
||||||
|
@ -196,7 +198,8 @@
|
||||||
lib.foldr (a: b: a // b) { } (map create_room rooms);
|
lib.foldr (a: b: a // b) { } (map create_room rooms);
|
||||||
# rooms
|
# rooms
|
||||||
# -----
|
# -----
|
||||||
in (create_rooms [
|
in
|
||||||
|
(create_rooms [
|
||||||
{
|
{
|
||||||
name = "floor_room";
|
name = "floor_room";
|
||||||
description = "Flur";
|
description = "Flur";
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
folderPath = config.services.home-assistant.configDir;
|
folderPath = config.services.home-assistant.configDir;
|
||||||
filePath = "${folderPath}/${name}.json";
|
filePath = "${folderPath}/${name}.json";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
sensor = [
|
sensor = [
|
||||||
|
|
|
@ -66,7 +66,8 @@
|
||||||
[ "zigbee2mqtt/motion_sensor_7" "zigbee2mqtt/door_sensor_4" ];
|
[ "zigbee2mqtt/motion_sensor_7" "zigbee2mqtt/door_sensor_4" ];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
sensors = let
|
sensors =
|
||||||
|
let
|
||||||
door = { topic, room }: {
|
door = { topic, room }: {
|
||||||
topic = topic;
|
topic = topic;
|
||||||
key = "contact";
|
key = "contact";
|
||||||
|
@ -80,7 +81,8 @@
|
||||||
room = room;
|
room = room;
|
||||||
delay = 60;
|
delay = 60;
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
|
|
||||||
(motion {
|
(motion {
|
||||||
topic = "zigbee2mqtt/motion_sensor_1";
|
topic = "zigbee2mqtt/motion_sensor_1";
|
||||||
|
@ -126,7 +128,8 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
];
|
];
|
||||||
switches = let
|
switches =
|
||||||
|
let
|
||||||
sonoff = { id, rooms, delay ? 0 }: {
|
sonoff = { id, rooms, delay ? 0 }: {
|
||||||
topic = "stat/${id}/RESULT";
|
topic = "stat/${id}/RESULT";
|
||||||
key = "POWER";
|
key = "POWER";
|
||||||
|
@ -167,7 +170,8 @@
|
||||||
off = "OFF";
|
off = "OFF";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
|
|
||||||
(light {
|
(light {
|
||||||
topic = "zigbee2mqtt/light_2";
|
topic = "zigbee2mqtt/light_2";
|
||||||
|
|
|
@ -39,7 +39,8 @@ let
|
||||||
|
|
||||||
toSwitch = name: "switch.${name}";
|
toSwitch = name: "switch.${name}";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ ./mqtt.nix ];
|
imports = [ ./mqtt.nix ];
|
||||||
|
|
||||||
|
@ -47,18 +48,21 @@ in {
|
||||||
|
|
||||||
# nicer names
|
# nicer names
|
||||||
# -----------
|
# -----------
|
||||||
homeassistant.customize = lib.mapAttrs' (entity:
|
homeassistant.customize = lib.mapAttrs'
|
||||||
|
(entity:
|
||||||
{ label, icon ? "mdi:power-plug-off", ... }: {
|
{ label, icon ? "mdi:power-plug-off", ... }: {
|
||||||
name = toSwitch entity;
|
name = toSwitch entity;
|
||||||
value = {
|
value = {
|
||||||
friendly_name = label;
|
friendly_name = label;
|
||||||
icon = icon;
|
icon = icon;
|
||||||
};
|
};
|
||||||
}) sonoffSwitches;
|
})
|
||||||
|
sonoffSwitches;
|
||||||
|
|
||||||
# define switches
|
# define switches
|
||||||
# ---------------
|
# ---------------
|
||||||
switch = lib.mapAttrsToList (name:
|
switch = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
name = name;
|
name = name;
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -68,7 +72,8 @@ in {
|
||||||
payload_off = "OFF";
|
payload_off = "OFF";
|
||||||
state_on = "ON";
|
state_on = "ON";
|
||||||
state_off = "OFF";
|
state_off = "OFF";
|
||||||
}) sonoffSwitches;
|
})
|
||||||
|
sonoffSwitches;
|
||||||
|
|
||||||
# discover state on init
|
# discover state on init
|
||||||
# ----------------------
|
# ----------------------
|
||||||
|
@ -78,27 +83,34 @@ in {
|
||||||
platform = "homeassistant";
|
platform = "homeassistant";
|
||||||
event = "start";
|
event = "start";
|
||||||
};
|
};
|
||||||
action = lib.mapAttrsToList (name:
|
action = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
service = "mqtt.publish";
|
service = "mqtt.publish";
|
||||||
data = {
|
data = {
|
||||||
topic = "cmnd/${lib.toUpper name}/power";
|
topic = "cmnd/${lib.toUpper name}/power";
|
||||||
payload = "";
|
payload = "";
|
||||||
};
|
};
|
||||||
}) sonoffSwitches;
|
})
|
||||||
|
sonoffSwitches;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
# append to groups
|
# append to groups
|
||||||
# ----------------
|
# ----------------
|
||||||
group = let
|
group =
|
||||||
|
let
|
||||||
# sort lights into given groups.
|
# sort lights into given groups.
|
||||||
sortedInGroups = let
|
sortedInGroups =
|
||||||
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
|
let
|
||||||
|
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ groups ? [ ], ... }:
|
{ groups ? [ ], ... }:
|
||||||
map (groupName: { "${groupName}" = "switch.${name}"; }) groups)
|
map (groupName: { "${groupName}" = "switch.${name}"; }) groups)
|
||||||
sonoffSwitches));
|
sonoffSwitches));
|
||||||
in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
in
|
||||||
in sortedInGroups;
|
lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
||||||
|
in
|
||||||
|
sortedInGroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,12 @@ let
|
||||||
|
|
||||||
cleanup_list = list: lib.filter (entry: entry != { }) (lib.flatten list);
|
cleanup_list = list: lib.filter (entry: entry != { }) (lib.flatten list);
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
sensor = cleanup_list (map ({ name, currency, own ? { }, ... }: [
|
sensor = cleanup_list (map
|
||||||
|
({ name, currency, own ? { }, ... }: [
|
||||||
{
|
{
|
||||||
platform = "file";
|
platform = "file";
|
||||||
name = "stock_${name}";
|
name = "stock_${name}";
|
||||||
|
@ -60,7 +62,8 @@ in {
|
||||||
toString (own.pieces * own.price)
|
toString (own.pieces * own.price)
|
||||||
} ) }} ${currency}'';
|
} ) }} ${currency}'';
|
||||||
})
|
})
|
||||||
]) stocks);
|
])
|
||||||
|
stocks);
|
||||||
|
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
whitelist_external_dirs = [ folderPath ];
|
whitelist_external_dirs = [ folderPath ];
|
||||||
|
@ -94,7 +97,8 @@ in {
|
||||||
friendly_name = "Profit";
|
friendly_name = "Profit";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]) stocks));
|
])
|
||||||
|
stocks));
|
||||||
};
|
};
|
||||||
|
|
||||||
group = (builtins.listToAttrs (map
|
group = (builtins.listToAttrs (map
|
||||||
|
@ -108,11 +112,13 @@ in {
|
||||||
"sensor.stock_${name}_change_percent"
|
"sensor.stock_${name}_change_percent"
|
||||||
] ++ (lib.optional (own != { }) "sensor.stock_${name}_profit");
|
] ++ (lib.optional (own != { }) "sensor.stock_${name}_profit");
|
||||||
};
|
};
|
||||||
}) stocks));
|
})
|
||||||
|
stocks));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services = let
|
systemd.services =
|
||||||
|
let
|
||||||
pullService = { name, symbol, currency, ... }: {
|
pullService = { name, symbol, currency, ... }: {
|
||||||
name = "pull_stock_${name}";
|
name = "pull_stock_${name}";
|
||||||
value = {
|
value = {
|
||||||
|
@ -154,9 +160,11 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in builtins.listToAttrs (map pullService stocks);
|
in
|
||||||
|
builtins.listToAttrs (map pullService stocks);
|
||||||
|
|
||||||
systemd.timers = let
|
systemd.timers =
|
||||||
|
let
|
||||||
pullTimer = { name, ... }: {
|
pullTimer = { name, ... }: {
|
||||||
name = "pull_stock_${name}";
|
name = "pull_stock_${name}";
|
||||||
value = {
|
value = {
|
||||||
|
@ -168,6 +176,7 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in builtins.listToAttrs (map pullTimer stocks);
|
in
|
||||||
|
builtins.listToAttrs (map pullTimer stocks);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
#];
|
#];
|
||||||
holidays = lib.flatten (privateHolidays holiday-range);
|
holidays = lib.flatten (privateHolidays holiday-range);
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
binary_sensor = [
|
binary_sensor = [
|
||||||
|
|
|
@ -32,24 +32,29 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
retain = false;
|
retain = false;
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
# define input_boolean
|
# define input_boolean
|
||||||
# --------------------
|
# --------------------
|
||||||
# which get toggled by the buttons
|
# which get toggled by the buttons
|
||||||
input_boolean = let stripEmpty = lib.filter (a: a != { });
|
input_boolean =
|
||||||
in builtins.listToAttrs (stripEmpty (lib.flatten (lib.mapAttrsToList (name:
|
let stripEmpty = lib.filter (a: a != { });
|
||||||
|
in builtins.listToAttrs (stripEmpty (lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ states ? { }, ... }: [
|
{ states ? { }, ... }: [
|
||||||
(lib.optionalAttrs (!lib.hasAttr "single" states) {
|
(lib.optionalAttrs (!lib.hasAttr "single" states) {
|
||||||
name = "single_${name}";
|
name = "single_${name}";
|
||||||
|
@ -63,10 +68,12 @@ in {
|
||||||
name = "hold_${name}";
|
name = "hold_${name}";
|
||||||
value = { icon = "mdi:toggle-switch"; };
|
value = { icon = "mdi:toggle-switch"; };
|
||||||
})
|
})
|
||||||
]) allDevices)));
|
])
|
||||||
|
allDevices)));
|
||||||
|
|
||||||
# define meta information sensors
|
# define meta information sensors
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -94,9 +101,11 @@ in {
|
||||||
unit_of_measurement = "lqi";
|
unit_of_measurement = "lqi";
|
||||||
value_template = "{{ value_json.linkquality }}";
|
value_template = "{{ value_json.linkquality }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
binary_sensor = lib.mapAttrsToList (name:
|
binary_sensor = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
name = name;
|
name = name;
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -106,7 +115,8 @@ in {
|
||||||
payload_on = true;
|
payload_on = true;
|
||||||
payload_off = false;
|
payload_off = false;
|
||||||
value_template = "{{ value_json.occupancy }}";
|
value_template = "{{ value_json.occupancy }}";
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
# -------------
|
# -------------
|
||||||
|
@ -144,17 +154,21 @@ in {
|
||||||
|
|
||||||
# create automation
|
# create automation
|
||||||
# -----------------
|
# -----------------
|
||||||
automation = let
|
automation =
|
||||||
|
let
|
||||||
|
|
||||||
# single click
|
# single click
|
||||||
toggle_single_button_input = lib.mapAttrsToList (name:
|
toggle_single_button_input = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ states ? { }, ... }:
|
{ states ? { }, ... }:
|
||||||
let
|
let
|
||||||
entityId = if (lib.hasAttr "single" states) then
|
entityId =
|
||||||
|
if (lib.hasAttr "single" states) then
|
||||||
states.single
|
states.single
|
||||||
else
|
else
|
||||||
"input_boolean.single_${name}";
|
"input_boolean.single_${name}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
alias = "toggle single click ${name}";
|
alias = "toggle single click ${name}";
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -168,17 +182,21 @@ in {
|
||||||
service = "input_boolean.toggle";
|
service = "input_boolean.toggle";
|
||||||
data.entity_id = entityId;
|
data.entity_id = entityId;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
# double click
|
# double click
|
||||||
toggle_double_button_input = lib.mapAttrsToList (name:
|
toggle_double_button_input = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ states ? { }, ... }:
|
{ states ? { }, ... }:
|
||||||
let
|
let
|
||||||
entityId = if (lib.hasAttr "double" states) then
|
entityId =
|
||||||
|
if (lib.hasAttr "double" states) then
|
||||||
states.double
|
states.double
|
||||||
else
|
else
|
||||||
"input_boolean.double_${name}";
|
"input_boolean.double_${name}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
alias = "toggle double click ${name}";
|
alias = "toggle double click ${name}";
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -192,17 +210,21 @@ in {
|
||||||
service = "input_boolean.toggle";
|
service = "input_boolean.toggle";
|
||||||
data.entity_id = entityId;
|
data.entity_id = entityId;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
# hold
|
# hold
|
||||||
toggle_hold_button_input = lib.mapAttrsToList (name:
|
toggle_hold_button_input = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ states ? { }, ... }:
|
{ states ? { }, ... }:
|
||||||
let
|
let
|
||||||
entityId = if (lib.hasAttr "hold" states) then
|
entityId =
|
||||||
|
if (lib.hasAttr "hold" states) then
|
||||||
states.hold
|
states.hold
|
||||||
else
|
else
|
||||||
"input_boolean.hold_${name}";
|
"input_boolean.hold_${name}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
alias = "toggle hold ${name}";
|
alias = "toggle hold ${name}";
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -216,9 +238,11 @@ in {
|
||||||
service = "input_boolean.toggle";
|
service = "input_boolean.toggle";
|
||||||
data.entity_id = entityId;
|
data.entity_id = entityId;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
in lib.flatten (toggle_single_button_input ++ toggle_double_button_input
|
in
|
||||||
|
lib.flatten (toggle_single_button_input ++ toggle_double_button_input
|
||||||
++ toggle_hold_button_input);
|
++ toggle_hold_button_input);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,21 +10,25 @@ let
|
||||||
"door_sensor_5" = { id = "0x00158d0003120d3e"; };
|
"door_sensor_5" = { id = "0x00158d0003120d3e"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
retain = false;
|
retain = false;
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
# define meta information sensors
|
# define meta information sensors
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
name = "battery_${name}";
|
name = "battery_${name}";
|
||||||
|
@ -44,9 +48,11 @@ in {
|
||||||
unit_of_measurement = "lqi";
|
unit_of_measurement = "lqi";
|
||||||
value_template = "{{ value_json.linkquality }}";
|
value_template = "{{ value_json.linkquality }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
binary_sensor = lib.mapAttrsToList (name:
|
binary_sensor = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
name = name;
|
name = name;
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -56,28 +62,36 @@ in {
|
||||||
payload_on = false;
|
payload_on = false;
|
||||||
payload_off = true;
|
payload_off = true;
|
||||||
value_template = "{{ value_json.contact}}";
|
value_template = "{{ value_json.contact}}";
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
# -------------
|
# -------------
|
||||||
group = let
|
group =
|
||||||
|
let
|
||||||
# to have nice panels for every device
|
# to have nice panels for every device
|
||||||
sensorGroups = lib.mapAttrs (name:
|
sensorGroups = lib.mapAttrs
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
entities = [
|
entities = [
|
||||||
"binary_sensor.${name}"
|
"binary_sensor.${name}"
|
||||||
"sensor.battery_${name}"
|
"sensor.battery_${name}"
|
||||||
"sensor.link_${name}"
|
"sensor.link_${name}"
|
||||||
];
|
];
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
# sort lights into given groups.
|
# sort lights into given groups.
|
||||||
sortedInGroups = let
|
sortedInGroups =
|
||||||
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList (name:
|
let
|
||||||
|
groupEntries = lib.zipAttrs (lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ groups ? [ ], ... }:
|
{ groups ? [ ], ... }:
|
||||||
map (groupName: { "${groupName}" = "binary_sensor.${name}"; }) groups)
|
map (groupName: { "${groupName}" = "binary_sensor.${name}"; }) groups)
|
||||||
allDevices));
|
allDevices));
|
||||||
in lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
in
|
||||||
in sortedInGroups // sensorGroups // {
|
lib.mapAttrs (name: entities: { inherit entities; }) groupEntries;
|
||||||
|
in
|
||||||
|
sortedInGroups // sensorGroups // {
|
||||||
all_sensors.entities =
|
all_sensors.entities =
|
||||||
lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices;
|
lib.mapAttrsToList (name: { ... }: "binary_sensor.${name}") allDevices;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,9 +11,11 @@ let
|
||||||
|
|
||||||
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":100}'
|
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":100}'
|
||||||
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":15}'
|
# -t "zigbee2mqtt/fyrtur1/set" -m '{"position":15}'
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
|
@ -21,11 +23,13 @@ in {
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
transition = 0.1;
|
transition = 0.1;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
name = "battery_${name}";
|
name = "battery_${name}";
|
||||||
|
@ -45,7 +49,8 @@ in {
|
||||||
unit_of_measurement = "lqi";
|
unit_of_measurement = "lqi";
|
||||||
value_template = "{{ value_json.linkquality }}";
|
value_template = "{{ value_json.linkquality }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,11 @@ let
|
||||||
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"auto","current_heating_setpoint":23}'
|
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"auto","current_heating_setpoint":23}'
|
||||||
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"off"}'
|
# -t "zigbee2mqtt/heater3/set" -m '{"system_mode":"off"}'
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
|
@ -32,11 +34,13 @@ in {
|
||||||
#"unoccupied_heating_setpoint"
|
#"unoccupied_heating_setpoint"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
name = "battery_${name}";
|
name = "battery_${name}";
|
||||||
|
@ -73,7 +77,8 @@ in {
|
||||||
unit_of_measurement = "%";
|
unit_of_measurement = "%";
|
||||||
value_template = "{{ value_json.pi_heating_demand }}";
|
value_template = "{{ value_json.pi_heating_demand }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,11 @@ let
|
||||||
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF","transition":0, "color_temp":255}'
|
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF","transition":0, "color_temp":255}'
|
||||||
# -t "zigbee2mqtt/led_1/set" -m '{"state":"ON","brightness":255,"color":{"hex":"#00FFFF"}}'
|
# -t "zigbee2mqtt/led_1/set" -m '{"state":"ON","brightness":255,"color":{"hex":"#00FFFF"}}'
|
||||||
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}'
|
# -t "zigbee2mqtt/led_1/set" -m '{"state":"OFF"}'
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
|
@ -21,11 +23,13 @@ in {
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
transition = 1;
|
transition = 1;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
light = lib.mapAttrsToList (name:
|
light = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
name = name;
|
name = name;
|
||||||
|
@ -36,7 +40,8 @@ in {
|
||||||
brightness = true;
|
brightness = true;
|
||||||
color_temp = true;
|
color_temp = true;
|
||||||
schema = "json";
|
schema = "json";
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,11 @@ let
|
||||||
"light_8" = { id = "0x7cb03eaa0a0384d3"; };
|
"light_8" = { id = "0x7cb03eaa0a0384d3"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
|
@ -23,11 +25,13 @@ in {
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
osram_set_transition = 2; # time in seconds (integer or float)
|
osram_set_transition = 2; # time in seconds (integer or float)
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
light = lib.mapAttrsToList (name:
|
light = lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
name = name;
|
name = name;
|
||||||
|
@ -38,7 +42,8 @@ in {
|
||||||
brightness = true;
|
brightness = true;
|
||||||
color_temp = true;
|
color_temp = true;
|
||||||
schema = "json";
|
schema = "json";
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
# sensor = with lib;
|
# sensor = with lib;
|
||||||
# mapAttrsToList (name:
|
# mapAttrsToList (name:
|
||||||
|
|
|
@ -14,9 +14,11 @@ let
|
||||||
"motion_sensor_8" = { id = "0x00158d0002f04637"; };
|
"motion_sensor_8" = { id = "0x00158d0002f04637"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, timeout ? 65, ... }: {
|
{ id, timeout ? 65, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
|
@ -25,12 +27,14 @@ in {
|
||||||
# should not be set below 60 seconds
|
# should not be set below 60 seconds
|
||||||
occupancy_timeout = timeout;
|
occupancy_timeout = timeout;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
# define meta information sensors
|
# define meta information sensors
|
||||||
binary_sensor = lib.flatten (lib.mapAttrsToList (name:
|
binary_sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [{
|
{ ... }: [{
|
||||||
name = "${name}";
|
name = "${name}";
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -41,10 +45,12 @@ in {
|
||||||
payload_on = true;
|
payload_on = true;
|
||||||
payload_off = false;
|
payload_off = false;
|
||||||
device_class = "motion";
|
device_class = "motion";
|
||||||
}]) allDevices);
|
}])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
# define meta information sensors
|
# define meta information sensors
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
name = "battery_${name}";
|
name = "battery_${name}";
|
||||||
|
@ -64,6 +70,7 @@ in {
|
||||||
unit_of_measurement = "lqi";
|
unit_of_measurement = "lqi";
|
||||||
value_template = "{{ value_json.linkquality }}";
|
value_template = "{{ value_json.linkquality }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,13 @@ let
|
||||||
"repeater4" = { id = "0x680ae2fffe8e2e71"; };
|
"repeater4" = { id = "0x680ae2fffe8e2e71"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
{
|
||||||
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = { friendly_name = name; };
|
value = { friendly_name = name; };
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ let
|
||||||
# is copied from the store on startup
|
# is copied from the store on startup
|
||||||
devices = "devices.yaml";
|
devices = "devices.yaml";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.custom.services.zigbee2mqtt = {
|
options.custom.services.zigbee2mqtt = {
|
||||||
enable = mkEnableOption "enable zigbee2mqtt service";
|
enable = mkEnableOption "enable zigbee2mqtt service";
|
||||||
|
|
||||||
|
|
|
@ -13,21 +13,25 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.zigbee2mqttConfiguration = lib.mapAttrs' (name:
|
services.zigbee2mqttConfiguration = lib.mapAttrs'
|
||||||
|
(name:
|
||||||
{ id, ... }: {
|
{ id, ... }: {
|
||||||
name = id;
|
name = id;
|
||||||
value = {
|
value = {
|
||||||
retain = false;
|
retain = false;
|
||||||
friendly_name = name;
|
friendly_name = name;
|
||||||
};
|
};
|
||||||
}) allDevices;
|
})
|
||||||
|
allDevices;
|
||||||
|
|
||||||
services.homeAssistantConfig = {
|
services.homeAssistantConfig = {
|
||||||
|
|
||||||
# define meta information sensors
|
# define meta information sensors
|
||||||
sensor = lib.flatten (lib.mapAttrsToList (name:
|
sensor = lib.flatten (lib.mapAttrsToList
|
||||||
|
(name:
|
||||||
{ ... }: [
|
{ ... }: [
|
||||||
{
|
{
|
||||||
platform = "mqtt";
|
platform = "mqtt";
|
||||||
|
@ -74,7 +78,8 @@ in {
|
||||||
unit_of_measurement = "lqi";
|
unit_of_measurement = "lqi";
|
||||||
value_template = "{{ value_json.linkquality }}";
|
value_template = "{{ value_json.linkquality }}";
|
||||||
}
|
}
|
||||||
]) allDevices);
|
])
|
||||||
|
allDevices);
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
# -------------
|
# -------------
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
ipAddress = "10.1.0.2";
|
ipAddress = "10.1.0.2";
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
networking.extraHosts = ''
|
networking.extraHosts = ''
|
||||||
10.1.0.1 workout.lan
|
10.1.0.1 workout.lan
|
||||||
|
|
|
@ -30,63 +30,63 @@
|
||||||
|
|
||||||
services.spotifyd.enable = true;
|
services.spotifyd.enable = true;
|
||||||
services.spotifyd.config = ''
|
services.spotifyd.config = ''
|
||||||
[global]
|
[global]
|
||||||
username_cmd = "cat ${config.sops.secrets.spotify_user.path}"
|
username_cmd = "cat ${config.sops.secrets.spotify_user.path}"
|
||||||
password_cmd = "cat ${config.sops.secrets.spotify_pass.path}"
|
password_cmd = "cat ${config.sops.secrets.spotify_pass.path}"
|
||||||
backend = "alsa" # use portaudio for macOS [homebrew]
|
backend = "alsa" # use portaudio for macOS [homebrew]
|
||||||
# The alsa audio device to stream audio to. To get a
|
# The alsa audio device to stream audio to. To get a
|
||||||
# list of valid devices, run `aplay -L`,
|
# list of valid devices, run `aplay -L`,
|
||||||
#device = "alsa_audio_device" # omit for macOS
|
#device = "alsa_audio_device" # omit for macOS
|
||||||
# The alsa mixer used by `spotifyd`.
|
# The alsa mixer used by `spotifyd`.
|
||||||
mixer = "PCM" # omit for macOS
|
mixer = "PCM" # omit for macOS
|
||||||
|
|
||||||
# A script that gets evaluated in the user's shell when the song changes [aliases: onevent]
|
# A script that gets evaluated in the user's shell when the song changes [aliases: onevent]
|
||||||
on-song-change-hook = "${pkgs.mpc_cli}/bin/mpc --host localhost --port 6600 stop"
|
on-song-change-hook = "${pkgs.mpc_cli}/bin/mpc --host localhost --port 6600 stop"
|
||||||
|
|
||||||
# The volume controller. Each one behaves different to
|
# The volume controller. Each one behaves different to
|
||||||
# volume increases. For possible values, run
|
# volume increases. For possible values, run
|
||||||
# `spotifyd --help`.
|
# `spotifyd --help`.
|
||||||
volume_controller = "alsa" # use softvol for macOS
|
volume_controller = "alsa" # use softvol for macOS
|
||||||
|
|
||||||
# The name that gets displayed under the connect tab on
|
# The name that gets displayed under the connect tab on
|
||||||
# official clients. Spaces are not allowed!
|
# official clients. Spaces are not allowed!
|
||||||
device_name = "DJane"
|
device_name = "DJane"
|
||||||
|
|
||||||
# The audio bitrate. 96, 160 or 320 kbit/s
|
# The audio bitrate. 96, 160 or 320 kbit/s
|
||||||
bitrate = 320
|
bitrate = 320
|
||||||
|
|
||||||
# The directory used to cache audio data. This setting can save
|
# The directory used to cache audio data. This setting can save
|
||||||
# a lot of bandwidth when activated, as it will avoid re-downloading
|
# a lot of bandwidth when activated, as it will avoid re-downloading
|
||||||
# audio files when replaying them.
|
# audio files when replaying them.
|
||||||
#
|
#
|
||||||
# Note: The file path does not get expanded. Environment variables and
|
# Note: The file path does not get expanded. Environment variables and
|
||||||
# shell placeholders like $HOME or ~ don't work!
|
# shell placeholders like $HOME or ~ don't work!
|
||||||
#cache_path = "cache_directory"
|
#cache_path = "cache_directory"
|
||||||
|
|
||||||
# If set to true, audio data does NOT get cached.
|
# If set to true, audio data does NOT get cached.
|
||||||
no_audio_cache = true
|
no_audio_cache = true
|
||||||
|
|
||||||
# Volume on startup between 0 and 100
|
# Volume on startup between 0 and 100
|
||||||
# NOTE: This variable's type will change in v0.4, to a number (instead of string)
|
# NOTE: This variable's type will change in v0.4, to a number (instead of string)
|
||||||
initial_volume = "90"
|
initial_volume = "90"
|
||||||
|
|
||||||
# If set to true, enables volume normalisation between songs.
|
# If set to true, enables volume normalisation between songs.
|
||||||
volume_normalisation = false
|
volume_normalisation = false
|
||||||
|
|
||||||
# The normalisation pregain that is applied for each song.
|
# The normalisation pregain that is applied for each song.
|
||||||
# normalisation_pregain = -10
|
# normalisation_pregain = -10
|
||||||
|
|
||||||
# The port `spotifyd` uses to announce its service over the network.
|
# The port `spotifyd` uses to announce its service over the network.
|
||||||
zeroconf_port = 1234
|
zeroconf_port = 1234
|
||||||
|
|
||||||
# The proxy `spotifyd` will use to connect to spotify.
|
# The proxy `spotifyd` will use to connect to spotify.
|
||||||
#proxy = "http://proxy.example.org:8080"
|
#proxy = "http://proxy.example.org:8080"
|
||||||
|
|
||||||
# The displayed device type in Spotify clients.
|
# The displayed device type in Spotify clients.
|
||||||
# Can be unknown, computer, tablet, smartphone, speaker, t_v,
|
# Can be unknown, computer, tablet, smartphone, speaker, t_v,
|
||||||
# a_v_r (Audio/Video Receiver), s_t_b (Set-Top Box), and audio_dongle.
|
# a_v_r (Audio/Video Receiver), s_t_b (Set-Top Box), and audio_dongle.
|
||||||
device_type = "computer"
|
device_type = "computer"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
services.taskwarrior-pushover = {
|
services.taskwarrior-pushover = {
|
||||||
enable = true;
|
enable = true;
|
||||||
recurrence="on";
|
recurrence = "on";
|
||||||
onCalendar = "06:30:00";
|
onCalendar = "06:30:00";
|
||||||
server = "taskd.ingolf-wagner.de:53589";
|
server = "taskd.ingolf-wagner.de:53589";
|
||||||
pushoverApiTokenFile = config.sops.secrets.pushoverApiToken.path;
|
pushoverApiTokenFile = config.sops.secrets.pushoverApiToken.path;
|
||||||
|
@ -19,6 +19,6 @@
|
||||||
caFile = config.sops.secrets.taskwarriorCa.path;
|
caFile = config.sops.secrets.taskwarriorCa.path;
|
||||||
certificateFile = config.sops.secrets.taskwarriorCertificate.path;
|
certificateFile = config.sops.secrets.taskwarriorCertificate.path;
|
||||||
keyFile = config.sops.secrets.taskwarriorKey.path;
|
keyFile = config.sops.secrets.taskwarriorKey.path;
|
||||||
credentials= "1337/palo/ed0fdbe8-2dc3-408b-84cb-d07d363bccd2";
|
credentials = "1337/palo/ed0fdbe8-2dc3-408b-84cb-d07d363bccd2";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ let
|
||||||
ssid = "palosiot";
|
ssid = "palosiot";
|
||||||
wifiPassword = lib.fileContents <secrets/iot_wifi>;
|
wifiPassword = lib.fileContents <secrets/iot_wifi>;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
# todo only open needed ports
|
# todo only open needed ports
|
||||||
networking.firewall.trustedInterfaces = [ wifi ];
|
networking.firewall.trustedInterfaces = [ wifi ];
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
# automount
|
# automount
|
||||||
# ---------
|
# ---------
|
||||||
(let mediaUUID = "3d106f56-89e5-400d-9d6b-1dd957919548";
|
(
|
||||||
|
let mediaUUID = "3d106f56-89e5-400d-9d6b-1dd957919548";
|
||||||
in {
|
in {
|
||||||
fileSystems."/media" = {
|
fileSystems."/media" = {
|
||||||
device = "/dev/disk/by-uuid/${mediaUUID}";
|
device = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
|
@ -46,7 +47,8 @@
|
||||||
what = "/dev/disk/by-uuid/${mediaUUID}";
|
what = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
where = "/media";
|
where = "/media";
|
||||||
}];
|
}];
|
||||||
})
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
# NTFS support
|
# NTFS support
|
||||||
|
|
|
@ -54,7 +54,12 @@
|
||||||
after = [ "media.mount" ];
|
after = [ "media.mount" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups."syncthing".members = [ mpd" "syncthing" "kodi" "palo" ];
|
users.groups."syncthing".members = [
|
||||||
|
"mpd"
|
||||||
|
"syncthing"
|
||||||
|
"kodi"
|
||||||
|
"palo"
|
||||||
|
];
|
||||||
|
|
||||||
backup.dirs = [ "/var/lib/syncthing/finance" ];
|
backup.dirs = [ "/var/lib/syncthing/finance" ];
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ let
|
||||||
ssid = "palosiot";
|
ssid = "palosiot";
|
||||||
wifiPassword = lib.fileContents <secrets/iot_wifi>;
|
wifiPassword = lib.fileContents <secrets/iot_wifi>;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# todo only open needed ports
|
# todo only open needed ports
|
||||||
networking.firewall.trustedInterfaces = [ wifi ];
|
networking.firewall.trustedInterfaces = [ wifi ];
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{ }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ let
|
||||||
domain = "io.ingolf-wagner.de";
|
domain = "io.ingolf-wagner.de";
|
||||||
publicIp = "195.201.134.247";
|
publicIp = "195.201.134.247";
|
||||||
pw = import <secrets/iodinepw.nix>;
|
pw = import <secrets/iodinepw.nix>;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.iodine.server = {
|
services.iodine.server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -28,7 +28,8 @@ let
|
||||||
root = "${errorPages}/";
|
root = "${errorPages}/";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts =
|
networking.firewall.allowedTCPPorts =
|
||||||
[ 80 443 4443 config.services.taskserver.listenPort ];
|
[ 80 443 4443 config.services.taskserver.listenPort ];
|
||||||
|
@ -439,7 +440,8 @@ in {
|
||||||
|
|
||||||
systemd.services."socat-taskd" = {
|
systemd.services."socat-taskd" = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = let port = toString config.services.taskserver.listenPort;
|
script =
|
||||||
|
let port = toString config.services.taskserver.listenPort;
|
||||||
in ''
|
in ''
|
||||||
${pkgs.socat}/bin/socat TCP-LISTEN:${port},fork TCP:workhorse.private:${port}
|
${pkgs.socat}/bin/socat TCP-LISTEN:${port},fork TCP:workhorse.private:${port}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -8,7 +8,8 @@ let
|
||||||
ssid = "bumbumbum";
|
ssid = "bumbumbum";
|
||||||
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
|
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# todo only open needed ports
|
# todo only open needed ports
|
||||||
networking.firewall.trustedInterfaces = [ wifi ];
|
networking.firewall.trustedInterfaces = [ wifi ];
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ let
|
||||||
https://nextcloud.ingolf-wagner.de/remote.php/webdav/${folder}
|
https://nextcloud.ingolf-wagner.de/remote.php/webdav/${folder}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ let
|
||||||
ssid = "bumbumbum";
|
ssid = "bumbumbum";
|
||||||
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
|
wifiPassword = lib.fileContents <secrets/wifi-access-point>;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# todo only open needed ports
|
# todo only open needed ports
|
||||||
networking.firewall.trustedInterfaces = [ wifi ];
|
networking.firewall.trustedInterfaces = [ wifi ];
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ let
|
||||||
|
|
||||||
home = "/home/syncthing/podcasts";
|
home = "/home/syncthing/podcasts";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
custom.services.castget = {
|
custom.services.castget = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "root";
|
user = "root";
|
||||||
|
|
|
@ -20,7 +20,8 @@ let
|
||||||
stocks = import ../../private_assets/finance/stocks;
|
stocks = import ../../private_assets/finance/stocks;
|
||||||
stocksFile = toString /home/syncthing/finance/hledger/stocks.journal;
|
stocksFile = toString /home/syncthing/finance/hledger/stocks.journal;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
systemd.services.pull_stocks = {
|
systemd.services.pull_stocks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -30,7 +31,8 @@ in {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
};
|
};
|
||||||
|
|
||||||
script = let
|
script =
|
||||||
|
let
|
||||||
command = { symbol, name, currency, ... }: ''
|
command = { symbol, name, currency, ... }: ''
|
||||||
APIKEY=${lib.fileContents ../../private_assets/finance/alphavantage/apiKey}
|
APIKEY=${lib.fileContents ../../private_assets/finance/alphavantage/apiKey}
|
||||||
SYMBOL="${symbol}"
|
SYMBOL="${symbol}"
|
||||||
|
@ -41,7 +43,8 @@ in {
|
||||||
>> ${stocksFile}
|
>> ${stocksFile}
|
||||||
sleep 1
|
sleep 1
|
||||||
'';
|
'';
|
||||||
in lib.concatStringsSep "\n" (map command stocks);
|
in
|
||||||
|
lib.concatStringsSep "\n" (map command stocks);
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.timers.pull_stocks = {
|
systemd.timers.pull_stocks = {
|
||||||
|
|
|
@ -28,7 +28,8 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -70,7 +70,8 @@ in {
|
||||||
imports = [
|
imports = [
|
||||||
# automount
|
# automount
|
||||||
# ---------
|
# ---------
|
||||||
(let mediaUUID = "b8ba192e-e2aa-47dd-85ec-dcf97ec9310a";
|
(
|
||||||
|
let mediaUUID = "b8ba192e-e2aa-47dd-85ec-dcf97ec9310a";
|
||||||
in {
|
in {
|
||||||
fileSystems."/media" = {
|
fileSystems."/media" = {
|
||||||
device = "/dev/disk/by-uuid/${mediaUUID}";
|
device = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
|
@ -89,9 +90,11 @@ in {
|
||||||
what = "/dev/disk/by-uuid/${mediaUUID}";
|
what = "/dev/disk/by-uuid/${mediaUUID}";
|
||||||
where = "/media";
|
where = "/media";
|
||||||
}];
|
}];
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
(let backupUUID = "f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89";
|
(
|
||||||
|
let backupUUID = "f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89";
|
||||||
in {
|
in {
|
||||||
fileSystems."/backup" = {
|
fileSystems."/backup" = {
|
||||||
device = "/dev/disk/by-uuid/${backupUUID}";
|
device = "/dev/disk/by-uuid/${backupUUID}";
|
||||||
|
@ -110,7 +113,8 @@ in {
|
||||||
what = "/dev/disk/by-uuid/${backupUUID}";
|
what = "/dev/disk/by-uuid/${backupUUID}";
|
||||||
where = "/backup";
|
where = "/backup";
|
||||||
}];
|
}];
|
||||||
})
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ let
|
||||||
sync-repo = library.jenkins.syncJob;
|
sync-repo = library.jenkins.syncJob;
|
||||||
job = library.jenkins.job;
|
job = library.jenkins.job;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.cabal-install ];
|
environment.systemPackages = [ pkgs.cabal-install ];
|
||||||
|
|
||||||
|
@ -62,7 +63,8 @@ in {
|
||||||
accessUser = "admin";
|
accessUser = "admin";
|
||||||
|
|
||||||
# https://docs.openstack.org/infra/jenkins-job-builder/definition.html#modules
|
# https://docs.openstack.org/infra/jenkins-job-builder/definition.html#modules
|
||||||
nixJobs = let
|
nixJobs =
|
||||||
|
let
|
||||||
# ssh username + key
|
# ssh username + key
|
||||||
gogs-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2";
|
gogs-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2";
|
||||||
# ssh username + key
|
# ssh username + key
|
||||||
|
@ -71,17 +73,21 @@ in {
|
||||||
sshSputnik = "d91eb57c-5bff-434c-b317-68aad46848d7";
|
sshSputnik = "d91eb57c-5bff-434c-b317-68aad46848d7";
|
||||||
|
|
||||||
sync-to-github = name: source: target:
|
sync-to-github = name: source: target:
|
||||||
sync-repo name {
|
sync-repo name
|
||||||
|
{
|
||||||
url = source;
|
url = source;
|
||||||
credentialsId = gogs-id;
|
credentialsId = gogs-id;
|
||||||
} {
|
}
|
||||||
|
{
|
||||||
url = target;
|
url = target;
|
||||||
credentialsId = github-id;
|
credentialsId = github-id;
|
||||||
};
|
};
|
||||||
|
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
|
|
||||||
(job "sync-retiolum" {
|
(job "sync-retiolum"
|
||||||
|
{
|
||||||
url = "git@github.com:krebs/retiolum.git";
|
url = "git@github.com:krebs/retiolum.git";
|
||||||
credentialsId = github-id;
|
credentialsId = github-id;
|
||||||
triggers = [{ timed = "H/30 * * * *"; }];
|
triggers = [{ timed = "H/30 * * * *"; }];
|
||||||
|
@ -112,7 +118,8 @@ in {
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
(job "test-taskninja" {
|
(job "test-taskninja"
|
||||||
|
{
|
||||||
url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git";
|
url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git";
|
||||||
credentialsId = gogs-id;
|
credentialsId = gogs-id;
|
||||||
} [
|
} [
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#NOTE: you need to keep the single quote inside nix string.
|
#NOTE: you need to keep the single quote inside nix string.
|
||||||
password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
|
password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
|
||||||
kernels = {
|
kernels = {
|
||||||
python3 = let
|
python3 =
|
||||||
|
let
|
||||||
env = (pkgs.python3.withPackages (pythonPackages:
|
env = (pkgs.python3.withPackages (pythonPackages:
|
||||||
with pythonPackages; [
|
with pythonPackages; [
|
||||||
ipykernel
|
ipykernel
|
||||||
|
@ -29,7 +30,8 @@
|
||||||
# pdf export
|
# pdf export
|
||||||
nbconvert
|
nbconvert
|
||||||
]));
|
]));
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
displayName = "Python 3";
|
displayName = "Python 3";
|
||||||
argv = [
|
argv = [
|
||||||
"${env.interpreter}"
|
"${env.interpreter}"
|
||||||
|
|
|
@ -364,17 +364,17 @@ let
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
notmuchTagging = let
|
notmuchTagging =
|
||||||
|
let
|
||||||
|
|
||||||
template = index:
|
template = index:
|
||||||
{ tags, query, message ? "generic", ... }:
|
{ tags, query, message ? "generic", ... }:
|
||||||
let
|
let
|
||||||
command = ''
|
command = ''
|
||||||
${pkgs.notmuch}/bin/notmuch tag ${
|
${pkgs.notmuch}/bin/notmuch tag ${lib.concatStringsSep " " tags} -- "${query}"
|
||||||
lib.concatStringsSep " " tags
|
|
||||||
} -- "${query}"
|
|
||||||
'';
|
'';
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
echo '${command}'
|
echo '${command}'
|
||||||
${command}
|
${command}
|
||||||
'';
|
'';
|
||||||
|
@ -385,10 +385,12 @@ let
|
||||||
message = "generic junk filter";
|
message = "generic junk filter";
|
||||||
};
|
};
|
||||||
|
|
||||||
in pkgs.writers.writeBash "notmuch-tagging" (lib.concatStringsSep "\n"
|
in
|
||||||
|
pkgs.writers.writeBash "notmuch-tagging" (lib.concatStringsSep "\n"
|
||||||
((lib.imap0 junk_template junk_filter) ++ (lib.imap0 template filters)));
|
((lib.imap0 junk_template junk_filter) ++ (lib.imap0 template filters)));
|
||||||
|
|
||||||
notmuchTaggingNew = let
|
notmuchTaggingNew =
|
||||||
|
let
|
||||||
|
|
||||||
template = index:
|
template = index:
|
||||||
{ tags, query, message ? "generic", ... }:
|
{ tags, query, message ? "generic", ... }:
|
||||||
|
@ -398,7 +400,8 @@ let
|
||||||
lib.concatStringsSep " " tags
|
lib.concatStringsSep " " tags
|
||||||
} -- "${query} AND tag:new"
|
} -- "${query} AND tag:new"
|
||||||
'';
|
'';
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
echo '${command}'
|
echo '${command}'
|
||||||
${command}
|
${command}
|
||||||
'';
|
'';
|
||||||
|
@ -409,10 +412,12 @@ let
|
||||||
query = query;
|
query = query;
|
||||||
message = "generic junk filter";
|
message = "generic junk filter";
|
||||||
};
|
};
|
||||||
in pkgs.writers.writeBash "notmuch-tagging-new" (lib.concatStringsSep "\n"
|
in
|
||||||
|
pkgs.writers.writeBash "notmuch-tagging-new" (lib.concatStringsSep "\n"
|
||||||
((lib.imap0 junk_template junk_filter) ++ (lib.imap0 template filters)));
|
((lib.imap0 junk_template junk_filter) ++ (lib.imap0 template filters)));
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
backup.dirs = [ "/home/mailfetcher" ];
|
backup.dirs = [ "/home/mailfetcher" ];
|
||||||
|
|
||||||
|
@ -431,12 +436,30 @@ in {
|
||||||
name = "mailfetcher";
|
name = "mailfetcher";
|
||||||
};
|
};
|
||||||
|
|
||||||
sops.secrets.mail_terranix.owner = "mailUser";
|
sops.secrets.mail_terranix = {
|
||||||
sops.secrets.mail_gmail.owner = "mailUser";
|
owner = config.users.users.mailUser.name;
|
||||||
sops.secrets.mail_gmx_palo.owner = "mailUser";
|
group = config.users.users.mailUser.group;
|
||||||
sops.secrets.mail_gmx_ingolf.owner = "mailUser";
|
};
|
||||||
sops.secrets.mail_web.owner = "mailUser";
|
sops.secrets.mail_gmail = {
|
||||||
sops.secrets.mail_siteground.owner = "mailUser";
|
owner = config.users.users.mailUser.name;
|
||||||
|
group = config.users.users.mailUser.group;
|
||||||
|
};
|
||||||
|
sops.secrets.mail_gmx_palo = {
|
||||||
|
owner = config.users.users.mailUser.name;
|
||||||
|
group = config.users.users.mailUser.group;
|
||||||
|
};
|
||||||
|
sops.secrets.mail_gmx_ingolf = {
|
||||||
|
owner = config.users.users.mailUser.name;
|
||||||
|
group = config.users.users.mailUser.group;
|
||||||
|
};
|
||||||
|
sops.secrets.mail_web = {
|
||||||
|
owner = config.users.users.mailUser.name;
|
||||||
|
group = config.users.users.mailUser.group;
|
||||||
|
};
|
||||||
|
sops.secrets.mail_siteground = {
|
||||||
|
owner = config.users.users.mailUser.name;
|
||||||
|
group = config.users.users.mailUser.group;
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.muchsync ];
|
environment.systemPackages = [ pkgs.muchsync ];
|
||||||
|
|
||||||
|
@ -598,7 +621,8 @@ in {
|
||||||
echo "tag threads with ${tag}"
|
echo "tag threads with ${tag}"
|
||||||
${pkgs.notmuch}/bin/notmuch tag +${tag} $(${pkgs.notmuch}/bin/notmuch search --output=threads tag:${tag})
|
${pkgs.notmuch}/bin/notmuch tag +${tag} $(${pkgs.notmuch}/bin/notmuch search --output=threads tag:${tag})
|
||||||
'';
|
'';
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
serviceConfig = { User = config.users.users.mailUser.name; };
|
serviceConfig = { User = config.users.users.mailUser.name; };
|
||||||
environment.NOTMUCH_CONFIG =
|
environment.NOTMUCH_CONFIG =
|
||||||
|
@ -607,7 +631,6 @@ in {
|
||||||
echo "run mbsync"
|
echo "run mbsync"
|
||||||
${pkgs.isync}/bin/mbsync \
|
${pkgs.isync}/bin/mbsync \
|
||||||
--all
|
--all
|
||||||
|
|
||||||
echo "run getmail"
|
echo "run getmail"
|
||||||
${pkgs.getmail}/bin/getmail \
|
${pkgs.getmail}/bin/getmail \
|
||||||
--quiet \
|
--quiet \
|
||||||
|
@ -619,8 +642,6 @@ in {
|
||||||
${threadTag "muted"}
|
${threadTag "muted"}
|
||||||
${threadTag "wohnung"}
|
${threadTag "wohnung"}
|
||||||
${threadTag "flagged"}
|
${threadTag "flagged"}
|
||||||
echo "delete threads"
|
|
||||||
${pkgs.notmuch}/bin/notmuch tag +deleted $(${pkgs.notmuch}/bin/notmuch search --output=threads tag:deleted)
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
systemd.timers.fetchmail = {
|
systemd.timers.fetchmail = {
|
||||||
|
@ -635,9 +656,5 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
new.tags = [ "unread" "inbox" "new" ];
|
new.tags = [ "unread" "inbox" "new" ];
|
||||||
};
|
};
|
||||||
#home-manager.users.mailUser.home.file."notmuch" = {
|
|
||||||
# source = "${config.users.users.mailUser.home}/.config/notmuch/notmuchrc";
|
|
||||||
# target = ".notmuch-config";
|
|
||||||
#};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ let
|
||||||
rig = config.networking.hostName;
|
rig = config.networking.hostName;
|
||||||
recheckInterval = 2000;
|
recheckInterval = 2000;
|
||||||
package = pkgs.ethminer;
|
package = pkgs.ethminer;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
systemd.services.ethminer = {
|
systemd.services.ethminer = {
|
||||||
description = "ethminer ethereum mining service";
|
description = "ethminer ethereum mining service";
|
||||||
|
|
|
@ -4,11 +4,22 @@ let
|
||||||
hostAddress = "192.168.100.10";
|
hostAddress = "192.168.100.10";
|
||||||
containerAddress = "192.168.100.11";
|
containerAddress = "192.168.100.11";
|
||||||
#syncthingGid = config.users.groups.syncthing.gid;
|
#syncthingGid = config.users.groups.syncthing.gid;
|
||||||
|
nextcloudUid = 1000;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
sops.secrets.nextcloud_database_password = {};
|
sops.secrets.nextcloud_database_password = {
|
||||||
sops.secrets.nextcloud_root_password = {};
|
owner = "nextcloud";
|
||||||
|
};
|
||||||
|
sops.secrets.nextcloud_root_password = {
|
||||||
|
owner = "nextcloud";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.nextcloud = {
|
||||||
|
isSystemUser = true;
|
||||||
|
uid = nextcloudUid;
|
||||||
|
};
|
||||||
|
|
||||||
containers.nextcloud = {
|
containers.nextcloud = {
|
||||||
|
|
||||||
|
@ -85,6 +96,8 @@ in {
|
||||||
|
|
||||||
config = { config, pkgs, lib, ... }: {
|
config = { config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
|
users.users.nextcloud.uid = nextcloudUid;
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
# Use recommended settings
|
# Use recommended settings
|
||||||
recommendedGzipSettings = lib.mkDefault true;
|
recommendedGzipSettings = lib.mkDefault true;
|
||||||
|
@ -93,10 +106,12 @@ in {
|
||||||
recommendedTlsSettings = lib.mkDefault true;
|
recommendedTlsSettings = lib.mkDefault true;
|
||||||
|
|
||||||
# for graylog logging
|
# for graylog logging
|
||||||
commonHttpConfig = let
|
commonHttpConfig =
|
||||||
|
let
|
||||||
access_log_sink = "${hostAddress}:12304";
|
access_log_sink = "${hostAddress}:12304";
|
||||||
error_log_sink = "${hostAddress}:12305";
|
error_log_sink = "${hostAddress}:12305";
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
|
log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
|
||||||
'"facility": "nginx", '
|
'"facility": "nginx", '
|
||||||
'"src_addr": "$remote_addr", '
|
'"src_addr": "$remote_addr", '
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, config, ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
hostAddress = "192.168.100.30";
|
hostAddress = "192.168.100.30";
|
||||||
containerAddress = "192.168.100.31";
|
containerAddress = "192.168.100.31";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
sops.secrets.nordvpn = {};
|
#users.users.transmission = {
|
||||||
|
# isSystemUser = true;
|
||||||
|
# uid = config.ids.uids.transmission;
|
||||||
|
#};
|
||||||
|
|
||||||
|
sops.secrets.nordvpn = { };
|
||||||
|
|
||||||
containers.torrent = {
|
containers.torrent = {
|
||||||
|
|
||||||
|
@ -185,7 +191,7 @@ in {
|
||||||
|
|
||||||
remote-cert-tls server
|
remote-cert-tls server
|
||||||
|
|
||||||
auth-user-pass /run/secrets/nordvpn.txt
|
auth-user-pass /run/secrets/nordvpn
|
||||||
|
|
||||||
verb 3
|
verb 3
|
||||||
pull
|
pull
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
ipAddress = "10.1.0.1";
|
ipAddress = "10.1.0.1";
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
networking.extraHosts = ''
|
networking.extraHosts = ''
|
||||||
10.1.0.1 workout.lan
|
10.1.0.1 workout.lan
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
nixpkgs.overlays = [ (import <mozilla-overlay/rust-overlay.nix>) ];
|
nixpkgs.overlays = [ (import <mozilla-overlay/rust-overlay.nix>) ];
|
||||||
|
|
||||||
nixpkgs.config.packageOverrides = pkgs: {
|
nixpkgs.config.packageOverrides = pkgs: {
|
||||||
nur = import (builtins.fetchTarball
|
nur = import
|
||||||
"https://github.com/nix-community/NUR/archive/master.tar.gz") {
|
(builtins.fetchTarball
|
||||||
|
"https://github.com/nix-community/NUR/archive/master.tar.gz")
|
||||||
|
{
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
101
nixos/flake.lock
101
nixos/flake.lock
|
@ -199,6 +199,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs-fmt",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1631067971,
|
||||||
|
"narHash": "sha256-z+qlJaCaw/OAoFGdzm0nDKkjRdCwstHzduF74nMn3bY=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "0771140f0a6a6622c509fb2d6d2c87f0bfda703d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1623875721,
|
"lastModified": 1623875721,
|
||||||
|
@ -215,6 +237,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1629481132,
|
||||||
|
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1631561581,
|
"lastModified": 1631561581,
|
||||||
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
||||||
|
@ -286,6 +323,27 @@
|
||||||
"url": "https://git.ingolf-wagner.de/nix-modules/krops.git"
|
"url": "https://git.ingolf-wagner.de/nix-modules/krops.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"naersk": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs-fmt",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1631004250,
|
||||||
|
"narHash": "sha256-LGh0CjAZwh13AVkTi9w9lITEC7x6bwSQyFViOZ6HyNo=",
|
||||||
|
"owner": "nmattia",
|
||||||
|
"repo": "naersk",
|
||||||
|
"rev": "08afb3d1dbfe016108b72e05b02ba0f6ecb3c8e1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nmattia",
|
||||||
|
"repo": "naersk",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-straight": {
|
"nix-straight": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -319,6 +377,29 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-fmt": {
|
||||||
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"naersk": "naersk",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1631557044,
|
||||||
|
"narHash": "sha256-5VPeqRvNhRxTv07NSvxQSXvtuGnrjWmmwss0PGhFzTI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs-fmt",
|
||||||
|
"rev": "c7f66ec1b969ed118231fdf7f596c5ed2c2cfe49",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs-fmt",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1634782485,
|
"lastModified": 1634782485,
|
||||||
|
@ -463,7 +544,7 @@
|
||||||
},
|
},
|
||||||
"polygon-art": {
|
"polygon-art": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_3",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -505,6 +586,7 @@
|
||||||
"home-manager-utils": "home-manager-utils",
|
"home-manager-utils": "home-manager-utils",
|
||||||
"krops-lib": "krops-lib",
|
"krops-lib": "krops-lib",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-fmt": "nixpkgs-fmt",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"polygon-art": "polygon-art",
|
"polygon-art": "polygon-art",
|
||||||
"sops-nix": "sops-nix"
|
"sops-nix": "sops-nix"
|
||||||
|
@ -526,6 +608,23 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1630943734,
|
||||||
|
"narHash": "sha256-jqgAKhvrVDEkv8HB56hVIgvMDuuQ7X4D2zE9ATV+baI=",
|
||||||
|
"owner": "rust-analyzer",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "3dae94bf2b3e496adb049da589c7efef272a39b8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-analyzer",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sops-nix": {
|
"sops-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
|
|
@ -33,11 +33,27 @@
|
||||||
"git+https://git.ingolf-wagner.de/nix-modules/cluster.git?rev=ef621797a30f8a57de16bf33672abdd411cbcece";
|
"git+https://git.ingolf-wagner.de/nix-modules/cluster.git?rev=ef621797a30f8a57de16bf33672abdd411cbcece";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
nixpkgs-fmt = {
|
||||||
|
url = "github:nix-community/nixpkgs-fmt";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, sops-nix, nixpkgs, home-manager, home-manager-utils
|
outputs =
|
||||||
, doom-emacs-nix, backup-module, nixpkgs-unstable, krops-lib, cluster-module
|
{ self
|
||||||
, polygon-art, ... }:
|
, sops-nix
|
||||||
|
, nixpkgs
|
||||||
|
, home-manager
|
||||||
|
, home-manager-utils
|
||||||
|
, doom-emacs-nix
|
||||||
|
, backup-module
|
||||||
|
, nixpkgs-unstable
|
||||||
|
, krops-lib
|
||||||
|
, cluster-module
|
||||||
|
, polygon-art
|
||||||
|
, nixpkgs-fmt
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
nixosSystem = nixpkgs.lib.nixosSystem;
|
nixosSystem = nixpkgs.lib.nixosSystem;
|
||||||
|
@ -70,13 +86,13 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
desktopModules = [
|
desktopModules = [
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
{
|
||||||
home-manager.users.mainUser = {
|
home-manager.users.mainUser = {
|
||||||
imports = [ doom-emacs-nix.hmModule home-manager-utils.hmModule ];
|
imports = [ doom-emacs-nix.hmModule home-manager-utils.hmModule ];
|
||||||
};
|
};
|
||||||
home-manager.useGlobalPkgs = true;
|
environment.systemPackages = [
|
||||||
home-manager.useUserPackages = true;
|
nixpkgs-fmt.defaultPackage."x86_64-linux"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
desktopConfiguration = initPath:
|
desktopConfiguration = initPath:
|
||||||
|
@ -89,7 +105,8 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = defaultModules ++ [ initPath ];
|
modules = defaultModules ++ [ initPath ];
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
sterni = desktopConfiguration ./configs/sterni/configuration.nix;
|
sterni = desktopConfiguration ./configs/sterni/configuration.nix;
|
||||||
sternchen = desktopConfiguration ./configs/sternchien/configuration.nix;
|
sternchen = desktopConfiguration ./configs/sternchien/configuration.nix;
|
||||||
|
|
|
@ -5,8 +5,9 @@ let
|
||||||
command = targetPath:
|
command = targetPath:
|
||||||
let
|
let
|
||||||
commandLine =
|
commandLine =
|
||||||
"TMPDIR=/tmp nixos-rebuild build --flake ${targetPath} -L --keep-going";
|
"TMPDIR=/tmp nixos-rebuild test --flake ${targetPath} -L --keep-going";
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
echo '${commandLine}'
|
echo '${commandLine}'
|
||||||
nix-shell \
|
nix-shell \
|
||||||
-E "with import <nixpkgs> {}; mkShell { buildInputs = [ git (nixos { nix.package = nixFlakes; }).nixos-rebuild ]; }" \
|
-E "with import <nixpkgs> {}; mkShell { buildInputs = [ git (nixos { nix.package = nixFlakes; }).nixos-rebuild ]; }" \
|
||||||
|
@ -64,7 +65,8 @@ let
|
||||||
target = lib.mkTarget "root@${host}/var/krops";
|
target = lib.mkTarget "root@${host}/var/krops";
|
||||||
inherit command;
|
inherit command;
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"${name}" = pkgs.writers.writeBashBin name ''
|
"${name}" = pkgs.writers.writeBashBin name ''
|
||||||
echo "deploy system"
|
echo "deploy system"
|
||||||
${system}/bin/system
|
${system}/bin/system
|
||||||
|
@ -89,7 +91,8 @@ let
|
||||||
force = true;
|
force = true;
|
||||||
target = lib.mkTarget "root@${host}/etc/NetworkManager";
|
target = lib.mkTarget "root@${host}/etc/NetworkManager";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"${name}" = pkgs.writers.writeBashBin "${name}-all" ''
|
"${name}" = pkgs.writers.writeBashBin "${name}-all" ''
|
||||||
echo "deploy network secerts"
|
echo "deploy network secerts"
|
||||||
${network}/bin/secrets
|
${network}/bin/secrets
|
||||||
|
@ -98,7 +101,8 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in (desktop {
|
in
|
||||||
|
(desktop {
|
||||||
name = "sterni";
|
name = "sterni";
|
||||||
host = "sterni.private";
|
host = "sterni.private";
|
||||||
}) // (desktop {
|
}) // (desktop {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{ pkgs, lib, ... }: {
|
{ pkgs, lib, ... }: {
|
||||||
desktopFile = bin:
|
desktopFile = bin:
|
||||||
{ comment ? "No Comment", longName ? "Script"
|
{ comment ? "No Comment"
|
||||||
, command ? "${bin}/bin/${bin.name}", ... }:
|
, longName ? "Script"
|
||||||
|
, command ? "${bin}/bin/${bin.name}"
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
pkgs.writeTextFile {
|
pkgs.writeTextFile {
|
||||||
name = "${bin.name}.desktop";
|
name = "${bin.name}.desktop";
|
||||||
destination = "/share/applications/${bin.name}.desktop";
|
destination = "/share/applications/${bin.name}.desktop";
|
||||||
|
|
|
@ -7,41 +7,51 @@ with builtins;
|
||||||
{
|
{
|
||||||
# source container url and credentialsId
|
# source container url and credentialsId
|
||||||
job = name:
|
job = name:
|
||||||
{ url, credentialsId, branch ? "master",
|
{ url
|
||||||
# https://docs.openstack.org/infra/jenkins-job-builder/triggers.html
|
, credentialsId
|
||||||
|
, branch ? "master"
|
||||||
|
, # https://docs.openstack.org/infra/jenkins-job-builder/triggers.html
|
||||||
triggers ? [{
|
triggers ? [{
|
||||||
pollscm = {
|
pollscm = {
|
||||||
cron = "H/30 * * * *";
|
cron = "H/30 * * * *";
|
||||||
ignore-post-commit-hooks = true;
|
ignore-post-commit-hooks = true;
|
||||||
};
|
};
|
||||||
}], ... }:
|
}]
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
config: {
|
config: {
|
||||||
job = {
|
job = {
|
||||||
inherit name triggers;
|
inherit name triggers;
|
||||||
sandbox = true;
|
sandbox = true;
|
||||||
project-type = "pipeline";
|
project-type = "pipeline";
|
||||||
dsl = let
|
dsl =
|
||||||
|
let
|
||||||
stage = elem:
|
stage = elem:
|
||||||
let
|
let
|
||||||
stageName = head (attrNames elem);
|
stageName = head (attrNames elem);
|
||||||
stateScripts = map (stage:
|
stateScripts = map
|
||||||
|
(stage:
|
||||||
lib.getAttr (typeOf stage) {
|
lib.getAttr (typeOf stage) {
|
||||||
string = ''
|
string = ''
|
||||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||||
sh '${toString stage}'
|
sh '${toString stage}'
|
||||||
}'';
|
}'';
|
||||||
set = let
|
set =
|
||||||
|
let
|
||||||
script = ''
|
script = ''
|
||||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||||
sh '${toString stage.script}'
|
sh '${toString stage.script}'
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
in if (stage.credentialsId != null) then ''
|
in
|
||||||
|
if (stage.credentialsId != null) then ''
|
||||||
sshagent(['${stage.credentialsId}']) { ${script} }
|
sshagent(['${stage.credentialsId}']) { ${script} }
|
||||||
'' else
|
'' else
|
||||||
script;
|
script;
|
||||||
}) (getAttr stageName elem);
|
})
|
||||||
in ''
|
(getAttr stageName elem);
|
||||||
|
in
|
||||||
|
''
|
||||||
stage('${stageName}') {
|
stage('${stageName}') {
|
||||||
steps {
|
steps {
|
||||||
${concatStringsSep "\n" stateScripts}
|
${concatStringsSep "\n" stateScripts}
|
||||||
|
@ -49,7 +59,8 @@ with builtins;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
stages = map stage config;
|
stages = map stage config;
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
post {
|
post {
|
||||||
|
|
|
@ -45,7 +45,8 @@ let
|
||||||
backupFile = "${homeBackup}.tar.lzma";
|
backupFile = "${homeBackup}.tar.lzma";
|
||||||
rolloutFile = "${home}.tar.lzma";
|
rolloutFile = "${home}.tar.lzma";
|
||||||
lockFile = "${home}-lock";
|
lockFile = "${home}-lock";
|
||||||
in pkgs.writeShellScriptBin "${name}-clean" # sh
|
in
|
||||||
|
pkgs.writeShellScriptBin "${name}-clean" # sh
|
||||||
''
|
''
|
||||||
sudo killall -9 -u ${name}
|
sudo killall -9 -u ${name}
|
||||||
sudo rm -f ${lockFile}
|
sudo rm -f ${lockFile}
|
||||||
|
@ -57,7 +58,8 @@ let
|
||||||
backupFile = "${homeBackup}.tar.lzma";
|
backupFile = "${homeBackup}.tar.lzma";
|
||||||
rolloutFile = "${home}.tar.lzma";
|
rolloutFile = "${home}.tar.lzma";
|
||||||
lockFile = "${home}-lock";
|
lockFile = "${home}-lock";
|
||||||
in pkgs.writeShellScriptBin "${name}" # sh
|
in
|
||||||
|
pkgs.writeShellScriptBin "${name}" # sh
|
||||||
''
|
''
|
||||||
# set -x
|
# set -x
|
||||||
if [[ ! -e ${lockFile} ]]
|
if [[ ! -e ${lockFile} ]]
|
||||||
|
@ -81,23 +83,27 @@ let
|
||||||
sudo -u ${user} ${browser}
|
sudo -u ${user} ${browser}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
browserExecutableList = let
|
browserExecutableList =
|
||||||
|
let
|
||||||
allBrowser = flip mapAttrsToList cfg.configList (name: config:
|
allBrowser = flip mapAttrsToList cfg.configList (name: config:
|
||||||
let
|
let
|
||||||
browser = if config.browserType == "chrome" then
|
browser =
|
||||||
|
if config.browserType == "chrome" then
|
||||||
''${chromiumBin} "$@"''
|
''${chromiumBin} "$@"''
|
||||||
else if config.browserType == "google" then
|
else if config.browserType == "google" then
|
||||||
''${chromeBin} "$@"''
|
''${chromeBin} "$@"''
|
||||||
else
|
else
|
||||||
''${firefoxBin} "$@"'';
|
''${firefoxBin} "$@"'';
|
||||||
in createBrowser name config.user browser config.home config.homeBackup);
|
in
|
||||||
|
createBrowser name config.user browser config.home config.homeBackup);
|
||||||
xclipBrowser = [
|
xclipBrowser = [
|
||||||
(pkgs.writeShellScriptBin "copy-to-xclip" # sh
|
(pkgs.writeShellScriptBin "copy-to-xclip" # sh
|
||||||
''
|
''
|
||||||
echo "$*" | ${pkgs.xclip}/bin/xclip
|
echo "$*" | ${pkgs.xclip}/bin/xclip
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
in allBrowser ++ xclipBrowser;
|
in
|
||||||
|
allBrowser ++ xclipBrowser;
|
||||||
|
|
||||||
createBackupScript = name: home: backupHome:
|
createBackupScript = name: home: backupHome:
|
||||||
pkgs.writeShellScriptBin "${name}-backup" # sh
|
pkgs.writeShellScriptBin "${name}-backup" # sh
|
||||||
|
@ -116,19 +122,25 @@ let
|
||||||
cp ${home}.tar.lzma ${backupHome}.tar.lzma
|
cp ${home}.tar.lzma ${backupHome}.tar.lzma
|
||||||
'';
|
'';
|
||||||
|
|
||||||
allBackupScripts = let
|
allBackupScripts =
|
||||||
|
let
|
||||||
filteredConfigs =
|
filteredConfigs =
|
||||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||||
cfg.configList;
|
cfg.configList;
|
||||||
in mapAttrsToList (name: browserConfig:
|
in
|
||||||
|
mapAttrsToList
|
||||||
|
(name: browserConfig:
|
||||||
createBackupScript name browserConfig.home browserConfig.homeBackup)
|
createBackupScript name browserConfig.home browserConfig.homeBackup)
|
||||||
filteredConfigs;
|
filteredConfigs;
|
||||||
|
|
||||||
allCleanScripts = let
|
allCleanScripts =
|
||||||
|
let
|
||||||
filteredConfigs =
|
filteredConfigs =
|
||||||
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
filterAttrs (name: browserConfig: browserConfig.homeBackup != null)
|
||||||
cfg.configList;
|
cfg.configList;
|
||||||
in mapAttrsToList (name: browserConfig:
|
in
|
||||||
|
mapAttrsToList
|
||||||
|
(name: browserConfig:
|
||||||
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
cleanBrowser name name browserConfig.home browserConfig.homeBackup)
|
||||||
filteredConfigs;
|
filteredConfigs;
|
||||||
|
|
||||||
|
@ -153,7 +165,8 @@ let
|
||||||
$BIN "$@"
|
$BIN "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.browser = {
|
options.programs.custom.browser = {
|
||||||
enable = mkEnableOption "enable browsers";
|
enable = mkEnableOption "enable browsers";
|
||||||
|
@ -214,9 +227,11 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
# add sudo rights
|
# add sudo rights
|
||||||
security.sudo.extraConfig = let
|
security.sudo.extraConfig =
|
||||||
|
let
|
||||||
extraRules = flip mapAttrsToList cfg.configList (name: values:
|
extraRules = flip mapAttrsToList cfg.configList (name: values:
|
||||||
concatStringsSep "" (map (sudoUser: ''
|
concatStringsSep "" (map
|
||||||
|
(sudoUser: ''
|
||||||
# sudo configuration to control browser
|
# sudo configuration to control browser
|
||||||
${sudoUser} ALL=(${values.user}) NOPASSWD: ALL
|
${sudoUser} ALL=(${values.user}) NOPASSWD: ALL
|
||||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/mkdir -p ${values.home}
|
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/mkdir -p ${values.home}
|
||||||
|
@ -224,8 +239,10 @@ in {
|
||||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/killall -9 -u ${name}
|
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/killall -9 -u ${name}
|
||||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -rf ${values.home}
|
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -rf ${values.home}
|
||||||
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -f ${values.home}-lock
|
${sudoUser} ALL=(root) NOPASSWD: /run/current-system/sw/bin/rm -f ${values.home}-lock
|
||||||
'') values.sudoUsers));
|
'')
|
||||||
in lib.concatStringsSep "\n" extraRules;
|
values.sudoUsers));
|
||||||
|
in
|
||||||
|
lib.concatStringsSep "\n" extraRules;
|
||||||
|
|
||||||
# create users
|
# create users
|
||||||
users.users = flip mapAttrs cfg.configList (name: config: {
|
users.users = flip mapAttrs cfg.configList (name: config: {
|
||||||
|
|
|
@ -19,7 +19,8 @@ let
|
||||||
scriptAxel = citateScript (toString ../../assets/sprueche-axel) "axel";
|
scriptAxel = citateScript (toString ../../assets/sprueche-axel) "axel";
|
||||||
scriptSiw = citateScript (toString ../../assets/sprueche-siw) "siw";
|
scriptSiw = citateScript (toString ../../assets/sprueche-siw) "siw";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.citate = {
|
options.programs.custom.citate = {
|
||||||
enable = mkEnableOption "enable programs.custom.citate";
|
enable = mkEnableOption "enable programs.custom.citate";
|
||||||
|
|
|
@ -18,7 +18,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.curlScripts;
|
cfg = config.programs.custom.curlScripts;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.curlScripts.enable =
|
options.programs.custom.curlScripts.enable =
|
||||||
mkEnableOption "enable curl scripts";
|
mkEnableOption "enable curl scripts";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.easytag;
|
cfg = config.programs.custom.easytag;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.easytag.enable =
|
options.programs.custom.easytag.enable =
|
||||||
mkEnableOption "install easytag with dependencies";
|
mkEnableOption "install easytag with dependencies";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.elm;
|
cfg = config.programs.custom.elm;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.elm.enable = mkEnableOption "enable elm stack";
|
options.programs.custom.elm.enable = mkEnableOption "enable elm stack";
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.espeak;
|
cfg = config.programs.custom.espeak;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.espeak.enable =
|
options.programs.custom.espeak.enable =
|
||||||
mkEnableOption "enable espeak scripts";
|
mkEnableOption "enable espeak scripts";
|
||||||
|
|
|
@ -5,8 +5,13 @@ let
|
||||||
cfg = config.programs.custom.ffmpeg;
|
cfg = config.programs.custom.ffmpeg;
|
||||||
|
|
||||||
ffmpegTemplate = name:
|
ffmpegTemplate = name:
|
||||||
{ profile, preset, tune ? null, width ? 1280, height ? 720
|
{ profile
|
||||||
, resolution ? "720p" }:
|
, preset
|
||||||
|
, tune ? null
|
||||||
|
, width ? 1280
|
||||||
|
, height ? 720
|
||||||
|
, resolution ? "720p"
|
||||||
|
}:
|
||||||
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
|
@ -99,7 +104,8 @@ let
|
||||||
];
|
];
|
||||||
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
|
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
|
||||||
|
|
||||||
ffmpegs = let
|
ffmpegs =
|
||||||
|
let
|
||||||
|
|
||||||
configurations = lib.cartesianProductOfSets {
|
configurations = lib.cartesianProductOfSets {
|
||||||
profile = profiles;
|
profile = profiles;
|
||||||
|
@ -116,9 +122,11 @@ let
|
||||||
width = 1920;
|
width = 1920;
|
||||||
resolution = "1080p";
|
resolution = "1080p";
|
||||||
};
|
};
|
||||||
in (map p720 configurations) ++ (map p1080 configurations);
|
in
|
||||||
|
(map p720 configurations) ++ (map p1080 configurations);
|
||||||
|
|
||||||
ffmpegsTune = let
|
ffmpegsTune =
|
||||||
|
let
|
||||||
configurations = lib.cartesianProductOfSets {
|
configurations = lib.cartesianProductOfSets {
|
||||||
profile = profiles;
|
profile = profiles;
|
||||||
preset = presets;
|
preset = presets;
|
||||||
|
@ -138,9 +146,11 @@ let
|
||||||
resolution = "1080p";
|
resolution = "1080p";
|
||||||
};
|
};
|
||||||
|
|
||||||
in (map p720 configurations) ++ (map p1080 configurations);
|
in
|
||||||
|
(map p720 configurations) ++ (map p1080 configurations);
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.ffmpeg = {
|
options.programs.custom.ffmpeg = {
|
||||||
enable = mkEnableOption "enable programs.custom.ffmpeg";
|
enable = mkEnableOption "enable programs.custom.ffmpeg";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.git;
|
cfg = config.programs.custom.git;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.git.enable =
|
options.programs.custom.git.enable =
|
||||||
mkEnableOption "install git and all its tools";
|
mkEnableOption "install git and all its tools";
|
||||||
|
|
|
@ -29,7 +29,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.shellTools;
|
cfg = config.programs.custom.shellTools;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.shellTools.enable =
|
options.programs.custom.shellTools.enable =
|
||||||
mkEnableOption "enable shell tools";
|
mkEnableOption "enable shell tools";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.zsh;
|
cfg = config.programs.custom.zsh;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.zsh = {
|
options.programs.custom.zsh = {
|
||||||
enable = mkEnableOption "enable zsh";
|
enable = mkEnableOption "enable zsh";
|
||||||
|
|
|
@ -14,10 +14,12 @@ let
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
command = "${pkgs.slack}/bin/slack";
|
command = "${pkgs.slack}/bin/slack";
|
||||||
|
|
||||||
desktopFile = let
|
desktopFile =
|
||||||
|
let
|
||||||
name = program;
|
name = program;
|
||||||
comment = "Chat Programm";
|
comment = "Chat Programm";
|
||||||
in pkgs.writeTextFile {
|
in
|
||||||
|
pkgs.writeTextFile {
|
||||||
name = "${name}.desktop";
|
name = "${name}.desktop";
|
||||||
destination = "/share/applications/${name}.desktop";
|
destination = "/share/applications/${name}.desktop";
|
||||||
text = ''
|
text = ''
|
||||||
|
@ -35,11 +37,13 @@ let
|
||||||
|
|
||||||
# the script
|
# the script
|
||||||
# ----------
|
# ----------
|
||||||
bin = let
|
bin =
|
||||||
|
let
|
||||||
backupFile = "${cfg.homeBackup}.tar.lzma";
|
backupFile = "${cfg.homeBackup}.tar.lzma";
|
||||||
rolloutFile = "${cfg.home}.tar.lzma";
|
rolloutFile = "${cfg.home}.tar.lzma";
|
||||||
lockFile = "${cfg.home}-lock";
|
lockFile = "${cfg.home}-lock";
|
||||||
in pkgs.writeShellScriptBin "${program}" ''
|
in
|
||||||
|
pkgs.writeShellScriptBin "${program}" ''
|
||||||
# set -x
|
# set -x
|
||||||
if [[ ! -e ${lockFile} ]]
|
if [[ ! -e ${lockFile} ]]
|
||||||
then
|
then
|
||||||
|
@ -75,7 +79,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.slack;
|
cfg = config.programs.custom.slack;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.slack = {
|
options.programs.custom.slack = {
|
||||||
enable = mkEnableOption "install slack";
|
enable = mkEnableOption "install slack";
|
||||||
|
|
|
@ -14,7 +14,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.steam;
|
cfg = config.programs.custom.steam;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.steam.enable = mkEnableOption "enable steam";
|
options.programs.custom.steam.enable = mkEnableOption "enable steam";
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ let
|
||||||
});
|
});
|
||||||
#vit = pkgs.vit;
|
#vit = pkgs.vit;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.taskwarrior.enable =
|
options.programs.custom.taskwarrior.enable =
|
||||||
mkEnableOption "Enable Taskwarrior services";
|
mkEnableOption "Enable Taskwarrior services";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.urxvt;
|
cfg = config.programs.custom.urxvt;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.urxvt = {
|
options.programs.custom.urxvt = {
|
||||||
|
|
||||||
|
@ -63,7 +64,8 @@ in {
|
||||||
URxvt.fading: 0
|
URxvt.fading: 0
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"X11/Xresource.d/urxvt-font".source = let
|
"X11/Xresource.d/urxvt-font".source =
|
||||||
|
let
|
||||||
fontFamily = "terminus";
|
fontFamily = "terminus";
|
||||||
normalFont = fontSize:
|
normalFont = fontSize:
|
||||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||||
|
@ -80,7 +82,8 @@ in {
|
||||||
}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
|
}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.writeText "Xresource-urxvt-font" ''
|
in
|
||||||
|
pkgs.writeText "Xresource-urxvt-font" ''
|
||||||
|
|
||||||
URxvt.allow_bold: true
|
URxvt.allow_bold: true
|
||||||
URxvt.xftAntialias: true
|
URxvt.xftAntialias: true
|
||||||
|
@ -110,8 +113,10 @@ in {
|
||||||
${fontCommand "F4" (cfg.fontSize + 20)}
|
${fontCommand "F4" (cfg.fontSize + 20)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"X11/Xresource.d/urxvt-colors".source = let
|
"X11/Xresource.d/urxvt-colors".source =
|
||||||
colorTheme = if (cfg.colorTheme == "dark") then ''
|
let
|
||||||
|
colorTheme =
|
||||||
|
if (cfg.colorTheme == "dark") then ''
|
||||||
#define S_base03 #002b36
|
#define S_base03 #002b36
|
||||||
#define S_base02 #073642
|
#define S_base02 #073642
|
||||||
#define S_base01 #586e75
|
#define S_base01 #586e75
|
||||||
|
@ -131,7 +136,8 @@ in {
|
||||||
#define S_base3 #002b36
|
#define S_base3 #002b36
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.writeText "Xresource-urxvt-colors" ''
|
in
|
||||||
|
pkgs.writeText "Xresource-urxvt-colors" ''
|
||||||
|
|
||||||
!! Common
|
!! Common
|
||||||
!! ------
|
!! ------
|
||||||
|
|
|
@ -9,7 +9,8 @@ let
|
||||||
# show keyboard input on desktop for screencasts
|
# show keyboard input on desktop for screencasts
|
||||||
screenKey = pkgs.symlinkJoin {
|
screenKey = pkgs.symlinkJoin {
|
||||||
name = "screen-keys";
|
name = "screen-keys";
|
||||||
paths = let
|
paths =
|
||||||
|
let
|
||||||
screenKeyScript = { position ? "bottom", size ? "small", ... }:
|
screenKeyScript = { position ? "bottom", size ? "small", ... }:
|
||||||
pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh
|
pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh
|
||||||
''
|
''
|
||||||
|
@ -21,12 +22,14 @@ let
|
||||||
-s ${size} \
|
-s ${size} \
|
||||||
"$@"
|
"$@"
|
||||||
'';
|
'';
|
||||||
in lib.flatten (lib.flip map [ "large" "small" "medium" ] (size:
|
in
|
||||||
|
lib.flatten (lib.flip map [ "large" "small" "medium" ] (size:
|
||||||
lib.flip map [ "top" "center" "bottom" ]
|
lib.flip map [ "top" "center" "bottom" ]
|
||||||
(position: screenKeyScript { inherit size position; })));
|
(position: screenKeyScript { inherit size position; })));
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.video.enable = mkEnableOption "enable video tools";
|
options.programs.custom.video.enable = mkEnableOption "enable video tools";
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,8 @@ let
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
# no options
|
# no options
|
||||||
options.programs.custom.vim.enable = lib.mkEnableOption "vim";
|
options.programs.custom.vim.enable = lib.mkEnableOption "vim";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.programs.custom.xterm;
|
cfg = config.programs.custom.xterm;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.programs.custom.xterm = {
|
options.programs.custom.xterm = {
|
||||||
enable = mkEnableOption "configure and enable urxvt";
|
enable = mkEnableOption "configure and enable urxvt";
|
||||||
|
@ -41,7 +42,8 @@ in {
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"X11/Xresource.d/xterm-font".source = let
|
"X11/Xresource.d/xterm-font".source =
|
||||||
|
let
|
||||||
fontFamily = "terminus";
|
fontFamily = "terminus";
|
||||||
normalFont = fontSize:
|
normalFont = fontSize:
|
||||||
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
"-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*";
|
||||||
|
@ -51,7 +53,8 @@ in {
|
||||||
itallicBoldFont = boldFont;
|
itallicBoldFont = boldFont;
|
||||||
backupFont = fontSize:
|
backupFont = fontSize:
|
||||||
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
"xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}";
|
||||||
in pkgs.writeText "Xresource-xterm-font" ''
|
in
|
||||||
|
pkgs.writeText "Xresource-xterm-font" ''
|
||||||
|
|
||||||
XTerm.allow_bold: true
|
XTerm.allow_bold: true
|
||||||
XTerm.xftAntialias: true
|
XTerm.xftAntialias: true
|
||||||
|
@ -76,8 +79,10 @@ in {
|
||||||
XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize}
|
XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"X11/Xresource.d/xterm-colors".source = let
|
"X11/Xresource.d/xterm-colors".source =
|
||||||
colorTheme = if (cfg.colorTheme == "dark") then ''
|
let
|
||||||
|
colorTheme =
|
||||||
|
if (cfg.colorTheme == "dark") then ''
|
||||||
#define S_base03 #002b36
|
#define S_base03 #002b36
|
||||||
#define S_base02 #073642
|
#define S_base02 #073642
|
||||||
#define S_base01 #586e75
|
#define S_base01 #586e75
|
||||||
|
@ -98,7 +103,8 @@ in {
|
||||||
#define S_base3 #002b36
|
#define S_base3 #002b36
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in pkgs.writeText "Xresource-xterm-colors" ''
|
in
|
||||||
|
pkgs.writeText "Xresource-xterm-colors" ''
|
||||||
|
|
||||||
!! Color Configuration
|
!! Color Configuration
|
||||||
!! -------------------
|
!! -------------------
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.custom.services.castget;
|
cfg = config.custom.services.castget;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.custom.services.castget = {
|
options.custom.services.castget = {
|
||||||
enable = mkEnableOption "enable custom.services.castget";
|
enable = mkEnableOption "enable custom.services.castget";
|
||||||
|
@ -67,23 +68,31 @@ in {
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
serviceConfig.User = cfg.user;
|
serviceConfig.User = cfg.user;
|
||||||
|
|
||||||
preStart = let
|
preStart =
|
||||||
|
let
|
||||||
mkSpools =
|
mkSpools =
|
||||||
mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
|
mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds;
|
||||||
in concatStringsSep "\n" mkSpools;
|
in
|
||||||
script = let
|
concatStringsSep "\n" mkSpools;
|
||||||
|
script =
|
||||||
|
let
|
||||||
channels = mapAttrsToList (key: ignore: key) cfg.feeds;
|
channels = mapAttrsToList (key: ignore: key) cfg.feeds;
|
||||||
castget = "${pkgs.castget}/bin/castget";
|
castget = "${pkgs.castget}/bin/castget";
|
||||||
|
|
||||||
configurationFile = let
|
configurationFile =
|
||||||
configurations = mapAttrsToList (key: value: ''
|
let
|
||||||
|
configurations = mapAttrsToList
|
||||||
|
(key: value: ''
|
||||||
[${key}]
|
[${key}]
|
||||||
url=${value.url}
|
url=${value.url}
|
||||||
spool=${value.spool}
|
spool=${value.spool}
|
||||||
'') cfg.feeds;
|
'')
|
||||||
in (pkgs.writeText "castget-configuration"
|
cfg.feeds;
|
||||||
|
in
|
||||||
|
(pkgs.writeText "castget-configuration"
|
||||||
(concatStringsSep "" configurations));
|
(concatStringsSep "" configurations));
|
||||||
in (concatMapStringsSep "\n"
|
in
|
||||||
|
(concatMapStringsSep "\n"
|
||||||
(channel: "${castget} --rcfile ${configurationFile} ${channel}")
|
(channel: "${castget} --rcfile ${configurationFile} ${channel}")
|
||||||
channels);
|
channels);
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
inherit example description default;
|
inherit example description default;
|
||||||
type = with lib.types;
|
type = with lib.types;
|
||||||
let
|
let
|
||||||
valueType = nullOr (oneOf [
|
valueType = nullOr
|
||||||
|
(oneOf [
|
||||||
bool
|
bool
|
||||||
int
|
int
|
||||||
float
|
float
|
||||||
|
@ -22,10 +23,12 @@ let
|
||||||
description = "";
|
description = "";
|
||||||
emptyValue.value = { };
|
emptyValue.value = { };
|
||||||
};
|
};
|
||||||
in valueType;
|
in
|
||||||
|
valueType;
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.services.homeAssistantConfig = mkMagicMergeOption {
|
options.services.homeAssistantConfig = mkMagicMergeOption {
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.services.lektor;
|
cfg = config.services.lektor;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.services.lektor = {
|
options.services.lektor = {
|
||||||
enable = mkEnableOption "enable services.lektor";
|
enable = mkEnableOption "enable services.lektor";
|
||||||
|
@ -107,7 +108,8 @@ in {
|
||||||
TimeoutStartSec =
|
TimeoutStartSec =
|
||||||
"infinity"; # it might take some time will this thing is up
|
"infinity"; # it might take some time will this thing is up
|
||||||
|
|
||||||
ExecStartPre = let
|
ExecStartPre =
|
||||||
|
let
|
||||||
|
|
||||||
sshKeyTarget = "/run/keys.lektor/id_rsa";
|
sshKeyTarget = "/run/keys.lektor/id_rsa";
|
||||||
|
|
||||||
|
@ -157,7 +159,8 @@ in {
|
||||||
${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user}
|
${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in [ "+${sshKeyScript}" "-${cloneScript}" ];
|
in
|
||||||
|
[ "+${sshKeyScript}" "-${cloneScript}" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# todo : add restart ruling
|
# todo : add restart ruling
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
inherit example description default;
|
inherit example description default;
|
||||||
type = with lib.types;
|
type = with lib.types;
|
||||||
let
|
let
|
||||||
valueType = nullOr (oneOf [
|
valueType = nullOr
|
||||||
|
(oneOf [
|
||||||
bool
|
bool
|
||||||
int
|
int
|
||||||
float
|
float
|
||||||
|
@ -22,13 +23,15 @@ let
|
||||||
description = "";
|
description = "";
|
||||||
emptyValue.value = { };
|
emptyValue.value = { };
|
||||||
};
|
};
|
||||||
in valueType;
|
in
|
||||||
|
valueType;
|
||||||
};
|
};
|
||||||
|
|
||||||
lightControlConfig =
|
lightControlConfig =
|
||||||
pkgs.writeText "light-control.json" (builtins.toJSON cfg.config);
|
pkgs.writeText "light-control.json" (builtins.toJSON cfg.config);
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.services.mqtt.light-control = {
|
options.services.mqtt.light-control = {
|
||||||
enable = mkEnableOption "enable mqtt.light-control";
|
enable = mkEnableOption "enable mqtt.light-control";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.custom.samba-share;
|
cfg = config.custom.samba-share;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.custom.samba-share = {
|
options.custom.samba-share = {
|
||||||
enable = mkEnableOption "enable custom.samba-share";
|
enable = mkEnableOption "enable custom.samba-share";
|
||||||
|
@ -61,7 +62,8 @@ in {
|
||||||
disable spoolss = yes
|
disable spoolss = yes
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shares = mapAttrs' (name: path: {
|
shares = mapAttrs'
|
||||||
|
(name: path: {
|
||||||
name = name;
|
name = name;
|
||||||
value = {
|
value = {
|
||||||
browsable = "yes";
|
browsable = "yes";
|
||||||
|
@ -70,7 +72,9 @@ in {
|
||||||
"read only" = "yes";
|
"read only" = "yes";
|
||||||
"guest ok" = "yes";
|
"guest ok" = "yes";
|
||||||
};
|
};
|
||||||
}) cfg.folders // (mapAttrs' (name:
|
})
|
||||||
|
cfg.folders // (mapAttrs'
|
||||||
|
(name:
|
||||||
{ users, folder, ... }: {
|
{ users, folder, ... }: {
|
||||||
name = name;
|
name = name;
|
||||||
value = {
|
value = {
|
||||||
|
@ -81,7 +85,8 @@ in {
|
||||||
"valid users" = users;
|
"valid users" = users;
|
||||||
"guest ok" = "false";
|
"guest ok" = "false";
|
||||||
};
|
};
|
||||||
}) cfg.private);
|
})
|
||||||
|
cfg.private);
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.smbguest = {
|
users.users.smbguest = {
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.services.custom.ssh;
|
cfg = config.services.custom.ssh;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.services.custom.ssh = {
|
options.services.custom.ssh = {
|
||||||
tools.enable = mkEnableOption "Add ssh tools";
|
tools.enable = mkEnableOption "Add ssh tools";
|
||||||
|
@ -44,11 +45,13 @@ in {
|
||||||
Banner /etc/sshd/banner-line
|
Banner /etc/sshd/banner-line
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.etc."sshd/banner-line".text = let
|
environment.etc."sshd/banner-line".text =
|
||||||
|
let
|
||||||
text = config.networking.hostName;
|
text = config.networking.hostName;
|
||||||
size = 80 - (lib.stringLength text);
|
size = 80 - (lib.stringLength text);
|
||||||
space = lib.fixedWidthString size " " "";
|
space = lib.fixedWidthString size " " "";
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
────────────────────────────────────────────────────────────────────────────────
|
||||||
${space}${text}
|
${space}${text}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -14,7 +14,7 @@ in
|
||||||
default = "4:00:00";
|
default = "4:00:00";
|
||||||
};
|
};
|
||||||
recurrence = mkOption {
|
recurrence = mkOption {
|
||||||
type = enum["on" "off"];
|
type = enum [ "on" "off" ];
|
||||||
default = "off";
|
default = "off";
|
||||||
};
|
};
|
||||||
pushoverApiTokenFile = mkOption {
|
pushoverApiTokenFile = mkOption {
|
||||||
|
@ -37,7 +37,7 @@ in
|
||||||
certificateFile = mkOption {
|
certificateFile = mkOption {
|
||||||
type = path;
|
type = path;
|
||||||
};
|
};
|
||||||
credentials= mkOption {
|
credentials = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
keyFile = mkOption {
|
keyFile = mkOption {
|
||||||
|
@ -55,7 +55,8 @@ in
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
StateDirectory = name;
|
StateDirectory = name;
|
||||||
};
|
};
|
||||||
script = let
|
script =
|
||||||
|
let
|
||||||
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
taskwarriorCommand = pkgs.writers.writeDash "taskwarrior-push" ''
|
||||||
${pkgs.taskwarrior}/bin/task \
|
${pkgs.taskwarrior}/bin/task \
|
||||||
rc.recurrence=${cfg.recurrence} \
|
rc.recurrence=${cfg.recurrence} \
|
||||||
|
|
|
@ -30,7 +30,8 @@ let
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.service.videoencoder = {
|
options.service.videoencoder = {
|
||||||
enable = mkEnableOption "enable service.videoencoder";
|
enable = mkEnableOption "enable service.videoencoder";
|
||||||
|
@ -91,11 +92,14 @@ in {
|
||||||
systemd.services."videoEncoding" = {
|
systemd.services."videoEncoding" = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
enable = true;
|
enable = true;
|
||||||
script = let
|
script =
|
||||||
myList = map (value:
|
let
|
||||||
|
myList = map
|
||||||
|
(value:
|
||||||
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile)
|
createEncoder "/tmp/videoencoder" value.inputFile value.outputFile)
|
||||||
cfg.fileConfig;
|
cfg.fileConfig;
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
set -x
|
set -x
|
||||||
${concatStringsSep "\n" myList}
|
${concatStringsSep "\n" myList}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -41,7 +41,8 @@ let
|
||||||
|
|
||||||
cfg = config.system.custom.audio;
|
cfg = config.system.custom.audio;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.audio = {
|
options.system.custom.audio = {
|
||||||
enable = mkEnableOption "use PluseAudio";
|
enable = mkEnableOption "use PluseAudio";
|
||||||
|
|
|
@ -4,7 +4,8 @@ let
|
||||||
|
|
||||||
cfg = config.system.custom.bluetooth;
|
cfg = config.system.custom.bluetooth;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.bluetooth.enable =
|
options.system.custom.bluetooth.enable =
|
||||||
lib.mkEnableOption "enable bluetooth support";
|
lib.mkEnableOption "enable bluetooth support";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.system.custom.fonts;
|
cfg = config.system.custom.fonts;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.fonts = {
|
options.system.custom.fonts = {
|
||||||
enable = mkEnableOption "enable fonts";
|
enable = mkEnableOption "enable fonts";
|
||||||
|
|
|
@ -9,12 +9,14 @@ let
|
||||||
dockerGroup =
|
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
|
vboxGroup =
|
||||||
|
if (config.virtualisation.virtualbox.host.enable) then
|
||||||
[ "vboxusers" ]
|
[ "vboxusers" ]
|
||||||
else
|
else
|
||||||
[ ];
|
[ ];
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.mainUser = {
|
options.system.custom.mainUser = {
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,8 @@ let
|
||||||
${cfg.url}
|
${cfg.url}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.on-failure = api;
|
options.on-failure = api;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
cfg = config.system.permown;
|
cfg = config.system.permown;
|
||||||
nameGenerator = path: "permown.${replaceStrings [ "/" ] [ "_" ] path}";
|
nameGenerator = path: "permown.${replaceStrings [ "/" ] [ "_" ] path}";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.permown = mkOption {
|
options.system.permown = mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -45,15 +46,18 @@ in {
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let plans = lib.attrValues cfg;
|
config =
|
||||||
|
let plans = lib.attrValues cfg;
|
||||||
|
|
||||||
in mkIf (plans != [ ]) {
|
in mkIf (plans != [ ]) {
|
||||||
|
|
||||||
system.activationScripts.permown = let
|
system.activationScripts.permown =
|
||||||
|
let
|
||||||
mkdir = { path, ... }: ''
|
mkdir = { path, ... }: ''
|
||||||
${pkgs.coreutils}/bin/mkdir -p ${path}
|
${pkgs.coreutils}/bin/mkdir -p ${path}
|
||||||
'';
|
'';
|
||||||
in concatMapStrings mkdir plans;
|
in
|
||||||
|
concatMapStrings mkdir plans;
|
||||||
|
|
||||||
systemd.services = listToAttrs (flip map plans
|
systemd.services = listToAttrs (flip map plans
|
||||||
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
|
({ path, directory-mode, file-mode, owner, group, umask, ... }: {
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.system.custom.wifi;
|
cfg = config.system.custom.wifi;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.wifi = {
|
options.system.custom.wifi = {
|
||||||
enable = mkEnableOption "enable wifi";
|
enable = mkEnableOption "enable wifi";
|
||||||
|
|
|
@ -6,7 +6,8 @@ let
|
||||||
|
|
||||||
cfg = config.system.custom.x11;
|
cfg = config.system.custom.x11;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.system.custom.x11 = {
|
options.system.custom.x11 = {
|
||||||
enable = mkEnableOption "enable x11";
|
enable = mkEnableOption "enable x11";
|
||||||
|
|
|
@ -12,7 +12,8 @@ let
|
||||||
|
|
||||||
# function call
|
# function call
|
||||||
# -------------
|
# -------------
|
||||||
in (pkgs.buildFHSUserEnv {
|
in
|
||||||
|
(pkgs.buildFHSUserEnv {
|
||||||
|
|
||||||
# name of the programm
|
# name of the programm
|
||||||
# --------------------
|
# --------------------
|
||||||
|
|
|
@ -1,6 +1,27 @@
|
||||||
{ stdenv, fetchurl, alsaLib, bzip2, cairo, dpkg, freetype, gdk_pixbuf, glib
|
{ stdenv
|
||||||
, gtk2, harfbuzz, jdk, lib, xorg, libbsd, libjack2, libpng, libxkbcommon
|
, fetchurl
|
||||||
, makeWrapper, pixman, xdg_utils, zenity, zlib }:
|
, alsaLib
|
||||||
|
, bzip2
|
||||||
|
, cairo
|
||||||
|
, dpkg
|
||||||
|
, freetype
|
||||||
|
, gdk_pixbuf
|
||||||
|
, glib
|
||||||
|
, gtk2
|
||||||
|
, harfbuzz
|
||||||
|
, jdk
|
||||||
|
, lib
|
||||||
|
, xorg
|
||||||
|
, libbsd
|
||||||
|
, libjack2
|
||||||
|
, libpng
|
||||||
|
, libxkbcommon
|
||||||
|
, makeWrapper
|
||||||
|
, pixman
|
||||||
|
, xdg_utils
|
||||||
|
, zenity
|
||||||
|
, zlib
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "bitwig-studio-${version}";
|
name = "bitwig-studio-${version}";
|
||||||
|
|
|
@ -42,7 +42,8 @@ let
|
||||||
@}-,-`- | rose
|
@}-,-`- | rose
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in writeShellScriptBin "emoticons" ''
|
in
|
||||||
|
writeShellScriptBin "emoticons" ''
|
||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
data=$(${coreutils}/bin/cat ${emoticons})
|
data=$(${coreutils}/bin/cat ${emoticons})
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
|
|
||||||
pkgs.writers.writePython3Bin "gitlog2json" {
|
pkgs.writers.writePython3Bin "gitlog2json"
|
||||||
|
{
|
||||||
libraries = [
|
libraries = [
|
||||||
pkgs.python3Packages.GitPython
|
pkgs.python3Packages.GitPython
|
||||||
pkgs.python3Packages.click
|
pkgs.python3Packages.click
|
||||||
pkgs.python3Packages.elasticsearch
|
pkgs.python3Packages.elasticsearch
|
||||||
];
|
];
|
||||||
} (lib.fileContents ./gitlog2json.py)
|
}
|
||||||
|
(lib.fileContents ./gitlog2json.py)
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{ lib, writeTextFile, jsonConfig ? { }, title ? "Landing Page"
|
{ lib
|
||||||
, destination ? "/index.html", ... }:
|
, writeTextFile
|
||||||
|
, jsonConfig ? { }
|
||||||
|
, title ? "Landing Page"
|
||||||
|
, destination ? "/index.html"
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
{ lib, symlinkJoin, rofi, gnused, pass-otp, writeTextFile, writeShellScriptBin
|
{ lib
|
||||||
, xdotool }:
|
, symlinkJoin
|
||||||
|
, rofi
|
||||||
|
, gnused
|
||||||
|
, pass-otp
|
||||||
|
, writeTextFile
|
||||||
|
, writeShellScriptBin
|
||||||
|
, xdotool
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
@ -36,7 +43,8 @@ let
|
||||||
printf %s "$otp" | ${xdotool}/bin/xdotool type -f -
|
printf %s "$otp" | ${xdotool}/bin/xdotool type -f -
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in symlinkJoin rec {
|
in
|
||||||
|
symlinkJoin rec {
|
||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
name = "otpMenu-${version}";
|
name = "otpMenu-${version}";
|
||||||
paths = [ bin desktopFile ];
|
paths = [ bin desktopFile ];
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
{ pkgs, lib
|
{ pkgs
|
||||||
# tzselect is your frind do find timezones
|
, lib
|
||||||
, timeZones ? [ ], timeColor ? 9, timeZoneColor ? 10, calBackgroundColor ? 10
|
# tzselect is your frind do find timezones
|
||||||
, calWeekColor ? 13, calDayColor ? 9, enableIntelBacklight ? true
|
, timeZones ? [ ]
|
||||||
, userHighlight ? [ "palo" ], enableBattery ? true, ... }:
|
, timeColor ? 9
|
||||||
|
, timeZoneColor ? 10
|
||||||
|
, calBackgroundColor ? 10
|
||||||
|
, calWeekColor ? 13
|
||||||
|
, calDayColor ? 9
|
||||||
|
, enableIntelBacklight ? true
|
||||||
|
, userHighlight ? [ "palo" ]
|
||||||
|
, enableBattery ? true
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
hrule = "${pkgs.terminal-tools}/bin/hrule";
|
hrule = "${pkgs.terminal-tools}/bin/hrule";
|
||||||
|
|
||||||
q-cal = let
|
q-cal =
|
||||||
|
let
|
||||||
|
|
||||||
# Maximum width of cal's output.
|
# Maximum width of cal's output.
|
||||||
calwidth = 23;
|
calwidth = 23;
|
||||||
|
@ -48,7 +58,8 @@ let
|
||||||
}m&[39;22m/
|
}m&[39;22m/
|
||||||
"
|
"
|
||||||
}'';
|
}'';
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
cols=$(${pkgs.ncurses}/bin/tput cols)
|
cols=$(${pkgs.ncurses}/bin/tput cols)
|
||||||
${pkgs.coreutils}/bin/paste \
|
${pkgs.coreutils}/bin/paste \
|
||||||
<(if test $cols -ge ${toString (need_width 3)}; then
|
<(if test $cols -ge ${toString (need_width 3)}; then
|
||||||
|
@ -88,13 +99,15 @@ let
|
||||||
comment = lib.optionalString (zone != null)
|
comment = lib.optionalString (zone != null)
|
||||||
" : ${lib.fixedWidthString size " " zone}";
|
" : ${lib.fixedWidthString size " " zone}";
|
||||||
# sh
|
# sh
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
${timeZoneVariable} ${pkgs.coreutils}/bin/date ${
|
${timeZoneVariable} ${pkgs.coreutils}/bin/date ${
|
||||||
dateString comment
|
dateString comment
|
||||||
} | ${pkgs.terminal-tools}/bin/center
|
} | ${pkgs.terminal-tools}/bin/center
|
||||||
'';
|
'';
|
||||||
|
|
||||||
q-timeZoneDates = if timeZones == [ ] then
|
q-timeZoneDates =
|
||||||
|
if timeZones == [ ] then
|
||||||
q-timeZoneDate 0 null
|
q-timeZoneDate 0 null
|
||||||
else
|
else
|
||||||
let size = lib.foldr lib.max 0 (map builtins.stringLength timeZones);
|
let size = lib.foldr lib.max 0 (map builtins.stringLength timeZones);
|
||||||
|
@ -116,7 +129,8 @@ let
|
||||||
'
|
'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
q-power_supply = let
|
q-power_supply =
|
||||||
|
let
|
||||||
power_supply = pkgs.writers.writeBash "power_supply" ''
|
power_supply = pkgs.writers.writeBash "power_supply" ''
|
||||||
set -efu
|
set -efu
|
||||||
uevent=$1
|
uevent=$1
|
||||||
|
@ -249,7 +263,8 @@ let
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
'';
|
'';
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
for uevent in /sys/class/power_supply/*/uevent; do
|
for uevent in /sys/class/power_supply/*/uevent; do
|
||||||
${power_supply} "$uevent" || :
|
${power_supply} "$uevent" || :
|
||||||
done
|
done
|
||||||
|
@ -323,7 +338,8 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# bash needed for <(...)
|
# bash needed for <(...)
|
||||||
in pkgs.writers.writeBashBin "q" ''
|
in
|
||||||
|
pkgs.writers.writeBashBin "q" ''
|
||||||
set -eu
|
set -eu
|
||||||
export PATH=/var/empty
|
export PATH=/var/empty
|
||||||
${hrule}
|
${hrule}
|
||||||
|
|
|
@ -32,7 +32,8 @@ let
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in (pkgs.buildFHSUserEnv {
|
in
|
||||||
|
(pkgs.buildFHSUserEnv {
|
||||||
|
|
||||||
# name it
|
# name it
|
||||||
# -------
|
# -------
|
||||||
|
|
|
@ -32,7 +32,8 @@ let
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in (pkgs.buildFHSUserEnv {
|
in
|
||||||
|
(pkgs.buildFHSUserEnv {
|
||||||
|
|
||||||
# name it
|
# name it
|
||||||
# -------
|
# -------
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
|
|
||||||
servers = [
|
servers = [
|
||||||
{
|
{
|
||||||
|
@ -59,18 +60,21 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
sops.secrets.backup_repository_passphrase = { };
|
sops.secrets.backup_repository_passphrase = { };
|
||||||
sops.secrets.backup_ssh_rsa_private = { };
|
sops.secrets.backup_ssh_rsa_private = { };
|
||||||
|
|
||||||
services.borgbackup.jobs = let
|
services.borgbackup.jobs =
|
||||||
|
let
|
||||||
setups = map ({ name, host }: { "${name}" = setup host; }) servers;
|
setups = map ({ name, host }: { "${name}" = setup host; }) servers;
|
||||||
setupAttrs = lib.zipAttrsWith (_: vals: lib.head vals) setups;
|
setupAttrs = lib.zipAttrsWith (_: vals: lib.head vals) setups;
|
||||||
nonEmptySetups =
|
nonEmptySetups =
|
||||||
lib.filterAttrs (_: { paths, ... }: builtins.length paths != 0)
|
lib.filterAttrs (_: { paths, ... }: builtins.length paths != 0)
|
||||||
setupAttrs;
|
setupAttrs;
|
||||||
in nonEmptySetups;
|
in
|
||||||
|
nonEmptySetups;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ pkgs, lib, ... }: {
|
{ pkgs, lib, ... }: {
|
||||||
|
|
||||||
environment.systemPackages = let
|
environment.systemPackages =
|
||||||
|
let
|
||||||
createScript = command: host: repository:
|
createScript = command: host: repository:
|
||||||
pkgs.writers.writeBashBin
|
pkgs.writers.writeBashBin
|
||||||
"borg-${command}-on-${host}-for-${repository}" ''
|
"borg-${command}-on-${host}-for-${repository}" ''
|
||||||
|
@ -12,9 +13,12 @@
|
||||||
hosts = [ "workhorse" "pepe" ];
|
hosts = [ "workhorse" "pepe" ];
|
||||||
repositories = [ "workhorse" "pepe" "sterni" "workout" ];
|
repositories = [ "workhorse" "pepe" "sterni" "workout" ];
|
||||||
commands = [ "list" ];
|
commands = [ "list" ];
|
||||||
in lib.flatten (map (command:
|
in
|
||||||
|
lib.flatten (map
|
||||||
|
(command:
|
||||||
map
|
map
|
||||||
(host: map (repository: createScript command host repository) repositories)
|
(host: map (repository: createScript command host repository) repositories)
|
||||||
hosts) commands);
|
hosts)
|
||||||
|
commands);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ let
|
||||||
rev = "fe27cbc99e994d50bb4269a9388e3f7d60492ffa";
|
rev = "fe27cbc99e994d50bb4269a9388e3f7d60492ffa";
|
||||||
sha256 = "1z8zc4k2mh8d56ipql8vfljvdjczrrna5ckgzjsdyrndfkwv8ghw";
|
sha256 = "1z8zc4k2mh8d56ipql8vfljvdjczrrna5ckgzjsdyrndfkwv8ghw";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
set theme=($drive1)//themes/fallout-grub-theme/theme.txt
|
set theme=($drive1)//themes/fallout-grub-theme/theme.txt
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
kbits = number:
|
kbits = number:
|
||||||
import (pkgs.runCommand "round-${toString number}" { }
|
import (pkgs.runCommand "round-${toString number}" { }
|
||||||
''awk 'BEGIN{printf "\"%ikbit\"", ${toString number}}' > $out'');
|
''awk 'BEGIN{printf "\"%ikbit\"", ${toString number}}' > $out'');
|
||||||
|
@ -42,7 +43,8 @@
|
||||||
lib.mapAttrsToList (name: configuration: toString configuration.port)
|
lib.mapAttrsToList (name: configuration: toString configuration.port)
|
||||||
config.module.cluster.services.tinc;
|
config.module.cluster.services.tinc;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
# https://firehol.org/tutorial/fireqos-new-user/
|
# https://firehol.org/tutorial/fireqos-new-user/
|
||||||
services.fireqos.enable = config.configuration.fireqos.enable;
|
services.fireqos.enable = config.configuration.fireqos.enable;
|
||||||
|
|
|
@ -228,21 +228,25 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
text = "Syncthings";
|
text = "Syncthings";
|
||||||
items = map ({ name, host ? "${name}.private", ... }: {
|
items = map
|
||||||
|
({ name, host ? "${name}.private", ... }: {
|
||||||
label = name;
|
label = name;
|
||||||
href = "http://${host}:8384/";
|
href = "http://${host}:8384/";
|
||||||
image =
|
image =
|
||||||
"https://media.giphy.com/media/JoyU4vuzwj6ZA7Ging/giphy.gif";
|
"https://media.giphy.com/media/JoyU4vuzwj6ZA7Ging/giphy.gif";
|
||||||
}) (map (name: { inherit name; }) (lib.attrNames
|
})
|
||||||
|
(map (name: { inherit name; }) (lib.attrNames
|
||||||
config.module.cluster.services.tinc."private".hosts));
|
config.module.cluster.services.tinc."private".hosts));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
text = "netdata";
|
text = "netdata";
|
||||||
items = map ({ name, host ? "${name}.private", ... }: {
|
items = map
|
||||||
|
({ name, host ? "${name}.private", ... }: {
|
||||||
label = name;
|
label = name;
|
||||||
href = "http://${host}:19999/";
|
href = "http://${host}:19999/";
|
||||||
image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif";
|
image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif";
|
||||||
}) (map (name: { inherit name; }) [
|
})
|
||||||
|
(map (name: { inherit name; }) [
|
||||||
"workhorse"
|
"workhorse"
|
||||||
"porani"
|
"porani"
|
||||||
"pepe"
|
"pepe"
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
let
|
let
|
||||||
access_log_sink = "workhorse.private:12304";
|
access_log_sink = "workhorse.private:12304";
|
||||||
error_log_sink = "workhorse.private:12305";
|
error_log_sink = "workhorse.private:12305";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
security.acme.email = "contact@ingolf-wagner.de";
|
security.acme.email = "contact@ingolf-wagner.de";
|
||||||
security.acme.acceptTerms = true;
|
security.acme.acceptTerms = true;
|
||||||
|
|
|
@ -29,14 +29,17 @@ let
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
storepath = let
|
storepath =
|
||||||
|
let
|
||||||
dirname = "${pkgs.coreutils-full}/bin/dirname";
|
dirname = "${pkgs.coreutils-full}/bin/dirname";
|
||||||
readlink = "${pkgs.coreutils-full}/bin/readlink";
|
readlink = "${pkgs.coreutils-full}/bin/readlink";
|
||||||
in pkgs.writers.writeBashBin "storepath" ''
|
in
|
||||||
|
pkgs.writers.writeBashBin "storepath" ''
|
||||||
${dirname} $( ${readlink} $( type -p "$1" ) )
|
${dirname} $( ${readlink} $( type -p "$1" ) )
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
#imports = [ ./packages/llvm-config-dummy.nix ];
|
#imports = [ ./packages/llvm-config-dummy.nix ];
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
with pkgs.lib; {
|
with pkgs.lib; {
|
||||||
environment.systemPackages = let
|
environment.systemPackages =
|
||||||
|
let
|
||||||
llvm = pkgs.llvm;
|
llvm = pkgs.llvm;
|
||||||
llvm-config = pkgs.writers.writeBashBin "llvm-config" ''
|
llvm-config = pkgs.writers.writeBashBin "llvm-config" ''
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
|
@ -37,5 +38,6 @@ with pkgs.lib; {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
in [ llvm-config ];
|
in
|
||||||
|
[ llvm-config ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
{
|
{ }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue