From 42d30d7edf3ee75c3fa9ba285ea538430534fdcd Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 20 Dec 2019 17:54:26 +1300 Subject: [PATCH] nixfmt: reformat all files --- configs/pepe/configuration.nix | 25 +- configs/pepe/hardware-configuration.nix | 38 +- configs/pepe/samba.nix | 1 - configs/pepe/syncthing.nix | 3 +- configs/pepe/wifi-access-point.nix | 51 +- configs/porani/configuration.nix | 3 +- configs/porani/hardware-configuration.nix | 52 +- configs/porani/home-assistant.nix | 305 +++++----- configs/porani/home-assistant/chaospott.nix | 23 +- configs/porani/home-assistant/dayOfWeek.nix | 27 +- configs/porani/home-assistant/holiday.nix | 37 +- configs/porani/home-assistant/kodi.nix | 26 +- configs/porani/home-assistant/mpd.nix | 26 +- configs/porani/home-assistant/sonoff.nix | 214 +++---- configs/porani/home-assistant/timer.nix | 122 ++-- configs/porani/home-assistant/zigbee2mqtt.nix | 243 ++++---- configs/porani/kodi.nix | 8 +- configs/porani/mpd.nix | 3 +- configs/porani/packages.nix | 6 +- configs/porani/syncthing.nix | 10 +- configs/porani/tinc.nix | 3 +- configs/porani/wifi-access-point.nix | 54 +- configs/sputnik/configuration.nix | 13 +- configs/sputnik/hardware-configuration.nix | 15 +- configs/sputnik/mail-server.nix | 17 +- configs/sputnik/nginx.nix | 117 ++-- configs/sputnik/tinc.nix | 3 +- configs/sterni/configuration.nix | 21 +- configs/sterni/hardware-configuration.nix | 36 +- configs/sterni/packages.nix | 8 +- configs/sterni/syncthing.nix | 5 +- configs/sterni/wifi-access-point.nix | 51 +- configs/workhorse/bepasty.nix | 22 +- configs/workhorse/configuration.nix | 17 +- configs/workhorse/gogs.nix | 11 +- configs/workhorse/grafana.nix | 26 +- configs/workhorse/graylog.nix | 19 +- configs/workhorse/hardware-configuration.nix | 72 +-- configs/workhorse/jenkins.nix | 261 ++++---- configs/workhorse/kibana.nix | 9 +- configs/workhorse/lektor-gaykraft.nix | 31 +- configs/workhorse/lektor-techblog.nix | 34 +- configs/workhorse/lektor-terranix.nix | 31 +- configs/workhorse/mail-fetcher.nix | 548 ++++++++++++----- configs/workhorse/packages.nix | 8 +- configs/workhorse/prometheus.nix | 53 +- configs/workhorse/restic.nix | 3 +- configs/workhorse/seafile.nix | 9 +- configs/workhorse/syncthing.nix | 152 ++--- configs/workhorse/taskserver.nix | 5 +- configs/workhorse/tinc.nix | 3 +- configs/workhorse/transmission.nix | 17 +- configs/workhorse/weechat.nix | 13 +- configs/workout/configuration.nix | 17 +- configs/workout/hardware-configuration.nix | 52 +- configs/workout/kibana.nix | 15 +- configs/workout/packages.nix | 21 +- configs/workout/slack.nix | 6 +- configs/workout/syncthing.nix | 3 +- configs/workout/tinc.nix | 3 +- images/lib/remote-access.nix | 32 +- images/remote-install/config.nix | 6 +- images/remote-install/remote-install.nix | 4 +- images/windows-rescue/config.nix | 11 +- images/yubikey-image.nix | 14 +- library/default.nix | 10 +- library/jenkins.nix | 127 ++-- modules/later/syncthing.nix | 128 ++-- modules/programs/browser.nix | 335 +++++------ modules/programs/citate.nix | 17 +- modules/programs/curl-scripts.nix | 13 +- modules/programs/easytag.nix | 8 +- modules/programs/elm.nix | 2 +- modules/programs/espeak.nix | 6 +- modules/programs/ffmpeg.nix | 32 +- modules/programs/git.nix | 5 +- modules/programs/q.nix | 2 +- modules/programs/shell-bash.nix | 101 ++-- modules/programs/shell-tools.nix | 47 +- modules/programs/shell-zsh.nix | 168 +++--- modules/programs/slack.nix | 145 +++-- modules/programs/steam.nix | 6 +- modules/programs/taskwarrior.nix | 25 +- modules/programs/urxvt.nix | 89 +-- modules/programs/vim.nix | 555 +++++++++--------- modules/programs/xterm.nix | 205 +++---- modules/services/castget.nix | 79 ++- modules/services/home-assistant.nix | 490 ++++++++-------- modules/services/lektor.nix | 66 ++- modules/services/samba-share.nix | 26 +- modules/services/seafile.nix | 41 +- modules/services/sshd.nix | 59 +- modules/services/transmission.nix | 56 +- modules/services/videoencoder.nix | 64 +- modules/system/audio.nix | 94 +-- modules/system/bluetooth.nix | 11 +- modules/system/font.nix | 23 +- modules/system/mainUser.nix | 35 +- modules/system/permown.nix | 84 ++- modules/system/wifi.nix | 11 +- modules/system/x11.nix | 5 +- pkgs/bepasty-client-cli/default.nix | 11 +- .../bitwig-studio-environment.nix | 93 ++- pkgs/bitwig-studio/bitwig-studio1.nix | 54 +- pkgs/bitwig-studio/bitwig-studio2.nix | 10 +- pkgs/bitwig-studio/bitwig-studio3.nix | 5 +- pkgs/castget/default.nix | 12 +- pkgs/default.nix | 33 +- pkgs/emoji/default.nix | 79 ++- pkgs/geodatabase/default.nix | 5 +- pkgs/gitlog2json/shell.nix | 4 +- pkgs/image-generator/default.nix | 20 +- pkgs/landingpage/default.nix | 234 ++++---- pkgs/lektor-with-plugins/lektor-git/shell.nix | 11 +- .../default.nix | 2 +- .../lektor-shell/shell.nix | 9 +- pkgs/lektor-with-plugins/requirements.nix | 390 ++++++------ .../requirements_override.nix | 15 +- pkgs/memo/default.nix | 16 +- pkgs/otpmenu/default.nix | 83 ++- pkgs/q/default.nix | 89 +-- pkgs/sononym/default.nix | 168 +++--- system/all/default.nix | 16 +- system/all/grub.nix | 5 +- system/all/networking-qos.nix | 46 +- system/all/nginx-landingpage.nix | 424 ++++++------- system/all/nginx.nix | 3 +- system/all/packages.nix | 70 +-- system/all/restic.nix | 20 +- system/all/sftp-user.nix | 9 +- system/all/shell.nix | 1 - system/all/sshd-known-hosts-bootup.nix | 45 +- system/all/sshd-known-hosts-private.nix | 24 +- system/all/sshd-known-hosts-public.nix | 36 +- system/all/sshd.nix | 7 +- system/all/syncthing.nix | 65 +- system/all/tinc.nix | 25 +- system/desktop/audio.nix | 80 ++- system/desktop/browser.nix | 2 - system/desktop/cachix.nix | 5 +- system/desktop/cachix/all-hies.nix | 9 +- system/desktop/default.nix | 16 +- system/desktop/direnv.nix | 3 +- system/desktop/dnsmasq.nix | 8 +- system/desktop/home-manager.nix | 79 ++- system/desktop/home-manager/spacemacs.nix | 416 +++++++------ system/desktop/home-manager/spacevim.nix | 9 +- system/desktop/home-manager/ssh.nix | 3 +- system/desktop/home-manager/xmonad.nix | 39 +- .../home-manager/xmonad/current-project.nix | 11 +- system/desktop/home-manager/xmonad/env.nix | 7 +- system/desktop/home-manager/xmonad/lsp.nix | 11 +- system/desktop/home-manager/xmonad/shell.nix | 21 +- system/desktop/icecast.nix | 7 +- system/desktop/mail-stuff.nix | 309 +++++----- system/desktop/mc.nix | 6 +- system/desktop/network.nix | 3 +- system/desktop/packages.nix | 433 +++++++------- system/desktop/pass.nix | 4 +- system/desktop/remote-install.nix | 7 +- system/desktop/restic.nix | 4 +- system/desktop/sshd.nix | 3 +- system/desktop/suspend.nix | 14 +- system/desktop/user.nix | 7 +- system/desktop/x11.nix | 12 +- system/desktop/xlock.nix | 45 +- system/desktop/yubikey.nix | 3 +- system/proxy/default.nix | 3 +- system/server/default.nix | 3 +- system/server/graylog-exporter.nix | 3 +- system/server/initssh.nix | 63 +- system/server/netdata.nix | 3 +- system/server/prometheus-exporters.nix | 3 +- system/server/restic.nix | 3 +- terranix/graylog/config.nix | 36 +- terranix/graylog/config/elasticsearch.nix | 3 +- terranix/graylog/config/gogs.nix | 3 +- terranix/graylog/config/home-assistant.nix | 3 +- terranix/graylog/config/kernel.nix | 5 +- terranix/graylog/config/nginx.nix | 5 +- terranix/graylog/config/sshd.nix | 3 +- terranix/graylog/config/sshguard.nix | 5 +- terranix/graylog/config/sslh.nix | 3 +- terranix/graylog/config/tinc.nix | 3 +- terranix/graylog/modules/all-messages.nix | 15 +- terranix/graylog/modules/default.nix | 9 +- terranix/graylog/modules/pipeline.nix | 148 ++--- terranix/graylog/modules/stream.nix | 67 +-- terranix/graylog/shell.nix | 8 +- terranix/servers/config.nix | 12 +- terranix/servers/modules/nix-server.nix | 4 +- terranix/servers/shell.nix | 35 +- 192 files changed, 5276 insertions(+), 5151 deletions(-) diff --git a/configs/pepe/configuration.nix b/configs/pepe/configuration.nix index 1b2d614..12550b8 100644 --- a/configs/pepe/configuration.nix +++ b/configs/pepe/configuration.nix @@ -1,6 +1,4 @@ -{ config, pkgs, lib, ... }: -{ - +{ config, pkgs, lib, ... }: { imports = [ @@ -16,18 +14,16 @@ custom.samba-share = { enable = false; - folders = { - public = "/home/palo/movies"; - }; + folders = { public = "/home/palo/movies"; }; }; - system.custom.wifi.interfaces = ["wlp3s0"]; + system.custom.wifi.interfaces = [ "wlp3s0" ]; - networking.hostName = "pepe"; + networking.hostName = "pepe"; security.wrappers = { - pmount.source = "${pkgs.pmount}/bin/pmount"; - pumount.source = "${pkgs.pmount}/bin/pumount"; + pmount.source = "${pkgs.pmount}/bin/pmount"; + pumount.source = "${pkgs.pmount}/bin/pumount"; }; # keybase @@ -41,16 +37,16 @@ # fonts # ----- - programs.custom.urxvt.fontSize = 12; - programs.custom.xterm.fontSize = 12; + programs.custom.urxvt.fontSize = 12; + programs.custom.xterm.fontSize = 12; system.custom.fonts.dpi = 100; virtualisation = { docker.enable = false; virtualbox = { - host.enable = false; - guest.x11 = false; + host.enable = false; + guest.x11 = false; guest.enable = false; }; }; @@ -62,4 +58,3 @@ } - diff --git a/configs/pepe/hardware-configuration.nix b/configs/pepe/hardware-configuration.nix index 5d208c9..4269dd5 100644 --- a/configs/pepe/hardware-configuration.nix +++ b/configs/pepe/hardware-configuration.nix @@ -4,18 +4,17 @@ { config, lib, pkgs, ... }: { - imports = - [ - ]; + imports = [ ]; - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = + [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; boot.loader.grub = { - enable = true; + enable = true; version = 2; - device = "/dev/sda"; + device = "/dev/sda"; }; zramSwap = { @@ -34,37 +33,31 @@ #device = "/dev/ram2"; #fsType = "tmpfs"; options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/secure_vg/browser"; - fsType = "ext4"; + device = "/dev/secure_vg/browser"; + fsType = "ext4"; }; nix.maxJobs = lib.mkDefault 4; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - - # lvm volume group # ---------------- - boot.initrd.luks.devices = [ - { - name = "secure_vg"; - device = "/dev/sda2"; - preLVM = true; - } - ]; + boot.initrd.luks.devices = [{ + name = "secure_vg"; + device = "/dev/sda2"; + preLVM = true; + }]; # NTFS support # ------------ - environment.systemPackages = [ - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.ntfs3g ]; # root # ---- fileSystems."/" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/secure_vg/root"; - fsType = "ext4"; + device = "/dev/secure_vg/root"; + fsType = "ext4"; }; # boot @@ -74,5 +67,4 @@ fsType = "ext4"; }; - } diff --git a/configs/pepe/samba.nix b/configs/pepe/samba.nix index bba5e4c..367633f 100644 --- a/configs/pepe/samba.nix +++ b/configs/pepe/samba.nix @@ -1,5 +1,4 @@ { config, ... }: { - } diff --git a/configs/pepe/syncthing.nix b/configs/pepe/syncthing.nix index e401d53..80ced56 100644 --- a/configs/pepe/syncthing.nix +++ b/configs/pepe/syncthing.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { test.services.syncthing = { enable = true; diff --git a/configs/pepe/wifi-access-point.nix b/configs/pepe/wifi-access-point.nix index 4c309cb..db5f81f 100644 --- a/configs/pepe/wifi-access-point.nix +++ b/configs/pepe/wifi-access-point.nix @@ -1,22 +1,21 @@ -{lib, pkgs, ... }: +{ lib, pkgs, ... }: let wifi = "wlp0s29u1u2"; ipAddress = "10.123.145.1"; prefixLength = 24; servedAddressRange = "10.123.145.2,10.123.145.150,12h"; - ssid="bumbumbum"; - wifiPassword=lib.fileContents ; -in + ssid = "bumbumbum"; + wifiPassword = lib.fileContents ; -{ +in { # todo only open needed ports networking.firewall.trustedInterfaces = [ wifi ]; networking.networkmanager.unmanaged = [ wifi ]; networking.dhcpcd.denyInterfaces = [ wifi ]; - networking.interfaces."${wifi}".ipv4.addresses = [ { + networking.interfaces."${wifi}".ipv4.addresses = [{ address = ipAddress; prefixLength = prefixLength; }]; @@ -35,25 +34,33 @@ in # start manual # wantedBy = [ "network.target" ]; - after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ]; + after = [ + "${wifi}-cfg.service" + "nat.service" + "bind.service" + "dhcpd.service" + "sys-subsystem-net-devices-${wifi}.device" + ]; serviceConfig = { - ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" '' - interface=${wifi} - hw_mode=g - channel=10 - ieee80211d=1 - country_code=DE - ieee80211n=1 - wmm_enabled=1 + ExecStart = "${pkgs.hostapd}/bin/hostapd ${ + pkgs.writeText "hostapd.conf" '' + interface=${wifi} + hw_mode=g + channel=10 + ieee80211d=1 + country_code=DE + ieee80211n=1 + wmm_enabled=1 - ssid=${ssid} - auth_algs=1 - wpa=2 - wpa_key_mgmt=WPA-PSK - rsn_pairwise=CCMP - wpa_passphrase=${wifiPassword} - ''}"; + ssid=${ssid} + auth_algs=1 + wpa=2 + wpa_key_mgmt=WPA-PSK + rsn_pairwise=CCMP + wpa_passphrase=${wifiPassword} + '' + }"; Restart = "always"; }; }; diff --git a/configs/porani/configuration.nix b/configs/porani/configuration.nix index 4a83703..4f84a80 100644 --- a/configs/porani/configuration.nix +++ b/configs/porani/configuration.nix @@ -1,5 +1,4 @@ -{ pkgs, lib, config, ... }: -{ +{ pkgs, lib, config, ... }: { imports = [ diff --git a/configs/porani/hardware-configuration.nix b/configs/porani/hardware-configuration.nix index effeda9..430b268 100644 --- a/configs/porani/hardware-configuration.nix +++ b/configs/porani/hardware-configuration.nix @@ -1,10 +1,8 @@ -{ config, lib, pkgs, ... }: -{ - imports = - [ - ]; +{ config, lib, pkgs, ... }: { + imports = [ ]; - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = + [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -12,33 +10,29 @@ # grub configuration # ------------------ boot.loader.grub = { - device = "/dev/sda"; - enable = true; + device = "/dev/sda"; + enable = true; version = 2; }; # lvm volume group # ---------------- - boot.initrd.luks.devices = [ - { - name = "vg"; - device = "/dev/sda2"; - preLVM = true; - } - ]; + boot.initrd.luks.devices = [{ + name = "vg"; + device = "/dev/sda2"; + preLVM = true; + }]; # NTFS support # ------------ - environment.systemPackages = [ - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.ntfs3g ]; # root # ---- fileSystems."/" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/root"; - fsType = "ext4"; + device = "/dev/vg/root"; + fsType = "ext4"; }; # boot @@ -59,16 +53,14 @@ #"x-systemd.device-timeout=1ms" ]; }; - systemd.mounts = [ - { - enable = true; - options = "nofail,noauto"; - type = "ext4"; - wantedBy = ["multi-user.target"]; - what = "/dev/disk/by-uuid/162c2f9e-8baa-4433-99fd-bb7e7b69472f"; - where = "/media"; - } - ]; + systemd.mounts = [{ + enable = true; + options = "nofail,noauto"; + type = "ext4"; + wantedBy = [ "multi-user.target" ]; + what = "/dev/disk/by-uuid/162c2f9e-8baa-4433-99fd-bb7e7b69472f"; + where = "/media"; + }]; swapDevices = [ ]; diff --git a/configs/porani/home-assistant.nix b/configs/porani/home-assistant.nix index b466290..9e6bfcd 100644 --- a/configs/porani/home-assistant.nix +++ b/configs/porani/home-assistant.nix @@ -1,6 +1,5 @@ { pkgs, config, lib, ... }: -let - unstablePkgs = import {}; +let unstablePkgs = import { }; in { imports = [ @@ -15,175 +14,167 @@ in { ./home-assistant/zigbee2mqtt.nix ]; - services.homeAssistantConfig = { - # turn on to edit GUI - # lovelace = {}; + # turn on to edit GUI + # lovelace = {}; - homeassistant = { - latitude = 51.444847; - longitude = 6.967006; - elevation = 116; + homeassistant = { + latitude = 51.444847; + longitude = 6.967006; + elevation = 116; + auth_providers = [{ + type = "trusted_networks"; + trusted_networks = + [ config.module.cluster.services.tinc."private".networkSubnet ]; + }]; + }; - auth_providers = [ - { - type = "trusted_networks"; - trusted_networks = [ - config.module.cluster.services.tinc."private".networkSubnet - ]; - } + prometheus.namespace = "hass"; + + automation = [ + + # todo when ich weis ich bin zuhause + #{ + # alias = "Licht and wenn Dunkel"; + # trigger = { + # platform = "state"; + # entity_id = [ "binary_sensor.night" ]; + # from = "off"; + # to = "on"; + # }; + # action = [ + # { + # service = "switch.turn_on"; + # entity_id = "group.kitchen"; + # } + # { + # service = "switch.turn_on"; + # entity_id = "group.living_room"; + # } + # ]; + #} + + #{ + # alias = "Küchen Sensor An"; + # trigger = { + # platform = "state"; + # entity_id = [ "binary_sensor.motion_1" ]; + # to = "on"; + # }; + # action = { + # service = "switch.turn_on"; + # entity_id = "group.kitchen"; + # }; + #} + + #{ + # alias = "Küchen Sensor aus"; + # trigger = { + # platform = "state"; + # entity_id = [ "binary_sensor.motion_1" ]; + # to = "off"; + # for = "00:00:25"; + # }; + # action = { + # service = "switch.turn_off"; + # entity_id = "group.kitchen"; + # }; + #} + ]; + + group = { + bed_room = { + name = "Schlafzimmer"; + view = false; + }; + tv = { + name = "TV"; + view = false; + }; + living_room = { + name = "Wohnzimmer"; + view = false; + }; + kitchen = { + name = "Küche"; + view = false; + }; + today = { + control = "hidden"; + name = "Today"; + view = false; + entities = [ "sensor.weather_temperature" "sun.sun" ]; + }; + all_lights = { + name = "All Lights"; + view = false; + }; + unknown = { + control = "hidden"; + name = "Not Used"; + view = false; + }; + + view_rooms = { + name = "Räume"; + view = true; + entities = [ + "group.all_lights" + "group.bed_room" + "group.living_room" + "group.kitchen" + "group.tv" ]; }; - prometheus.namespace = "hass"; - - automation = [ - - # todo when ich weis ich bin zuhause - #{ - # alias = "Licht and wenn Dunkel"; - # trigger = { - # platform = "state"; - # entity_id = [ "binary_sensor.night" ]; - # from = "off"; - # to = "on"; - # }; - # action = [ - # { - # service = "switch.turn_on"; - # entity_id = "group.kitchen"; - # } - # { - # service = "switch.turn_on"; - # entity_id = "group.living_room"; - # } - # ]; - #} - - #{ - # alias = "Küchen Sensor An"; - # trigger = { - # platform = "state"; - # entity_id = [ "binary_sensor.motion_1" ]; - # to = "on"; - # }; - # action = { - # service = "switch.turn_on"; - # entity_id = "group.kitchen"; - # }; - #} - - #{ - # alias = "Küchen Sensor aus"; - # trigger = { - # platform = "state"; - # entity_id = [ "binary_sensor.motion_1" ]; - # to = "off"; - # for = "00:00:25"; - # }; - # action = { - # service = "switch.turn_off"; - # entity_id = "group.kitchen"; - # }; - #} - ]; - - group = { - bed_room = { - name = "Schlafzimmer"; - view = false; - }; - tv = { - name = "TV"; - view = false; - }; - living_room = { - name = "Wohnzimmer"; - view = false; - }; - kitchen = { - name = "Küche"; - view = false; - }; - today = { - control = "hidden"; - name = "Today"; - view = false; - entities = [ - "sensor.weather_temperature" - "sun.sun" - ]; - }; - all_lights = { - name = "All Lights"; - view = false; - }; - unknown = { - control = "hidden"; - name = "Not Used"; - view = false; - }; - - view_rooms = { - name = "Räume"; - view = true; - entities = [ - "group.all_lights" - "group.bed_room" - "group.living_room" - "group.kitchen" - "group.tv" - ]; - }; - - view_overview = { - name = "Übersicht"; - view = true; - entities = [ "group.today" ]; - }; - + view_overview = { + name = "Übersicht"; + view = true; + entities = [ "group.today" ]; }; - sun = {}; + }; - script.turn_all_off.sequence = [ ]; + sun = { }; - script.turn_all_on.sequence = [ ]; + script.turn_all_off.sequence = [ ]; - sensor = [ - # Weather prediction - { platform = "zamg"; - name = "Weather"; - } - ]; + script.turn_all_on.sequence = [ ]; - # todo: add holidays package to home-assiatnt - binary_sensor = [ - { - name = "before_workday"; - platform = "workday"; - country = "DE"; - province = "NW"; - workdays = [ "mon" "tue" "wed" "thu" "fri" ]; - days_offset = 1; - } - { - name = "workday"; - platform = "workday"; - country = "DE"; - province = "NW"; - workdays = [ "mon" "tue" "wed" "thu" "fri" ]; - } - ]; + sensor = [ + # Weather prediction + { + platform = "zamg"; + name = "Weather"; + } + ]; + + # todo: add holidays package to home-assiatnt + binary_sensor = [ + { + name = "before_workday"; + platform = "workday"; + country = "DE"; + province = "NW"; + workdays = [ "mon" "tue" "wed" "thu" "fri" ]; + days_offset = 1; + } + { + name = "workday"; + platform = "workday"; + country = "DE"; + province = "NW"; + workdays = [ "mon" "tue" "wed" "thu" "fri" ]; + } + ]; }; - services.home-assistant = { enable = true; - package = unstablePkgs.home-assistant.override{ + package = unstablePkgs.home-assistant.override { python3 = unstablePkgs.python36; extraPackages = python: [ # todo : check which is still needed @@ -196,22 +187,20 @@ in { python.paho-mqtt # needed for platform workday - (python.buildPythonPackage rec{ + (python.buildPythonPackage rec { pname = "holidays"; version = "0.9.10"; src = python.fetchPypi { inherit pname version; - sha256 = "9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f"; + sha256 = + "9f06d143eb708e8732230260636938f2f57114e94defd8fa2082408e0d422d6f"; }; doCheck = false; buildInputs = [ pkgs.dateutils ]; - propagatedBuildInputs = [ - python."python-dateutil" - python."six" - ]; + propagatedBuildInputs = [ python."python-dateutil" python."six" ]; meta = with pkgs.stdenv.lib; { homepage = "https://github.com/dr-prodigy/python-holidays"; license = licenses.mit; diff --git a/configs/porani/home-assistant/chaospott.nix b/configs/porani/home-assistant/chaospott.nix index 97ac37f..945d7cd 100644 --- a/configs/porani/home-assistant/chaospott.nix +++ b/configs/porani/home-assistant/chaospott.nix @@ -43,10 +43,7 @@ in { "${name}" = { name = "ChaosPott (Essen)"; control = "hidden"; - entities = [ - "sensor.${name}_aerie" - "sensor.${name}_cellar" - ]; + entities = [ "sensor.${name}_aerie" "sensor.${name}_cellar" ]; }; view_overview.entities = [ "group.${name}" ]; }; @@ -62,14 +59,15 @@ in { Type = "oneshot"; }; description = "set ${name} for homeassistant"; - script = /* sh */ '' - ${pkgs.curl}/bin/curl -Ls https://status.chaospott.de/api \ - | ${pkgs.jq}/bin/jq --compact-output \ - '.sensors.door_locked | - [.[] | { "\(.location)" : (if .value then "closed" else "open" end) }] | - reduce .[] as $item ({}; . + $item) ' \ - >> ${filePath} - ''; + script = # sh + '' + ${pkgs.curl}/bin/curl -Ls https://status.chaospott.de/api \ + | ${pkgs.jq}/bin/jq --compact-output \ + '.sensors.door_locked | + [.[] | { "\(.location)" : (if .value then "closed" else "open" end) }] | + reduce .[] as $item ({}; . + $item) ' \ + >> ${filePath} + ''; }; systemd.timers."${name}" = { @@ -81,5 +79,4 @@ in { }; }; - } diff --git a/configs/porani/home-assistant/dayOfWeek.nix b/configs/porani/home-assistant/dayOfWeek.nix index 88b6af3..0aba0d1 100644 --- a/configs/porani/home-assistant/dayOfWeek.nix +++ b/configs/porani/home-assistant/dayOfWeek.nix @@ -7,13 +7,12 @@ let in { services.homeAssistantConfig = { - sensor = [ - { platform = "file"; - name = "day_of_week"; - file_path = filePath; - value_template = "{{ value_json.dayOfWeek }}"; - } - ]; + sensor = [{ + platform = "file"; + name = "day_of_week"; + file_path = filePath; + value_template = "{{ value_json.dayOfWeek }}"; + }]; homeassistant = { whitelist_external_dirs = [ folderPath ]; @@ -23,11 +22,7 @@ in { }; }; - group = { - overview.entities = [ - "sensor.day_of_week" - ]; - }; + group = { overview.entities = [ "sensor.day_of_week" ]; }; }; @@ -40,9 +35,10 @@ in { Type = "oneshot"; }; description = "set day of wek for homeassistant"; - script = /* sh */ '' - date +'{"dayOfWeek":"%A"}' >> ${filePath} - ''; + script = # sh + '' + date +'{"dayOfWeek":"%A"}' >> ${filePath} + ''; }; systemd.timers.dayOfWeek = { enable = true; @@ -53,5 +49,4 @@ in { }; }; - } diff --git a/configs/porani/home-assistant/holiday.nix b/configs/porani/home-assistant/holiday.nix index 7d2b739..fea17a4 100644 --- a/configs/porani/home-assistant/holiday.nix +++ b/configs/porani/home-assistant/holiday.nix @@ -13,12 +13,14 @@ in { # todo : use the python tool sensor = [ - { platform = "file"; + { + platform = "file"; name = "${name}_date"; file_path = filePath; value_template = "{{ value_json.date }}"; } - { platform = "file"; + { + platform = "file"; name = "${name}_name"; file_path = filePath; value_template = "{{ value_json.name }}"; @@ -45,10 +47,7 @@ in { name = "Feiertage"; view = false; control = "hidden"; - entities = [ - "sensor.${name}_date" - "sensor.${name}_name" - ]; + entities = [ "sensor.${name}_date" "sensor.${name}_name" ]; }; view_overview.entities = [ "group.holidays" ]; @@ -66,18 +65,19 @@ in { Type = "oneshot"; }; description = "set ${name} for homeassistant"; - script = /* sh */ '' - ${pkgs.curl}/bin/curl \ - -Ls "https://feiertage-api.de/api/?jahr=$( date +%Y )&nur_land=${state}" \ - | ${pkgs.jq}/bin/jq --compact-output ' - map_values( .datum ) | - to_entries | - map( { date: .value, name : .key } ) | - sort_by( .date ) | - map(select ( .date >= "'`date +%Y-%m-%d`'" )) | - .[0]' \ - >> ${filePath} - ''; + script = # sh + '' + ${pkgs.curl}/bin/curl \ + -Ls "https://feiertage-api.de/api/?jahr=$( date +%Y )&nur_land=${state}" \ + | ${pkgs.jq}/bin/jq --compact-output ' + map_values( .datum ) | + to_entries | + map( { date: .value, name : .key } ) | + sort_by( .date ) | + map(select ( .date >= "'`date +%Y-%m-%d`'" )) | + .[0]' \ + >> ${filePath} + ''; }; systemd.timers."${name}" = { @@ -89,5 +89,4 @@ in { }; }; - } diff --git a/configs/porani/home-assistant/kodi.nix b/configs/porani/home-assistant/kodi.nix index 3998815..b668ae9 100644 --- a/configs/porani/home-assistant/kodi.nix +++ b/configs/porani/home-assistant/kodi.nix @@ -1,23 +1,19 @@ -{ pkgs, config, lib, ... }: -{ +{ pkgs, config, lib, ... }: { services.homeAssistantConfig = { - group.view_overview.entities = [ - "media_player.kodi" - ]; + group.view_overview.entities = [ "media_player.kodi" ]; - media_player = [ - { - platform = "kodi"; - host = "127.0.0.1"; - turn_on_action.service = "script.watch_tv"; - turn_off_action.service = "script.stop_watch_tv"; - } - ]; + media_player = [{ + platform = "kodi"; + host = "127.0.0.1"; + turn_on_action.service = "script.watch_tv"; + turn_off_action.service = "script.stop_watch_tv"; + }]; shell_command = { - start_display = "sudo ${pkgs.systemd}/bin/systemctl start display-manager"; + start_display = + "sudo ${pkgs.systemd}/bin/systemctl start display-manager"; stop_display = "sudo ${pkgs.systemd}/bin/systemctl stop display-manager"; }; @@ -50,7 +46,7 @@ service = "switch.turn_on"; data.entity_id = "group.tv"; } - { delay.minutes = 1;} + { delay.minutes = 1; } { alias = "start kodi"; service = "shell_command.start_display"; diff --git a/configs/porani/home-assistant/mpd.nix b/configs/porani/home-assistant/mpd.nix index 8400bb8..c7650e8 100644 --- a/configs/porani/home-assistant/mpd.nix +++ b/configs/porani/home-assistant/mpd.nix @@ -3,24 +3,18 @@ { services.homeAssistantConfig = { - group.view_overview.entities = [ - "media_player.mpd" - ]; + group.view_overview.entities = [ "media_player.mpd" ]; - media_player = [ - { - platform = "mpd"; - host = "localhost"; - } - ]; + media_player = [{ + platform = "mpd"; + host = "localhost"; + }]; - script.turn_all_off.sequence = [ - { - alias = "turn mpd off"; - service = "media_player.turn_off"; - data.entity_id = "media_player.mpd"; - } - ]; + script.turn_all_off.sequence = [{ + alias = "turn mpd off"; + service = "media_player.turn_off"; + data.entity_id = "media_player.mpd"; + }]; script.turn_all_on.sequence = [ { diff --git a/configs/porani/home-assistant/sonoff.nix b/configs/porani/home-assistant/sonoff.nix index 38ebba8..3c956f4 100644 --- a/configs/porani/home-assistant/sonoff.nix +++ b/configs/porani/home-assistant/sonoff.nix @@ -1,118 +1,120 @@ { pkgs, config, lib, ... }: -let - unstablePkgs = import {}; +let unstablePkgs = import { }; in { - services.homeAssistantConfig = - let + services.homeAssistantConfig = let - sonoffSwitches = { - "pal01" = { label = "Bett"; icon = "mdi:lightbulb-on"; }; - "pal02" = { label = "Lampe"; icon = "mdi:lightbulb-on"; }; - "pal03" = { label = "Couche"; icon = "mdi:lightbulb-on"; }; - "pal06" = { label = "Küche"; icon = "mdi:lightbulb-on"; }; - "pal05" = { label = "TV"; icon = "mdi:television"; }; - - "pal04" = { label = "Nummer 4"; icon = "mdi:power-plug-off"; }; - "pal07" = { label = "Nummer 7"; icon = "mdi:power-plug-off"; }; - "pal08" = { label = "Nummer 8"; icon = "mdi:power-plug-off"; }; + sonoffSwitches = { + "pal01" = { + label = "Bett"; + icon = "mdi:lightbulb-on"; + }; + "pal02" = { + label = "Lampe"; + icon = "mdi:lightbulb-on"; + }; + "pal03" = { + label = "Couche"; + icon = "mdi:lightbulb-on"; + }; + "pal06" = { + label = "Küche"; + icon = "mdi:lightbulb-on"; + }; + "pal05" = { + label = "TV"; + icon = "mdi:television"; }; - toSwitch = name: "switch.${name}"; - - in { - - homeassistant = { - customize = lib.mapAttrs' ( - entity: value: - { - name = toSwitch entity; - value = { - friendly_name = value.label; - icon = value.icon; - }; - } - ) sonoffSwitches; + "pal04" = { + label = "Nummer 4"; + icon = "mdi:power-plug-off"; }; - - script.turn_all_off.sequence = [ - { - alias = "turn off sonoff"; - service = "switch.turn_off"; - data.entity_id = "group.all_lights"; - } - { - alias = "turn off sonoff"; - service = "switch.turn_off"; - data.entity_id = "group.tv"; - } - ]; - - script.turn_all_on.sequence = [ - { - alias = "turn on all lights"; - service = "switch.turn_on"; - data.entity_id = "group.all_lights"; - } - ]; - - group = { - bed_room = { - entities = builtins.map toSwitch [ "pal01" ]; - }; - living_room = { - entities = builtins.map toSwitch [ "pal03" "pal02" ]; - }; - tv = { - entities = builtins.map toSwitch [ "pal05" ]; - }; - kitchen = { - entities = builtins.map toSwitch [ "pal06" ]; - }; - unknown = { - entities = builtins.map toSwitch [ "pal04" "pal07" "pal08" ]; - }; - all_lights = { - entities = builtins.map toSwitch [ "pal01" "pal02" "pal03" "pal06" ]; - }; + "pal07" = { + label = "Nummer 7"; + icon = "mdi:power-plug-off"; + }; + "pal08" = { + label = "Nummer 8"; + icon = "mdi:power-plug-off"; }; - - switch = - let - sonoffConfigurations = builtins.map (name: - { - name = name; - platform = "mqtt"; - command_topic = "cmnd/${lib.toUpper name}/POWER"; - state_topic = "stat/${lib.toUpper name}/POWER"; - payload_on = "ON"; - payload_off = "OFF"; - state_on = "ON"; - state_off = "OFF"; - }) (builtins.attrNames sonoffSwitches) ; - in - sonoffConfigurations; - - # discover state on init - automation = [ - { - alias = "Sonoff initial Power state"; - trigger = { - platform = "homeassistant"; - event = "start"; - }; - action = builtins.map ( name: - { - service = "mqtt.publish"; - data = { - topic = "cmnd/${lib.toUpper name}/power"; - payload = ""; - }; - }) - (builtins.attrNames sonoffSwitches); - } - ]; }; + toSwitch = name: "switch.${name}"; + + in { + + homeassistant = { + customize = lib.mapAttrs' (entity: value: { + name = toSwitch entity; + value = { + friendly_name = value.label; + icon = value.icon; + }; + }) sonoffSwitches; + }; + + script.turn_all_off.sequence = [ + { + alias = "turn off sonoff"; + service = "switch.turn_off"; + data.entity_id = "group.all_lights"; + } + { + alias = "turn off sonoff"; + service = "switch.turn_off"; + data.entity_id = "group.tv"; + } + ]; + + script.turn_all_on.sequence = [{ + alias = "turn on all lights"; + service = "switch.turn_on"; + data.entity_id = "group.all_lights"; + }]; + + group = { + bed_room = { entities = builtins.map toSwitch [ "pal01" ]; }; + living_room = { entities = builtins.map toSwitch [ "pal03" "pal02" ]; }; + tv = { entities = builtins.map toSwitch [ "pal05" ]; }; + kitchen = { entities = builtins.map toSwitch [ "pal06" ]; }; + unknown = { + entities = builtins.map toSwitch [ "pal04" "pal07" "pal08" ]; + }; + all_lights = { + entities = builtins.map toSwitch [ "pal01" "pal02" "pal03" "pal06" ]; + }; + }; + + switch = let + sonoffConfigurations = builtins.map (name: { + name = name; + platform = "mqtt"; + command_topic = "cmnd/${lib.toUpper name}/POWER"; + state_topic = "stat/${lib.toUpper name}/POWER"; + payload_on = "ON"; + payload_off = "OFF"; + state_on = "ON"; + state_off = "OFF"; + }) (builtins.attrNames sonoffSwitches); + in sonoffConfigurations; + + # discover state on init + automation = [{ + alias = "Sonoff initial Power state"; + trigger = { + platform = "homeassistant"; + event = "start"; + }; + action = builtins.map (name: { + service = "mqtt.publish"; + data = { + topic = "cmnd/${lib.toUpper name}/power"; + payload = ""; + }; + }) (builtins.attrNames sonoffSwitches); + }]; + }; + } diff --git a/configs/porani/home-assistant/timer.nix b/configs/porani/home-assistant/timer.nix index ad9bc07..663a179 100644 --- a/configs/porani/home-assistant/timer.nix +++ b/configs/porani/home-assistant/timer.nix @@ -1,41 +1,35 @@ -{ config, ... }: -{ +{ config, ... }: { imports = [ ./mpd.nix ]; services.homeAssistantConfig = { - sensor = [ - { - platform = "time_date"; - display_options = [ - "time" - "date" - ]; - } - ]; + sensor = [{ + platform = "time_date"; + display_options = [ "time" "date" ]; + }]; input_datetime = { wakeup = { - name = "Arbeitswecker"; + name = "Arbeitswecker"; has_time = true; has_date = false; icon = "mdi:alarm"; }; leave = { - name = "Turn off Time"; + name = "Turn off Time"; has_time = true; has_date = false; icon = "mdi:alarm"; }; return = { - name = "Return home"; + name = "Return home"; has_time = true; has_date = false; icon = "mdi:alarm"; }; sleep = { - name = "Turn off Time"; + name = "Turn off Time"; has_time = true; has_date = false; icon = "mdi:alarm"; @@ -63,7 +57,7 @@ input_select = { wakeup = { - name = "Playlist"; + name = "Playlist"; icon = "mdi:library-music"; options = [ "wakeup" "wakeup1" "wakeup2" ]; }; @@ -72,13 +66,13 @@ binary_sensor = [ { platform = "tod"; - name = "night"; + name = "night"; after = "sunset"; before = "sunrise"; } { platform = "tod"; - name = "daytime"; + name = "daytime"; after = "sunrise"; before = "sunset"; } @@ -101,30 +95,21 @@ view = false; name = "Leave Time"; control = "hidden"; - entities = [ - "input_boolean.leave" - "input_datetime.leave" - ]; + entities = [ "input_boolean.leave" "input_datetime.leave" ]; }; timer_return = { view = false; name = "Nach Hause kommen"; control = "hidden"; - entities = [ - "input_boolean.return" - "input_datetime.return" - ]; + entities = [ "input_boolean.return" "input_datetime.return" ]; }; timer_sleep = { view = false; name = "Einschlafen"; control = "hidden"; - entities = [ - "input_boolean.sleep" - "input_datetime.sleep" - ]; + entities = [ "input_boolean.sleep" "input_datetime.sleep" ]; }; timers.entities = [ @@ -136,10 +121,7 @@ "binary_sensor.daytime" ]; - today.entities = [ - "sensor.date" - "sensor.time" - ]; + today.entities = [ "sensor.date" "sensor.time" ]; view_overview.entities = [ "group.timer_wakeup" @@ -199,21 +181,17 @@ }; condition = { condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "input_boolean.leave"; - state = "on"; - } - ]; + conditions = [{ + condition = "state"; + entity_id = "input_boolean.leave"; + state = "on"; + }]; }; - action = [ - { - alias = "turn all off"; - service = "script.turn_on"; - entity_id = "script.turn_all_off"; - } - ]; + action = [{ + alias = "turn all off"; + service = "script.turn_on"; + entity_id = "script.turn_all_off"; + }]; } { @@ -225,21 +203,17 @@ }; condition = { condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "input_boolean.return"; - state = "on"; - } - ]; + conditions = [{ + condition = "state"; + entity_id = "input_boolean.return"; + state = "on"; + }]; }; - action = [ - { - alias = "turn all on"; - service = "script.turn_on"; - entity_id = "script.turn_all_on"; - } - ]; + action = [{ + alias = "turn all on"; + service = "script.turn_on"; + entity_id = "script.turn_all_on"; + }]; } { @@ -251,21 +225,17 @@ }; condition = { condition = "and"; - conditions = [ - { - condition = "state"; - entity_id = "input_boolean.sleep"; - state = "on"; - } - ]; + conditions = [{ + condition = "state"; + entity_id = "input_boolean.sleep"; + state = "on"; + }]; }; - action = [ - { - alias = "turn all off"; - service = "script.turn_on"; - entity_id = "script.turn_all_off"; - } - ]; + action = [{ + alias = "turn all off"; + service = "script.turn_on"; + entity_id = "script.turn_all_off"; + }]; } ]; diff --git a/configs/porani/home-assistant/zigbee2mqtt.nix b/configs/porani/home-assistant/zigbee2mqtt.nix index fdc6006..03b100d 100644 --- a/configs/porani/home-assistant/zigbee2mqtt.nix +++ b/configs/porani/home-assistant/zigbee2mqtt.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config , ... }: +{ pkgs, lib, config, ... }: let # allow new devices to join @@ -17,9 +17,7 @@ let "temperature_sensor_1".id = "0x00158d0002d79220"; "temperature_sensor_2".id = "0x00158d0002d7913d"; }; - motion = { - "motion_sensor_1".id = "0x00158d0002fbd451"; - }; + motion = { "motion_sensor_1".id = "0x00158d0002fbd451"; }; }; # todo : rename with allSensors @@ -41,7 +39,7 @@ let # MQTT server URL server = "mqtt://127.0.0.1:1883"; # MQTT server authentication, uncomment if required: - user = "zigbee"; + user = "zigbee"; password = lib.fileContents ; }; @@ -52,21 +50,19 @@ let disable_led = true; }; - devices = lib.mapAttrs' ( - name: { id , ... }: - { + devices = lib.mapAttrs' (name: + { id, ... }: { name = id; value = { retain = false; friendly_name = name; }; - } - ) allSensors; + }) allSensors; }; - configurationYaml = pkgs.writeText "configuration.yml" (builtins.toJSON zigBee2MqttConfig); -in -{ + configurationYaml = + pkgs.writeText "configuration.yml" (builtins.toJSON zigBee2MqttConfig); +in { imports = [ ./mqtt.nix ]; services.homeAssistantConfig = { @@ -74,55 +70,51 @@ in # group.unknown.entities = [ "sensor.button_1" ]; sensor = let - buttons = with lib; mapAttrsToList ( - name: {...}: - { - platform = "mqtt"; - name = name; - icon = "mdi:toggle-switch"; - state_topic = "zigbee2mqtt/${name}"; - availability_topic = "zigbee2mqtt/bridge/state"; - value_template = "{{ value_json.click }}"; - } - ) sensors.buttons; - - - temperature = with lib; mapAttrsToList ( - name: {...}: - [ - { + buttons = with lib; + mapAttrsToList (name: + { ... }: { platform = "mqtt"; name = name; + icon = "mdi:toggle-switch"; state_topic = "zigbee2mqtt/${name}"; availability_topic = "zigbee2mqtt/bridge/state"; - unit_of_measurement = "°C"; - device_class = "temperature"; - value_template = "{{ value_json.temperature }}"; - } - { - platform = "mqtt"; - name = "humidity_${name}"; - state_topic = "zigbee2mqtt/${name}"; - availability_topic = "zigbee2mqtt/bridge/state"; - unit_of_measurement = "%"; - device_class = "humidity"; - value_template = "{{ value_json.humidity }}"; - } - { - platform = "mqtt"; - name = "pressure_${name}"; - state_topic = "zigbee2mqtt/${name}"; - availability_topic = "zigbee2mqtt/bridge/state"; - unit_of_measurement = "hPa"; - device_class = "pressure"; - value_template = "{{ value_json.pressure }}"; - } - ] - ) sensors.temperature; + value_template = "{{ value_json.click }}"; + }) sensors.buttons; - informations = lib.mapAttrsToList ( - name: {...}: - [ + temperature = with lib; + mapAttrsToList (name: + { ... }: [ + { + platform = "mqtt"; + name = name; + state_topic = "zigbee2mqtt/${name}"; + availability_topic = "zigbee2mqtt/bridge/state"; + unit_of_measurement = "°C"; + device_class = "temperature"; + value_template = "{{ value_json.temperature }}"; + } + { + platform = "mqtt"; + name = "humidity_${name}"; + state_topic = "zigbee2mqtt/${name}"; + availability_topic = "zigbee2mqtt/bridge/state"; + unit_of_measurement = "%"; + device_class = "humidity"; + value_template = "{{ value_json.humidity }}"; + } + { + platform = "mqtt"; + name = "pressure_${name}"; + state_topic = "zigbee2mqtt/${name}"; + availability_topic = "zigbee2mqtt/bridge/state"; + unit_of_measurement = "hPa"; + device_class = "pressure"; + value_template = "{{ value_json.pressure }}"; + } + ]) sensors.temperature; + + informations = lib.mapAttrsToList (name: + { ... }: [ { platform = "mqtt"; name = "battery_${name}"; @@ -140,17 +132,14 @@ in unit_of_measurement = "-"; value_template = "{{ value_json.linkquality }}"; } - ] - ) allSensors; + ]) allSensors; - in - lib.flatten ( buttons ++ temperature ++ informations ); + in lib.flatten (buttons ++ temperature ++ informations); binary_sensor = let - motion = lib.mapAttrsToList ( - name: { ... }: - { + motion = lib.mapAttrsToList (name: + { ... }: { name = name; platform = "mqtt"; device_class = "motion"; @@ -160,31 +149,24 @@ in payload_on = true; payload_off = false; value_template = "{{ value_json.occupancy }}"; - } - ) sensors.motion; - in - lib.flatten ( motion ); - - + }) sensors.motion; + in lib.flatten (motion); group = let information = name: [ "sensor.battery_${name}" "sensor.link_${name}" ]; - sensor = lib.mapAttrs' ( - name: {...}: - { + sensor = lib.mapAttrs' (name: + { ... }: { name = name; value = { control = "hidden"; - entities = ["sensor.${name}"] ++ (information name); + entities = [ "sensor.${name}" ] ++ (information name); }; - } - ) (sensors.buttons); + }) (sensors.buttons); - sensorTemperature = lib.mapAttrs' ( - name: { ... }: - { + sensorTemperature = lib.mapAttrs' (name: + { ... }: { name = name; value = { control = "hidden"; @@ -194,69 +176,62 @@ in "sensor.pressure_${name}" ] ++ (information name); }; - } - ) (sensors.temperature); + }) (sensors.temperature); - binarySensor = lib.mapAttrs' ( - name: { ... }: - { + binarySensor = lib.mapAttrs' (name: + { ... }: { name = name; value = { control = "hidden"; entities = [ "binary_sensor.${name}" ] ++ (information name); }; - } - ) (sensors.motion); + }) (sensors.motion); views = { view_sensors = { name = "Sensoren"; control = "hidden"; view = true; - entities = lib.mapAttrsToList (name: { ... }: "group.${name}") allSensors; + entities = + lib.mapAttrsToList (name: { ... }: "group.${name}") allSensors; }; }; - in - views // sensor // binarySensor // sensorTemperature ; + in views // sensor // binarySensor // sensorTemperature; - automation = - let - lights = map (button: - { - alias = "Toggle all lights, on click"; - trigger = { - platform = "mqtt"; - topic = "zigbee2mqtt/${button}"; - }; - condition = { - condition = "template"; - value_template = ''{{ "single" == trigger.payload_json.click }}''; - }; - action = { - service = "switch.toggle"; - entity_id = "group.all_lights"; - }; - }) ["button_1" "button_2" "button_3"]; - mpd = map (button: - { - alias = "Toggle mpd, on double click"; - trigger = { - platform = "mqtt"; - topic = "zigbee2mqtt/${button}"; - }; - condition = { - condition = "template"; - value_template = ''{{ "double" == trigger.payload_json.click }}''; - }; - action = { - service = "media_player.toggle"; - # todo use a group here - entity_id = "media_player.mpd"; - }; - }) ["button_1" "button_2" "button_3"]; - in - lights ++ mpd; + automation = let + lights = map (button: { + alias = "Toggle all lights, on click"; + trigger = { + platform = "mqtt"; + topic = "zigbee2mqtt/${button}"; + }; + condition = { + condition = "template"; + value_template = ''{{ "single" == trigger.payload_json.click }}''; + }; + action = { + service = "switch.toggle"; + entity_id = "group.all_lights"; + }; + }) [ "button_1" "button_2" "button_3" ]; + mpd = map (button: { + alias = "Toggle mpd, on double click"; + trigger = { + platform = "mqtt"; + topic = "zigbee2mqtt/${button}"; + }; + condition = { + condition = "template"; + value_template = ''{{ "double" == trigger.payload_json.click }}''; + }; + action = { + service = "media_player.toggle"; + # todo use a group here + entity_id = "media_player.mpd"; + }; + }) [ "button_1" "button_2" "button_3" ]; + in lights ++ mpd; # click = double => music an aus @@ -270,19 +245,20 @@ in systemd.services."zigbee2mqtt" = { enable = true; - description = "Allows you to use your Zigbee devices without the vendors bridge/gateway."; + description = + "Allows you to use your Zigbee devices without the vendors bridge/gateway."; after = [ "docker.service" ]; requires = [ "docker.service" ]; # todo : udev rule erstellen, die diesen service erst startet, dieses wanted by ist labil wantedBy = [ "home-assistant.service" ]; preStart = '' - if [ -f ${dataFolder}/configuration.yaml ] - then - rm ${dataFolder}/configuration.yaml - fi - mkdir -p ${dataFolder} - cat ${configurationYaml} | ${pkgs.yq}/bin/yq --yaml-output '.' > ${dataFolder}/configuration.yaml + if [ -f ${dataFolder}/configuration.yaml ] + then + rm ${dataFolder}/configuration.yaml + fi + mkdir -p ${dataFolder} + cat ${configurationYaml} | ${pkgs.yq}/bin/yq --yaml-output '.' > ${dataFolder}/configuration.yaml ''; restartTriggers = [ configurationYaml ]; @@ -300,5 +276,4 @@ in ''; }; - } diff --git a/configs/porani/kodi.nix b/configs/porani/kodi.nix index e31aa08..82fec19 100644 --- a/configs/porani/kodi.nix +++ b/configs/porani/kodi.nix @@ -1,6 +1,4 @@ -{ config, lib, pkgs, ... }: -{ - +{ config, lib, pkgs, ... }: { services.xserver = { enable = true; @@ -10,7 +8,7 @@ default = "kodi"; xterm.enable = false; }; - displayManager ={ + displayManager = { sddm = { enable = true; autoLogin = { @@ -24,7 +22,7 @@ users = { # mutableUsers = true; - users.kodi= { + users.kodi = { isNormalUser = true; name = "kodi"; uid = 1338; diff --git a/configs/porani/mpd.nix b/configs/porani/mpd.nix index 2f1b861..b4dbd90 100644 --- a/configs/porani/mpd.nix +++ b/configs/porani/mpd.nix @@ -1,5 +1,4 @@ -{ config, lib, ... }: -{ +{ config, lib, ... }: { sound.enable = true; diff --git a/configs/porani/packages.nix b/configs/porani/packages.nix index 4456ca7..83d55c6 100644 --- a/configs/porani/packages.nix +++ b/configs/porani/packages.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { - environment.systemPackages = [ - ]; + environment.systemPackages = [ ]; } diff --git a/configs/porani/syncthing.nix b/configs/porani/syncthing.nix index 88c55a8..0e72eff 100644 --- a/configs/porani/syncthing.nix +++ b/configs/porani/syncthing.nix @@ -1,11 +1,11 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { custom.samba-share = { enable = true; folders = { movies = config.test.services.syncthing.declarative.folders.movies.path; series = config.test.services.syncthing.declarative.folders.series.path; - music = config.test.services.syncthing.declarative.folders.music-library.path; + music = + config.test.services.syncthing.declarative.folders.music-library.path; }; }; @@ -58,7 +58,7 @@ enable = true; path = "/media/series"; }; - smartphone-music= { + smartphone-music = { enable = true; path = "/media/smartphone-music"; }; @@ -82,7 +82,7 @@ users.groups."syncthing".members = [ "mpd" "syncthing" "kodi" "palo" ]; - backup.all.restic.dirs = ["/var/lib/syncthing/finance"]; + backup.all.restic.dirs = [ "/var/lib/syncthing/finance" ]; } diff --git a/configs/porani/tinc.nix b/configs/porani/tinc.nix index 6c15e0b..5029f6f 100644 --- a/configs/porani/tinc.nix +++ b/configs/porani/tinc.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { module.cluster.services.tinc = { "private" = { diff --git a/configs/porani/wifi-access-point.nix b/configs/porani/wifi-access-point.nix index 6b17801..1c62102 100644 --- a/configs/porani/wifi-access-point.nix +++ b/configs/porani/wifi-access-point.nix @@ -1,23 +1,23 @@ -{lib, pkgs, ... }: +{ lib, pkgs, ... }: let wifi = "wlp0s29u1u2"; ipAddress = "10.23.45.1"; prefixLength = 24; servedAddressRange = "10.23.45.2,10.23.45.150,12h"; - ssid="palosiot"; - wifiPassword=lib.fileContents ; -in + ssid = "palosiot"; + wifiPassword = lib.fileContents ; -{ +in { # todo only open needed ports networking.firewall.trustedInterfaces = [ wifi ]; networking.networkmanager.unmanaged = [ wifi ]; networking.dhcpcd.denyInterfaces = [ wifi ]; - networking.interfaces."${wifi}".ipv4.addresses = [ { - address = ipAddress; prefixLength = prefixLength; + networking.interfaces."${wifi}".ipv4.addresses = [{ + address = ipAddress; + prefixLength = prefixLength; }]; systemd.services.hostapd = { @@ -25,25 +25,33 @@ in path = [ pkgs.hostapd ]; wantedBy = [ "network.target" ]; - after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ]; + after = [ + "${wifi}-cfg.service" + "nat.service" + "bind.service" + "dhcpd.service" + "sys-subsystem-net-devices-${wifi}.device" + ]; serviceConfig = { - ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" '' - interface=${wifi} - hw_mode=g - channel=10 - ieee80211d=1 - country_code=DE - ieee80211n=1 - wmm_enabled=1 + ExecStart = "${pkgs.hostapd}/bin/hostapd ${ + pkgs.writeText "hostapd.conf" '' + interface=${wifi} + hw_mode=g + channel=10 + ieee80211d=1 + country_code=DE + ieee80211n=1 + wmm_enabled=1 - ssid=${ssid} - auth_algs=1 - wpa=2 - wpa_key_mgmt=WPA-PSK - rsn_pairwise=CCMP - wpa_passphrase=${wifiPassword} - ''}"; + ssid=${ssid} + auth_algs=1 + wpa=2 + wpa_key_mgmt=WPA-PSK + rsn_pairwise=CCMP + wpa_passphrase=${wifiPassword} + '' + }"; Restart = "always"; }; }; diff --git a/configs/sputnik/configuration.nix b/configs/sputnik/configuration.nix index 32842f0..ae7fd56 100644 --- a/configs/sputnik/configuration.nix +++ b/configs/sputnik/configuration.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { imports = [ @@ -12,14 +11,14 @@ ]; - networking.hostName = "sputnik"; + networking.hostName = "sputnik"; networking.useDHCP = true; boot.kernelParams = [ "net.ifnames=0" ]; boot.loader.grub = { - enable = true; + enable = true; version = 2; - device = "/dev/sda"; + device = "/dev/sda"; }; # nix-shell -p speedtest_cli --run speedtest @@ -31,7 +30,8 @@ balance = false; }; - services.custom.ssh.sshd.rootKeyFiles = [ (toString ) ]; + services.custom.ssh.sshd.rootKeyFiles = + [ (toString ) ]; # make sure ssh is only available trough the tinc networking.firewall.extraCommands = '' @@ -40,4 +40,3 @@ } - diff --git a/configs/sputnik/hardware-configuration.nix b/configs/sputnik/hardware-configuration.nix index 1ce8aaa..99cbfb2 100644 --- a/configs/sputnik/hardware-configuration.nix +++ b/configs/sputnik/hardware-configuration.nix @@ -4,18 +4,17 @@ { config, lib, pkgs, ... }: { - imports = - [ - ]; + imports = [ ]; - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = + [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/8f2986a3-d2b0-4735-be98-9ec081b87984"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/8f2986a3-d2b0-4735-be98-9ec081b87984"; + fsType = "ext4"; + }; swapDevices = [ ]; diff --git a/configs/sputnik/mail-server.nix b/configs/sputnik/mail-server.nix index c67a2d7..5d1d220 100644 --- a/configs/sputnik/mail-server.nix +++ b/configs/sputnik/mail-server.nix @@ -1,8 +1,8 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { imports = [ (builtins.fetchTarball { - url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz"; + url = + "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz"; sha256 = "03d49v8qnid9g9rha0wg2z6vic06mhp0b049s3whccn1axvs2zzx"; }) ]; @@ -16,22 +16,21 @@ # nix-shell -p mkpasswd --run 'mkpasswd -m sha-512 "super secret password"' loginAccounts = { "root@gaykraft.com" = { - hashedPassword = lib.fileContents ; + hashedPassword = lib.fileContents + ; #aliases = [ # "postmaster@gaykraft.com" #]; # Make this user the catchAll address for domains - catchAll = [ - "gaykraft.com" - ]; + catchAll = [ "gaykraft.com" ]; }; }; # Extra virtual aliases. These are email addresses that are forwarded to # loginAccounts addresses. #extraVirtualAliases = { - # address = forward address; - #"abuse@example.com" = "user1@example.com"; + # address = forward address; + #"abuse@example.com" = "user1@example.com"; #}; # Use Let's Encrypt certificates. Note that this needs to set up a stripped diff --git a/configs/sputnik/nginx.nix b/configs/sputnik/nginx.nix index 55544cf..28ec936 100644 --- a/configs/sputnik/nginx.nix +++ b/configs/sputnik/nginx.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { networking.firewall.allowedTCPPorts = [ 80 443 ]; @@ -9,26 +8,38 @@ "git.ingolf-wagner.de" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; - locations."/" = { - proxyPass = "http://workhorse.private:3000"; - }; + locations."/" = { proxyPass = "http://workhorse.private:3000"; }; }; "paste.ingolf-wagner.de" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; - locations."/" = { - proxyPass = "http://workhorse.private:8000"; - }; + locations."/" = { proxyPass = "http://workhorse.private:8000"; }; }; #"landing.ingolf-wagner.de" = { @@ -46,10 +57,18 @@ "tech.ingolf-wagner.de" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; locations."/" = { root = "/srv/www/tech"; @@ -63,10 +82,18 @@ "terranix.org" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; locations."/" = { root = "/srv/www/terranix"; @@ -78,13 +105,20 @@ }; }; - "seafile.gaykraft.com" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; locations."/" = { proxyPass = "http://workhorse.private:3030"; @@ -105,14 +139,20 @@ "gaykraft.com" = { listen = [ - { addr = "0.0.0.0"; port = 4443; ssl = true; } - { addr = "0.0.0.0"; port = 80; ssl = false; } + { + addr = "0.0.0.0"; + port = 4443; + ssl = true; + } + { + addr = "0.0.0.0"; + port = 80; + ssl = false; + } ]; - forceSSL = true; + forceSSL = true; enableACME = true; - locations."/" = { - root = "/srv/www/gaykraft"; - }; + locations."/" = { root = "/srv/www/gaykraft"; }; }; }; @@ -124,14 +164,15 @@ port = 443; verbose = false; transparent = true; - appendConfig = /* json */ '' - protocols: - ( - { name: "ssh"; service: "ssh"; host: "localhost"; port: "2222"; probe: "builtin"; }, - { name: "ssl"; host: "localhost"; port: "4443"; probe: "builtin"; }, - { name: "tinc"; host: "localhost"; port: "655"; probe: "builtin"; } - ); - ''; + appendConfig = # json + '' + protocols: + ( + { name: "ssh"; service: "ssh"; host: "localhost"; port: "2222"; probe: "builtin"; }, + { name: "ssl"; host: "localhost"; port: "4443"; probe: "builtin"; }, + { name: "tinc"; host: "localhost"; port: "655"; probe: "builtin"; } + ); + ''; }; systemd.services."socat-proxy" = { diff --git a/configs/sputnik/tinc.nix b/configs/sputnik/tinc.nix index 14b49e5..234bf22 100644 --- a/configs/sputnik/tinc.nix +++ b/configs/sputnik/tinc.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { module.cluster.services.tinc = { "private" = { enable = true; diff --git a/configs/sterni/configuration.nix b/configs/sterni/configuration.nix index 5939ea9..132d2c1 100644 --- a/configs/sterni/configuration.nix +++ b/configs/sterni/configuration.nix @@ -1,6 +1,4 @@ -{ config, pkgs, lib, ... }: -{ - +{ config, pkgs, lib, ... }: { imports = [ @@ -15,13 +13,13 @@ ]; - networking.hostName = "sterni"; + networking.hostName = "sterni"; - system.custom.wifi.interfaces = ["wlp3s0"]; + system.custom.wifi.interfaces = [ "wlp3s0" ]; security.wrappers = { - pmount.source = "${pkgs.pmount}/bin/pmount"; - pumount.source = "${pkgs.pmount}/bin/pumount"; + pmount.source = "${pkgs.pmount}/bin/pmount"; + pumount.source = "${pkgs.pmount}/bin/pumount"; }; # keybase @@ -35,16 +33,16 @@ # fonts # ----- - programs.custom.urxvt.fontSize = 12; - programs.custom.xterm.fontSize = 12; + programs.custom.urxvt.fontSize = 12; + programs.custom.xterm.fontSize = 12; system.custom.fonts.dpi = 100; virtualisation = { docker.enable = false; virtualbox = { - host.enable = false; - guest.x11 = false; + host.enable = false; + guest.x11 = false; guest.enable = false; }; }; @@ -71,4 +69,3 @@ } - diff --git a/configs/sterni/hardware-configuration.nix b/configs/sterni/hardware-configuration.nix index f4d4058..e9be582 100644 --- a/configs/sterni/hardware-configuration.nix +++ b/configs/sterni/hardware-configuration.nix @@ -5,11 +5,10 @@ { - imports = - [ - ]; + imports = [ ]; - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = + [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; @@ -34,8 +33,8 @@ #device = "/dev/ram2"; #fsType = "tmpfs"; options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/browser"; - fsType = "ext4"; + device = "/dev/vg/browser"; + fsType = "ext4"; }; nix.maxJobs = lib.mkDefault 4; @@ -43,34 +42,30 @@ # lvm volume group # ---------------- - boot.initrd.luks.devices = [ - { - name = "vg"; - device = "/dev/sda2"; - preLVM = true; - } - ]; + boot.initrd.luks.devices = [{ + name = "vg"; + device = "/dev/sda2"; + preLVM = true; + }]; # NTFS support # ------------ - environment.systemPackages = [ - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.ntfs3g ]; # root # ---- fileSystems."/" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/root"; - fsType = "ext4"; + device = "/dev/vg/root"; + fsType = "ext4"; }; # home # ---- fileSystems."/home" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/home"; - fsType = "ext4"; + device = "/dev/vg/home"; + fsType = "ext4"; }; # /home/palo/private/.fotos.ct @@ -88,5 +83,4 @@ fsType = "vfat"; }; - } diff --git a/configs/sterni/packages.nix b/configs/sterni/packages.nix index 9413d66..c14c950 100644 --- a/configs/sterni/packages.nix +++ b/configs/sterni/packages.nix @@ -1,9 +1,5 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs ; [ - bitwig-studio - sononym - ]; + environment.systemPackages = with pkgs; [ bitwig-studio sononym ]; } diff --git a/configs/sterni/syncthing.nix b/configs/sterni/syncthing.nix index 02ef647..fbed27a 100644 --- a/configs/sterni/syncthing.nix +++ b/configs/sterni/syncthing.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { test.services.syncthing = { enable = true; @@ -43,7 +42,7 @@ enable = true; path = "/home/palo/smartphone-fotos"; }; - smartphone-music= { + smartphone-music = { enable = true; path = "/home/palo/smartphone-music"; }; diff --git a/configs/sterni/wifi-access-point.nix b/configs/sterni/wifi-access-point.nix index 4c309cb..db5f81f 100644 --- a/configs/sterni/wifi-access-point.nix +++ b/configs/sterni/wifi-access-point.nix @@ -1,22 +1,21 @@ -{lib, pkgs, ... }: +{ lib, pkgs, ... }: let wifi = "wlp0s29u1u2"; ipAddress = "10.123.145.1"; prefixLength = 24; servedAddressRange = "10.123.145.2,10.123.145.150,12h"; - ssid="bumbumbum"; - wifiPassword=lib.fileContents ; -in + ssid = "bumbumbum"; + wifiPassword = lib.fileContents ; -{ +in { # todo only open needed ports networking.firewall.trustedInterfaces = [ wifi ]; networking.networkmanager.unmanaged = [ wifi ]; networking.dhcpcd.denyInterfaces = [ wifi ]; - networking.interfaces."${wifi}".ipv4.addresses = [ { + networking.interfaces."${wifi}".ipv4.addresses = [{ address = ipAddress; prefixLength = prefixLength; }]; @@ -35,25 +34,33 @@ in # start manual # wantedBy = [ "network.target" ]; - after = [ "${wifi}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${wifi}.device" ]; + after = [ + "${wifi}-cfg.service" + "nat.service" + "bind.service" + "dhcpd.service" + "sys-subsystem-net-devices-${wifi}.device" + ]; serviceConfig = { - ExecStart = "${pkgs.hostapd}/bin/hostapd ${pkgs.writeText "hostapd.conf" '' - interface=${wifi} - hw_mode=g - channel=10 - ieee80211d=1 - country_code=DE - ieee80211n=1 - wmm_enabled=1 + ExecStart = "${pkgs.hostapd}/bin/hostapd ${ + pkgs.writeText "hostapd.conf" '' + interface=${wifi} + hw_mode=g + channel=10 + ieee80211d=1 + country_code=DE + ieee80211n=1 + wmm_enabled=1 - ssid=${ssid} - auth_algs=1 - wpa=2 - wpa_key_mgmt=WPA-PSK - rsn_pairwise=CCMP - wpa_passphrase=${wifiPassword} - ''}"; + ssid=${ssid} + auth_algs=1 + wpa=2 + wpa_key_mgmt=WPA-PSK + rsn_pairwise=CCMP + wpa_passphrase=${wifiPassword} + '' + }"; Restart = "always"; }; }; diff --git a/configs/workhorse/bepasty.nix b/configs/workhorse/bepasty.nix index f544e03..e63dbc3 100644 --- a/configs/workhorse/bepasty.nix +++ b/configs/workhorse/bepasty.nix @@ -1,8 +1,7 @@ { config, pkgs, lib, ... }: with lib; -let - port = 8000; +let port = 8000; in { # configure nginx @@ -18,7 +17,9 @@ in { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 90; - proxy_redirect http://localhost:${toString port} https://paste.workhorse.private/; + proxy_redirect http://localhost:${ + toString port + } https://paste.workhorse.private/; ''; }; }; @@ -38,19 +39,20 @@ in { secretKeyFile = config.krops.userKeys."bepasty".target; extraConfig = '' PERMISSIONS = { - '${lib.fileContents }': 'admin,list,create,read,delete', + '${ + lib.fileContents + }': 'admin,list,create,read,delete', } ''; }; }; - /* fix bepasty service */ + # fix bepasty service nixpkgs.overlays = let - overlay = self: super: - { - bepasty = super.bepasty.override { python3Packages = pkgs.python27Packages; }; + overlay = self: super: { + bepasty = + super.bepasty.override { python3Packages = pkgs.python27Packages; }; }; - in - [ overlay ]; + in [ overlay ]; } diff --git a/configs/workhorse/configuration.nix b/configs/workhorse/configuration.nix index b89b0c9..07d3059 100644 --- a/configs/workhorse/configuration.nix +++ b/configs/workhorse/configuration.nix @@ -1,5 +1,4 @@ -{ lib, config, pkgs, ... }: -{ +{ lib, config, pkgs, ... }: { imports = [ @@ -29,7 +28,7 @@ ]; - networking.hostName = "workhorse"; + networking.hostName = "workhorse"; # enable initrd ssh configuration.init-ssh = { @@ -48,8 +47,8 @@ }; security.wrappers = { - pmount.source = "${pkgs.pmount}/bin/pmount"; - pumount.source = "${pkgs.pmount}/bin/pumount"; + pmount.source = "${pkgs.pmount}/bin/pmount"; + pumount.source = "${pkgs.pmount}/bin/pumount"; }; services.logind.lidSwitch = lib.mkForce "ignore"; @@ -59,8 +58,8 @@ # font # ---- - programs.custom.urxvt.fontSize = 17; - programs.custom.xterm.fontSize = 17; + programs.custom.urxvt.fontSize = 17; + programs.custom.xterm.fontSize = 17; system.custom.fonts.dpi = 140; services.printing.enable = true; @@ -69,8 +68,8 @@ virtualisation = { docker.enable = true; virtualbox = { - host.enable = true; - guest.x11 = true; + host.enable = true; + guest.x11 = true; guest.enable = true; }; }; diff --git a/configs/workhorse/gogs.nix b/configs/workhorse/gogs.nix index 1790a66..85cca58 100644 --- a/configs/workhorse/gogs.nix +++ b/configs/workhorse/gogs.nix @@ -1,14 +1,15 @@ -{ config, lib, ... }: -{ +{ config, lib, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "gogs.${config.networking.hostName}.private" = { - serverAliases = ["git.${config.networking.hostName}.private"]; + serverAliases = [ "git.${config.networking.hostName}.private" ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.services.gogs.httpPort}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.services.gogs.httpPort + }"; }; }; }; @@ -31,7 +32,7 @@ SSH_PORT = 443 START_SSH_SERVER = true SSH_LISTEN_PORT = 2222 - ''; + ''; }; backup.all.restic.dirs = [ config.services.gogs.repositoryRoot ]; diff --git a/configs/workhorse/grafana.nix b/configs/workhorse/grafana.nix index 22ed645..c9c6390 100644 --- a/configs/workhorse/grafana.nix +++ b/configs/workhorse/grafana.nix @@ -1,13 +1,14 @@ -{ config, ... }: -{ +{ config, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "grafana.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.services.grafana.port}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.services.grafana.port + }"; }; }; }; @@ -16,7 +17,8 @@ services.grafana = { enable = true; port = 5656; - addr = config.module.cluster.services.tinc."private".hosts."${config.networking.hostName}".tincIp; + addr = + config.module.cluster.services.tinc."private".hosts."${config.networking.hostName}".tincIp; auth.anonymous = { enable = true; org_role = "Editor"; @@ -24,14 +26,12 @@ }; provision = { enable = true; - datasources = [ - { - type = "prometheus"; - isDefault = true; - name = "Prometheus Workhorse"; - url = "http://workhorse.private:9090"; - } - ]; + datasources = [{ + type = "prometheus"; + isDefault = true; + name = "Prometheus Workhorse"; + url = "http://workhorse.private:9090"; + }]; }; }; diff --git a/configs/workhorse/graylog.nix b/configs/workhorse/graylog.nix index 3c9faf5..63e5134 100644 --- a/configs/workhorse/graylog.nix +++ b/configs/workhorse/graylog.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: -let - port = 9000; -in -{ +let port = 9000; +in { # configure nginx services.nginx = { enable = true; @@ -16,7 +14,9 @@ in proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 90; - proxy_redirect http://localhost:${toString port} https://graylog.workhorse.private/; + proxy_redirect http://localhost:${ + toString port + } https://graylog.workhorse.private/; ''; }; }; @@ -27,7 +27,8 @@ in services.mongodb.enable = true; services.graylog.enable = true; - services.graylog.elasticsearchHosts = [ "http://${config.services.elasticsearch.listenAddress}:9200" ]; + services.graylog.elasticsearchHosts = + [ "http://${config.services.elasticsearch.listenAddress}:9200" ]; # https://docs.graylog.org/en/3.0/pages/configuration/server.conf.html services.graylog.extraConfig = '' @@ -39,10 +40,12 @@ in services.graylog.nodeIdFile = "/var/lib/graylog/node-id"; # pwgen -N 1 -s 96 - services.graylog.passwordSecret = lib.fileContents ; + services.graylog.passwordSecret = + lib.fileContents ; # echo -n yourpassword | shasum -a 256 - services.graylog.rootPasswordSha2 = lib.fileContents ; + services.graylog.rootPasswordSha2 = + lib.fileContents ; environment.etc."graylog/server/GeoLite2-City.mmdb" = { enable = true; diff --git a/configs/workhorse/hardware-configuration.nix b/configs/workhorse/hardware-configuration.nix index c968587..666be45 100644 --- a/configs/workhorse/hardware-configuration.nix +++ b/configs/workhorse/hardware-configuration.nix @@ -1,40 +1,34 @@ { config, lib, pkgs, ... }: -let - mainUserHome = "/home/palo"; -in -{ +let mainUserHome = "/home/palo"; +in { # grub configuration # ------------------ boot.loader.grub = { - device = "/dev/sda"; - enable = true; + device = "/dev/sda"; + enable = true; version = 2; }; # lvm volume group # ---------------- - boot.initrd.luks.devices = [ - { - name = "vg"; - device = "/dev/sda2"; - preLVM = true; - } - ]; + boot.initrd.luks.devices = [{ + name = "vg"; + device = "/dev/sda2"; + preLVM = true; + }]; # NTFS support # ------------ - environment.systemPackages = [ - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.ntfs3g ]; # root # ---- fileSystems."/" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/root"; - fsType = "ext4"; + device = "/dev/vg/root"; + fsType = "ext4"; }; # boot @@ -47,28 +41,28 @@ in # home # ---- fileSystems."/home" = { - options = [ "noatime" "nodiratime" ]; - device = "/dev/mapper/decrypted_home"; - fsType = "ext4"; + options = [ "noatime" "nodiratime" ]; + device = "/dev/mapper/decrypted_home"; + fsType = "ext4"; encrypted = { - enable = true; + enable = true; keyFile = "/mnt-root/root/keys/home.key"; - label = "decrypted_home"; - blkDev = "/dev/mapper/store-home"; + label = "decrypted_home"; + blkDev = "/dev/mapper/store-home"; }; }; # var/lib/docker # -------------- fileSystems."/var/lib/docker" = { - options = [ "noatime" "nodiratime" ]; - device = "/dev/mapper/decrypted_docker"; - fsType = "ext4"; + options = [ "noatime" "nodiratime" ]; + device = "/dev/mapper/decrypted_docker"; + fsType = "ext4"; encrypted = { - enable = true; + enable = true; keyFile = "/mnt-root/root/keys/docker.key"; - label = "decrypted_docker"; - blkDev = "/dev/mapper/store-docker"; + label = "decrypted_docker"; + blkDev = "/dev/mapper/store-docker"; }; }; @@ -83,16 +77,14 @@ in #"x-systemd.device-timeout=1ms" ]; }; - systemd.mounts = [ - { - enable = true; - options = "nofail,noauto"; - type = "ext4"; - wantedBy = ["multi-user.target"]; - what = "/dev/disk/by-uuid/f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89"; - where = "/media"; - } - ]; + systemd.mounts = [{ + enable = true; + options = "nofail,noauto"; + type = "ext4"; + wantedBy = [ "multi-user.target" ]; + what = "/dev/disk/by-uuid/f7fa1c0e-ac9f-4955-b4bd-644c1ddb0d89"; + where = "/media"; + }]; } diff --git a/configs/workhorse/jenkins.nix b/configs/workhorse/jenkins.nix index f22e36e..40540d1 100644 --- a/configs/workhorse/jenkins.nix +++ b/configs/workhorse/jenkins.nix @@ -18,7 +18,8 @@ in { virtualHosts = { "jenkins.${config.networking.hostName}.private" = { locations."/" = { - proxyPass = "http://localhost:${toString config.services.jenkins.port}"; + proxyPass = + "http://localhost:${toString config.services.jenkins.port}"; extraConfig = '' proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; @@ -26,7 +27,9 @@ in { proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 90; - proxy_redirect http://localhost:${toString config.services.jenkins.port} https://jenkins.${config.networking.hostName}.private/; + proxy_redirect http://localhost:${ + toString config.services.jenkins.port + } https://jenkins.${config.networking.hostName}.private/; ''; }; }; @@ -56,183 +59,177 @@ in { accessUser = "admin"; # https://docs.openstack.org/infra/jenkins-job-builder/definition.html#modules - nixJobs = - let - # ssh username + key - gogs-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2"; - # ssh username + key - github-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2"; - # ssh username + key - sshSputnik = "d91eb57c-5bff-434c-b317-68aad46848d7"; + nixJobs = let + # ssh username + key + gogs-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2"; + # ssh username + key + github-id = "bc584c99-0fb7-43fb-af75-4076d64c51b2"; + # ssh username + key + sshSputnik = "d91eb57c-5bff-434c-b317-68aad46848d7"; - sync-to-github = - name: source: target: - sync-repo name - { - url = source; - credentialsId = gogs-id; - } - { - url = target; - credentialsId = github-id; - }; + sync-to-github = name: source: target: + sync-repo name { + url = source; + credentialsId = gogs-id; + } { + url = target; + credentialsId = github-id; + }; - in [ + in [ + (job "deploy-gaykraft" { + url = "ssh://gogs@workhorse.private:2222/palo/gaykraft.git"; + credentialsId = gogs-id; + } [ + { "build" = [ "nix-shell --run build" ]; } + { + "publish" = [{ + script = "nix-shell --run publish"; + credentialsId = sshSputnik; + }]; + } + ]) - (job "deploy-gaykraft" - { url = "ssh://gogs@workhorse.private:2222/palo/gaykraft.git"; - credentialsId = gogs-id; } - [ - { "build" = [ - "nix-shell --run build" - ]; - } - { "publish" = [ - { - script = "nix-shell --run publish"; - credentialsId = sshSputnik; - } - ]; - } - ] - ) + (job "deploy-techblock" { + url = + "ssh://gogs@workhorse.private:2222/palo/tech.ingolf-wagner.de.git"; + credentialsId = gogs-id; + } [ + { "build" = [ "nix-shell --run build" ]; } + { + "publish" = [{ + script = "nix-shell --run publish"; + credentialsId = sshSputnik; + }]; + } + ]) - (job "deploy-techblock" - { url = "ssh://gogs@workhorse.private:2222/palo/tech.ingolf-wagner.de.git"; - credentialsId = gogs-id; } - [ - { "build" = ["nix-shell --run build"];} - { "publish" = [ - { - script = "nix-shell --run publish"; - credentialsId = sshSputnik; - } - ];} - ]) + (job "deploy-terranix" { + url = "ssh://gogs@workhorse.private:2222/terranix/terranix.org.git"; + credentialsId = gogs-id; + } [ + { "build" = [ "nix-shell --run build" ]; } + { + "publish" = [{ + script = "nix-shell --run publish"; + credentialsId = sshSputnik; + }]; + } + ]) - (job "deploy-terranix" - { url = "ssh://gogs@workhorse.private:2222/terranix/terranix.org.git"; - credentialsId = gogs-id; } - [ - { "build" = ["nix-shell --run build"];} - { "publish" = [ - { - script = "nix-shell --run publish"; - credentialsId = sshSputnik; - } - ];} - ]) - - (job "sync-retiolum" - { url = "git@github.com:krebs/retiolum.git"; + (job "sync-retiolum" { + url = "git@github.com:krebs/retiolum.git"; credentialsId = github-id; - triggers = [ { timed = "H/30 * * * *"; } ];} - [ - { "Download Files" = [ - ''chmod 755 hosts'' - ''chmod 755 -R hosts'' - ''nix-shell -p curl -p gnutar -p bzip2 --run "curl https://lassul.us/retiolum-hosts.tar.bz2 | tar xvjf - || true"'' - ''chmod 755 -R etc.hosts'' - ''nix-shell -p curl --run "curl https://lassul.us/retiolum.hosts > etc.hosts || true"'' - ];} - { "update repo" = [ + triggers = [{ timed = "H/30 * * * *"; }]; + } [ + { + "Download Files" = [ + "chmod 755 hosts" + "chmod 755 -R hosts" + '' + nix-shell -p curl -p gnutar -p bzip2 --run "curl https://lassul.us/retiolum-hosts.tar.bz2 | tar xvjf - || true"'' + "chmod 755 -R etc.hosts" + '' + nix-shell -p curl --run "curl https://lassul.us/retiolum.hosts > etc.hosts || true"'' + ]; + } + { + "update repo" = [ ''nix-shell -p git --run "git add ."'' - ''nix-shell -p git --run "git -c user.name=\'Ingolf Wagner\' -c user.email=\'contact@ingolf-wagner.de\' commit -m update-`date +%Y-%m-%dT%H:%M:%S` || exit 0"'' - ];} - { Push = [ - { script = ''nix-shell -p git --run "git push origin master"''; - credentialsId = github-id; } - ];} - ]) + '' + nix-shell -p git --run "git -c user.name=\'Ingolf Wagner\' -c user.email=\'contact@ingolf-wagner.de\' commit -m update-`date +%Y-%m-%dT%H:%M:%S` || exit 0"'' + ]; + } + { + Push = [{ + script = ''nix-shell -p git --run "git push origin master"''; + credentialsId = github-id; + }]; + } + ]) - (job "test-terranix" - { url = "ssh://gogs@workhorse.private:2222/terranix/terranix.git"; + (job "test-terranix" { + url = "ssh://gogs@workhorse.private:2222/terranix/terranix.git"; credentialsId = github-id; - branch = "develop";} - [ - { "run Tests" = [ - ''nix-shell tests/shell.nix --run "test-terranix"'' - ];} - ]) + branch = "develop"; + } [{ + "run Tests" = [ ''nix-shell tests/shell.nix --run "test-terranix"'' ]; + }]) - (job "test-taskninja" - { url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git"; - credentialsId = gogs-id; } - [ - { "Create Shell" = [ - ''nix-shell -p cabal2nix --run "cabal2nix --shell file://. > jenkins.nix"'' - ];} - { Update = [ - ''nix-shell ./jenkins.nix --run "cabal update"'' - ];} - { Configure = [ + (job "test-taskninja" { + url = "ssh://gogs@workhorse.private:2222/palo/taskninja.git"; + credentialsId = gogs-id; + } [ + { + "Create Shell" = [ + '' + nix-shell -p cabal2nix --run "cabal2nix --shell file://. > jenkins.nix"'' + ]; + } + { Update = [ ''nix-shell ./jenkins.nix --run "cabal update"'' ]; } + { + Configure = [ ''nix-shell ./jenkins.nix --run "cabal configure --enable-tests"'' - ''nix-shell ./jenkins.nix --run "cabal install --only-dependencies"'' - ];} - { Build = [ - ''nix-shell ./jenkins.nix --run "cabal build"'' - ];} - { Test = [ - ''nix-shell ./jenkins.nix --run "cabal test"'' - ];} - ]) + '' + nix-shell ./jenkins.nix --run "cabal install --only-dependencies"'' + ]; + } + { Build = [ ''nix-shell ./jenkins.nix --run "cabal build"'' ]; } + { Test = [ ''nix-shell ./jenkins.nix --run "cabal test"'' ]; } + ]) - - # sync to me - # ---------- - (sync-to-github "sync-nixwriters" - "https://cgit.krebsco.de/nix-writers/" + # sync to me + # ---------- + (sync-to-github "sync-nixwriters" "https://cgit.krebsco.de/nix-writers/" "ssh://gogs@workhorse.private:2222/krebs/nix-writers.git") - (sync-to-github "sync-krops" - "https://cgit.krebsco.de/krops/" + (sync-to-github "sync-krops" "https://cgit.krebsco.de/krops/" "ssh://gogs@workhorse.private:2222/krebs/krops.git") - - # sync to github - # -------------- - (sync-to-github "sync-radiodj" + # sync to github + # -------------- + (sync-to-github "sync-radiodj" "ssh://gogs@workhorse.private:2222/crashburn_radio/radio_dj.git" "git@github.com:crashburn-radio/radio-dj.git") - (sync-to-github "sync-krops-module" + (sync-to-github "sync-krops-module" "ssh://gogs@workhorse.private:2222/nix-modules/krops.git" "git@github.com:mrVanDalo/module.krops.git") - (sync-to-github "sync-cluster-module" + (sync-to-github "sync-cluster-module" "ssh://gogs@workhorse.private:2222/nix-modules/cluster.git" "git@github.com:mrVanDalo/module.cluster.git") - (sync-to-github "sync-backup-module" + (sync-to-github "sync-backup-module" "ssh://gogs@workhorse.private:2222/nix-modules/backup.git" "git@github.com:mrVanDalo/module.backup.git") - (sync-to-github "sync-module-tinc" + (sync-to-github "sync-module-tinc" "ssh://gogs@workhorse.private:2222/palo/nixos-tinc.git" "git@github.com:mrVanDalo/nixos-tinc.git") - (sync-to-github "sync-memo" + (sync-to-github "sync-memo" "ssh://gogs@workhorse.private:2222/palo/memo.git" "git@github.com:mrVanDalo/memo.git") - (sync-to-github "sync-diagrams-template" + (sync-to-github "sync-diagrams-template" "ssh://gogs@workhorse.private:2222/palo/diagrams-template.git" "git@github.com:mrVanDalo/diagrams.git") - (sync-to-github "sync-terranix" + (sync-to-github "sync-terranix" "ssh://gogs@workhorse.private:2222/terranix/terranix.git" "git@github.com:mrVanDalo/terranix.git") - (sync-to-github "sync-plops" + (sync-to-github "sync-plops" "ssh://gogs@workhorse.private:2222/palo/plops.git" "git@github.com:mrVanDalo/plops.git") - (sync-to-github "sync-image-generator" + (sync-to-github "sync-image-generator" "ssh://gogs@workhorse.private:2222/palo/image-generator.git" "git@github.com:mrVanDalo/image-generator.git") - ]; + ]; }; }; diff --git a/configs/workhorse/kibana.nix b/configs/workhorse/kibana.nix index 4c4433c..279aea1 100644 --- a/configs/workhorse/kibana.nix +++ b/configs/workhorse/kibana.nix @@ -1,13 +1,14 @@ -{ config, ... }: -{ +{ config, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "kibana.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.services.kibana.port}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.services.kibana.port + }"; }; }; }; diff --git a/configs/workhorse/lektor-gaykraft.nix b/configs/workhorse/lektor-gaykraft.nix index 6acfe7a..a5aca46 100644 --- a/configs/workhorse/lektor-gaykraft.nix +++ b/configs/workhorse/lektor-gaykraft.nix @@ -14,9 +14,10 @@ in { statusPage = true; virtualHosts = { "${containerName}.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString port}"; + proxyPass = + "http://${config.networking.hostName}.private:${toString port}"; }; }; }; @@ -32,23 +33,23 @@ in { }; autoStart = true; - config = - { config, pkgs, ... }: - { - imports = [ ]; - services.lektor = { - enable = true; - host = "git.ingolf-wagner.de"; - sshKey = sshKey; - repository = repository; - port = port; - additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; - }; + config = { config, pkgs, ... }: { + imports = [ ]; + services.lektor = { + enable = true; + host = "git.ingolf-wagner.de"; + sshKey = sshKey; + repository = repository; + port = port; + additionalScript = + pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; }; + }; }; # it might take some time will this thing is up - systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity"; + systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = + lib.mkForce "infinity"; } diff --git a/configs/workhorse/lektor-techblog.nix b/configs/workhorse/lektor-techblog.nix index e900485..f124efc 100644 --- a/configs/workhorse/lektor-techblog.nix +++ b/configs/workhorse/lektor-techblog.nix @@ -4,7 +4,8 @@ let containerName = "techblog"; port = 5002; - repository = "ssh://gogs@git.ingolf-wagner.de:443/palo/tech.ingolf-wagner.de.git"; + repository = + "ssh://gogs@git.ingolf-wagner.de:443/palo/tech.ingolf-wagner.de.git"; sshKey = toString ; in { @@ -14,9 +15,10 @@ in { statusPage = true; virtualHosts = { "${containerName}.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString port}"; + proxyPass = + "http://${config.networking.hostName}.private:${toString port}"; }; }; }; @@ -32,23 +34,23 @@ in { }; autoStart = true; - config = - { config, pkgs, ... }: - { - imports = [ ]; - services.lektor = { - enable = true; - host = "git.ingolf-wagner.de"; - sshKey = sshKey; - repository = repository; - port = port; - additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; - }; + config = { config, pkgs, ... }: { + imports = [ ]; + services.lektor = { + enable = true; + host = "git.ingolf-wagner.de"; + sshKey = sshKey; + repository = repository; + port = port; + additionalScript = + pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; }; + }; }; # it might take some time will this thing is up - systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity"; + systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = + lib.mkForce "infinity"; } diff --git a/configs/workhorse/lektor-terranix.nix b/configs/workhorse/lektor-terranix.nix index 81185f2..6cb9235 100644 --- a/configs/workhorse/lektor-terranix.nix +++ b/configs/workhorse/lektor-terranix.nix @@ -14,9 +14,10 @@ in { statusPage = true; virtualHosts = { "${containerName}.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString port}"; + proxyPass = + "http://${config.networking.hostName}.private:${toString port}"; }; }; }; @@ -32,23 +33,23 @@ in { }; autoStart = true; - config = - { config, pkgs, ... }: - { - imports = [ ]; - services.lektor = { - enable = true; - host = "git.ingolf-wagner.de"; - sshKey = sshKey; - repository = repository; - port = port; - additionalScript = pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; - }; + config = { config, pkgs, ... }: { + imports = [ ]; + services.lektor = { + enable = true; + host = "git.ingolf-wagner.de"; + sshKey = sshKey; + repository = repository; + port = port; + additionalScript = + pkgs.writeScript "build" "${pkgs.nix}/bin/nix-shell --run build"; }; + }; }; # it might take some time will this thing is up - systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = lib.mkForce "infinity"; + systemd.services."container@${containerName}".serviceConfig.TimeoutStartSec = + lib.mkForce "infinity"; } diff --git a/configs/workhorse/mail-fetcher.nix b/configs/workhorse/mail-fetcher.nix index 7abedf0..6fa9a75 100644 --- a/configs/workhorse/mail-fetcher.nix +++ b/configs/workhorse/mail-fetcher.nix @@ -1,51 +1,50 @@ # fetches mails for me -{ lib, pkgs, config, ... }: -{ +{ lib, pkgs, config, ... }: { users.users.mailUser = { isNormalUser = true; description = "collects mails for me"; hashedPassword = "!"; name = "mailfetcher"; - openssh.authorizedKeys.keyFiles = config.users.users.root.openssh.authorizedKeys.keyFiles; + openssh.authorizedKeys.keyFiles = + config.users.users.root.openssh.authorizedKeys.keyFiles; }; - # configure passwords krops.userKeys = { "gmail.palipalo9" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "gmx.palo_van_dalo" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "gmx.ingolf_wagner" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "web.pali_palo" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "siteground.contact" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "gaykraft.root" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; "c-base.palo" = { user = config.users.users.mailUser.name; source = toString ; - requiredBy = ["fetchmail.service"]; + requiredBy = [ "fetchmail.service" ]; }; }; @@ -60,7 +59,8 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "palo_van_dalo@gmx.de"; - passwordCommand = "cat ${toString config.krops.userKeys."gmx.palo_van_dalo".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."gmx.palo_van_dalo".target}"; imap = { host = "imap.gmx.net"; port = 993; @@ -77,7 +77,8 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "ingolf.wagner@gmx.de"; - passwordCommand = "cat ${toString config.krops.userKeys."gmx.ingolf_wagner".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."gmx.ingolf_wagner".target}"; imap = { host = "imap.gmx.net"; @@ -136,7 +137,8 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "pali_palo@web.de"; - passwordCommand = "cat ${toString config.krops.userKeys."web.pali_palo".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."web.pali_palo".target}"; imap = { host = "imap.web.de"; port = 993; @@ -153,43 +155,43 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "palo"; - passwordCommand = "cat ${toString config.krops.userKeys."c-base.palo".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."c-base.palo".target}"; imap = { host = "c-mail.c-base.org"; port = 993; # fetched using : nix-shell -p openssl --run "openssl s_client -connect c-mail.c-base.org:993 -showcerts" - tls.certificatesFile = - pkgs.writeText "c-base.pem" '' - -----BEGIN CERTIFICATE----- - MIIFKDCCAxCgAwIBAgIDAtwrMA0GCSqGSIb3DQEBDQUAMFQxFDASBgNVBAoTC0NB - Y2VydCBJbmMuMR4wHAYDVQQLExVodHRwOi8vd3d3LkNBY2VydC5vcmcxHDAaBgNV - BAMTE0NBY2VydCBDbGFzcyAzIFJvb3QwHhcNMTkxMTA5MDgzMjUyWhcNMjExMTA4 - MDgzMjUyWjBhMQswCQYDVQQGEwJERTEPMA0GA1UECBMGQmVybGluMQ8wDQYDVQQH - EwZCZXJsaW4xFDASBgNVBAoTC2MtYmFzZSBlLlYuMRowGAYDVQQDExFjLW1haWwu - Yy1iYXNlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKR3XBxJ - 72MayCS0D5GCoHcY0TQLs1DQSohCCobRdSowFJzNQw/2lL6bb+Q2rmevZQXuM4vP - YbFytvTDmY5y5MNXEqGLfi8D5TcaP/RdXWQU++yUunE6yMdqZNheeXPjM//PnoXG - DyT236BovEi3YipUUsLXFiRj+cAjrQE7a2YUs3fjV3P6grMH0V06J6P6+JJvRgp2 - K33uhKhnKyb3s1tbdbu1KeGozx2ws9lg79XV+Py6PXxP6jTZ2PCsaxs3BThSdmsl - vQyk/zoW7tA1m2ntRCoyFHZqfOHsN3UOS/HDRlXqgSf0ah8cPYPsl0ayXhgOv0Tu - 1PSMt4Ve2GajX8MCAwEAAaOB9TCB8jAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE - AwIDqDA0BgNVHSUELTArBggrBgEFBQcDAgYIKwYBBQUHAwEGCWCGSAGG+EIEAQYK - KwYBBAGCNwoDAzAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9v - Y3NwLmNhY2VydC5vcmcvMDgGA1UdHwQxMC8wLaAroCmGJ2h0dHA6Ly9jcmwuY2Fj - ZXJ0Lm9yZy9jbGFzczMtcmV2b2tlLmNybDAtBgNVHREEJjAkghFjLW1haWwuYy1i - YXNlLm9yZ4IPbWFpbC5jLWJhc2Uub3JnMA0GCSqGSIb3DQEBDQUAA4ICAQBjTIa1 - xdhUYXJidv1U0qaqSV1DzumakFY20OM4QCV0Qvlq+SQUqroGBTIGodxhTnjG5o01 - 4xBAnsTcMRNycXHu0j6XYqDS4QhaFcGdFmXP0EQfAFbvhwZdbvgiRHuUTSGEbcLp - Vk8sP8dpzx+zMAZ6PL7XMwPFPTHm7vw40qmTyCuUcnhIwHgwGxu4yu0tdsU+VwRD - RVsdZO4V2GhFTz8oRcHvmC2wmx+Zwx0RXWPXSN5yRDDZWwY4WbECa2MvojH1HlJG - YJkokq7nbYJix/RipSkAXgurcgppVmM5cf7uYgSrltW8pm3IMMPrlaFrlzMMMtdq - SYFk+FDp296B7CDyWpQhDcVjnGQ70JfMWT5S3Lsi8DnI2pul9ljxPOt+Q8XFh1oz - Ofr7y5Qjm72YToOX1j7N8ppCh0RJH4lOsouTPVdp859ch9FxZdceq+nC744wv+Nt - TQPw15Gk3RY5mVYBE/Cw2T7j7qDmBaEUKxkfW7q8t287FXM4XX6C+cKYr6jYx6s1 - 5/2p4gCuOALYqJ7kD2xjci0VTWu77H4J2QKEZF8AgdI36dIYr7GY0e/+xb/CScwr - uvu2R9jfPOMVu6CiavPGUtcvju4A+qMUDqIyH9dNwkMQRffAtmsF6KR4nMYxhr45 - nKY1BaufWLD1UWrjaR1IF6L5qDHOXeMJEChYkg== - -----END CERTIFICATE-----''; + tls.certificatesFile = pkgs.writeText "c-base.pem" '' + -----BEGIN CERTIFICATE----- + MIIFKDCCAxCgAwIBAgIDAtwrMA0GCSqGSIb3DQEBDQUAMFQxFDASBgNVBAoTC0NB + Y2VydCBJbmMuMR4wHAYDVQQLExVodHRwOi8vd3d3LkNBY2VydC5vcmcxHDAaBgNV + BAMTE0NBY2VydCBDbGFzcyAzIFJvb3QwHhcNMTkxMTA5MDgzMjUyWhcNMjExMTA4 + MDgzMjUyWjBhMQswCQYDVQQGEwJERTEPMA0GA1UECBMGQmVybGluMQ8wDQYDVQQH + EwZCZXJsaW4xFDASBgNVBAoTC2MtYmFzZSBlLlYuMRowGAYDVQQDExFjLW1haWwu + Yy1iYXNlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKR3XBxJ + 72MayCS0D5GCoHcY0TQLs1DQSohCCobRdSowFJzNQw/2lL6bb+Q2rmevZQXuM4vP + YbFytvTDmY5y5MNXEqGLfi8D5TcaP/RdXWQU++yUunE6yMdqZNheeXPjM//PnoXG + DyT236BovEi3YipUUsLXFiRj+cAjrQE7a2YUs3fjV3P6grMH0V06J6P6+JJvRgp2 + K33uhKhnKyb3s1tbdbu1KeGozx2ws9lg79XV+Py6PXxP6jTZ2PCsaxs3BThSdmsl + vQyk/zoW7tA1m2ntRCoyFHZqfOHsN3UOS/HDRlXqgSf0ah8cPYPsl0ayXhgOv0Tu + 1PSMt4Ve2GajX8MCAwEAAaOB9TCB8jAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE + AwIDqDA0BgNVHSUELTArBggrBgEFBQcDAgYIKwYBBQUHAwEGCWCGSAGG+EIEAQYK + KwYBBAGCNwoDAzAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9v + Y3NwLmNhY2VydC5vcmcvMDgGA1UdHwQxMC8wLaAroCmGJ2h0dHA6Ly9jcmwuY2Fj + ZXJ0Lm9yZy9jbGFzczMtcmV2b2tlLmNybDAtBgNVHREEJjAkghFjLW1haWwuYy1i + YXNlLm9yZ4IPbWFpbC5jLWJhc2Uub3JnMA0GCSqGSIb3DQEBDQUAA4ICAQBjTIa1 + xdhUYXJidv1U0qaqSV1DzumakFY20OM4QCV0Qvlq+SQUqroGBTIGodxhTnjG5o01 + 4xBAnsTcMRNycXHu0j6XYqDS4QhaFcGdFmXP0EQfAFbvhwZdbvgiRHuUTSGEbcLp + Vk8sP8dpzx+zMAZ6PL7XMwPFPTHm7vw40qmTyCuUcnhIwHgwGxu4yu0tdsU+VwRD + RVsdZO4V2GhFTz8oRcHvmC2wmx+Zwx0RXWPXSN5yRDDZWwY4WbECa2MvojH1HlJG + YJkokq7nbYJix/RipSkAXgurcgppVmM5cf7uYgSrltW8pm3IMMPrlaFrlzMMMtdq + SYFk+FDp296B7CDyWpQhDcVjnGQ70JfMWT5S3Lsi8DnI2pul9ljxPOt+Q8XFh1oz + Ofr7y5Qjm72YToOX1j7N8ppCh0RJH4lOsouTPVdp859ch9FxZdceq+nC744wv+Nt + TQPw15Gk3RY5mVYBE/Cw2T7j7qDmBaEUKxkfW7q8t287FXM4XX6C+cKYr6jYx6s1 + 5/2p4gCuOALYqJ7kD2xjci0VTWu77H4J2QKEZF8AgdI36dIYr7GY0e/+xb/CScwr + uvu2R9jfPOMVu6CiavPGUtcvju4A+qMUDqIyH9dNwkMQRffAtmsF6KR4nMYxhr45 + nKY1BaufWLD1UWrjaR1IF6L5qDHOXeMJEChYkg== + -----END CERTIFICATE-----''; }; mbsync = { enable = true; @@ -204,7 +206,8 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "palipalo9@googlemail.com"; - passwordCommand = "cat ${toString config.krops.userKeys."gmail.palipalo9".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."gmail.palipalo9".target}"; imap = { host = "imap.gmail.com"; port = 993; @@ -221,7 +224,8 @@ aliases = [ ]; realName = "Ingolf Wagner"; userName = "contact@ingolf-wagner.de"; - passwordCommand = "cat ${toString config.krops.userKeys."siteground.contact".target}"; + passwordCommand = + "cat ${toString config.krops.userKeys."siteground.contact".target}"; imap = { host = "securees5.sgcpanel.com"; port = 143; @@ -261,15 +265,13 @@ }; }; - # configure mbsync home-manager.users.mailUser.programs.mbsync.enable = true; systemd.services.fetchmail = { enable = true; - serviceConfig = { - User = config.users.users.mailUser.name; - }; - environment.NOTMUCH_CONFIG = "${config.users.users.mailUser.home}/.config/notmuch/notmuchrc"; + serviceConfig = { User = config.users.users.mailUser.name; }; + environment.NOTMUCH_CONFIG = + "${config.users.users.mailUser.home}/.config/notmuch/notmuchrc"; script = '' echo "run mbsync" ${pkgs.isync}/bin/mbsync \ @@ -284,13 +286,13 @@ ${pkgs.notmuch}/bin/notmuch new echo "run afew" ${pkgs.afew}/bin/afew --new --tag -v - ''; + ''; }; systemd.timers.fetchmail = { enable = true; # timerConfig.OnCalendar = " *-*-* *:00:00"; timerConfig.OnCalendar = "*:0/10"; - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; }; # configure notmuch @@ -305,123 +307,361 @@ # a few config home-manager.users.mailUser.programs.afew = { - enable = true; - extraConfig = with lib; let + enable = true; + extraConfig = with lib; + let - template = index: { tags, query, message ? "generic", ... }: '' - [Filter.${toString index}] - query = ${query} - tags = ${concatStringsSep ";" tags} - message = ${message} - ''; + template = index: + { tags, query, message ? "generic", ... }: '' + [Filter.${toString index}] + query = ${query} + tags = ${concatStringsSep ";" tags} + message = ${message} + ''; filters = [ - - {query = "from:linkedin.com"; tags = [ "+linked" "+jobs" ];} - {query = "from:computerfutures.com OR from:computerfutures.de"; tags = [ "+jobs" "-inbox" ];} - {query = "from:seek.com.au"; tags = [ "+jobs" ];} - {query = "from:xing.com"; tags = [ "+jobs" "-inbox" ];} - - {query = "from:no-reply@backtrace.io"; tags = ["+sononym" "-inbox" "-unread"];} - {query = "from:ebay.com OR from:ebay.de OR from:ebay.net"; tags = [ "+ebay" "+shop" "+billing"];} - {query = "from:bahn.de"; tags = [ "+billing" "+bahn" ];} - {query = "from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com"; tags = [ "+mia" "+work" "-unread" "-inbox"];} - {query = "from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:getdigital.de"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:digitalo.de"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:puppet.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:mixcloudmail.com AND subject:Weekly Update"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:facebook.com OR from:facebookmail.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:getpocket.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:oknotify2.com"; tags = [ "+okcupid" ];} - {query = "from:oknotify2.com AND NOT subject:New message"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:paulaschoice.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:immobilienscout24.de"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:magix.net"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:booking.com"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:hackster.io"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:trade4less.de"; tags = [ "-inbox" "-unread" "+junk" ];} - {query = "from:taxback.de OR to:taxback.de"; tags = ["+steuer"] ;} - {query = "from:campact.de"; tags = ["+campact" "+politics"] ;} - {query = "from:menospese.com"; tags = ["+junk" "-unread" "-inbox"] ;} - {query = "from:aliexpress.com"; tags = ["+shop" "+aliexpress"] ;} - {query = "from:congstar.de"; tags = ["+billing" "+congstar" "-inbox" "-unread"] ;} - {query = "from:congstarnews.de"; tags = ["+congstar" "-inbox" "-unread" "+junk"] ;} - {query = "from:fitnessfirst.de"; tags = ["-inbox" "-unread" "+junk"] ;} - {query = "from:steampowered.com AND NOT ( subject:purchase OR subject:received )"; tags = ["-inbox" "-unread" ] ;} - {query = "from:steampowered.com AND ( subject:purchase OR subject:received )"; tags = ["+billing" "+steam" ] ;} - {query = "from:gog.com AND NOT subject:Bestellung"; tags = ["-inbox" "-unread" ] ;} - {query = "from:gog.com AND subject:Bestellung"; tags = ["+billing" "+gog" ] ;} - {query = "from:drive-now.com"; tags = ["+billing" "+drivenow" "-inbox" "-unread"] ;} - {query = "from:mindfactory.de"; tags = ["+shop" "+billing"] ;} - {query = "from:zalando.de"; tags = ["+shop" "+billing" "+zalando"] ;} - {query = "from:ing.de"; tags = ["+bank" "+ingdiba"] ;} - {query = "from:nab.com.au"; tags = ["+bank" "+nab" "-inbox" "-unread"] ;} - {query = "from:dkb.de"; tags = ["+bank" "+dkb"] ;} - {query = "from:o2online.de"; tags = ["+billing" "+o2"] ;} - {query = "from:betfair.com"; tags = ["+work" "+betfair"] ;} - {query = "from:ghostinspector.com"; tags = ["-unread" "-inbox" "+junk"] ;} - {query = "from:travis-ci.org AND subject:csv-to-qif"; tags = ["+development" "+csv-to-qif"] ;} - {query = "to:proaudio@lists.tuxfamily.org"; tags = ["-inbox" "-unread"] ;} - {query = "tag:lists AND from:nixos1@discoursemail.com"; tags = ["+nixos" "+discourse"] ;} - {query = "from:limebike.com AND (subject:Funds OR subject:Receipt)" ; tags = ["-inbox" "-unread" "+billing" "+limebike"] ;} - {query = "from:hetzner.com OR from:hetzner.de" ; tags = ["+hetzner"] ;} - {query = "from:freemusicarchive.org" ; tags = ["+FMA"] ;} - {query = "from:namecheap.com" ; tags = ["+namecheap" "+billing"] ;} - {query = "from:nintendo.com" ; tags = ["+nintendo" "+billing"] ;} - {query = "from:oculus.com AND subject:receipt" ; tags = ["+oculus" "+billing"] ;} - {query = "from:vstbuzz.com" ; tags = ["+junk" "-inbox" ] ;} - {query = "from:runtastic.com" ; tags = ["+junk" "-inbox" ] ;} - {query = "from:letterboxd.com" ; tags = ["+junk" "-inbox" ] ;} - {query = "from::microsoftstoreemail.com" ; tags = ["+junk" "-inbox" ] ;} - {query = "from:car2go.com" ; tags = ["-inbox" "-unread" ] ;} - {query = "from:sixt.de" ; tags = ["-inbox" "-unread" ] ;} - {query = "from:meetup.com" ; tags = ["-inbox" "-unread" "+meetup"] ;} - {query = "from:slack.com" ; tags = ["+slack"] ;} - {query = "from:keybase.io" ; tags = ["+keybase"] ;} - {query = "from:tumblr.com" ; tags = ["+junk" "-inbox" "-unread"];} - {query = "from:jobs2web.com" ; tags = ["+newzealand" "+jobs" "-inbox" ];} - {query = "from:mailings.gmx.net" ; tags = ["+junk" "-inbox" "-unread"];} - {query = "from:paypal.de AND subject:Bestätigung"; tags = ["-unread" "+paypal" "+billing"] ;} - {query = "to:c-base.org" ; tags = ["+cbase"] ;} - {query = "to:c-base.org AND subject=[auto-report]"; tags = ["-unread" "-inbox"] ;} - - {query = "to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com"; tags = ["+renoise"] ;} - {query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com"; tags = ["+shop" "+amazon" "+billing"];} { - query = "to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )"; + query = "from:linkedin.com"; + tags = [ "+linked" "+jobs" ]; + } + { + query = "from:computerfutures.com OR from:computerfutures.de"; + tags = [ "+jobs" "-inbox" ]; + } + { + query = "from:seek.com.au"; + tags = [ "+jobs" ]; + } + { + query = "from:xing.com"; + tags = [ "+jobs" "-inbox" ]; + } + + { + query = "from:no-reply@backtrace.io"; + tags = [ "+sononym" "-inbox" "-unread" ]; + } + { + query = "from:ebay.com OR from:ebay.de OR from:ebay.net"; + tags = [ "+ebay" "+shop" "+billing" ]; + } + { + query = "from:bahn.de"; + tags = [ "+billing" "+bahn" ]; + } + { + query = + "from:fysitech.atlassian.net OR to:engiadina-pwa@noreply.github.com"; + tags = [ "+mia" "+work" "-unread" "-inbox" ]; + } + { + query = + "from:circleci.com OR (from:noreply@github.com AND to:audio-overlay@googlegroups.com)"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:getdigital.de"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:digitalo.de"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:puppet.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:mixcloudmail.com AND subject:Weekly Update"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:facebook.com OR from:facebookmail.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:getpocket.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:oknotify2.com"; + tags = [ "+okcupid" ]; + } + { + query = "from:oknotify2.com AND NOT subject:New message"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:paulaschoice.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = + "from:samplemagic.com OR from:wavealchemy.co.uk OR from:creators.gumroad.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:immobilienscout24.de"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:magix.net"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:booking.com"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:hackster.io"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:trade4less.de"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = "from:taxback.de OR to:taxback.de"; + tags = [ "+steuer" ]; + } + { + query = "from:campact.de"; + tags = [ "+campact" "+politics" ]; + } + { + query = "from:menospese.com"; + tags = [ "+junk" "-unread" "-inbox" ]; + } + { + query = "from:aliexpress.com"; + tags = [ "+shop" "+aliexpress" ]; + } + { + query = "from:congstar.de"; + tags = [ "+billing" "+congstar" "-inbox" "-unread" ]; + } + { + query = "from:congstarnews.de"; + tags = [ "+congstar" "-inbox" "-unread" "+junk" ]; + } + { + query = "from:fitnessfirst.de"; + tags = [ "-inbox" "-unread" "+junk" ]; + } + { + query = + "from:steampowered.com AND NOT ( subject:purchase OR subject:received )"; + tags = [ "-inbox" "-unread" ]; + } + { + query = + "from:steampowered.com AND ( subject:purchase OR subject:received )"; + tags = [ "+billing" "+steam" ]; + } + { + query = "from:gog.com AND NOT subject:Bestellung"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:gog.com AND subject:Bestellung"; + tags = [ "+billing" "+gog" ]; + } + { + query = "from:drive-now.com"; + tags = [ "+billing" "+drivenow" "-inbox" "-unread" ]; + } + { + query = "from:mindfactory.de"; + tags = [ "+shop" "+billing" ]; + } + { + query = "from:zalando.de"; + tags = [ "+shop" "+billing" "+zalando" ]; + } + { + query = "from:ing.de"; + tags = [ "+bank" "+ingdiba" ]; + } + { + query = "from:nab.com.au"; + tags = [ "+bank" "+nab" "-inbox" "-unread" ]; + } + { + query = "from:dkb.de"; + tags = [ "+bank" "+dkb" ]; + } + { + query = "from:o2online.de"; + tags = [ "+billing" "+o2" ]; + } + { + query = "from:betfair.com"; + tags = [ "+work" "+betfair" ]; + } + { + query = "from:ghostinspector.com"; + tags = [ "-unread" "-inbox" "+junk" ]; + } + { + query = "from:travis-ci.org AND subject:csv-to-qif"; + tags = [ "+development" "+csv-to-qif" ]; + } + { + query = "to:proaudio@lists.tuxfamily.org"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "tag:lists AND from:nixos1@discoursemail.com"; + tags = [ "+nixos" "+discourse" ]; + } + { + query = "from:limebike.com AND (subject:Funds OR subject:Receipt)"; + tags = [ "-inbox" "-unread" "+billing" "+limebike" ]; + } + { + query = "from:hetzner.com OR from:hetzner.de"; + tags = [ "+hetzner" ]; + } + { + query = "from:freemusicarchive.org"; + tags = [ "+FMA" ]; + } + { + query = "from:namecheap.com"; + tags = [ "+namecheap" "+billing" ]; + } + { + query = "from:nintendo.com"; + tags = [ "+nintendo" "+billing" ]; + } + { + query = "from:oculus.com AND subject:receipt"; + tags = [ "+oculus" "+billing" ]; + } + { + query = "from:vstbuzz.com"; + tags = [ "+junk" "-inbox" ]; + } + { + query = "from:runtastic.com"; + tags = [ "+junk" "-inbox" ]; + } + { + query = "from:letterboxd.com"; + tags = [ "+junk" "-inbox" ]; + } + { + query = "from::microsoftstoreemail.com"; + tags = [ "+junk" "-inbox" ]; + } + { + query = "from:car2go.com"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:sixt.de"; + tags = [ "-inbox" "-unread" ]; + } + { + query = "from:meetup.com"; + tags = [ "-inbox" "-unread" "+meetup" ]; + } + { + query = "from:slack.com"; + tags = [ "+slack" ]; + } + { + query = "from:keybase.io"; + tags = [ "+keybase" ]; + } + { + query = "from:tumblr.com"; + tags = [ "+junk" "-inbox" "-unread" ]; + } + { + query = "from:jobs2web.com"; + tags = [ "+newzealand" "+jobs" "-inbox" ]; + } + { + query = "from:mailings.gmx.net"; + tags = [ "+junk" "-inbox" "-unread" ]; + } + { + query = "from:paypal.de AND subject:Bestätigung"; + tags = [ "-unread" "+paypal" "+billing" ]; + } + { + query = "to:c-base.org"; + tags = [ "+cbase" ]; + } + { + query = "to:c-base.org AND subject=[auto-report]"; + tags = [ "-unread" "-inbox" ]; + } + + { + query = + "to:renoise@ingolf-wagner.de OR to:root@renoise.com OR from:renoise.com OR to:admin@renoise.com"; + tags = [ "+renoise" ]; + } + { + query = "from:amazon.de OR from:amazon.com AND NOT to:renoise.com"; + tags = [ "+shop" "+amazon" "+billing" ]; + } + { + query = + "to:renoise.com AND NOT ( from:renoise.com OR from:root OR from:hetzner.com OR from:hetzner.de OR from:amazon.com OR from:gmail.com )"; tags = [ "-inbox" "-unread" "+junk" "+renoise" ]; } # final rules to make imap sync stuff easier # there can only be one output folder tag, and theses rules are prioritized - { query = "tag:fraud" ; tags = ["-inbox" "-archive" "-junk" "-unread" ]; message = "clean up tag fraud";} - { query = "tag:junk" ; tags = ["-inbox" "-archive" "-fraud" "-unread" ]; message = "clean up tag junk";} - { query = "tag:archive" ; tags = ["-inbox" "-junk" "-fraud" "-unread" ]; message = "clean up tag archive";} - { query = "tag:inbox" ; tags = ["-archive" "-junk" "-fraud"]; message = "clean up inbox";} - { query = "tag:killed"; tags = ["-inbox" "-unread"]; message = "clean up tag killed" ;} + { + query = "tag:fraud"; + tags = [ "-inbox" "-archive" "-junk" "-unread" ]; + message = "clean up tag fraud"; + } + { + query = "tag:junk"; + tags = [ "-inbox" "-archive" "-fraud" "-unread" ]; + message = "clean up tag junk"; + } + { + query = "tag:archive"; + tags = [ "-inbox" "-junk" "-fraud" "-unread" ]; + message = "clean up tag archive"; + } + { + query = "tag:inbox"; + tags = [ "-archive" "-junk" "-fraud" ]; + message = "clean up inbox"; + } + { + query = "tag:killed"; + tags = [ "-inbox" "-unread" ]; + message = "clean up tag killed"; + } # remove new tag at the end - { query = "tag:new"; tags = ["-new"]; message = "remove new tag at the end" ;} + { + query = "tag:new"; + tags = [ "-new" ]; + message = "remove new tag at the end"; + } ]; - in - '' - # Tag mails which are mailing lists - [ListMailsFilter] + in '' + # Tag mails which are mailing lists + [ListMailsFilter] - # Tag mails as killed if the thread has been marked as "killed" - [KillThreadsFilter] + # Tag mails as killed if the thread has been marked as "killed" + [KillThreadsFilter] - ${concatStringsSep "\n" (imap0 template filters)} + ${concatStringsSep "\n" (imap0 template filters)} ''; }; - - - } diff --git a/configs/workhorse/packages.nix b/configs/workhorse/packages.nix index cda5056..9726dcf 100644 --- a/configs/workhorse/packages.nix +++ b/configs/workhorse/packages.nix @@ -1,7 +1,3 @@ { config, pkgs, ... }: -let - unstable = import {}; -in { - environment.systemPackages = with pkgs ; [ - ]; -} +let unstable = import { }; +in { environment.systemPackages = with pkgs; [ ]; } diff --git a/configs/workhorse/prometheus.nix b/configs/workhorse/prometheus.nix index 130ed04..6626193 100644 --- a/configs/workhorse/prometheus.nix +++ b/configs/workhorse/prometheus.nix @@ -1,14 +1,11 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "prometheus.workhorse.private" = { - locations."/" = { - proxyPass = "http://workhorse.private:9090"; - }; + locations."/" = { proxyPass = "http://workhorse.private:9090"; }; }; }; }; @@ -21,21 +18,21 @@ scrape_interval = "8s"; static_configs = [ { - targets = ["sputnik.private:9113"]; + targets = [ "sputnik.private:9113" ]; labels = { service = "nginx"; server = "sputnik"; }; } { - targets = ["sputnik.private:9113"]; + targets = [ "sputnik.private:9113" ]; labels = { service = "nginx"; server = "sputnik"; }; } { - targets = ["workhorse.private:9113"]; + targets = [ "workhorse.private:9113" ]; labels = { service = "nginx"; server = "sputnik"; @@ -50,21 +47,21 @@ scrape_interval = "5s"; static_configs = [ { - targets = ["porani.private:19999"]; + targets = [ "porani.private:19999" ]; labels = { service = "netdata"; server = "porani"; }; } { - targets = ["sputnik.private:19999"]; + targets = [ "sputnik.private:19999" ]; labels = { service = "netdata"; server = "sputnik"; }; } { - targets = ["workhorse.private:19999"]; + targets = [ "workhorse.private:19999" ]; labels = { service = "netdata"; server = "workhorse"; @@ -77,30 +74,26 @@ metrics_path = "/-/metrics"; params.format = [ "prometheus" ]; scrape_interval = "10s"; - static_configs = [ - { - targets = ["workhorse.private:3000"]; - labels = { - service = "gogs"; - server = "kruck"; - }; - } - ]; + static_configs = [{ + targets = [ "workhorse.private:3000" ]; + labels = { + service = "gogs"; + server = "kruck"; + }; + }]; } { job_name = "home-assistant"; scrape_interval = "60s"; metrics_path = "/api/prometheus"; - static_configs = [ - { - targets = ["porani.private:8123"]; - labels = { - service = "hass"; - server = "porani"; - city = "essen"; - }; - } - ]; + static_configs = [{ + targets = [ "porani.private:8123" ]; + labels = { + service = "hass"; + server = "porani"; + city = "essen"; + }; + }]; } ]; }; diff --git a/configs/workhorse/restic.nix b/configs/workhorse/restic.nix index e227982..1a7d601 100644 --- a/configs/workhorse/restic.nix +++ b/configs/workhorse/restic.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{ config, ... }: { backup.services.restic = { "on-porani".enable = false; diff --git a/configs/workhorse/seafile.nix b/configs/workhorse/seafile.nix index 74bddb2..dfde9ec 100644 --- a/configs/workhorse/seafile.nix +++ b/configs/workhorse/seafile.nix @@ -1,14 +1,15 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "seafile.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.custom.services.seafile.port}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.custom.services.seafile.port + }"; }; }; }; diff --git a/configs/workhorse/syncthing.nix b/configs/workhorse/syncthing.nix index 3ffde70..fdff0cf 100644 --- a/configs/workhorse/syncthing.nix +++ b/configs/workhorse/syncthing.nix @@ -1,98 +1,98 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { custom.samba-share = { enable = true; folders = { movies = config.test.services.syncthing.declarative.folders.movies.path; series = config.test.services.syncthing.declarative.folders.series.path; - music = config.test.services.syncthing.declarative.folders.music-library.path; + music = + config.test.services.syncthing.declarative.folders.music-library.path; }; }; - test.services.syncthing = { - enable = true; - openDefaultPorts = false; - dataDir = "/home/syncthing"; - configDir = "/home/syncthing"; - declarative = { - cert = toString ; - key = toString ; - overrideFolders = true; + test.services.syncthing = { + enable = true; + openDefaultPorts = false; + dataDir = "/home/syncthing"; + configDir = "/home/syncthing"; + declarative = { + cert = toString ; + key = toString ; + overrideFolders = true; - folders = { + folders = { - # todo add podcast here + # todo add podcast here - # on encrypted hard drive - # ----------------------- - private = { + # on encrypted hard drive + # ----------------------- + private = { enable = true; path = "/home/syncthing/private"; versioning = { type = "simple"; params.keep = "10"; }; - }; - desktop = { - enable = true; - path = "/home/syncthing/desktop"; - }; - finance = { - enable = true; - path = "/home/syncthing/finance"; - versioning = { - type = "simple"; - params.keep = "10"; - }; - }; - fotos = { - enable = true; - path = "/home/syncthing/fotos"; - }; - lost-fotos = { - enable = true; - path = "/home/syncthing/lost-fotos.ct"; - }; - music-projects = { - enable = true; - path = "/home/syncthing/music-projects"; - }; - video-material = { - enable = true; - path = "/home/syncthing/video-material"; - }; + }; + desktop = { + enable = true; + path = "/home/syncthing/desktop"; + }; + finance = { + enable = true; + path = "/home/syncthing/finance"; + versioning = { + type = "simple"; + params.keep = "10"; + }; + }; + fotos = { + enable = true; + path = "/home/syncthing/fotos"; + }; + lost-fotos = { + enable = true; + path = "/home/syncthing/lost-fotos.ct"; + }; + music-projects = { + enable = true; + path = "/home/syncthing/music-projects"; + }; + video-material = { + enable = true; + path = "/home/syncthing/video-material"; + }; - # on media hard drive (not encrypted) - # ----------------------------------- - music-library-free = { - enable = true; - path = "/media/syncthing/music-library-free"; - }; - samples = { - enable = true; - path = "/media/syncthing/samples"; - }; - movies = { - enable = true; - path = "/media/syncthing/movies"; - }; - music-library = { - enable = true; - path = "/media/syncthing/music-library"; - }; - podcasts = { - enable = true; - path = "/media/syncthing/podcasts"; - }; - series = { - enable = true; - path = "/media/syncthing/series"; - }; + # on media hard drive (not encrypted) + # ----------------------------------- + music-library-free = { + enable = true; + path = "/media/syncthing/music-library-free"; + }; + samples = { + enable = true; + path = "/media/syncthing/samples"; + }; + movies = { + enable = true; + path = "/media/syncthing/movies"; + }; + music-library = { + enable = true; + path = "/media/syncthing/music-library"; + }; + podcasts = { + enable = true; + path = "/media/syncthing/podcasts"; + }; + series = { + enable = true; + path = "/media/syncthing/series"; + }; - }; - }; - }; + }; + }; + }; systemd.services."permown._media_syncthing" = { bindsTo = [ "media.mount" ]; @@ -108,6 +108,6 @@ after = [ "media.mount" ]; }; - backup.all.restic.dirs = ["/home/syncthing/finance"]; + backup.all.restic.dirs = [ "/home/syncthing/finance" ]; } diff --git a/configs/workhorse/taskserver.nix b/configs/workhorse/taskserver.nix index 841dcea..2f7ca23 100644 --- a/configs/workhorse/taskserver.nix +++ b/configs/workhorse/taskserver.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { services.taskserver = { enable = true; @@ -8,7 +7,7 @@ requestLimit = 104857600; trust = "allow all"; dataDir = "/var/lib/taskserver"; - organisations."orgie".users = ["palo"]; + organisations."orgie".users = [ "palo" ]; }; } diff --git a/configs/workhorse/tinc.nix b/configs/workhorse/tinc.nix index 05bac3b..dcf8219 100644 --- a/configs/workhorse/tinc.nix +++ b/configs/workhorse/tinc.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { module.cluster.services.tinc = { "private" = { diff --git a/configs/workhorse/transmission.nix b/configs/workhorse/transmission.nix index 4450c44..e6d7c98 100644 --- a/configs/workhorse/transmission.nix +++ b/configs/workhorse/transmission.nix @@ -4,12 +4,10 @@ with lib; let - allTincNetworks = - builtins.attrNames config.module.cluster.services.tinc; + allTincNetworks = builtins.attrNames config.module.cluster.services.tinc; - ipAddresses = - flatten (mapAttrsToList (_: data: - mapAttrsToList (_: hostConfig: hostConfig.tincIp) data.hosts) + ipAddresses = flatten (mapAttrsToList + (_: data: mapAttrsToList (_: hostConfig: hostConfig.tincIp) data.hosts) config.module.cluster.services.tinc); in { @@ -19,9 +17,11 @@ in { statusPage = true; virtualHosts = { "transmission.${config.networking.hostName}.private" = { - serverAliases = ["torrent.${config.networking.hostName}.private"]; + serverAliases = [ "torrent.${config.networking.hostName}.private" ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.services.transmission.port}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.services.transmission.port + }"; }; }; }; @@ -36,7 +36,8 @@ in { enable = true; home = "/home/torrent"; store = "/home/torrent"; - hosts = concatStringsSep "," (map (name: "${config.networking.hostName}.${name}") allTincNetworks); + hosts = concatStringsSep "," + (map (name: "${config.networking.hostName}.${name}") allTincNetworks); whitelist = concatStringsSep "," ipAddresses; user = "palo"; password = lib.fileContents ; diff --git a/configs/workhorse/weechat.nix b/configs/workhorse/weechat.nix index ad9d578..fca8d4e 100644 --- a/configs/workhorse/weechat.nix +++ b/configs/workhorse/weechat.nix @@ -9,9 +9,7 @@ { # configure weechat - services.weechat = { - enable = true; - }; + services.weechat = { enable = true; }; # configure bitlbee services.bitlbee = { @@ -28,17 +26,12 @@ pkgs.telegram-purple #pkgs.purple-lurch ]; - plugins = [ - pkgs.bitlbee-facebook - pkgs.bitlbee-steam - ]; + plugins = [ pkgs.bitlbee-facebook pkgs.bitlbee-steam ]; }; # otherwise xterm is the only thing that works environment.systemPackages = [ pkgs.rxvt_unicode ]; - backup.all.restic.dirs = [ - config.services.weechat.root - ]; + backup.all.restic.dirs = [ config.services.weechat.root ]; } diff --git a/configs/workout/configuration.nix b/configs/workout/configuration.nix index 15a453a..2469638 100644 --- a/configs/workout/configuration.nix +++ b/configs/workout/configuration.nix @@ -1,5 +1,4 @@ -{ lib, config, pkgs, ... }: -{ +{ lib, config, pkgs, ... }: { imports = [ @@ -13,13 +12,13 @@ ]; - networking.hostName = "workout"; + networking.hostName = "workout"; services.logind.lidSwitch = lib.mkForce "ignore"; security.wrappers = { - pmount.source = "${pkgs.pmount}/bin/pmount"; - pumount.source = "${pkgs.pmount}/bin/pumount"; + pmount.source = "${pkgs.pmount}/bin/pmount"; + pumount.source = "${pkgs.pmount}/bin/pumount"; }; # nix-shell -p speedtest_cli --run speedtest @@ -36,8 +35,8 @@ # font # ---- - programs.custom.urxvt.fontSize = 17; - programs.custom.xterm.fontSize = 17; + programs.custom.urxvt.fontSize = 17; + programs.custom.xterm.fontSize = 17; system.custom.fonts.dpi = 140; services.printing.enable = true; @@ -45,8 +44,8 @@ virtualisation = { docker.enable = true; virtualbox = { - host.enable = true; - guest.x11 = true; + host.enable = true; + guest.x11 = true; guest.enable = true; }; }; diff --git a/configs/workout/hardware-configuration.nix b/configs/workout/hardware-configuration.nix index b05414c..8f1a2fb 100644 --- a/configs/workout/hardware-configuration.nix +++ b/configs/workout/hardware-configuration.nix @@ -1,40 +1,48 @@ { config, lib, pkgs, ... }: -let - mainUserHome = "/home/palo"; -in -{ +let mainUserHome = "/home/palo"; +in { # fix fileSystems..encrypted - false overwrite # -------------------------------------------------- - boot.initrd.luks.cryptoModules = [ "aes" "aes_generic" "blowfish" "twofish" "serpent" "cbc" "xts" "lrw" "sha1" "sha256" "sha512" "aes_x86_64" ]; + boot.initrd.luks.cryptoModules = [ + "aes" + "aes_generic" + "blowfish" + "twofish" + "serpent" + "cbc" + "xts" + "lrw" + "sha1" + "sha256" + "sha512" + "aes_x86_64" + ]; # todo : why should I use this here - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; boot.kernelModules = [ "kvm-intel" ]; nix.maxJobs = lib.mkDefault 8; # lvm volume group # ---------------- - boot.initrd.luks.devices = [ - { - name = "vg"; - device = "/dev/sda2"; - preLVM = true; - } - ]; + boot.initrd.luks.devices = [{ + name = "vg"; + device = "/dev/sda2"; + preLVM = true; + }]; # NTFS support # ------------ - environment.systemPackages = [ - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.ntfs3g ]; # root # ---- fileSystems."/" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/root"; - fsType = "ext4"; + device = "/dev/vg/root"; + fsType = "ext4"; }; # boot @@ -44,8 +52,8 @@ in fsType = "ext4"; }; boot.loader.grub = { - device = "/dev/sda"; - enable = true; + device = "/dev/sda"; + enable = true; version = 2; }; @@ -53,8 +61,8 @@ in # ---- fileSystems."/home" = { options = [ "noatime" "nodiratime" "discard" ]; - device = "/dev/vg/home"; - fsType = "ext4"; + device = "/dev/vg/home"; + fsType = "ext4"; }; } diff --git a/configs/workout/kibana.nix b/configs/workout/kibana.nix index 92634c4..fc78713 100644 --- a/configs/workout/kibana.nix +++ b/configs/workout/kibana.nix @@ -1,22 +1,25 @@ -{ config, ... }: -{ +{ config, ... }: { services.nginx = { enable = true; statusPage = true; virtualHosts = { "kibana.${config.networking.hostName}.private" = { - serverAliases = []; + serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${toString config.services.kibana.port}"; + proxyPass = "http://${config.networking.hostName}.private:${ + toString config.services.kibana.port + }"; }; }; }; }; services.elasticsearch.enable = true; - services.elasticsearch.listenAddress = "${config.networking.hostName}.private"; + services.elasticsearch.listenAddress = + "${config.networking.hostName}.private"; services.kibana.enable = true; - services.kibana.elasticsearch.hosts = [ "http://${config.networking.hostName}.private:9200" ]; + services.kibana.elasticsearch.hosts = + [ "http://${config.networking.hostName}.private:9200" ]; services.kibana.listenAddress = "${config.networking.hostName}.private"; services.kibana.port = 5601; diff --git a/configs/workout/packages.nix b/configs/workout/packages.nix index 0a69edc..2ab166b 100644 --- a/configs/workout/packages.nix +++ b/configs/workout/packages.nix @@ -1,19 +1,20 @@ { config, pkgs, ... }: -let - unstable = import {}; +let unstable = import { }; in { nixpkgs.config.packageOverrides = pkgs: { - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { - inherit pkgs; - }; + nur = import (builtins.fetchTarball + "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; }; - environment.systemPackages = with pkgs ; [ - bitwig-studio - #unstable.pypi2nix - #nur.repos.mic92.nixos-shell - ]; + environment.systemPackages = with pkgs; + [ + bitwig-studio + #unstable.pypi2nix + #nur.repos.mic92.nixos-shell + ]; programs.custom.q = { enableIntelBacklight = false; diff --git a/configs/workout/slack.nix b/configs/workout/slack.nix index 5810031..d5b3920 100644 --- a/configs/workout/slack.nix +++ b/configs/workout/slack.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { programs.custom.slack = { enable = true; @@ -7,7 +6,8 @@ }; programs.custom.browser.configList.google-chrome = { - inherit (config.programs.custom.browser.configList.development) home homeBackup user; + inherit (config.programs.custom.browser.configList.development) + home homeBackup user; sudoUsers = [ "slack" ]; }; diff --git a/configs/workout/syncthing.nix b/configs/workout/syncthing.nix index 2fa43d7..b01988a 100644 --- a/configs/workout/syncthing.nix +++ b/configs/workout/syncthing.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { test.services.syncthing = { enable = true; diff --git a/configs/workout/tinc.nix b/configs/workout/tinc.nix index 606a6b7..e78d9f9 100644 --- a/configs/workout/tinc.nix +++ b/configs/workout/tinc.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { module.cluster.services.tinc = { "private" = { enable = true; diff --git a/images/lib/remote-access.nix b/images/lib/remote-access.nix index 38abdb4..9590af6 100644 --- a/images/lib/remote-access.nix +++ b/images/lib/remote-access.nix @@ -1,56 +1,50 @@ { - # cat ~/.ssh/id_rsa.pub - publicSshKey ? "", - # remote-install-get-hiddenReceiver - hiddenReceiver ? "", -}: -{ config, lib, pkgs, ... }: -{ +# cat ~/.ssh/id_rsa.pub +publicSshKey ? "", +# remote-install-get-hiddenReceiver +hiddenReceiver ? "", }: +{ config, lib, pkgs, ... }: { imports = [ { # system setup networking.hostName = "liveos"; users.extraUsers = { - root = { - openssh.authorizedKeys.keys = [ - publicSshKey - ]; - }; + root = { openssh.authorizedKeys.keys = [ publicSshKey ]; }; }; } { # installed packages nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ - #style + #style most rxvt_unicode.terminfo - #monitoring tools + #monitoring tools htop iotop - #network + #network iptables iftop nmap - #stuff for dl + #stuff for dl aria2 - #neat utils + #neat utils pciutils psmisc tmux usbutils git - #unpack stuff + #unpack stuff p7zip unzip unrar - #data recovery + #data recovery ddrescue ntfs3g dosfstools diff --git a/images/remote-install/config.nix b/images/remote-install/config.nix index 1374bbb..af37d80 100644 --- a/images/remote-install/config.nix +++ b/images/remote-install/config.nix @@ -1,8 +1,10 @@ -{ pkgs, lib, ... }: let +{ pkgs, lib, ... }: +let remote-access = import ../lib/remote-access.nix { # cat ~/.ssh/id_rsa.pub - publicSshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw=="; + publicSshKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw=="; # remote-install-get-hiddenReceiver hiddenReceiver = ""; diff --git a/images/remote-install/remote-install.nix b/images/remote-install/remote-install.nix index 8cf9a9a..61b82d3 100644 --- a/images/remote-install/remote-install.nix +++ b/images/remote-install/remote-install.nix @@ -3,9 +3,7 @@ services.tor = { enable = true; client.enable = true; - hiddenServices.liveos.map = [ - { port = 1337; } - ]; + hiddenServices.liveos.map = [{ port = 1337; }]; }; environment.systemPackages = [ diff --git a/images/windows-rescue/config.nix b/images/windows-rescue/config.nix index d63e021..966f110 100644 --- a/images/windows-rescue/config.nix +++ b/images/windows-rescue/config.nix @@ -1,23 +1,22 @@ # NixOS livesystem to reset windows passwords # Step by step guide : https://opensource.com/article/18/3/how-reset-windows-password-linux # $ nixos-generator -f iso -c config.nix -{ pkgs, ... }: let +{ pkgs, ... }: +let wifi = { ssid = ""; plainTextPassword = ""; }; remote-access = import ../lib/remote-access.nix { - publicSshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw=="; + publicSshKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw=="; hiddenReceiver = ""; }; in { imports = [ remote-access ]; - environment.systemPackages = [ - pkgs.chntpw - pkgs.ntfs3g - ]; + environment.systemPackages = [ pkgs.chntpw pkgs.ntfs3g ]; networking.dhcpcd.enable = true; networking.wireless = { diff --git a/images/yubikey-image.nix b/images/yubikey-image.nix index 9c04f99..0db5a9d 100644 --- a/images/yubikey-image.nix +++ b/images/yubikey-image.nix @@ -7,10 +7,13 @@ if [ ! -d $GNUPGHOME ]; then mkdir $GNUPGHOME fi - cp ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/drduh/config/662c16404eef04f506a6a208f1253fee2f4895d9/gpg.conf"; - sha256 = "118fmrsn28fz629y7wwwcx7r1wfn59h3mqz1snyhf8b5yh0sb8la"; - }} "$GNUPGHOME/gpg.conf" + cp ${ + pkgs.fetchurl { + url = + "https://raw.githubusercontent.com/drduh/config/662c16404eef04f506a6a208f1253fee2f4895d9/gpg.conf"; + sha256 = "118fmrsn28fz629y7wwwcx7r1wfn59h3mqz1snyhf8b5yh0sb8la"; + } + } "$GNUPGHOME/gpg.conf" echo "\$GNUPGHOME has been set up for you. Generated keys will be in $GNUPGHOME." ''; @@ -49,7 +52,8 @@ sha256 = "0rzy06a5xgfjpaklxdgrxml24d0vhk78lb577l3z4x7a2p32dbyq"; }; buildInputs = [ pkgs.pandoc ]; - installPhase = "pandoc --highlight-style pygments -s --toc README.md -o $out"; + installPhase = + "pandoc --highlight-style pygments -s --toc README.md -o $out"; }; in { default = "xfce"; diff --git a/library/default.nix b/library/default.nix index 44a2c74..3a3813f 100644 --- a/library/default.nix +++ b/library/default.nix @@ -1,8 +1,8 @@ -{ pkgs, lib, ... }: -{ - desktopFile = bin: { longName ? "Script", command ? "${bin}/bin/${bin.name}", ... }: +{ pkgs, lib, ... }: { + desktopFile = bin: + { longName ? "Script", command ? "${bin}/bin/${bin.name}", ... }: pkgs.writeTextFile { - name = "${bin.name}.desktop" ; + name = "${bin.name}.desktop"; destination = "/share/applications/${bin.name}.desktop"; text = '' [Desktop Entry] @@ -14,7 +14,7 @@ GenericName=${longName} StartupWMClass=${bin.name} ''; - }; + }; jenkins = import ./jenkins.nix { inherit lib; }; diff --git a/library/jenkins.nix b/library/jenkins.nix index 6376dc6..510781b 100644 --- a/library/jenkins.nix +++ b/library/jenkins.nix @@ -4,77 +4,74 @@ with builtins; { # source container url and credentialsId - job = name: { - url, - credentialsId, - branch ? "master", + job = name: + { url, credentialsId, branch ? "master", # https://docs.openstack.org/infra/jenkins-job-builder/triggers.html - triggers ? [ - { pollscm = { - cron = "H/30 * * * *"; - ignore-post-commit-hooks = true; - };} - ], ... }: config: { job = { - inherit name triggers; - sandbox = true; - project-type = "pipeline"; - dsl = let - stage = elem: - let - stageName = head ( attrNames elem ); - stateScripts = map ( stage : - lib.getAttr (typeOf stage) { - string = '' - withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) { - sh '${toString stage}' - }''; - set = - let - script = '' + triggers ? [{ + pollscm = { + cron = "H/30 * * * *"; + ignore-post-commit-hooks = true; + }; + }], ... }: + config: { + job = { + inherit name triggers; + sandbox = true; + project-type = "pipeline"; + dsl = let + stage = elem: + let + stageName = head (attrNames elem); + stateScripts = map (stage: + lib.getAttr (typeOf stage) { + string = '' withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) { - sh '${toString stage.script}' - } - ''; - in - if (stage.credentialsId != null) - then '' + sh '${toString stage}' + }''; + set = let + script = '' + withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) { + sh '${toString stage.script}' + } + ''; + in if (stage.credentialsId != null) then '' sshagent(['${stage.credentialsId}']) { ${script} } - '' - else script; + '' else + script; + }) (getAttr stageName elem); + in '' + stage('${stageName}') { + steps { + ${concatStringsSep "\n" stateScripts} + } } - )( getAttr stageName elem ); + ''; + stages = map stage config; in '' - stage('${stageName}') { - steps { - ${concatStringsSep "\n" stateScripts} + pipeline { + agent any + stages{ + stage('Pull') { + steps { + checkout( + [$class: 'GitSCM' + , branches: [[name: '*/${branch}']] + , doGenerateSubmoduleConfigurations: false + , extensions: [[$class: 'LocalBranch', localBranch: 'master']] + , submoduleCfg: [] + , userRemoteConfigs: + [[ credentialsId: '${credentialsId}' + , url: '${url}']] + ] + ) + } + } + ${concatStringsSep "\n" stages} } } ''; - stages = map stage config; - in '' - pipeline { - agent any - stages{ - stage('Pull') { - steps { - checkout( - [$class: 'GitSCM' - , branches: [[name: '*/${branch}']] - , doGenerateSubmoduleConfigurations: false - , extensions: [[$class: 'LocalBranch', localBranch: 'master']] - , submoduleCfg: [] - , userRemoteConfigs: - [[ credentialsId: '${credentialsId}' - , url: '${url}']] - ] - ) - } - } - ${concatStringsSep "\n" stages} - } - } - ''; - };}; + }; + }; # creates a sync job # source and target container url and credentialsId @@ -83,12 +80,12 @@ with builtins; name = name; sandbox = true; project-type = "pipeline"; - triggers = [ { + triggers = [{ pollscm = { cron = "H/30 * * * *"; ignore-post-commit-hooks = true; }; - } ]; + }]; dsl = '' pipeline { agent any diff --git a/modules/later/syncthing.nix b/modules/later/syncthing.nix index 2f9d365..ea7401f 100644 --- a/modules/later/syncthing.nix +++ b/modules/later/syncthing.nix @@ -11,18 +11,16 @@ let inherit (device) name addresses introducer; }) cfg.declarative.devices; - folders = mapAttrsToList ( _: folder: { + folders = mapAttrsToList (_: folder: { inherit (folder) path id label type; - devices = map (device: { deviceId = cfg.declarative.devices.${device}.id; }) folder.devices; + devices = map (device: { deviceId = cfg.declarative.devices.${device}.id; }) + folder.devices; rescanIntervalS = folder.rescanInterval; fsWatcherEnabled = folder.watch; fsWatcherDelayS = folder.watchDelay; ignorePerms = folder.ignorePerms; versioning = folder.versioning; - }) (filterAttrs ( - _: folder: - folder.enable - ) cfg.declarative.folders); + }) (filterAttrs (_: folder: folder.enable) cfg.declarative.folders); # get the api key by parsing the config.xml getApiKey = pkgs.writers.writeDash "getAPIKey" '' @@ -45,8 +43,12 @@ let # generate the new config by merging with the nixos config options NEW_CFG=$(echo "$OLD_CFG" | ${pkgs.jq}/bin/jq -s '.[] as $in | $in * { - "devices": (${builtins.toJSON devices}${optionalString (! cfg.declarative.overrideDevices) " + $in.devices"}), - "folders": (${builtins.toJSON folders}${optionalString (! cfg.declarative.overrideFolders) " + $in.folders"}) + "devices": (${builtins.toJSON devices}${ + optionalString (!cfg.declarative.overrideDevices) " + $in.devices" + }), + "folders": (${builtins.toJSON folders}${ + optionalString (!cfg.declarative.overrideFolders) " + $in.folders" + }) }') # POST the new config to syncthing @@ -102,13 +104,14 @@ in { }; devices = mkOption { - default = {}; + default = { }; description = '' Peers/devices which syncthing should communicate with. ''; example = { bigbox = { - id = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU"; + id = + "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU"; addresses = [ "tcp://192.168.0.10:51820" ]; }; }; @@ -125,7 +128,7 @@ in { addresses = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; description = '' The addresses used to connect to the device. If this is let empty, dynamic configuration is attempted @@ -165,7 +168,7 @@ in { }; folders = mkOption { - default = {}; + default = { }; description = '' folders which should be shared by syncthing. ''; @@ -214,7 +217,7 @@ in { devices = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; description = '' The devices this folder should be shared with. Must be defined in the declarative.devices attribute. @@ -262,16 +265,16 @@ in { }; } ]; - type = with types; nullOr (submodule { - options = { - type = mkOption { - type = enum [ "external" "simple" "staggered" "trashcan" ]; + type = with types; + nullOr (submodule { + options = { + type = mkOption { + type = + enum [ "external" "simple" "staggered" "trashcan" ]; + }; + params = mkOption { type = attrsOf (either str path); }; }; - params = mkOption { - type = attrsOf (either str path); - }; - }; - }); + }); }; rescanInterval = mkOption { @@ -376,11 +379,10 @@ in { description = '' Path where the settings and keys will exist. ''; - default = - let - nixos = config.system.stateVersion; - cond = versionAtLeast nixos "19.03"; - in cfg.dataDir + (optionalString cond "/.config/syncthing"); + default = let + nixos = config.system.stateVersion; + cond = versionAtLeast nixos "19.03"; + in cfg.dataDir + (optionalString cond "/.config/syncthing"); }; openDefaultPorts = mkOption { @@ -427,18 +429,17 @@ in { systemd.packages = [ pkgs.syncthing ]; users.users = mkIf (cfg.systemService && cfg.user == defaultUser) { - ${defaultUser} = - { group = cfg.group; - home = cfg.dataDir; - createHome = true; - uid = config.ids.uids.syncthing; - description = "Syncthing daemon user"; - }; + ${defaultUser} = { + group = cfg.group; + home = cfg.dataDir; + createHome = true; + uid = config.ids.uids.syncthing; + description = "Syncthing daemon user"; + }; }; users.groups = mkIf (cfg.systemService && cfg.group == defaultUser) { - ${defaultUser}.gid = - config.ids.gids.syncthing; + ${defaultUser}.gid = config.ids.gids.syncthing; }; systemd.services = { @@ -454,20 +455,26 @@ in { serviceConfig = { Restart = "on-failure"; SuccessExitStatus = "2 3 4"; - RestartForceExitStatus="3 4"; + RestartForceExitStatus = "3 4"; User = cfg.user; Group = cfg.group; - ExecStartPre = mkIf (cfg.declarative.cert != null || cfg.declarative.key != null) - "+${pkgs.writers.writeBash "syncthing-copy-keys" '' - install -dm700 -o ${cfg.user} -g ${cfg.group} ${cfg.configDir} - ${optionalString (cfg.declarative.cert != null) '' - install -Dm400 -o ${cfg.user} -g ${cfg.group} ${toString cfg.declarative.cert} ${cfg.configDir}/cert.pem - ''} - ${optionalString (cfg.declarative.key != null) '' - install -Dm400 -o ${cfg.user} -g ${cfg.group} ${toString cfg.declarative.key} ${cfg.configDir}/key.pem - ''} - ''}" - ; + ExecStartPre = + mkIf (cfg.declarative.cert != null || cfg.declarative.key != null) + "+${ + pkgs.writers.writeBash "syncthing-copy-keys" '' + install -dm700 -o ${cfg.user} -g ${cfg.group} ${cfg.configDir} + ${optionalString (cfg.declarative.cert != null) '' + install -Dm400 -o ${cfg.user} -g ${cfg.group} ${ + toString cfg.declarative.cert + } ${cfg.configDir}/cert.pem + ''} + ${optionalString (cfg.declarative.key != null) '' + install -Dm400 -o ${cfg.user} -g ${cfg.group} ${ + toString cfg.declarative.key + } ${cfg.configDir}/key.pem + ''} + '' + }"; ExecStart = '' ${cfg.package}/bin/syncthing \ -no-browser \ @@ -476,23 +483,20 @@ in { ''; }; }; - syncthing-init = mkIf ( - cfg.declarative.devices != {} || cfg.declarative.folders != {} - ) { - after = [ "syncthing.service" ]; - wantedBy = [ "multi-user.target" ]; + syncthing-init = mkIf + (cfg.declarative.devices != { } || cfg.declarative.folders != { }) { + after = [ "syncthing.service" ]; + wantedBy = [ "multi-user.target" ]; - serviceConfig = { - User = cfg.user; - RemainAfterExit = true; - Type = "oneshot"; - ExecStart = updateConfig; + serviceConfig = { + User = cfg.user; + RemainAfterExit = true; + Type = "oneshot"; + ExecStart = updateConfig; + }; }; - }; - syncthing-resume = { - wantedBy = [ "suspend.target" ]; - }; + syncthing-resume = { wantedBy = [ "suspend.target" ]; }; }; }; } diff --git a/modules/programs/browser.nix b/modules/programs/browser.nix index 6161b04..181226c 100644 --- a/modules/programs/browser.nix +++ b/modules/programs/browser.nix @@ -14,234 +14,219 @@ let firefoxBin = "${pkgs.firefox}/bin/firefox"; tarBin = "${pkgs.gnutar}/bin/tar"; - # desktop file # ------------ # makes it possible to be used by other programs - desktopFile = bin: let - browserName = bin.name; - in pkgs.writeTextFile { - name = "${browserName}.desktop" ; - destination = "/share/applications/${browserName}.desktop"; - text = '' - [Desktop Entry] - Type=Application - Exec=${bin}/bin/${browserName} %U - Icon=chromium - Comment=An open source web browser from Google - Terminal=false - Name=${browserName} - GenericName=Web browser - MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/webcal;x-scheme-handler/about - Categories=Network;WebBrowser - StartupWMClass=${browserName} - ''; - }; + desktopFile = bin: + let browserName = bin.name; + in pkgs.writeTextFile { + name = "${browserName}.desktop"; + destination = "/share/applications/${browserName}.desktop"; + text = '' + [Desktop Entry] + Type=Application + Exec=${bin}/bin/${browserName} %U + Icon=chromium + Comment=An open source web browser from Google + Terminal=false + Name=${browserName} + GenericName=Web browser + MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/webcal;x-scheme-handler/about + Categories=Network;WebBrowser + StartupWMClass=${browserName} + ''; + }; cleanBrowser = name: browser: home: homeBackup: - let - backupFile = "${homeBackup}.tar.lzma"; - rolloutFile = "${home}.tar.lzma"; - lockFile = "${home}-lock"; - in - pkgs.writeShellScriptBin "${name}-clean" /* sh */ '' - sudo killall -9 -u ${name} - sudo rm ${lockFile} - sudo rm -rf ${home} - ''; + let + backupFile = "${homeBackup}.tar.lzma"; + rolloutFile = "${home}.tar.lzma"; + lockFile = "${home}-lock"; + in pkgs.writeShellScriptBin "${name}-clean" # sh + '' + sudo killall -9 -u ${name} + sudo rm ${lockFile} + sudo rm -rf ${home} + ''; createBrowser = name: user: browser: home: homeBackup: - let - backupFile = "${homeBackup}.tar.lzma"; - rolloutFile = "${home}.tar.lzma"; - lockFile = "${home}-lock"; - in - pkgs.writeShellScriptBin "${name}" /* sh */ '' - # set -x - if [[ ! -e ${lockFile} ]] - then - # rollout backup - if [[ -e ${backupFile} ]] + let + backupFile = "${homeBackup}.tar.lzma"; + rolloutFile = "${home}.tar.lzma"; + lockFile = "${home}-lock"; + in pkgs.writeShellScriptBin "${name}" # sh + '' + # set -x + if [[ ! -e ${lockFile} ]] then - if [[ ! -d ${home} ]] + # rollout backup + if [[ -e ${backupFile} ]] then - # todo : use make user - sudo mkdir -p ${home} - sudo chown -R ${user}:users ${home} + if [[ ! -d ${home} ]] + then + # todo : use make user + sudo mkdir -p ${home} + sudo chown -R ${user}:users ${home} + fi + cp ${backupFile} ${rolloutFile} + sudo -u ${user} ${tarBin} xf ${rolloutFile} --directory ${home} + rm ${rolloutFile} + touch ${lockFile} fi - cp ${backupFile} ${rolloutFile} - sudo -u ${user} ${tarBin} xf ${rolloutFile} --directory ${home} - rm ${rolloutFile} - touch ${lockFile} fi - fi - sudo -u ${user} ${browser} - ''; + sudo -u ${user} ${browser} + ''; - browserExecutableList = - let - allBrowser = flip mapAttrsToList cfg.configList ( - name: config: + browserExecutableList = let + allBrowser = flip mapAttrsToList cfg.configList (name: config: let - browser = if config.browserType == "chrome" - then "${chromiumBin} \"$@\"" - else if config.browserType == "google" - then "${chromeBin} \"$@\"" - else "${firefoxBin} \"$@\""; - in - createBrowser name config.user browser config.home config.homeBackup - ); + browser = if config.browserType == "chrome" then + ''${chromiumBin} "$@"'' + else if config.browserType == "google" then + ''${chromeBin} "$@"'' + else + ''${firefoxBin} "$@"''; + in createBrowser name config.user browser config.home config.homeBackup); xclipBrowser = [ - (pkgs.writeShellScriptBin "copy-to-xclip" /* sh */'' - echo "$*" | ${pkgs.xclip}/bin/xclip - '') + (pkgs.writeShellScriptBin "copy-to-xclip" # sh + '' + echo "$*" | ${pkgs.xclip}/bin/xclip + '') ]; - in - allBrowser ++ xclipBrowser; + in allBrowser ++ xclipBrowser; createBackupScript = name: home: backupHome: - pkgs.writeShellScriptBin "${name}-backup" /* sh */ '' - sudo -u ${name} \ - ${tarBin} \ - --exclude=.cache \ - --exclude=Downloads \ - --create \ - --verbos \ - --lzma \ - --file ${home}.tar.lzma \ - --directory ${home} \ - . + pkgs.writeShellScriptBin "${name}-backup" # sh + '' + sudo -u ${name} \ + ${tarBin} \ + --exclude=.cache \ + --exclude=Downloads \ + --create \ + --verbos \ + --lzma \ + --file ${home}.tar.lzma \ + --directory ${home} \ + . - cp ${home}.tar.lzma ${backupHome}.tar.lzma - ''; + cp ${home}.tar.lzma ${backupHome}.tar.lzma + ''; - allBackupScripts = - let - filteredConfigs = - filterAttrs - (name: browserConfig: browserConfig.homeBackup != null) - cfg.configList; - in - mapAttrsToList - (name: browserConfig: createBackupScript name browserConfig.home browserConfig.homeBackup) - filteredConfigs; - - allCleanScripts = - let - filteredConfigs = - filterAttrs - (name: browserConfig: browserConfig.homeBackup != null) - cfg.configList; - in - mapAttrsToList - (name: browserConfig: cleanBrowser name name browserConfig.home browserConfig.homeBackup) - filteredConfigs; + allBackupScripts = let + filteredConfigs = + filterAttrs (name: browserConfig: browserConfig.homeBackup != null) + cfg.configList; + in mapAttrsToList (name: browserConfig: + createBackupScript name browserConfig.home browserConfig.homeBackup) + filteredConfigs; + allCleanScripts = let + filteredConfigs = + filterAttrs (name: browserConfig: browserConfig.homeBackup != null) + cfg.configList; + in mapAttrsToList (name: browserConfig: + cleanBrowser name name browserConfig.home browserConfig.homeBackup) + filteredConfigs; # browser chooser # --------------- - browserSelect = pkgs.writeScriptBin "browser-select" '' + browserSelect = pkgs.writeScriptBin "browser-select" '' # select a browser using dmenu # ---------------------------- - BROWSER=$( echo -e "${lib.concatMapStringsSep "\\n" (bin: bin.name) browserExecutableList}" \ + BROWSER=$( echo -e "${ + lib.concatMapStringsSep "\\n" (bin: bin.name) browserExecutableList + }" \ | ${pkgs.rofi}/bin/rofi -dmenu ) # start selected browser # ---------------------- case $BROWSER in - ${lib.concatStringsSep "\n" - (flip map browserExecutableList (bin: "${bin.name}) export BIN=${bin}/bin/${bin.name} ;;")) - } + ${lib.concatStringsSep "\n" (flip map browserExecutableList + (bin: "${bin.name}) export BIN=${bin}/bin/${bin.name} ;;"))} esac $BIN "$@" ''; - in { options.programs.custom.browser = { enable = mkEnableOption "enable browsers"; configList = mkOption { - type = with types; attrsOf (submodule ({ name , ... }: { - options = { - browserType = mkOption { - type = with types; enum ["firefox" "chrome" "google"]; - default = "chrome"; - description = '' - the type of browser which is simulated - ''; + type = with types; + attrsOf (submodule ({ name, ... }: { + options = { + browserType = mkOption { + type = with types; enum [ "firefox" "chrome" "google" ]; + default = "chrome"; + description = '' + the type of browser which is simulated + ''; + }; + home = mkOption { + type = with types; str; + description = '' + Home of the browser. + ''; + }; + user = mkOption { + default = name; + type = with types; str; + description = '' + user to run the browser as + ''; + }; + sudoUsers = mkOption { + default = [ config.users.users.mainUser.name ]; + type = with types; listOf str; + description = '' + user allowed to run sudo without password to start the browser + ''; + }; + homeBackup = mkOption { + type = with types; nullOr str; + default = null; + example = "~/.my-browser-backup"; + description = '' + backup of the home, which gets rolled out if the + home does not exists. usefull for homes in tmpfs. + dont use file endings! + ''; + }; }; - home = mkOption { - type = with types; str; - description = '' - Home of the browser. - ''; - }; - user = mkOption { - default = name; - type = with types; str; - description = '' - user to run the browser as - ''; - }; - sudoUsers = mkOption { - default = [ config.users.users.mainUser.name ]; - type = with types; listOf str; - description = '' - user allowed to run sudo without password to start the browser - ''; - }; - homeBackup = mkOption { - type = with types; nullOr str; - default = null; - example = "~/.my-browser-backup"; - description = '' - backup of the home, which gets rolled out if the - home does not exists. usefull for homes in tmpfs. - dont use file endings! - ''; - }; - }; - })); + })); }; }; config = mkIf cfg.enable { # add sudo rights - security.sudo.extraConfig = - let - extraRules = flip mapAttrsToList cfg.configList (name: values: - concatStringsSep "\n" (map (sudoUser: "${sudoUser} ALL=(${values.user}) NOPASSWD: ALL") values.sudoUsers)) ; - in - lib.concatStringsSep "\n" extraRules; + security.sudo.extraConfig = let + extraRules = flip mapAttrsToList cfg.configList (name: values: + concatStringsSep "\n" + (map (sudoUser: "${sudoUser} ALL=(${values.user}) NOPASSWD: ALL") + values.sudoUsers)); + in lib.concatStringsSep "\n" extraRules; # create users - users.users = flip mapAttrs cfg.configList (name: config: - { - home = config.home; - createHome = true; - initialPassword = "${name}-browser"; - shell = pkgs.bashInteractive; - isNormalUser = true; - group = "users"; - # enable video usage - extraGroups = [ "video" "audio" ]; - } - ); + users.users = flip mapAttrs cfg.configList (name: config: { + home = config.home; + createHome = true; + initialPassword = "${name}-browser"; + shell = pkgs.bashInteractive; + isNormalUser = true; + group = "users"; + # enable video usage + extraGroups = [ "video" "audio" ]; + }); # add groups to mainUser system.custom.mainUser.extraGroups = builtins.attrNames cfg.configList; - environment.systemPackages = [ - browserSelect - ( desktopFile browserSelect ) - ] - ++ browserExecutableList - ++ (map (bin: desktopFile bin) browserExecutableList) - ++ allBackupScripts - ++ allCleanScripts; + environment.systemPackages = [ browserSelect (desktopFile browserSelect) ] + ++ browserExecutableList + ++ (map (bin: desktopFile bin) browserExecutableList) ++ allBackupScripts + ++ allCleanScripts; }; } diff --git a/modules/programs/citate.nix b/modules/programs/citate.nix index 7679caa..91d2264 100644 --- a/modules/programs/citate.nix +++ b/modules/programs/citate.nix @@ -11,9 +11,10 @@ let xdotool = "${pkgs.xdotool}/bin/xdotool"; dmenu = "${pkgs.dmenu}/bin/dmenu"; - citateScript = file: suffix: pkgs.writeShellScriptBin "citate-${suffix}" '' - ${xdotool} - <<<"type -- $( cat ${file} | ${dmenu} -l 10 -i | sed -e "s/\(.*\)/'\1'/" )" - ''; + citateScript = file: suffix: + pkgs.writeShellScriptBin "citate-${suffix}" '' + ${xdotool} - <<<"type -- $( cat ${file} | ${dmenu} -l 10 -i | sed -e "s/\(.*\)/'\1'/" )" + ''; scriptAxel = citateScript (toString ) "axel"; scriptSiw = citateScript (toString ) "siw"; @@ -27,9 +28,15 @@ in { config = mkIf cfg.enable { environment.systemPackages = [ scriptAxel - (library.desktopFile scriptAxel { longName = "Citate Axel"; command = "citate-axel"; }) + (library.desktopFile scriptAxel { + longName = "Citate Axel"; + command = "citate-axel"; + }) scriptSiw - (library.desktopFile scriptSiw { longName = "Citate Sinnlos im Weltall"; command = "citate-siw"; }) + (library.desktopFile scriptSiw { + longName = "Citate Sinnlos im Weltall"; + command = "citate-siw"; + }) ]; }; } diff --git a/modules/programs/curl-scripts.nix b/modules/programs/curl-scripts.nix index 67243fb..2365502 100644 --- a/modules/programs/curl-scripts.nix +++ b/modules/programs/curl-scripts.nix @@ -12,7 +12,7 @@ let ${pkgs.curl}/bin/curl "qrenco.de/$1" ''; - cheatSheetScript = pkgs.writeShellScriptBin "cheatsheet" '' + cheatSheetScript = pkgs.writeShellScriptBin "cheatsheet" '' ${pkgs.curl}/bin/curl "cheat.sh/$1" ''; @@ -20,15 +20,12 @@ let in { - options.programs.custom.curlScripts.enable = mkEnableOption "enable curl scripts"; + options.programs.custom.curlScripts.enable = + mkEnableOption "enable curl scripts"; config = mkIf cfg.enable { - environment.systemPackages = [ - weatherScript - qrCodeScript - cheatSheetScript - ]; + environment.systemPackages = + [ weatherScript qrCodeScript cheatSheetScript ]; }; } - diff --git a/modules/programs/easytag.nix b/modules/programs/easytag.nix index 92ca44d..02e6814 100644 --- a/modules/programs/easytag.nix +++ b/modules/programs/easytag.nix @@ -8,13 +8,11 @@ let in { - options.programs.custom.easytag.enable = mkEnableOption "install easytag with dependencies"; + options.programs.custom.easytag.enable = + mkEnableOption "install easytag with dependencies"; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - easytag - gnome3.dconf - ]; + environment.systemPackages = with pkgs; [ easytag gnome3.dconf ]; }; } diff --git a/modules/programs/elm.nix b/modules/programs/elm.nix index 17ae6b5..e1cc323 100644 --- a/modules/programs/elm.nix +++ b/modules/programs/elm.nix @@ -11,7 +11,7 @@ in { options.programs.custom.elm.enable = mkEnableOption "enable elm stack"; config = mkIf cfg.enable { - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ elmPackages.elm elmPackages.elm-compiler elmPackages.elm-format diff --git a/modules/programs/espeak.nix b/modules/programs/espeak.nix index 55545cc..ac14b1e 100644 --- a/modules/programs/espeak.nix +++ b/modules/programs/espeak.nix @@ -36,11 +36,12 @@ let in { - options.programs.custom.espeak.enable = mkEnableOption "enable espeak scripts"; + options.programs.custom.espeak.enable = + mkEnableOption "enable espeak scripts"; config = mkIf cfg.enable { - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ espeak en_espeak en_read @@ -51,4 +52,3 @@ in { }; } - diff --git a/modules/programs/ffmpeg.nix b/modules/programs/ffmpeg.nix index be30608..f004d72 100644 --- a/modules/programs/ffmpeg.nix +++ b/modules/programs/ffmpeg.nix @@ -4,7 +4,8 @@ let cfg = config.programs.custom.ffmpeg; - ffmpegTemplate = name: { profile, preset, tune ? null}: + ffmpegTemplate = name: + { profile, preset, tune ? null }: pkgs.writeShellScriptBin "ffmpeg-${name}" '' if [ $# -eq 0 ] @@ -64,13 +65,15 @@ let -acodec aac \ "$output" \ -hide_banner - ''; + ''; ffmpegDescriptive = profile: preset: - ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset ; }; + ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; }; ffmpegDescriptiveTune = profile: preset: tune: - ffmpegTemplate "${profile}-${preset}-${tune}-720p" { inherit profile preset tune; }; + ffmpegTemplate "${profile}-${preset}-${tune}-720p" { + inherit profile preset tune; + }; # https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles profiles = [ @@ -92,21 +95,11 @@ let #"slower" "veryslow" ]; - tunes = [ - "film" - "animation" - "grain" - "stillimage" - "fastdecode" - ]; + tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ]; - ffmpegs = lib.crossLists - ffmpegDescriptive - [ profiles presets ]; + ffmpegs = lib.crossLists ffmpegDescriptive [ profiles presets ]; - ffmpegsTune = lib.crossLists - ffmpegDescriptiveTune - [ profiles presets tunes ]; + ffmpegsTune = lib.crossLists ffmpegDescriptiveTune [ profiles presets tunes ]; in { @@ -114,7 +107,6 @@ in { enable = mkEnableOption "enable programs.custom.ffmpeg"; }; - config = mkIf cfg.enable { - environment.systemPackages = ffmpegs ++ ffmpegsTune; - }; + config = + mkIf cfg.enable { environment.systemPackages = ffmpegs ++ ffmpegsTune; }; } diff --git a/modules/programs/git.nix b/modules/programs/git.nix index c119cf4..8912249 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -8,11 +8,12 @@ let in { - options.programs.custom.git.enable = mkEnableOption "install git and all its tools"; + options.programs.custom.git.enable = + mkEnableOption "install git and all its tools"; config = mkIf cfg.enable { - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ git tig git-crypt diff --git a/modules/programs/q.nix b/modules/programs/q.nix index 5b9aef2..5a76db1 100644 --- a/modules/programs/q.nix +++ b/modules/programs/q.nix @@ -27,7 +27,7 @@ in { config = mkIf cfg.enable { environment.systemPackages = [ - (pkgs.q.override{ + (pkgs.q.override { timeZones = cfg.timeZones; enableIntelBacklight = cfg.enableIntelBacklight; enableBattery = cfg.enableBattery; diff --git a/modules/programs/shell-bash.nix b/modules/programs/shell-bash.nix index ce81eb8..a0e9f3c 100644 --- a/modules/programs/shell-bash.nix +++ b/modules/programs/shell-bash.nix @@ -1,6 +1,5 @@ { config, pkgs, lib, ... }: -let - cfg = config.programs.custom.bash; +let cfg = config.programs.custom.bash; in { options.programs.custom.bash.enable = lib.mkEnableOption "enable bash config"; @@ -15,64 +14,66 @@ in { # Configure Shell # --------------- - interactiveShellInit = /* sh */ '' - # use vi shortcuts - # ---------------- - set -o vi + interactiveShellInit = # sh + '' + # use vi shortcuts + # ---------------- + set -o vi - # Configure ls-colors - # ------------------- - export LS_COLORS='rs=0:di=01;35:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;33:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35::*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:' - ''; + # Configure ls-colors + # ------------------- + export LS_COLORS='rs=0:di=01;35:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;33:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35::*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:' + ''; # Configure Prompt # ---------------- - promptInit = /* sh */ '' - # PS1 content functions - # --------------------- - function nonzero_return() { - RETVAL=$? - [ $RETVAL -ne 0 ] && echo "[> $RETVAL <] " - } + promptInit = # sh + '' + # PS1 content functions + # --------------------- + function nonzero_return() { + RETVAL=$? + [ $RETVAL -ne 0 ] && echo "[> $RETVAL <] " + } - # Provide a nice prompt - # --------------------- - case $TERM in - xterm*|rxvt*|Eterm) - # used : http://ezprompt.net/ - USER_COLOR="\[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\]" - CURRENT_PATH="\[\e[33m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[33m\]]\[\e[m\]" - if [[ $UID -eq 0 ]] - then - USER_COLOR="\[\e[31m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[31m\]\h\[\e[m\]" - fi - export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] $USER_COLOR $CURRENT_PATH\[\e[31m\]\\$\[\e[m\] " - ;; - screen) - export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] \[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\] \[\e[33m\][\[\e[m\]\[\e[33m\]\W\[\e[m\]\[\e[33m\]]\[\e[m\]\[\e[31m\]\\$\[\e[m\] " - ;; - esac - ''; + # Provide a nice prompt + # --------------------- + case $TERM in + xterm*|rxvt*|Eterm) + # used : http://ezprompt.net/ + USER_COLOR="\[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\]" + CURRENT_PATH="\[\e[33m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[33m\]]\[\e[m\]" + if [[ $UID -eq 0 ]] + then + USER_COLOR="\[\e[31m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[31m\]\h\[\e[m\]" + fi + export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] $USER_COLOR $CURRENT_PATH\[\e[31m\]\\$\[\e[m\] " + ;; + screen) + export PS1="\[\e[31m\]\`nonzero_return\`\[\e[m\]\[\e[35m\]\A\[\e[m\] \[\e[36m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[36m\]\h\[\e[m\] \[\e[33m\][\[\e[m\]\[\e[33m\]\W\[\e[m\]\[\e[33m\]]\[\e[m\]\[\e[31m\]\\$\[\e[m\] " + ;; + esac + ''; # Shell Aliases # ------------- shellAliases = { - ls = "ls --color=tty"; - l = "ls -CFh"; - la = "ls -Ah"; - ll = "ls -lh" ; - lt = "ls -lct --reverse"; - less = "less -S"; - top = "htop"; - todo = "task todo"; - active = "task active"; + ls = "ls --color=tty"; + l = "ls -CFh"; + la = "ls -Ah"; + ll = "ls -lh"; + lt = "ls -lct --reverse"; + less = "less -S"; + top = "htop"; + todo = "task todo"; + active = "task active"; version = "date '+%Y%m%d%H%M%S'"; - vclip = "xclip -selection clipboard"; - df = "df -h"; + vclip = "xclip -selection clipboard"; + df = "df -h"; - nix-search = "nix-env -qaP"; - nix-list = "nix-env -qaP \"*\" --description"; - nix-list-haskell = "nix-env -f \"\" -qaP -A haskellPackages"; + nix-search = "nix-env -qaP"; + nix-list = ''nix-env -qaP "*" --description''; + nix-list-haskell = ''nix-env -f "" -qaP -A haskellPackages''; nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/"; @@ -83,5 +84,3 @@ in { }; } - - diff --git a/modules/programs/shell-tools.nix b/modules/programs/shell-tools.nix index 69a4dd8..b0dad7e 100644 --- a/modules/programs/shell-tools.nix +++ b/modules/programs/shell-tools.nix @@ -5,39 +5,38 @@ with lib; let xterm-colors = pkgs.writeShellScriptBin "256-xterm-colors" - /* sh */ '' - for i in {0..255} ; do - printf "\x1b[38;5;%sm%3d\e[0m " "$i" "$i" - if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then - printf "\n"; - fi - done - ''; - - xterm-background-colors = pkgs.writeShellScriptBin "256-xterm-colors-background" - /* sh */ '' - for i in {0..255} ; do - printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" - if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then - printf "\n"; - fi - done - ''; + # sh + '' + for i in {0..255} ; do + printf "\x1b[38;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi + done + ''; + xterm-background-colors = pkgs.writeShellScriptBin + "256-xterm-colors-background" + # sh + '' + for i in {0..255} ; do + printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi + done + ''; cfg = config.programs.custom.shellTools; in { - options.programs.custom.shellTools.enable = mkEnableOption "enable shell tools"; + options.programs.custom.shellTools.enable = + mkEnableOption "enable shell tools"; config = mkIf cfg.enable { - environment.systemPackages = [ - xterm-colors - xterm-background-colors - ]; + environment.systemPackages = [ xterm-colors xterm-background-colors ]; }; } - diff --git a/modules/programs/shell-zsh.nix b/modules/programs/shell-zsh.nix index c0d1154..97a77f6 100644 --- a/modules/programs/shell-zsh.nix +++ b/modules/programs/shell-zsh.nix @@ -12,7 +12,7 @@ in { enable = mkEnableOption "enable zsh"; mainUser = mkOption { - type = with types; nullOr str; + type = with types; nullOr str; default = null; description = '' the main User if available @@ -25,8 +25,8 @@ in { programs.zsh = { - enable = true; - enableCompletion = true; + enable = true; + enableCompletion = true; #autosuggestions.enable = true; syntaxHighlighting.enable = true; @@ -56,26 +56,26 @@ in { export TERM="xterm-256color" ''; shellAliases = { - ls = "ls --color=tty"; - l = "ls -CFh"; - la = "ls -Ah"; - ll = "ls -lh" ; - lt = "ls -lct --reverse"; - less = "less -S"; - top = "htop"; - todo = "task todo"; - active = "task active"; + ls = "ls --color=tty"; + l = "ls -CFh"; + la = "ls -Ah"; + ll = "ls -lh"; + lt = "ls -lct --reverse"; + less = "less -S"; + top = "htop"; + todo = "task todo"; + active = "task active"; version = "date '+%Y%m%d%H%M%S'"; - vclip = "xclip -selection clipboard"; - df = "df -h"; + vclip = "xclip -selection clipboard"; + df = "df -h"; timestamp = "date +%Y%m%d%H%M%S"; - nix-search = "nix-env -qaP"; - nix-list = "nix-env -qaP \"*\" --description"; - nix-list-haskell = "nix-env -f \"\" -qaP -A haskellPackages"; - nix-list-node = "nix-env -f \"\" -qaP -A nodePackages"; - nix-list-beam = "nix-env -f \"\" -qaP -A beamPackages"; + nix-search = "nix-env -qaP"; + nix-list = ''nix-env -qaP "*" --description''; + nix-list-haskell = ''nix-env -f "" -qaP -A haskellPackages''; + nix-list-node = ''nix-env -f "" -qaP -A nodePackages''; + nix-list-beam = ''nix-env -f "" -qaP -A beamPackages''; # nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w"; nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/"; @@ -90,90 +90,88 @@ in { # only used to make quick config changes # -------------------------------------- environment.etc."zshcustom/mainuser.zsh".source = - pkgs.writeText "mainuser-zsh" ( - if ( cfg.mainUser != null ) - then - '' - source ${config.users.users.mainUser.home}/.zshrc - '' - else '' # programs.custom.zsh.mainUser not set '' ); + pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then '' + source ${config.users.users.mainUser.home}/.zshrc + '' else + "# programs.custom.zsh.mainUser not set "); # Theme # ----- # make sure powerline-fonts is set in `fonts.fonts` - environment.etc."zshcustom/themes/powerlevel9k".source = pkgs.fetchFromGitHub { - owner = "bhilburn"; - repo = "powerlevel9k"; - rev = "v0.6.4"; - sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5"; - }; - environment.etc."zshcustom/powerlevel9kpatch.zsh".source = pkgs.writeText "powerlevel9kpatch.zsh" '' + environment.etc."zshcustom/themes/powerlevel9k".source = + pkgs.fetchFromGitHub { + owner = "bhilburn"; + repo = "powerlevel9k"; + rev = "v0.6.4"; + sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5"; + }; + environment.etc."zshcustom/powerlevel9kpatch.zsh".source = + pkgs.writeText "powerlevel9kpatch.zsh" '' - # this shows all the colors which are available - # --------------------------------------------- - # for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f" + # this shows all the colors which are available + # --------------------------------------------- + # for code ({000..255}) print -P -- "$code: %F{$code}This is how your text would look like%f" - # prompt elements - # --------------- - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status) - POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() + # prompt elements + # --------------- + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status) + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() - # vi mode - # ------- - POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND="black" - POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND="blue" - POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND="black" - POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND="yellow" + # vi mode + # ------- + POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND="black" + POWERLEVEL9K_VI_MODE_INSERT_BACKGROUND="blue" + POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND="black" + POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND="yellow" - # context - # ------- - POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="green" - POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="008" - POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="008" - POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red" - POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND="008" - POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND="red" + # context + # ------- + POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="green" + POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND="008" + POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND="008" + POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND="red" + POWERLEVEL9K_CONTEXT_REMOTE_FOREGROUND="008" + POWERLEVEL9K_CONTEXT_REMOTE_BACKGROUND="red" - # dir - # --- - POWERLEVEL9K_DIR_HOME_FOREGROUND="black" - POWERLEVEL9K_DIR_HOME_BACKGROUND="yellow" - POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="black" - POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="yellow" - POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="black" - POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="green" + # dir + # --- + POWERLEVEL9K_DIR_HOME_FOREGROUND="black" + POWERLEVEL9K_DIR_HOME_BACKGROUND="yellow" + POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="black" + POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="yellow" + POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="black" + POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="green" - # root_indicator - # -------------- - POWERLEVEL9K_ROOT_ICON="#" - POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black" - POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" + # root_indicator + # -------------- + POWERLEVEL9K_ROOT_ICON="#" + POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black" + POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" - # background_jobs - # --------------- - POWERLEVEL9K_BACKGROUND_JOBS_ICON="" + # background_jobs + # --------------- + POWERLEVEL9K_BACKGROUND_JOBS_ICON="" - # status - # ------ - POWERLEVEL9K_STATUS_OK_BACKGROUND="008" - POWERLEVEL9K_STATUS_ERROR_BACKGROUND="008" + # status + # ------ + POWERLEVEL9K_STATUS_OK_BACKGROUND="008" + POWERLEVEL9K_STATUS_ERROR_BACKGROUND="008" - # time - # ---- - POWERLEVEL9K_TIME_FOREGROUND="008" - POWERLEVEL9K_TIME_BACKGROUND="006" + # time + # ---- + POWERLEVEL9K_TIME_FOREGROUND="008" + POWERLEVEL9K_TIME_BACKGROUND="006" - # jail indicator - # -------------- - POWERLEVEL9K_CUSTOM_JAIL="[ -z $JAIL ] || echo $JAIL" - POWERLEVEL9K_CUSTOM_JAIL_BACKGROUND="red" - POWERLEVEL9K_CUSTOM_JAIL_FOREGROUND="black" + # jail indicator + # -------------- + POWERLEVEL9K_CUSTOM_JAIL="[ -z $JAIL ] || echo $JAIL" + POWERLEVEL9K_CUSTOM_JAIL_BACKGROUND="red" + POWERLEVEL9K_CUSTOM_JAIL_FOREGROUND="black" - ''; + ''; }; } - diff --git a/modules/programs/slack.nix b/modules/programs/slack.nix index cd6457c..90ef624 100644 --- a/modules/programs/slack.nix +++ b/modules/programs/slack.nix @@ -14,72 +14,64 @@ let # --------------------------- command = "${pkgs.slack}/bin/slack"; - desktopFile = - let - name = program; - comment = "Chat Programm"; - in - pkgs.writeTextFile { - name = "${name}.desktop" ; - destination = "/share/applications/${name}.desktop"; - text = '' - [Desktop Entry] - Categories=Application;Utility; - Comment=${comment} - Encoding=UTF-8 - Exec=${bin}/bin/${name} - Icon=gnome-lockscreen - Name=${name} - Terminal=false - Type=Application - ''; - }; - + desktopFile = let + name = program; + comment = "Chat Programm"; + in pkgs.writeTextFile { + name = "${name}.desktop"; + destination = "/share/applications/${name}.desktop"; + text = '' + [Desktop Entry] + Categories=Application;Utility; + Comment=${comment} + Encoding=UTF-8 + Exec=${bin}/bin/${name} + Icon=gnome-lockscreen + Name=${name} + Terminal=false + Type=Application + ''; + }; # the script # ---------- - bin = - let - backupFile = "${cfg.homeBackup}.tar.lzma"; - rolloutFile = "${cfg.home}.tar.lzma"; - lockFile = "${cfg.home}-lock"; - in - pkgs.writeShellScriptBin "${program}" '' - # set -x - if [[ ! -e ${lockFile} ]] - then - # rollout backup - if [[ -e ${backupFile} ]] - then - cp ${backupFile} ${rolloutFile} - sudo -u ${program} ${tarBin} xf ${rolloutFile} --directory ${cfg.home} - rm ${rolloutFile} - touch ${lockFile} - fi - fi + bin = let + backupFile = "${cfg.homeBackup}.tar.lzma"; + rolloutFile = "${cfg.home}.tar.lzma"; + lockFile = "${cfg.home}-lock"; + in pkgs.writeShellScriptBin "${program}" '' + # set -x + if [[ ! -e ${lockFile} ]] + then + # rollout backup + if [[ -e ${backupFile} ]] + then + cp ${backupFile} ${rolloutFile} + sudo -u ${program} ${tarBin} xf ${rolloutFile} --directory ${cfg.home} + rm ${rolloutFile} + touch ${lockFile} + fi + fi - sudo -u ${program} ${command} - ''; + sudo -u ${program} ${command} + ''; + backupScript = pkgs.writeShellScriptBin "${program}-backup" '' + sudo -u ${program} \ + ${tarBin} \ + --exclude=.cache \ + --exclude=".config/**/*Cache*" \ + --exclude-cache-all \ + --exclude=Downloads \ + --create \ + --verbos \ + --lzma \ + --file ${cfg.home}.tar.lzma \ + --directory ${cfg.home} \ + . - - backupScript = - pkgs.writeShellScriptBin "${program}-backup" '' - sudo -u ${program} \ - ${tarBin} \ - --exclude=.cache \ - --exclude=".config/**/*Cache*" \ - --exclude-cache-all \ - --exclude=Downloads \ - --create \ - --verbos \ - --lzma \ - --file ${cfg.home}.tar.lzma \ - --directory ${cfg.home} \ - . - - cp ${cfg.home}.tar.lzma ${cfg.homeBackup}.tar.lzma - ''; + cp ${cfg.home}.tar.lzma ${cfg.homeBackup}.tar.lzma + ''; cfg = config.programs.custom.slack; @@ -89,7 +81,7 @@ in { enable = mkEnableOption "install slack"; homeBackup = mkOption { - type = with types; nullOr string; + type = with types; nullOr string; description = '' folder where to backup ''; @@ -97,7 +89,7 @@ in { # todo : make sure the folder /home/sudoers belongs to mainUser home = mkOption { - type = with types; string; + type = with types; string; default = "/home/sudoers/slack"; description = '' home folder of this @@ -108,28 +100,23 @@ in { config = mkIf cfg.enable { - security.sudo.extraConfig = - '' - ${config.users.users.mainUser.name} ALL=(${program}) NOPASSWD: ALL - ''; + security.sudo.extraConfig = '' + ${config.users.users.mainUser.name} ALL=(${program}) NOPASSWD: ALL + ''; # create users users.users."${program}" = { - home = cfg.home; - createHome = true; - # initialPassword = "${program}"; - shell = pkgs.bashInteractive; - isNormalUser = true; - group = "users"; - # enable video usage - extraGroups = [ "video" "audio" ]; + home = cfg.home; + createHome = true; + # initialPassword = "${program}"; + shell = pkgs.bashInteractive; + isNormalUser = true; + group = "users"; + # enable video usage + extraGroups = [ "video" "audio" ]; }; - environment.systemPackages = [ - bin - backupScript - desktopFile - ]; + environment.systemPackages = [ bin backupScript desktopFile ]; }; } diff --git a/modules/programs/steam.nix b/modules/programs/steam.nix index 91b3db0..c3ae26d 100644 --- a/modules/programs/steam.nix +++ b/modules/programs/steam.nix @@ -29,9 +29,9 @@ in { users.users.steam = { isNormalUser = true; - home = "/home/steam"; - createHome = true; - extraGroups = [ "audio" "input" "video" ]; + home = "/home/steam"; + createHome = true; + extraGroups = [ "audio" "input" "video" ]; }; # for steam diff --git a/modules/programs/taskwarrior.nix b/modules/programs/taskwarrior.nix index 0c76d14..26c44e0 100644 --- a/modules/programs/taskwarrior.nix +++ b/modules/programs/taskwarrior.nix @@ -6,21 +6,24 @@ let cfg = config.programs.custom.taskwarrior; - taskNextWeek = pkgs.writeShellScriptBin "taskweek" /* sh */ '' - ${pkgs.taskwarrior}/bin/task \ - export \ - status:pending and \( due.before:6days \) \ - | ${pkgs.jq}/bin/jq '[.[] | { Day: .due, ID: .id, Description: .description } ] | sort_by(.Day)' \ - | ${pkgs.miller}/bin/mlr --ijson --opprint put "\$Day = strftime(strptime(\$Day,\"%Y%m%dT%H%M%SZ\")$(date +%z)00,\"%A\")" - ''; + taskNextWeek = pkgs.writeShellScriptBin "taskweek" # sh + '' + ${pkgs.taskwarrior}/bin/task \ + export \ + status:pending and \( due.before:6days \) \ + | ${pkgs.jq}/bin/jq '[.[] | { Day: .due, ID: .id, Description: .description } ] | sort_by(.Day)' \ + | ${pkgs.miller}/bin/mlr --ijson --opprint put "\$Day = strftime(strptime(\$Day,\"%Y%m%dT%H%M%SZ\")$(date +%z)00,\"%A\")" + ''; - tsak = pkgs.writeShellScriptBin "tsak" /* sh */ '' - ${pkgs.taskwarrior}/bin/task "$@" - ''; + tsak = pkgs.writeShellScriptBin "tsak" # sh + '' + ${pkgs.taskwarrior}/bin/task "$@" + ''; in { - options.programs.custom.taskwarrior.enable = mkEnableOption "Enable Taskwarrior services"; + options.programs.custom.taskwarrior.enable = + mkEnableOption "Enable Taskwarrior services"; config = mkIf cfg.enable { diff --git a/modules/programs/urxvt.nix b/modules/programs/urxvt.nix index 54c900f..3e58175 100644 --- a/modules/programs/urxvt.nix +++ b/modules/programs/urxvt.nix @@ -13,15 +13,15 @@ in { enable = mkEnableOption "configure and enable urxvt"; fontSize = mkOption { - type = types.int; - default = 17; + type = types.int; + default = 17; description = '' size of the terminal font ''; }; colorTheme = mkOption { - type = types.enum[ "dark" "light" ]; + type = types.enum [ "dark" "light" ]; default = "dark"; description = '' solarized color theme @@ -64,31 +64,44 @@ in { ''; "X11/Xresource.d/urxvt-font".source = let - fontFamily = "terminus"; - normalFont = fontSize: "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - boldFont = fontSize: "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - italicFont = normalFont; - itallicBoldFont = boldFont; - backupFont = fontSize: "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; + fontFamily = "terminus"; + normalFont = fontSize: + "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + boldFont = fontSize: + "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + italicFont = normalFont; + itallicBoldFont = boldFont; + backupFont = fontSize: + "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; - fontCommand = key: fontSize: '' - URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${backupFont fontSize}\007\033]711;${boldFont fontSize},${backupFont fontSize}\007 - ''; + fontCommand = key: fontSize: '' + URxvt.keysym.M-${key}: command:\033]710;${normalFont fontSize},${ + backupFont fontSize + }\007\033]711;${boldFont fontSize},${backupFont fontSize}\007 + ''; - in pkgs.writeText "Xresource-urxvt-font" '' + in pkgs.writeText "Xresource-urxvt-font" '' URxvt.allow_bold: true URxvt.xftAntialias: true !! use xfontsel or fontmatrix to choose line - !URxvt.font: ${normalFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.boldFont: ${boldFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.italicFont: ${italicFont cfg.fontSize},${backupFont cfg.fontSize} - !URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${backupFont cfg.fontSize} + !URxvt.font: ${normalFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !URxvt.boldFont: ${boldFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !URxvt.italicFont: ${italicFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize},${ + backupFont cfg.fontSize + } - URxvt.font: ${normalFont cfg.fontSize} - URxvt.boldFont: ${boldFont cfg.fontSize} - URxvt.italicFont: ${italicFont cfg.fontSize} + URxvt.font: ${normalFont cfg.fontSize} + URxvt.boldFont: ${boldFont cfg.fontSize} + URxvt.italicFont: ${italicFont cfg.fontSize} URxvt.bolditalicFont: ${itallicBoldFont cfg.fontSize} ${fontCommand "F1" cfg.fontSize} @@ -97,26 +110,25 @@ in { ${fontCommand "F4" (cfg.fontSize + 20)} ''; - "X11/Xresource.d/urxvt-colors".source = - let + "X11/Xresource.d/urxvt-colors".source = let colorTheme = if (cfg.colorTheme == "dark") then '' - #define S_base03 #002b36 - #define S_base02 #073642 - #define S_base01 #586e75 - #define S_base00 #657b83 - #define S_base0 #839496 - #define S_base1 #93a1a1 - #define S_base2 #eee8d5 - #define S_base3 #fdf6e3 + #define S_base03 #002b36 + #define S_base02 #073642 + #define S_base01 #586e75 + #define S_base00 #657b83 + #define S_base0 #839496 + #define S_base1 #93a1a1 + #define S_base2 #eee8d5 + #define S_base3 #fdf6e3 '' else '' - #define S_base03 #fdf6e3 - #define S_base02 #eee8d5 - #define S_base01 #93a1a1 - #define S_base00 #839496 - #define S_base0 #657b83 - #define S_base1 #586e75 - #define S_base2 #073642 - #define S_base3 #002b36 + #define S_base03 #fdf6e3 + #define S_base02 #eee8d5 + #define S_base01 #93a1a1 + #define S_base00 #839496 + #define S_base0 #657b83 + #define S_base1 #586e75 + #define S_base2 #073642 + #define S_base3 #002b36 ''; in pkgs.writeText "Xresource-urxvt-colors" '' @@ -166,4 +178,3 @@ in { }; } - diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index 2faa1af..6bf88bd 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -5,313 +5,314 @@ let cfg = config.programs.custom.vim; nix-xptemplates = pkgs.writeTextFile { - name = "nix-xptemplates"; + name = "nix-xptemplates"; destination = "/ftplugin/nix/nix.xpt.vim"; - text = /* vim */ '' -XPTemplate priority=personal + text = # vim + '' + XPTemplate priority=personal -XPT option " tips -`name^ = mkOption { - type = with types; `type^; - description = ${"''"} - `cursor^ - ${"''"}; -}; + XPT option " tips + `name^ = mkOption { + type = with types; `type^; + description = ${"''"} + `cursor^ + ${"''"}; + }; -XPT package " tips -{ config, lib, ... }: -{ - `cursor^ -} + XPT package " tips + { config, lib, ... }: + { + `cursor^ + } -XPT terranix" tips -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.`name^; -in { + XPT terranix" tips + { config, lib, pkgs, ... }: + with lib; + let + cfg = config.`name^; + in { - options.`name^ = mkOption { - default = {}; - type = with types; attrsOf (submodule ({ name, ... }:{ - options = { - enable = mkEnableOption "`name^.name"; - }; - })); + options.`name^ = mkOption { + default = {}; + type = with types; attrsOf (submodule ({ name, ... }:{ + options = { + enable = mkEnableOption "`name^.name"; + }; + })); + }; + + config = + let + allConfigs = cfg + in + mkIf (cfg != {} ){ + `cursor^ + }; + } + + XPT module " tips + { config, lib, pkgs, ... }: + + with lib; + + let + + cfg = config.`name^; + + in { + + options.`name^ = { + enable = mkEnableOption "enable `name^"; + }; + + config = mkIf cfg.enable { + `cursor^ + }; + } + + XPT shell " tips + { pkgs ? import {} }: + pkgs.mkShell { + + # needed pkgs + # ----------- + buildInputs = with pkgs; [ + `name^ + ]; + + # run this on start + # ----------------- + shellHook = ${"''"} + HISTFILE=${"$"}{toString ./.}/.history + ${"''"}; + } + + XPT fhsUser " tips + { pkgs ? import {} }: + (pkgs.buildFHSUserEnv { + name = "fhs-user-env"; + + targetPkgs = pkgs: with pkgs; [ + # core stuff + # ---------- + vim silver-searcher curl coreutils git tig + + # common X dependencies + # --------------------- + atk cairo dbus eudev expat fontconfig freetype gdk_pixbuf glib gnome3.GConf gtk2-x11 + mesa_glu nspr nss pango xlibs.libXScrnSaver xlibs.libXcomposite xlibs.libXcursor + xlibs.libXdamage xlibs.libXfixes xlibs.libXi xlibs.libXrender xlibs.libXtst xorg.libX11 + xorg.libXext xorg.libXinerama xorg.libxcb + liblo zlib fftw minixml libcxx alsaLib glibc + + # new stuff + # --------- + `cursor^ + + ]; + + # multilib packages + # ----------------- + # these are packages compiled 32bit and 64bit + multiPkgs = pkgs: with pkgs; [ + ]; + + # environment variables + # --------------------- + profile = ${"''"} + export TERM="xterm" + ${"''"}; + + }).env + + ''; }; - config = - let - allConfigs = cfg - in - mkIf (cfg != {} ){ - `cursor^ - }; -} - -XPT module " tips -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.`name^; - -in { - - options.`name^ = { - enable = mkEnableOption "enable `name^"; - }; - - config = mkIf cfg.enable { - `cursor^ - }; -} - -XPT shell " tips -{ pkgs ? import {} }: -pkgs.mkShell { - - # needed pkgs - # ----------- - buildInputs = with pkgs; [ - `name^ - ]; - - # run this on start - # ----------------- - shellHook = ${"''"} - HISTFILE=${"$"}{toString ./.}/.history - ${"''"}; -} - -XPT fhsUser " tips -{ pkgs ? import {} }: -(pkgs.buildFHSUserEnv { -name = "fhs-user-env"; - -targetPkgs = pkgs: with pkgs; [ - # core stuff - # ---------- - vim silver-searcher curl coreutils git tig - - # common X dependencies - # --------------------- - atk cairo dbus eudev expat fontconfig freetype gdk_pixbuf glib gnome3.GConf gtk2-x11 - mesa_glu nspr nss pango xlibs.libXScrnSaver xlibs.libXcomposite xlibs.libXcursor - xlibs.libXdamage xlibs.libXfixes xlibs.libXi xlibs.libXrender xlibs.libXtst xorg.libX11 - xorg.libXext xorg.libXinerama xorg.libxcb - liblo zlib fftw minixml libcxx alsaLib glibc - - # new stuff - # --------- - `cursor^ - -]; - -# multilib packages -# ----------------- -# these are packages compiled 32bit and 64bit -multiPkgs = pkgs: with pkgs; [ -]; - -# environment variables -# --------------------- -profile = ${"''"} - export TERM="xterm" - ${"''"}; - -}).env - - ''; - }; - vim-tv-plugin = with lib; ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { - "/syntax/haskell.vim".text = /* vim */ '' - syn region String start=+\[[[:alnum:]]*|+ end=+|]+ + "/syntax/haskell.vim".text = # vim + '' + syn region String start=+\[[[:alnum:]]*|+ end=+|]+ - hi link ConId Identifier - hi link VarId Identifier - hi link hsDelimiter Delimiter - ''; - "/syntax/nix.vim".text = /* vim */ '' - "" Quit when a (custom) syntax file was already loaded - "if exists("b:current_syntax") - " finish - "endif + hi link ConId Identifier + hi link VarId Identifier + hi link hsDelimiter Delimiter + ''; + "/syntax/nix.vim".text = # vim + '' + "" Quit when a (custom) syntax file was already loaded + "if exists("b:current_syntax") + " finish + "endif - "setf nix + "setf nix - " Ref - syn match NixID /[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/ - syn match NixINT /\<[0-9]\+\>/ - syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match NixSPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ - syn match NixURI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ - syn region NixSTRING - \ matchgroup=NixSTRING - \ start='"' - \ skip='\\"' - \ end='"' - syn region NixIND_STRING - \ matchgroup=NixIND_STRING - \ start="'''" - \ skip="'''\('\|[$]\|\\[nrt]\)" - \ end="'''" - - syn match NixOther /[-!+&<>|():/;=.,?\[\]*@]/ - - syn match NixCommentMatch /\(^\|\s\)#.*/ - syn region NixCommentRegion start="/\*" end="\*/" - - hi link NixCode Statement - hi link NixData Constant - hi link NixComment Comment - - hi link NixCommentMatch NixComment - hi link NixCommentRegion NixComment - hi link NixID NixCode - hi link NixINT NixData - hi link NixPATH NixData - hi link NixHPATH NixData - hi link NixSPATH NixData - hi link NixURI NixData - hi link NixSTRING NixData - hi link NixIND_STRING NixData - - hi link NixEnter NixCode - hi link NixOther NixCode - hi link NixQuote NixData - - syn cluster nix_has_dollar_curly contains=@nix_ind_strings,@nix_strings - syn cluster nix_ind_strings contains=NixIND_STRING - syn cluster nix_strings contains=NixSTRING - - ${concatStringsSep "\n" (mapAttrsToList (name: { - extraStart ? null, - lang ? name - }: - let - startAlts = filter isString [ - ''/\* ${name} \*/'' - extraStart - ]; - sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*''; - in /* vim */ '' - syn include @nix_${lang}_syntax syntax/${lang}.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - - syn match nix_${lang}_sigil - \ X${replaceStrings ["X"] ["\\X"] sigil}\ze\('''\|"\)X - \ nextgroup=nix_${lang}_region_IND_STRING,nix_${lang}_region_STRING - \ transparent - - syn region nix_${lang}_region_STRING + " Ref + syn match NixID /[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/ + syn match NixINT /\<[0-9]\+\>/ + syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixSPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ + syn match NixURI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ + syn region NixSTRING \ matchgroup=NixSTRING \ start='"' \ skip='\\"' \ end='"' - \ contained - \ contains=@nix_${lang}_syntax - \ transparent - - syn region nix_${lang}_region_IND_STRING + syn region NixIND_STRING \ matchgroup=NixIND_STRING \ start="'''" \ skip="'''\('\|[$]\|\\[nrt]\)" \ end="'''" - \ contained - \ contains=@nix_${lang}_syntax + + syn match NixOther /[-!+&<>|():/;=.,?\[\]*@]/ + + syn match NixCommentMatch /\(^\|\s\)#.*/ + syn region NixCommentRegion start="/\*" end="\*/" + + hi link NixCode Statement + hi link NixData Constant + hi link NixComment Comment + + hi link NixCommentMatch NixComment + hi link NixCommentRegion NixComment + hi link NixID NixCode + hi link NixINT NixData + hi link NixPATH NixData + hi link NixHPATH NixData + hi link NixSPATH NixData + hi link NixURI NixData + hi link NixSTRING NixData + hi link NixIND_STRING NixData + + hi link NixEnter NixCode + hi link NixOther NixCode + hi link NixQuote NixData + + syn cluster nix_has_dollar_curly contains=@nix_ind_strings,@nix_strings + syn cluster nix_ind_strings contains=NixIND_STRING + syn cluster nix_strings contains=NixSTRING + + ${concatStringsSep "\n" (mapAttrsToList (name: + { extraStart ? null, lang ? name }: + let + startAlts = filter isString [ "/\\* ${name} \\*/" extraStart ]; + sigil = "\\(${concatStringsSep "\\|" startAlts}\\)[ \\t\\r\\n]*"; + # vim + in '' + syn include @nix_${lang}_syntax syntax/${lang}.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif + + syn match nix_${lang}_sigil + \ X${replaceStrings [ "X" ] [ "\\X" ] sigil}\ze\('''\|"\)X + \ nextgroup=nix_${lang}_region_IND_STRING,nix_${lang}_region_STRING + \ transparent + + syn region nix_${lang}_region_STRING + \ matchgroup=NixSTRING + \ start='"' + \ skip='\\"' + \ end='"' + \ contained + \ contains=@nix_${lang}_syntax + \ transparent + + syn region nix_${lang}_region_IND_STRING + \ matchgroup=NixIND_STRING + \ start="'''" + \ skip="'''\('\|[$]\|\\[nrt]\)" + \ end="'''" + \ contained + \ contains=@nix_${lang}_syntax + \ transparent + + syn cluster nix_ind_strings + \ add=nix_${lang}_region_IND_STRING + + syn cluster nix_strings + \ add=nix_${lang}_region_STRING + + " This is required because containedin isn't transitive. + syn cluster nix_has_dollar_curly + \ add=@nix_${lang}_syntax + '') { + c = { }; + cabal = { }; + diff = { }; + haskell = { }; + python = { }; + lua = { }; + sed.extraStart = ''writeSed[^ \t\r\n]*[ \t\r\n]*"[^"]*"''; + sh.extraStart = concatStringsSep "\\|" [ + '' + write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'' + "[a-z]*Phase[ \\t\\r\\n]*=" + ]; + yaml = { }; + vim.extraStart = '' + write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; + xdefaults = { }; + })} + + " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. + syn clear shVarAssign + + syn region nixINSIDE_DOLLAR_CURLY + \ matchgroup=NixEnter + \ start="[$]{" + \ end="}" + \ contains=TOP + \ containedin=@nix_has_dollar_curly \ transparent - syn cluster nix_ind_strings - \ add=nix_${lang}_region_IND_STRING + syn region nix_inside_curly + \ matchgroup=NixEnter + \ start="{" + \ end="}" + \ contains=TOP + \ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly + \ transparent - syn cluster nix_strings - \ add=nix_${lang}_region_STRING + syn match NixQuote /'''\($\|\\.\)/he=s+2 + \ containedin=@nix_ind_strings + \ contained - " This is required because containedin isn't transitive. - syn cluster nix_has_dollar_curly - \ add=@nix_${lang}_syntax - '') { - c = {}; - cabal = {}; - diff = {}; - haskell = {}; - python = {}; - lua = {}; - sed.extraStart = ''writeSed[^ \t\r\n]*[ \t\r\n]*"[^"]*"''; - sh.extraStart = concatStringsSep ''\|'' [ - ''write\(A\|Ba\|Da\)sh[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'' - ''[a-z]*Phase[ \t\r\n]*='' - ]; - yaml = {}; - vim.extraStart = - ''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; - xdefaults = {}; - })} + syn match NixQuote /'''\('\|\\.\)/he=s+1 + \ containedin=@nix_ind_strings + \ contained - " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. - syn clear shVarAssign + syn match NixQuote /\\./he=s+1 + \ containedin=@nix_strings + \ contained - syn region nixINSIDE_DOLLAR_CURLY - \ matchgroup=NixEnter - \ start="[$]{" - \ end="}" - \ contains=TOP - \ containedin=@nix_has_dollar_curly - \ transparent + syn sync fromstart - syn region nix_inside_curly - \ matchgroup=NixEnter - \ start="{" - \ end="}" - \ contains=TOP - \ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly - \ transparent + let b:current_syntax = "nix" - syn match NixQuote /'''\(''$\|\\.\)/he=s+2 - \ containedin=@nix_ind_strings - \ contained - - syn match NixQuote /'''\('\|\\.\)/he=s+1 - \ containedin=@nix_ind_strings - \ contained - - syn match NixQuote /\\./he=s+1 - \ containedin=@nix_strings - \ contained - - syn sync fromstart - - let b:current_syntax = "nix" - - set isk=@,48-57,_,192-255,-,' - ''; - "/syntax/sed.vim".text = /* vim */ '' - syn region sedBranch - \ matchgroup=sedFunction start="T" - \ matchgroup=sedSemicolon end=";\|$" - \ contains=sedWhitespace - ''; + set isk=@,48-57,_,192-255,-,' + ''; + "/syntax/sed.vim".text = # vim + '' + syn region sedBranch + \ matchgroup=sedFunction start="T" + \ matchgroup=sedSemicolon end=";\|$" + \ contains=sedWhitespace + ''; })); - # active plugins # -------------- - extra-runtimepath = with pkgs; lib.concatMapStringsSep "," (pkg: "${pkg.rtp}") [ - vimPlugins.Syntastic - vimPlugins.ack-vim - vimPlugins.airline - vimPlugins.vim-nix - vimPlugins.xptemplate - vim-tv-plugin - ]; + extra-runtimepath = with pkgs; + lib.concatMapStringsSep "," (pkg: "${pkg.rtp}") [ + vimPlugins.Syntastic + vimPlugins.ack-vim + vimPlugins.airline + vimPlugins.vim-nix + vimPlugins.xptemplate + vim-tv-plugin + ]; # the vimrc # --------- @@ -392,9 +393,7 @@ in { # install vim # ----------- - environment.systemPackages = [ - pkgs.vim - ]; + environment.systemPackages = [ pkgs.vim ]; }; } diff --git a/modules/programs/xterm.nix b/modules/programs/xterm.nix index 3b1bda3..33968ec 100644 --- a/modules/programs/xterm.nix +++ b/modules/programs/xterm.nix @@ -8,17 +8,17 @@ let in { - options.programs.custom.xterm= { + options.programs.custom.xterm = { enable = mkEnableOption "configure and enable urxvt"; fontSize = mkOption { - type = types.int; - default = 17; + type = types.int; + default = 17; description = '' size of the terminal font ''; }; colorTheme = mkOption { - type = types.enum[ "dark" "light" ]; + type = types.enum [ "dark" "light" ]; default = "dark"; description = '' solarized color theme @@ -32,113 +32,120 @@ in { environment.etc = { - "X11/Xresource.d/xterm".source = pkgs.writeText "Xresource-xterm" '' + "X11/Xresource.d/xterm".source = pkgs.writeText "Xresource-xterm" '' - XTerm*termName: xterm-256color - XTerm*selectToClipboard: true + XTerm*termName: xterm-256color + XTerm*selectToClipboard: true - XTerm.*.bellIsUrgent: true + XTerm.*.bellIsUrgent: true - ''; - - "X11/Xresource.d/xterm-font".source = let - fontFamily = "terminus"; - normalFont = fontSize: "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - boldFont = fontSize: "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; - italicFont = normalFont; - itallicBoldFont = boldFont; - backupFont = fontSize: "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; - in pkgs.writeText "Xresource-xterm-font" '' - - XTerm.allow_bold: true - XTerm.xftAntialias: true - - !! use xfontsel or fontmatrix to choose line - !XTerm.*.font: ${normalFont cfg.fontSize},${backupFont cfg.fontSize} - !XTerm.*.boldFont: ${boldFont cfg.fontSize},${backupFont cfg.fontSize} - !XTerm.*.italicFont: ${italicFont cfg.fontSize},${backupFont cfg.fontSize} - !XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize},${backupFont cfg.fontSize} - - XTerm.*.font: ${normalFont cfg.fontSize} - XTerm.*.boldFont: ${boldFont cfg.fontSize} - XTerm.*.italicFont: ${italicFont cfg.fontSize} - XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize} - ''; - - - "X11/Xresource.d/xterm-colors".source = - let - colorTheme = if (cfg.colorTheme == "dark") then '' - #define S_base03 #002b36 - #define S_base02 #073642 - #define S_base01 #586e75 - #define S_base00 #657b83 - #define S_base0 #839496 - #define S_base1 #93a1a1 - #define S_base2 #eee8d5 - #define S_base3 #fdf6e3 - - '' - else '' - #define S_base03 #fdf6e3 - #define S_base02 #eee8d5 - #define S_base01 #93a1a1 - #define S_base00 #839496 - #define S_base0 #657b83 - #define S_base1 #586e75 - #define S_base2 #073642 - #define S_base3 #002b36 ''; - in pkgs.writeText "Xresource-xterm-colors" '' + "X11/Xresource.d/xterm-font".source = let + fontFamily = "terminus"; + normalFont = fontSize: + "-*-${fontFamily}-medium-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + boldFont = fontSize: + "-*-${fontFamily}-bold-*-*-*-${toString fontSize}-*-*-*-*-*-*-*"; + italicFont = normalFont; + itallicBoldFont = boldFont; + backupFont = fontSize: + "xft:TerminessTTF Nerd Font:pixelsize=${toString fontSize}"; + in pkgs.writeText "Xresource-xterm-font" '' - !! Color Configuration - !! ------------------- + XTerm.allow_bold: true + XTerm.xftAntialias: true - !! Common - !! ------ - #define S_yellow #b58900 - #define S_orange #cb4b16 - #define S_red #dc322f - #define S_magenta #d33682 - #define S_violet #6c71c4 - #define S_blue #268bd2 - #define S_cyan #2aa198 - #define S_green #859900 + !! use xfontsel or fontmatrix to choose line + !XTerm.*.font: ${normalFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !XTerm.*.boldFont: ${boldFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !XTerm.*.italicFont: ${italicFont cfg.fontSize},${ + backupFont cfg.fontSize + } + !XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize},${ + backupFont cfg.fontSize + } - !! ColorTheme - !! ---------- - ${colorTheme} + XTerm.*.font: ${normalFont cfg.fontSize} + XTerm.*.boldFont: ${boldFont cfg.fontSize} + XTerm.*.italicFont: ${italicFont cfg.fontSize} + XTerm.*.bolditalicFont: ${itallicBoldFont cfg.fontSize} + ''; - XTerm*background: S_base03 - XTerm*foreground: S_base0 - XTerm*fading: 40 - XTerm*fadeColor: S_base03 - XTerm*cursorColor: S_base1 - XTerm*pointerColorBackground: S_base01 - XTerm*pointerColorForeground: S_base1 + "X11/Xresource.d/xterm-colors".source = let + colorTheme = if (cfg.colorTheme == "dark") then '' + #define S_base03 #002b36 + #define S_base02 #073642 + #define S_base01 #586e75 + #define S_base00 #657b83 + #define S_base0 #839496 + #define S_base1 #93a1a1 + #define S_base2 #eee8d5 + #define S_base3 #fdf6e3 - XTerm*color0: S_base02 - XTerm*color1: S_red - XTerm*color2: S_green - XTerm*color3: S_yellow - XTerm*color4: S_blue - XTerm*color5: S_magenta - XTerm*color6: S_cyan - XTerm*color7: S_base2 - XTerm*color9: S_orange - XTerm*color8: S_base03 - XTerm*color10: S_base01 - XTerm*color11: S_base00 - XTerm*color12: S_base0 - XTerm*color13: S_violet - XTerm*color14: S_base1 - XTerm*color15: S_base3 - ''; + '' else '' + #define S_base03 #fdf6e3 + #define S_base02 #eee8d5 + #define S_base01 #93a1a1 + #define S_base00 #839496 + #define S_base0 #657b83 + #define S_base1 #586e75 + #define S_base2 #073642 + #define S_base3 #002b36 + ''; - }; + in pkgs.writeText "Xresource-xterm-colors" '' + + !! Color Configuration + !! ------------------- + + !! Common + !! ------ + #define S_yellow #b58900 + #define S_orange #cb4b16 + #define S_red #dc322f + #define S_magenta #d33682 + #define S_violet #6c71c4 + #define S_blue #268bd2 + #define S_cyan #2aa198 + #define S_green #859900 + + !! ColorTheme + !! ---------- + ${colorTheme} + + XTerm*background: S_base03 + XTerm*foreground: S_base0 + XTerm*fading: 40 + XTerm*fadeColor: S_base03 + XTerm*cursorColor: S_base1 + XTerm*pointerColorBackground: S_base01 + XTerm*pointerColorForeground: S_base1 + + XTerm*color0: S_base02 + XTerm*color1: S_red + XTerm*color2: S_green + XTerm*color3: S_yellow + XTerm*color4: S_blue + XTerm*color5: S_magenta + XTerm*color6: S_cyan + XTerm*color7: S_base2 + XTerm*color9: S_orange + XTerm*color8: S_base03 + XTerm*color10: S_base01 + XTerm*color11: S_base00 + XTerm*color12: S_base0 + XTerm*color13: S_violet + XTerm*color14: S_base1 + XTerm*color15: S_base3 + ''; + + }; }; } - diff --git a/modules/services/castget.nix b/modules/services/castget.nix index b84a461..d660ed0 100644 --- a/modules/services/castget.nix +++ b/modules/services/castget.nix @@ -11,47 +11,46 @@ in { options.custom.services.castget = { enable = mkEnableOption "enable custom.services.castget"; feeds = mkOption { - type = with types; attrsOf (submodule { - options = { - url = mkOption { - type = with types; str; - description = '' - url to the rss feed - ''; + type = with types; + attrsOf (submodule { + options = { + url = mkOption { + type = with types; str; + description = '' + url to the rss feed + ''; + }; + spool = mkOption { + type = with types; path; + description = '' + download enclosures to this directory. + ''; + }; }; - spool = mkOption { - type = with types; path; - description = '' - download enclosures to this directory. - ''; - }; - }; - }); + }); description = '' configurations for the cast ''; }; user = mkOption { - type = with types; string; + type = with types; string; description = '' user to run the systemd service as ''; }; timerConfig = mkOption { type = with types; attrsOf str; - default = { - OnCalendar = "daily"; - }; + default = { OnCalendar = "daily"; }; example = { OnCalendar = "00:05"; RandomizedDelaySec = "5h"; }; description = '' When to run the polling script. See man systemd.timer for details. - ''; + ''; }; serviceName = mkOption { - type = with types; string; + type = with types; string; default = "castget"; description = '' the name of the castget systemd service @@ -68,27 +67,25 @@ in { restartIfChanged = false; serviceConfig.User = cfg.user; - preStart = - let - mkSpools = mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds; - in - concatStringsSep "\n" mkSpools; - script = - let - channels = mapAttrsToList (key: ignore: key) cfg.feeds; - castget = "${pkgs.castget}/bin/castget"; + preStart = let + mkSpools = + mapAttrsToList (ignore: value: "mkdir -p ${value.spool}") cfg.feeds; + in concatStringsSep "\n" mkSpools; + script = let + channels = mapAttrsToList (key: ignore: key) cfg.feeds; + castget = "${pkgs.castget}/bin/castget"; - configurationFile = - let - configurations = mapAttrsToList (key: value: '' - [${key}] - url=${value.url} - spool=${value.spool} - '') cfg.feeds; - in - (pkgs.writeText "castget-configuration" (concatStringsSep "" configurations)); - in - (concatMapStringsSep "\n" (channel: "${castget} --rcfile ${configurationFile} ${channel}") channels); + configurationFile = let + configurations = mapAttrsToList (key: value: '' + [${key}] + url=${value.url} + spool=${value.spool} + '') cfg.feeds; + in (pkgs.writeText "castget-configuration" + (concatStringsSep "" configurations)); + in (concatMapStringsSep "\n" + (channel: "${castget} --rcfile ${configurationFile} ${channel}") + channels); }; systemd.timers."${cfg.serviceName}" = { diff --git a/modules/services/home-assistant.nix b/modules/services/home-assistant.nix index 71af009..a6a51f9 100644 --- a/modules/services/home-assistant.nix +++ b/modules/services/home-assistant.nix @@ -10,265 +10,271 @@ in { options.services.homeAssistantConfig = mkOption { default = null; - type = with types; nullOr (submodule { options = { - group = mkOption { - default = null; - example = { schlafzimmer = { view = false; entities = [ "switch.pal01" ]; }; }; - type = with types; nullOr (attrsOf ( submodule { - options = { - name = mkOption { - default = null; - type = with types; nullOr str; - description = '' - (string)(Optional)Name of the group. - ''; - }; - view = mkOption { - default = false; - type = with types; bool; - description = '' - (boolean)(Optional)If yes then the entry will be shown as a view (tab) at the top. Groups that are set to view: true cannot be used as entities in other views. - ''; - }; - icon = mkOption { - default = null; - type = with types; nullOr str; - description = '' - (string)(Optional)If the group is a view, this icon will show at the top in the frontend instead of the name. If the group is a view and both name and icon have been specified, the icon will appear at the top of the frontend and the name will be displayed as the mouse-over text. If it’s not a view, then the icon shows when this group is used in another group. - ''; - }; - control = mkOption { - default = null; - type = with types; nullOr str; - description = '' - (string)(Optional)Set value to hidden. If hidden then the group switch will be hidden. - ''; - }; - entities = mkOption { - type = with types; listOf str; - description = '' - (list)(Required)Array or comma delimited string, list of entities to group. - ''; - }; - all = mkOption { - default = true; - type = with types; bool; - description = '' - (boolean)(Optional)Set this to true if the group state should only turn on if all grouped entities are on. - ''; - }; - - }; - })); - }; - homeassistant = mkOption { - type = with types; (submodule { options = { - name = mkOption { - default = "Home"; - type = with types; str; - }; - time_zone = mkOption { - default = config.time.timeZone; - type = with types; str; - }; - latitude = mkOption { - default = 52.464031; - type = with types; float; - }; - longitude = mkOption { - default = 13.381925; - type = with types; float; - }; - elevation = mkOption { - default = 34; - type = with types; int; - }; - unit_system = mkOption { - default = "metric"; - type = with types; str; - }; - whitelist_external_dirs = mkOption { + type = with types; + nullOr (submodule { + options = { + group = mkOption { default = null; - type = with types; nullOr (listOf str); + example = { + schlafzimmer = { + view = false; + entities = [ "switch.pal01" ]; + }; + }; + type = with types; + nullOr (attrsOf (submodule { + options = { + name = mkOption { + default = null; + type = with types; nullOr str; + description = '' + (string)(Optional)Name of the group. + ''; + }; + view = mkOption { + default = false; + type = with types; bool; + description = '' + (boolean)(Optional)If yes then the entry will be shown as a view (tab) at the top. Groups that are set to view: true cannot be used as entities in other views. + ''; + }; + icon = mkOption { + default = null; + type = with types; nullOr str; + description = '' + (string)(Optional)If the group is a view, this icon will show at the top in the frontend instead of the name. If the group is a view and both name and icon have been specified, the icon will appear at the top of the frontend and the name will be displayed as the mouse-over text. If it’s not a view, then the icon shows when this group is used in another group. + ''; + }; + control = mkOption { + default = null; + type = with types; nullOr str; + description = '' + (string)(Optional)Set value to hidden. If hidden then the group switch will be hidden. + ''; + }; + entities = mkOption { + type = with types; listOf str; + description = '' + (list)(Required)Array or comma delimited string, list of entities to group. + ''; + }; + all = mkOption { + default = true; + type = with types; bool; + description = '' + (boolean)(Optional)Set this to true if the group state should only turn on if all grouped entities are on. + ''; + }; + + }; + })); }; - auth_providers = mkOption { + homeassistant = mkOption { + type = with types; + (submodule { + options = { + name = mkOption { + default = "Home"; + type = with types; str; + }; + time_zone = mkOption { + default = config.time.timeZone; + type = with types; str; + }; + latitude = mkOption { + default = 52.464031; + type = with types; float; + }; + longitude = mkOption { + default = 13.381925; + type = with types; float; + }; + elevation = mkOption { + default = 34; + type = with types; int; + }; + unit_system = mkOption { + default = "metric"; + type = with types; str; + }; + whitelist_external_dirs = mkOption { + default = null; + type = with types; nullOr (listOf str); + }; + auth_providers = mkOption { + default = null; + type = with types; nullOr (listOf attrs); + }; + customize = mkOption { + type = with types; + attrsOf (submodule { + options = { + friendly_name = mkOption { type = with types; str; }; + entity_picture = mkOption { + default = null; + type = with types; nullOr str; + }; + icon = mkOption { + default = null; + type = with types; nullOr str; + }; + }; + }); + }; + }; + }); + }; + introduction = mkOption { + default = { }; + type = with types; attrs; + }; + frontend = mkOption { + default = { }; + type = with types; attrs; + }; + config = mkOption { + default = { }; + type = with types; attrs; + }; + http = mkOption { + default = null; + type = with types; nullOr attrs; + }; + discovery = mkOption { + default = null; + type = with types; nullOr attrs; + }; + history = mkOption { + default = null; + type = with types; nullOr attrs; + }; + logbook = mkOption { + default = null; + type = with types; nullOr attrs; + }; + logger = mkOption { + default = { }; + type = with types; attrs; + }; + lovelace = mkOption { + default = { mode = "yaml"; }; + type = with types; nullOr attrs; + }; + map = mkOption { + default = null; + type = with types; nullOr attrs; + }; + mqtt = mkOption { + default = null; + type = with types; nullOr attrs; + }; + sun = mkOption { + default = null; + type = with types; nullOr attrs; + }; + + switch = mkOption { default = null; type = with types; nullOr (listOf attrs); }; - customize = mkOption { - type = with types; attrsOf (submodule{ options = { - friendly_name = mkOption { - type = with types; str; - }; - entity_picture = mkOption { - default = null; - type = with types; nullOr str; - }; - icon = mkOption { - default = null; - type = with types; nullOr str; - }; - };}); + binary_sensor = mkOption { + default = null; + type = with types; nullOr (listOf attrs); }; - };}); - }; - introduction = mkOption { - default = {}; - type = with types; attrs; - }; - frontend = mkOption { - default = {}; - type = with types; attrs; - }; - config = mkOption { - default = {}; - type = with types; attrs; - }; - http = mkOption { - default = null; - type = with types; nullOr attrs; - }; - discovery = mkOption { - default = null; - type = with types; nullOr attrs; - }; - history = mkOption { - default = null; - type = with types; nullOr attrs; - }; - logbook = mkOption { - default = null; - type = with types; nullOr attrs; - }; - logger = mkOption { - default = {}; - type = with types; attrs; - }; - lovelace = mkOption { - default = { mode = "yaml"; }; - type = with types; nullOr attrs; - }; - map = mkOption { - default = null; - type = with types; nullOr attrs; - }; - mqtt = mkOption { - default = null; - type = with types; nullOr attrs; - }; - sun = mkOption { - default = null; - type = with types; nullOr attrs; - }; - - switch = mkOption { - default = null; - type = with types; nullOr (listOf attrs); - }; - binary_sensor = mkOption { - default = null; - type = with types; nullOr (listOf attrs); - }; - sensor = mkOption { - default = null; - type = with types; nullOr (listOf attrs); - }; - prometheus = mkOption { - default = null; - type = with types; nullOr attrs; - }; - automation = mkOption { - default = null; - type = with types; nullOr (listOf attrs); - }; - media_player = mkOption { - default = null; - type = with types; nullOr (listOf attrs); - }; - mysensors = mkOption { - default = null; - type = with types; nullOr attrs; - }; - script = mkOption { - default = null; - type = with types; nullOr (attrsOf (submodule { - options = { - alias = mkOption { - default = null; - type = with types; nullOr str; - }; - sequence = mkOption { - default = []; - type = with types; listOf attrs; - }; + sensor = mkOption { + default = null; + type = with types; nullOr (listOf attrs); + }; + prometheus = mkOption { + default = null; + type = with types; nullOr attrs; + }; + automation = mkOption { + default = null; + type = with types; nullOr (listOf attrs); + }; + media_player = mkOption { + default = null; + type = with types; nullOr (listOf attrs); + }; + mysensors = mkOption { + default = null; + type = with types; nullOr attrs; + }; + script = mkOption { + default = null; + type = with types; + nullOr (attrsOf (submodule { + options = { + alias = mkOption { + default = null; + type = with types; nullOr str; + }; + sequence = mkOption { + default = [ ]; + type = with types; listOf attrs; + }; + }; + })); + }; + input_number = mkOption { + default = null; + type = with types; nullOr (attrsOf attrs); + }; + input_text = mkOption { + default = null; + type = with types; nullOr (attrsOf attrs); + }; + input_select = mkOption { + default = null; + type = with types; nullOr (attrsOf attrs); + }; + input_boolean = mkOption { + default = null; + type = with types; (attrsOf attrs); + }; + input_datetime = mkOption { + default = null; + type = with types; (attrsOf attrs); + }; + calendar = mkOption { + default = [ ]; + type = with types; listOf attrs; + }; + shell_command = mkOption { + default = null; + type = with types; nullOr (attrsOf str); }; - })); - }; - input_number = mkOption { - default = null; - type = with types; nullOr (attrsOf attrs); - }; - input_text = mkOption { - default = null; - type = with types; nullOr (attrsOf attrs); - }; - input_select = mkOption { - default = null; - type = with types; nullOr (attrsOf attrs); - }; - input_boolean = mkOption { - default = null; - type = with types; (attrsOf attrs); - }; - input_datetime = mkOption { - default = null; - type = with types; (attrsOf attrs); - }; - calendar = mkOption { - default = []; - type = with types; listOf attrs; - }; - shell_command = mkOption { - default = null; - type = with types; nullOr (attrsOf str); - }; - };}); + }; + }); description = '' home-assistant configuration ''; }; config = mkIf (cfg != null) { - services.home-assistant.config = - let + services.home-assistant.config = let - sanitize = configuration: lib.getAttr (builtins.typeOf configuration) { - bool = configuration; - int = configuration; - string = configuration; - str = configuration; - float = configuration; - list = map sanitize configuration; - set = - let - stripped = lib.flip lib.filterAttrs configuration - (name: value: - name != "_module" - && name != "_ref" - && value != null - ); + sanitize = configuration: + lib.getAttr (builtins.typeOf configuration) { + bool = configuration; + int = configuration; + string = configuration; + str = configuration; + float = configuration; + list = map sanitize configuration; + set = let + stripped = lib.flip lib.filterAttrs configuration (name: value: + name != "_module" && name != "_ref" && value != null); recursiveSanitized = lib.mapAttrs (lib.const sanitize) stripped; - in - if ( length ( attrNames configuration ) == 0 ) - then - null - else - recursiveSanitized; - }; + in if (length (attrNames configuration) == 0) then + null + else + recursiveSanitized; + }; - in - sanitize cfg ; + in sanitize cfg; }; } diff --git a/modules/services/lektor.nix b/modules/services/lektor.nix index 6b00392..3b325cf 100644 --- a/modules/services/lektor.nix +++ b/modules/services/lektor.nix @@ -104,29 +104,30 @@ in { serviceConfig = { User = cfg.user; # todo : this is not working properly - TimeoutStartSec = "infinity"; # it might take some time will this thing is up + TimeoutStartSec = + "infinity"; # it might take some time will this thing is up - ExecStartPre = - let + ExecStartPre = let - sshKeyTarget = "/run/keys.lektor/id_rsa"; + sshKeyTarget = "/run/keys.lektor/id_rsa"; - sshConfig = pkgs.writeText "sshconfig" '' - Host ${cfg.host} - IdentityFile ${sshKeyTarget} + sshConfig = pkgs.writeText "sshconfig" '' + Host ${cfg.host} + IdentityFile ${sshKeyTarget} - Host * - ForwardAgent no - Compression no - ServerAliveInterval 0 - HashKnownHosts no - UserKnownHostsFile ~/.ssh/known_hosts - ControlMaster no - ControlPath ~/.ssh/master-%r@%n:%p - ControlPersist no - ''; + Host * + ForwardAgent no + Compression no + ServerAliveInterval 0 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/master-%r@%n:%p + ControlPersist no + ''; - sshKeyScript = pkgs.writers.writeDash "keyfile-gen" /* sh */ '' + sshKeyScript = pkgs.writers.writeDash "keyfile-gen" # sh + '' set -x # setup ~/.ssh @@ -146,7 +147,8 @@ in { chmod 500 ${sshKeyTarget} ''; - cloneScript = pkgs.writers.writeDash "clone" /* sh */ '' + cloneScript = pkgs.writers.writeDash "clone" # sh + '' set -x if [[ `ls ~/${cfg.user} | wc -l` == 0 ]] then @@ -155,23 +157,23 @@ in { ${pkgs.git}/bin/git clone ${cfg.repository} ~/${cfg.user} ''; - in [ - "+${sshKeyScript}" - "-${cloneScript}" - ]; + in [ "+${sshKeyScript}" "-${cloneScript}" ]; }; - # todo : add restart ruling - script = /* sh */ '' - cd ~/${cfg.user} && \ - ${pkgs.git}/bin/git pull && \ - ${optionalString (cfg.additionalScript != null) "${cfg.additionalScript} &&"} \ - ${pkgs.python36Packages.lektor}/bin/lektor server \ - --host ${cfg.bind} \ - --port ${toString cfg.port} - ''; + script = # sh + '' + cd ~/${cfg.user} && \ + ${pkgs.git}/bin/git pull && \ + ${ + optionalString (cfg.additionalScript != null) + "${cfg.additionalScript} &&" + } \ + ${pkgs.python36Packages.lektor}/bin/lektor server \ + --host ${cfg.bind} \ + --port ${toString cfg.port} + ''; }; }; } diff --git a/modules/services/samba-share.nix b/modules/services/samba-share.nix index 5337b24..8ad5ed0 100644 --- a/modules/services/samba-share.nix +++ b/modules/services/samba-share.nix @@ -15,9 +15,7 @@ in { description = '' folders to share as readonly ''; - example = { - public = "/srv/downloads/movies"; - }; + example = { public = "/srv/downloads/movies"; }; }; }; @@ -42,18 +40,16 @@ in { disable spoolss = yes ''; - shares = - mapAttrs' (name: path: - { - name = name; - value = { - browsable = "yes"; - comment = "read only share {name}"; - path = path; - "read only" = "yes"; - "guest ok" = "yes"; - }; - }) cfg.folders; + shares = mapAttrs' (name: path: { + name = name; + value = { + browsable = "yes"; + comment = "read only share {name}"; + path = path; + "read only" = "yes"; + "guest ok" = "yes"; + }; + }) cfg.folders; }; users.users.smbguest = { diff --git a/modules/services/seafile.nix b/modules/services/seafile.nix index 065a2aa..832e5d0 100644 --- a/modules/services/seafile.nix +++ b/modules/services/seafile.nix @@ -11,25 +11,25 @@ in { options.custom.services.seafile = { enable = mkEnableOption "enable custom.services.seafile"; hostname = mkOption { - type = with types; string; + type = with types; string; description = '' hostname of the seafile server ''; }; port = mkOption { - type = with types; int; + type = with types; int; description = '' port on where ther server runs on ''; }; home = mkOption { - type = with types; path; + type = with types; path; description = '' folder in where the seafile stuff gets stored ''; }; serviceName = mkOption { - type = with types; string; + type = with types; string; default = "seafile-docker"; description = '' name of the systemd service @@ -47,31 +47,31 @@ in { after = [ "network.target" "docker.service" ]; requires = [ "docker.service" ]; wantedBy = [ "multi-user.target" ]; - script = /* sh */'' - # delete old instance to ensure update - ${pkgs.docker}/bin/docker stop seafile || true && ${pkgs.docker}/bin/docker rm -f seafile || true - # start instance - ${pkgs.docker}/bin/docker run \ - --name seafile \ - --env SEAFILE_SERVER_HOSTNAME=${cfg.hostname} \ - --env SEAFILE_ADMIN_EMAIL="root@${cfg.hostname}" \ - --env SEAFILE_ADMIN_PASSWORD="${lib.fileContents }" \ - --volume ${cfg.home}:/shared \ - --publish ${toString cfg.port}:80 \ - seafileltd/seafile:latest - ''; + script = # sh + '' + # delete old instance to ensure update + ${pkgs.docker}/bin/docker stop seafile || true && ${pkgs.docker}/bin/docker rm -f seafile || true + # start instance + ${pkgs.docker}/bin/docker run \ + --name seafile \ + --env SEAFILE_SERVER_HOSTNAME=${cfg.hostname} \ + --env SEAFILE_ADMIN_EMAIL="root@${cfg.hostname}" \ + --env SEAFILE_ADMIN_PASSWORD="${ + lib.fileContents + }" \ + --volume ${cfg.home}:/shared \ + --publish ${toString cfg.port}:80 \ + seafileltd/seafile:latest + ''; }; }; } - - # ! todo # requires = [ "${config.module.backup.services.encfs."seafile".serviceName}.service" ]; - # krops.keys."seafile".path = toString ; # # module.backup.services.encfs = { @@ -84,4 +84,3 @@ in { # }; # }; - diff --git a/modules/services/sshd.nix b/modules/services/sshd.nix index 85aa65d..2c514b3 100644 --- a/modules/services/sshd.nix +++ b/modules/services/sshd.nix @@ -13,50 +13,47 @@ in { sshd = { enable = mkEnableOption "Start sshd server"; rootKeyFiles = mkOption { - type = with types; listOf path; + type = with types; listOf path; description = "keys to root login"; - default = [ ]; + default = [ ]; }; }; }; - config = mkMerge [ - (mkIf cfg.tools.enable { - environment.systemPackages = with pkgs; [ - # sshuttle - sshfs - ]; - }) + (mkIf cfg.tools.enable { + environment.systemPackages = with pkgs; + [ + # sshuttle + sshfs + ]; + }) - (mkIf cfg.sshd.enable { + (mkIf cfg.sshd.enable { - services.openssh = { - enable = true; - forwardX11 = true; - passwordAuthentication = false; - }; + services.openssh = { + enable = true; + forwardX11 = true; + passwordAuthentication = false; + }; - users.users.root.openssh.authorizedKeys.keyFiles = cfg.sshd.rootKeyFiles ; + users.users.root.openssh.authorizedKeys.keyFiles = cfg.sshd.rootKeyFiles; - services.openssh.extraConfig = '' - Banner /etc/sshd/banner-line - ''; + services.openssh.extraConfig = '' + Banner /etc/sshd/banner-line + ''; - environment.etc."sshd/banner-line".text = - let - text = config.networking.hostName; - size = 80 - (lib.stringLength text); - space = lib.fixedWidthString size " " ""; - in '' - ──────────────────────────────────────────────────────────────────────────────── - ${ space }${ text } - ''; - - } - ) + environment.etc."sshd/banner-line".text = let + text = config.networking.hostName; + size = 80 - (lib.stringLength text); + space = lib.fixedWidthString size " " ""; + in '' + ──────────────────────────────────────────────────────────────────────────────── + ${space}${text} + ''; + }) ]; diff --git a/modules/services/transmission.nix b/modules/services/transmission.nix index b0fbcb0..99d1f58 100644 --- a/modules/services/transmission.nix +++ b/modules/services/transmission.nix @@ -3,36 +3,34 @@ with lib; let - cfg = config.services.custom.transmission; in { - options.services.custom.transmission = { enable = lib.mkEnableOption "transmission"; home = lib.mkOption { - type = lib.types.path; + type = lib.types.path; description = "where the configs are"; }; - store = lib.mkOption { - type = lib.types.path; + store = lib.mkOption { + type = lib.types.path; description = "where to store"; }; hosts = lib.mkOption { - type = lib.types.str; + type = lib.types.str; description = "allowed hostnames"; }; whitelist = lib.mkOption { - type = lib.types.str; + type = lib.types.str; description = "Ip to listen to"; }; user = lib.mkOption { - type = lib.types.str; + type = lib.types.str; description = "user to login"; }; password = lib.mkOption { - type = lib.types.str; + type = lib.types.str; description = "password to login"; }; port = mkOption { @@ -60,23 +58,23 @@ in { services.transmission = { enable = true; - home = "${cfg.home}"; + home = "${cfg.home}"; settings = { # Downloads - download-dir = "${cfg.store}/downloads"; + download-dir = "${cfg.store}/downloads"; incomplete-dir-enabled = true; - incomplete-dir = "${cfg.store}/incomplete"; + incomplete-dir = "${cfg.store}/incomplete"; # RPC = UI connection - rpc-whitelist = "${cfg.whitelist}"; - rpc-host-whitelist = "${cfg.hosts}"; - rpc-user = "${cfg.user}"; - rpc-username = "${cfg.user}"; - rpc-password = "${cfg.password}"; + rpc-whitelist = "${cfg.whitelist}"; + rpc-host-whitelist = "${cfg.hosts}"; + rpc-user = "${cfg.user}"; + rpc-username = "${cfg.user}"; + rpc-password = "${cfg.password}"; # Start torrents as soon as they are added - start-added-torrents = true; + start-added-torrents = true; # Encryption may help get around some ISP filtering, # but at the cost of slightly higher CPU use. @@ -86,36 +84,36 @@ in { encryption = 2; # Enable Local Peer Discovery (LPD). - lpd-enabled = true; + lpd-enabled = true; # Enable UPnP or NAT-PMP. peer-port = cfg.port; - port-forwarding-enabled = true; + port-forwarding-enabled = true; # "normal" speed limits speed-limit-down-enabled = true; - speed-limit-down = 800; - speed-limit-up-enabled = true ; - speed-limit-up = 50; + speed-limit-down = 800; + speed-limit-up-enabled = true; + speed-limit-up = 50; upload-slots-per-torrent = 8; # Queuing # When true, Transmission will only download # download-queue-size non-stalled torrents at once. - download-queue-enabled = true; - download-queue-size = 1; + download-queue-enabled = true; + download-queue-size = 1; # When true, torrents that have not shared data for # queue-stalled-minutes are treated as 'stalled' # and are not counted against the queue-download-size # and seed-queue-size limits. - queue-stalled-enabled = true; - queue-stalled-minutes = 60; + queue-stalled-enabled = true; + queue-stalled-minutes = 60; # When true. Transmission will only seed seed-queue-size # non-stalled torrents at once. - seed-queue-enabled = true; - seed-queue-size = 10; + seed-queue-enabled = true; + seed-queue-size = 10; # umask of the moves that got downloaded umask = 18; diff --git a/modules/services/videoencoder.nix b/modules/services/videoencoder.nix index 2446633..5bf0679 100644 --- a/modules/services/videoencoder.nix +++ b/modules/services/videoencoder.nix @@ -7,7 +7,8 @@ let cfg = config.service.videoencoder; # todo : escape output and input File - createEncoder = tmpFolder: inputFile: outputFile: /* sh */ '' + createEncoder = tmpFolder: inputFile: outputFile: # sh + '' mkdir -p ${tmpFolder} rm -rf ${tmpFolder}/* TMP_FILE=`mktemp --dry-run ${tmpFolder}/XXXXXXXX.${cfg.format}` @@ -35,7 +36,7 @@ in { enable = mkEnableOption "enable service.videoencoder"; profile = mkOption { - type = with types; string; + type = with types; string; default = "main"; description = '' -profile:v @@ -43,7 +44,8 @@ in { }; tune = mkOption { - type = with types; nullOr (enum [ "film" "animation" "grain" "stillimage" ]); + type = with types; + nullOr (enum [ "film" "animation" "grain" "stillimage" ]); default = null; description = '' -tune @@ -51,7 +53,7 @@ in { }; format = mkOption { - type = with types; enum [ "mp4" "mkv" ]; + type = with types; enum [ "mp4" "mkv" ]; default = "mp4"; description = '' the format @@ -59,24 +61,25 @@ in { }; fileConfig = mkOption { - type = with types; listOf (submodule { - options = { - inputFile = mkOption { - # todo make this path - type = with types; string; - description = '' - full path to the inputFile - ''; + type = with types; + listOf (submodule { + options = { + inputFile = mkOption { + # todo make this path + type = with types; string; + description = '' + full path to the inputFile + ''; + }; + outputFile = mkOption { + type = with types; string; + description = '' + full path to the ouputFile + folder must exist + ''; + }; }; - outputFile = mkOption { - type = with types; string; - description = '' - full path to the ouputFile - folder must exist - ''; - }; - }; - }); + }); description = '' list of files to encode. ''; @@ -86,17 +89,16 @@ in { config = mkIf cfg.enable { systemd.services."videoEncoding" = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; enable = true; - script = - let - myList = map ( value : - createEncoder "/tmp/videoencoder" value.inputFile value.outputFile - ) cfg.fileConfig; - in '' - set -x - ${concatStringsSep "\n" myList} - ''; + script = let + myList = map (value: + createEncoder "/tmp/videoencoder" value.inputFile value.outputFile) + cfg.fileConfig; + in '' + set -x + ${concatStringsSep "\n" myList} + ''; }; diff --git a/modules/system/audio.nix b/modules/system/audio.nix index a61addd..6fd5a4e 100644 --- a/modules/system/audio.nix +++ b/modules/system/audio.nix @@ -6,20 +6,21 @@ let ladspaPath = "${pkgs.ladspaPlugins}/lib/ladspa"; - jackScript = pkgs.writeShellScriptBin "jack" (lib.fileContents ); + jackScript = + pkgs.writeShellScriptBin "jack" (lib.fileContents ); queueElement = { options = { plugin = mkOption { - type = with types; str; + type = with types; str; description = "file name without suffix of the plugin"; }; label = mkOption { - type = with types; str; + type = with types; str; description = "label of the queue element (needs to be correct)"; }; control = mkOption { - type = with types; listOf str; + type = with types; listOf str; description = "parameter of plugin"; }; }; @@ -28,11 +29,11 @@ let sinkElement = { options = { name = mkOption { - type = with types; str; + type = with types; str; description = "name of the sink"; }; queue = mkOption { - type = with types; listOf (submodule queueElement); + type = with types; listOf (submodule queueElement); description = "queues"; }; }; @@ -44,8 +45,8 @@ in { options.system.custom.audio = { enable = mkEnableOption "use PluseAudio"; - sinks = mkOption { - type = with types; listOf (submodule sinkElement); + sinks = mkOption { + type = with types; listOf (submodule sinkElement); description = "list of sinks"; }; }; @@ -66,16 +67,18 @@ in { # LADSPA # ------ - programs.bash.interactiveShellInit = /* sh */ '' - # set ladspa library path - # about testing the plugins check analyseplugin command - export LADSPA_PATH=${ladspaPath} - ''; - programs.zsh.interactiveShellInit = /* sh */ '' - # set ladspa library path - # about testing the plugins check analyseplugin command - export LADSPA_PATH=${ladspaPath} - ''; + programs.bash.interactiveShellInit = # sh + '' + # set ladspa library path + # about testing the plugins check analyseplugin command + export LADSPA_PATH=${ladspaPath} + ''; + programs.zsh.interactiveShellInit = # sh + '' + # set ladspa library path + # about testing the plugins check analyseplugin command + export LADSPA_PATH=${ladspaPath} + ''; # PulseAudio # ---------- @@ -84,7 +87,7 @@ in { system.custom.mainUser.extraGroups = [ "audio" ]; hardware.pulseaudio = { - enable = true; + enable = true; # all in audio group can do audio systemWide = true; @@ -93,34 +96,42 @@ in { extraConfig = '' - # automatically switch to newly-connected devices - load-module module-switch-on-connect + # automatically switch to newly-connected devices + load-module module-switch-on-connect - # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html - # https://gavv.github.io/articles/pulseaudio-under-the-hood/#ladspa-plugin-sink - ${builtins.toString (flip map cfg.sinks (sink : '' - # ladspa sink : ${sink.name} - # ------------- - ${builtins.toString (flip imap0 (reverseList sink.queue) (index : queua: - let - sinkName = suffix : "${sink.name}${builtins.toString suffix}"; - sinkValue = "sink_name=${sinkName index}"; - sinkDescription = "sink_properties=device.description=${sinkName index}-${queua.label}"; - masterValue = if (index == 0) then "" else "master=${sinkName (index - 1)}"; - pluginValue = "plugin=${ladspaPath}/${queua.plugin}"; - labelValue = "label=${queua.label}"; - controlValue = "control=${builtins.toString (foldl (a: b: "${a},${b}") (head queua.control) (tail queua.control))}"; - in '' - # ${sinkName index} : ${queua.label} - load-module module-ladspa-sink ${sinkValue} ${sinkDescription} ${masterValue} ${pluginValue} ${labelValue} ${controlValue} + # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html + # https://gavv.github.io/articles/pulseaudio-under-the-hood/#ladspa-plugin-sink + ${builtins.toString (flip map cfg.sinks (sink: '' + # ladspa sink : ${sink.name} + # ------------- + ${builtins.toString (flip imap0 (reverseList sink.queue) + (index: queua: + let + sinkName = suffix: "${sink.name}${builtins.toString suffix}"; + sinkValue = "sink_name=${sinkName index}"; + sinkDescription = "sink_properties=device.description=${ + sinkName index + }-${queua.label}"; + masterValue = + if (index == 0) then "" else "master=${sinkName (index - 1)}"; + pluginValue = "plugin=${ladspaPath}/${queua.plugin}"; + labelValue = "label=${queua.label}"; + controlValue = "control=${ + builtins.toString + (foldl (a: b: "${a},${b}") (head queua.control) + (tail queua.control)) + }"; + in '' + # ${sinkName index} : ${queua.label} + load-module module-ladspa-sink ${sinkValue} ${sinkDescription} ${masterValue} ${pluginValue} ${labelValue} ${controlValue} + ''))} ''))} - ''))} - ''; + ''; }; # Packages needed # --------------- - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ jackScript @@ -132,7 +143,6 @@ in { # qjackctl - # LADSPA # ------ ladspaPlugins diff --git a/modules/system/bluetooth.nix b/modules/system/bluetooth.nix index f9b876f..cae2923 100644 --- a/modules/system/bluetooth.nix +++ b/modules/system/bluetooth.nix @@ -6,20 +6,21 @@ let in { - options.system.custom.bluetooth.enable = lib.mkEnableOption "enable bluetooth support"; + options.system.custom.bluetooth.enable = + lib.mkEnableOption "enable bluetooth support"; config = lib.mkIf cfg.enable { hardware.bluetooth = { - enable = true; + enable = true; powerOnBoot = true; extraConfig = '' - [General] - AutoConnect=true + [General] + AutoConnect=true ''; }; - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ # bluetooth audio # --------------- diff --git a/modules/system/font.nix b/modules/system/font.nix index 3e413f2..c262ca8 100644 --- a/modules/system/font.nix +++ b/modules/system/font.nix @@ -11,8 +11,8 @@ in { options.system.custom.fonts = { enable = mkEnableOption "enable fonts"; dpi = mkOption { - type = types.int; - default = 141; + type = types.int; + default = 141; description = '' dpi of the monitor ''; @@ -23,25 +23,23 @@ in { fonts = { - enableCoreFonts = true; - enableFontDir = true; + enableCoreFonts = true; + enableFontDir = true; enableGhostscriptFonts = true; fontconfig = { - dpi = cfg.dpi; + dpi = cfg.dpi; subpixel = { lcdfilter = "default"; - rgba = "rgb"; + rgba = "rgb"; }; hinting = { - enable = true; + enable = true; autohint = false; }; - enable = true; - antialias = true; - defaultFonts = { - monospace = [ "inconsolata" ]; - }; + enable = true; + antialias = true; + defaultFonts = { monospace = [ "inconsolata" ]; }; }; fonts = with pkgs; [ @@ -73,4 +71,3 @@ in { } - diff --git a/modules/system/mainUser.nix b/modules/system/mainUser.nix index ec0d7d8..da19e78 100644 --- a/modules/system/mainUser.nix +++ b/modules/system/mainUser.nix @@ -7,14 +7,12 @@ let cfg = config.system.custom.mainUser; dockerGroup = - if (config.virtualisation.docker.enable) - then [ "docker" ] - else []; + if (config.virtualisation.docker.enable) then [ "docker" ] else [ ]; - vboxGroup = - if (config.virtualisation.virtualbox.host.enable) - then [ "vboxusers" ] - else []; + vboxGroup = if (config.virtualisation.virtualbox.host.enable) then + [ "vboxusers" ] + else + [ ]; in { @@ -23,14 +21,14 @@ in { enable = mkEnableOption "enable mainUser for a desktop system"; userName = mkOption { - type = with types; str; + type = with types; str; description = '' name of the main user ''; }; uid = mkOption { - type = with types; int; + type = with types; int; default = 1337; description = '' uid of main user @@ -38,7 +36,7 @@ in { }; extraGroups = mkOption { - default = []; + default = [ ]; type = with types; listOf str; description = '' list of groups the main user should also be in @@ -46,7 +44,7 @@ in { }; authorizedKeyFiles = mkOption { - default = []; + default = [ ]; type = with types; listOf str; description = '' list of keys allowed to login as this user @@ -59,17 +57,18 @@ in { users = { - mutableUsers = true; + mutableUsers = true; defaultUserShell = pkgs.zsh; users.mainUser = { - isNormalUser = true; - name = cfg.userName; - uid = cfg.uid; - home = "/home/${cfg.userName}"; + isNormalUser = true; + name = cfg.userName; + uid = cfg.uid; + home = "/home/${cfg.userName}"; initialPassword = cfg.userName; - extraGroups = [ "wheel" "networkmanager" "transmission" "wireshark" ] ++ dockerGroup ++ vboxGroup ++ cfg.extraGroups; - openssh.authorizedKeys.keyFiles = cfg.authorizedKeyFiles ; + extraGroups = [ "wheel" "networkmanager" "transmission" "wireshark" ] + ++ dockerGroup ++ vboxGroup ++ cfg.extraGroups; + openssh.authorizedKeys.keyFiles = cfg.authorizedKeyFiles; }; }; }; diff --git a/modules/system/permown.nix b/modules/system/permown.nix index 70e8c18..a079525 100644 --- a/modules/system/permown.nix +++ b/modules/system/permown.nix @@ -1,59 +1,53 @@ { config, pkgs, lib, ... }: with lib; -let - cfg = config.system.permown; +let cfg = config.system.permown; in { options.system.permown = mkOption { - default = {}; - type = with types; attrsOf (submodule ({ config, ... }: { - options = { - directory-mode = mkOption { - default = "=rwx"; - type = types.str; # TODO + default = { }; + type = with types; + attrsOf (submodule ({ config, ... }: { + options = { + directory-mode = mkOption { + default = "=rwx"; + type = types.str; # TODO + }; + file-mode = mkOption { + default = "=rw"; + type = types.str; # TODO + }; + group = mkOption { + apply = x: if x == null then "" else x; + default = null; + type = types.nullOr types.str; + }; + owner = mkOption { type = types.str; }; + path = mkOption { + default = config._module.args.name; + type = types.path; + }; + umask = mkOption { + default = "0027"; + type = types.str; + }; }; - file-mode = mkOption { - default = "=rw"; - type = types.str; # TODO - }; - group = mkOption { - apply = x: if x == null then "" else x; - default = null; - type = types.nullOr types.str; - }; - owner = mkOption { - type = types.str; - }; - path = mkOption { - default = config._module.args.name; - type = types.path; - }; - umask = mkOption { - default = "0027"; - type = types.str; - }; - }; - })); + })); }; - config = - let - plans = lib.attrValues cfg; - in - mkIf (plans != []) { + config = let plans = lib.attrValues cfg; + in mkIf (plans != [ ]) { system.activationScripts.permown = let - mkdir = plan: /* sh */ '' - ${pkgs.coreutils}/bin/mkdir -p ${plan.path} - ''; - in - concatMapStrings mkdir plans; - + mkdir = plan: # sh + '' + ${pkgs.coreutils}/bin/mkdir -p ${plan.path} + ''; + in concatMapStrings mkdir plans; # genAttrs' = names: f: listToAttrs (map f names); systemd.services = listToAttrs (flip map plans (plan: { - name = "permown.${replaceStrings ["/"] ["_"] plan.path}"; + name = "permown.${replaceStrings [ "/" ] [ "_" ] plan.path}"; value = { environment = { DIR_MODE = plan.directory-mode; @@ -61,11 +55,7 @@ in { OWNER_GROUP = "${plan.owner}:${plan.group}"; ROOT_PATH = plan.path; }; - path = [ - pkgs.coreutils - pkgs.findutils - pkgs.inotifyTools - ]; + path = [ pkgs.coreutils pkgs.findutils pkgs.inotifyTools ]; serviceConfig = { ExecStart = pkgs.writers.writeDash "permown" '' set -efu diff --git a/modules/system/wifi.nix b/modules/system/wifi.nix index 47a0e3a..1701f21 100644 --- a/modules/system/wifi.nix +++ b/modules/system/wifi.nix @@ -10,11 +10,11 @@ in { options.system.custom.wifi = { enable = mkEnableOption "enable wifi"; - system = mkOption{ + system = mkOption { default = "wpa_supplicant"; - type = with types; enum ["wpa_supplicant" "networkmanager"]; + type = with types; enum [ "wpa_supplicant" "networkmanager" ]; }; - configurationFile = mkOption{ + configurationFile = mkOption { default = null; type = with types; nullOr path; description = '' @@ -22,8 +22,8 @@ in { ''; }; interfaces = mkOption { - type = with types; listOf string; - default = []; + type = with types; listOf string; + default = [ ]; description = '' list of interfaces to take care of, if empty it will test all interfaces @@ -73,4 +73,3 @@ in { } - diff --git a/modules/system/x11.nix b/modules/system/x11.nix index db61779..4dd3c00 100644 --- a/modules/system/x11.nix +++ b/modules/system/x11.nix @@ -9,7 +9,7 @@ let in { options.system.custom.x11 = { - enable = mkEnableOption "enable x11"; + enable = mkEnableOption "enable x11"; autoLoginUser = mkOption { type = with types; str; description = "user to login"; @@ -47,7 +47,6 @@ in { default = "xmonad"; }; - # mouse/touchpad # -------------- libinput = { @@ -65,7 +64,7 @@ in { # Packages # -------- - environment.systemPackages = with pkgs ; [ + environment.systemPackages = with pkgs; [ dmenu arandr diff --git a/pkgs/bepasty-client-cli/default.nix b/pkgs/bepasty-client-cli/default.nix index 7811ef5..117ca82 100644 --- a/pkgs/bepasty-client-cli/default.nix +++ b/pkgs/bepasty-client-cli/default.nix @@ -1,12 +1,9 @@ { lib, pkgs, pythonPackages, fetchFromGitHub, ... }: -with pythonPackages; buildPythonPackage rec { +with pythonPackages; +buildPythonPackage rec { name = "bepasty-client-cli"; - propagatedBuildInputs = [ - python_magic - click - requests - ]; + propagatedBuildInputs = [ python_magic click requests ]; src = fetchFromGitHub { owner = "bepasty"; @@ -16,7 +13,7 @@ with pythonPackages; buildPythonPackage rec { }; meta = { - homepage = https://github.com/bepasty/bepasty-client-cli; + homepage = "https://github.com/bepasty/bepasty-client-cli"; description = "CLI client for bepasty-server"; license = lib.licenses.bsd2; }; diff --git a/pkgs/bitwig-studio/bitwig-studio-environment.nix b/pkgs/bitwig-studio/bitwig-studio-environment.nix index 4a3c17a..3b58bdd 100644 --- a/pkgs/bitwig-studio/bitwig-studio-environment.nix +++ b/pkgs/bitwig-studio/bitwig-studio-environment.nix @@ -4,10 +4,9 @@ # this is a script to start Bitwig Studio. # it is necessary because without my VSTs won't run. - # function header # --------------- -{ pkgs ? import {} }: +{ pkgs ? import { } }: # function call # ------------- @@ -21,59 +20,59 @@ # --------------------- # these are packages which are compiled for the target # system architecture - targetPkgs = pkgs: with pkgs; [ + targetPkgs = pkgs: + with pkgs; [ - # todo : check if they are needed - coreutils - curl - vim - tig - ack - bitwig-studio3 - liblo - zlib - fftw - minixml - libcxx - alsaLib - glibc + # todo : check if they are needed + coreutils + curl + vim + tig + ack + bitwig-studio3 + liblo + zlib + fftw + minixml + libcxx + alsaLib + glibc - gtk2-x11 - atk - mesa_glu - glib - pango - gdk_pixbuf - cairo - freetype - fontconfig - dbus - xorg.libX11 - xorg.libxcb - xorg.libXext - xorg.libXinerama - xlibs.libXi - xlibs.libXcursor - xlibs.libXdamage - xlibs.libXcomposite - xlibs.libXfixes - xlibs.libXrender - xlibs.libXtst - xlibs.libXScrnSaver + gtk2-x11 + atk + mesa_glu + glib + pango + gdk_pixbuf + cairo + freetype + fontconfig + dbus + xorg.libX11 + xorg.libxcb + xorg.libXext + xorg.libXinerama + xlibs.libXi + xlibs.libXcursor + xlibs.libXdamage + xlibs.libXcomposite + xlibs.libXfixes + xlibs.libXrender + xlibs.libXtst + xlibs.libXScrnSaver - gnome2.GConf - nss - nspr - expat - eudev - ]; + gnome2.GConf + nss + nspr + expat + eudev + ]; # multilib packages # ----------------- # these are packages compiled for multiple system # architectures (32bit/64bit) - multiPkgs = pkgs: with pkgs; [ - ]; + multiPkgs = pkgs: with pkgs; [ ]; # command # ------- diff --git a/pkgs/bitwig-studio/bitwig-studio1.nix b/pkgs/bitwig-studio/bitwig-studio1.nix index 8b26ba0..06441f3 100644 --- a/pkgs/bitwig-studio/bitwig-studio1.nix +++ b/pkgs/bitwig-studio/bitwig-studio1.nix @@ -1,16 +1,14 @@ -{ stdenv, fetchurl, alsaLib, bzip2, cairo, dpkg, freetype, gdk_pixbuf -, glib, gtk2, harfbuzz, jdk, lib, xorg -, libbsd, libjack2, libpng -, libxkbcommon -, makeWrapper, pixman -, xdg_utils, zenity, zlib }: +{ stdenv, fetchurl, 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 { name = "bitwig-studio-${version}"; version = "1.3.16"; src = fetchurl { - url = "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; + url = + "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; sha256 = "0n0fxh9gnmilwskjcayvjsjfcs3fz9hn00wh7b3gg0cv3qqhich8"; }; @@ -18,19 +16,39 @@ stdenv.mkDerivation rec { unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root"; - dontBuild = true; + dontBuild = true; dontPatchELF = true; - dontStrip = true; + dontStrip = true; - libPath = with xorg; lib.makeLibraryPath [ - alsaLib bzip2.out cairo freetype gdk_pixbuf glib gtk2 harfbuzz libX11 libXau - libXcursor libXdmcp libXext libXfixes libXrender libbsd libjack2 libpng libxcb - libxkbfile pixman xcbutil xcbutilwm zlib - ]; + libPath = with xorg; + lib.makeLibraryPath [ + alsaLib + bzip2.out + cairo + freetype + gdk_pixbuf + glib + gtk2 + harfbuzz + libX11 + libXau + libXcursor + libXdmcp + libXext + libXfixes + libXrender + libbsd + libjack2 + libpng + libxcb + libxkbfile + pixman + xcbutil + xcbutilwm + zlib + ]; - binPath = lib.makeBinPath [ - xdg_utils zenity - ]; + binPath = lib.makeBinPath [ xdg_utils zenity ]; installPhase = '' mkdir -p $out @@ -92,7 +110,7 @@ stdenv.mkDerivation rec { production, performance and DJing, with a focus on flexible editing tools and a super-fast workflow. ''; - homepage = http://www.bitwig.com/; + homepage = "http://www.bitwig.com/"; license = licenses.unfree; platforms = [ "x86_64-linux" ]; maintainers = with maintainers; [ michalrus mrVanDalo ]; diff --git a/pkgs/bitwig-studio/bitwig-studio2.nix b/pkgs/bitwig-studio/bitwig-studio2.nix index e5a5cc7..5bcc34d 100644 --- a/pkgs/bitwig-studio/bitwig-studio2.nix +++ b/pkgs/bitwig-studio/bitwig-studio2.nix @@ -1,18 +1,16 @@ -{ stdenv, fetchurl, bitwig-studio1, - xdg_utils, zenity, ffmpeg }: +{ stdenv, fetchurl, bitwig-studio1, xdg_utils, zenity, ffmpeg }: bitwig-studio1.overrideAttrs (oldAttrs: rec { name = "bitwig-studio-${version}"; version = "2.2.2"; src = fetchurl { - url = "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; + url = + "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; sha256 = "1x4wka32xlygmhdh9rb15s37zh5qjrgap2qk35y34c52lf5aak22"; }; buildInputs = bitwig-studio1.buildInputs ++ [ ffmpeg ]; - binPath = stdenv.lib.makeBinPath [ - ffmpeg xdg_utils zenity - ]; + binPath = stdenv.lib.makeBinPath [ ffmpeg xdg_utils zenity ]; }) diff --git a/pkgs/bitwig-studio/bitwig-studio3.nix b/pkgs/bitwig-studio/bitwig-studio3.nix index 8579ce1..cfe342d 100644 --- a/pkgs/bitwig-studio/bitwig-studio3.nix +++ b/pkgs/bitwig-studio/bitwig-studio3.nix @@ -1,11 +1,12 @@ -{ stdenv, fetchurl, bitwig-studio2, ... }: +{ stdenv, fetchurl, bitwig-studio2, ... }: bitwig-studio2.overrideAttrs (oldAttrs: rec { name = "bitwig-studio-${version}"; version = "3.0.3"; src = fetchurl { - url = "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; + url = + "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb"; sha256 = "162l95imq2fb4blfkianlkymm690by9ri73xf9zigknqf0gacgsa"; }; diff --git a/pkgs/castget/default.nix b/pkgs/castget/default.nix index e55b186..f888def 100644 --- a/pkgs/castget/default.nix +++ b/pkgs/castget/default.nix @@ -1,6 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, - curl, glib, id3lib, libxml2, ... }: - +{ stdenv, fetchurl, pkgconfig, curl, glib, id3lib, libxml2, ... }: stdenv.mkDerivation rec { version = "1.2.4"; @@ -11,12 +9,12 @@ stdenv.mkDerivation rec { sha256 = "0bb9pb1pn3d3x6a0l1d7l77gjq369g5v62bbnmg4k1jkxl633vli"; }; - buildInputs = - [ glib libxml2 curl id3lib pkgconfig ]; + buildInputs = [ glib libxml2 curl id3lib pkgconfig ]; meta = with stdenv.lib; { - description = "a simple, command-line based RSS enclosure downloader. It is primarily intended for automatic, unattended downloading of podcasts."; - homepage = https://castget.johndal.com; + description = + "a simple, command-line based RSS enclosure downloader. It is primarily intended for automatic, unattended downloading of podcasts."; + homepage = "https://castget.johndal.com"; license = licenses.gpl2; platforms = platforms.linux; maintainers = with maintainers; [ mrVanDalo ]; diff --git a/pkgs/default.nix b/pkgs/default.nix index aae76a8..8b00806 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,18 +4,17 @@ self: super: let callPackage = super.lib.callPackageWith super; - unstablePkgs = import {}; -in + unstablePkgs = import { }; -{ +in { haskellPackages = super.haskellPackages.override { overrides = self: super: { - image-generator = super.callPackage ./image-generator {}; + image-generator = super.callPackage ./image-generator { }; }; }; - bitwig-studio1 = super.bitwig-studio1.override{ - libxkbcommon = super.libxkbcommon.overrideAttrs( old: rec { + bitwig-studio1 = super.bitwig-studio1.override { + libxkbcommon = super.libxkbcommon.overrideAttrs (old: rec { name = "libxkbcommon-0.7.2"; src = super.fetchurl { url = "https://xkbcommon.org/download/${name}.tar.xz"; @@ -24,30 +23,30 @@ in }); }; - gitlog2json = callPackage ./gitlog2json {}; + gitlog2json = callPackage ./gitlog2json { }; - bitwig-studio3 = callPackage ./bitwig-studio/bitwig-studio3.nix {}; + bitwig-studio3 = callPackage ./bitwig-studio/bitwig-studio3.nix { }; - bitwig-studio = callPackage ./bitwig-studio/bitwig-studio-environment.nix {}; + bitwig-studio = callPackage ./bitwig-studio/bitwig-studio-environment.nix { }; - geodatabase = callPackage ./geodatabase {}; + geodatabase = callPackage ./geodatabase { }; - landingpage = callPackage ./landingpage {}; + landingpage = callPackage ./landingpage { }; - bepasty-client-cli = callPackage ./bepasty-client-cli {}; + bepasty-client-cli = callPackage ./bepasty-client-cli { }; - emo = callPackage ./emoji {}; + emo = callPackage ./emoji { }; - q = callPackage ./q {}; + q = callPackage ./q { }; - otpmenu = callPackage ./otpmenu {}; + otpmenu = callPackage ./otpmenu { }; # use upstream only for package tests # memo = callPackage ./memo {}; - sononym = callPackage ./sononym {}; + sononym = callPackage ./sononym { }; - castget = callPackage ./castget {}; + castget = callPackage ./castget { }; terranix = callPackage (super.fetchgit { url = "https://git.ingolf-wagner.de/terranix/terranix.git"; diff --git a/pkgs/emoji/default.nix b/pkgs/emoji/default.nix index b71a384..9171a77 100644 --- a/pkgs/emoji/default.nix +++ b/pkgs/emoji/default.nix @@ -1,49 +1,48 @@ -{ coreutils, dmenu, gnused, writeShellScriptBin , writeText, xdotool, ... }: +{ coreutils, dmenu, gnused, writeShellScriptBin, writeText, xdotool, ... }: let # from http://asciimoji.com/ emoticons = writeText "emoticons" '' -¯\(°_o)/¯ | dunno lol shrug dlol -¯\_(ツ)_/¯ | dunno lol shrug dlol -( ͡° ͜ʖ ͡°) | lenny -¯\_( ͡° ͜ʖ ͡°)_/¯ | lenny shrug dlol -( ゚д゚) | aaah sad noo -ヽ(^o^)丿 | hi yay yey hello -(^o^; | ups hehe -(^∇^) | yay yey -┗(`皿´)┛ | angry argh -ヾ(^_^) byebye!! | bye -<(^.^<) <(^.^)> (>^.^)> (7^.^)7 (>^.^<) | dance -(-.-)Zzz... | sleep -(∩╹□╹∩) | oh noes woot -™ | tm -ζ | zeta -(╯°□°)╯ ┻━┻ | table flip -(」゜ロ゜)」 | why woot -(= ФェФ=) | cat -(。◕‿‿◕。) | cute -☜(゚ヮ゚☜) | you -x⸑x | dead -☉ ‿ ⚆ | derp -(҂◡_◡) ᕤ | endure -(*・‿・)ノ⌒*:・゚✧ | glitter -(⌐⊙_⊙) | nerd -WHΣИ $HΛLL WΣ MΣΣ† ΛGΛ|И? | when shall we meet again -✔ | check -(◕ᴥ◕ʋ) | dog -(ノ◕ヮ◕)ノ*:・゚✧ | excited -(❍ᴥ❍ʋ) | jake dog -L(° O °L) | lol -o()xxxx[{::::::::::::::::::> | sword -(ÒДÓױ) | what wat -Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ | yolo -⊹╰(⌣ʟ⌣)╯⊹ | zen -@}-,-`- | rose - ''; + ¯\(°_o)/¯ | dunno lol shrug dlol + ¯\_(ツ)_/¯ | dunno lol shrug dlol + ( ͡° ͜ʖ ͡°) | lenny + ¯\_( ͡° ͜ʖ ͡°)_/¯ | lenny shrug dlol + ( ゚д゚) | aaah sad noo + ヽ(^o^)丿 | hi yay yey hello + (^o^; | ups hehe + (^∇^) | yay yey + ┗(`皿´)┛ | angry argh + ヾ(^_^) byebye!! | bye + <(^.^<) <(^.^)> (>^.^)> (7^.^)7 (>^.^<) | dance + (-.-)Zzz... | sleep + (∩╹□╹∩) | oh noes woot + ™ | tm + ζ | zeta + (╯°□°)╯ ┻━┻ | table flip + (」゜ロ゜)」 | why woot + (= ФェФ=) | cat + (。◕‿‿◕。) | cute + ☜(゚ヮ゚☜) | you + x⸑x | dead + ☉ ‿ ⚆ | derp + (҂◡_◡) ᕤ | endure + (*・‿・)ノ⌒*:・゚✧ | glitter + (⌐⊙_⊙) | nerd + WHΣИ $HΛLL WΣ MΣΣ† ΛGΛ|И? | when shall we meet again + ✔ | check + (◕ᴥ◕ʋ) | dog + (ノ◕ヮ◕)ノ*:・゚✧ | excited + (❍ᴥ❍ʋ) | jake dog + L(° O °L) | lol + o()xxxx[{::::::::::::::::::> | sword + (ÒДÓױ) | what wat + Yᵒᵘ Oᶰˡʸ Lᶤᵛᵉ Oᶰᶜᵉ | yolo + ⊹╰(⌣ʟ⌣)╯⊹ | zen + @}-,-`- | rose + ''; -in -writeShellScriptBin "emoticons" '' +in writeShellScriptBin "emoticons" '' set -efu data=$(${coreutils}/bin/cat ${emoticons}) diff --git a/pkgs/geodatabase/default.nix b/pkgs/geodatabase/default.nix index 988736b..9887d3c 100644 --- a/pkgs/geodatabase/default.nix +++ b/pkgs/geodatabase/default.nix @@ -4,7 +4,8 @@ stdenv.mkDerivation rec { version = "20190702"; name = "geocities-${version}"; src = fetchurl { - url = "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"; + url = + "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"; # sha256 = "10jc4sff6p0gx5lirpy1m683l42al4sdh44hqmvnznxdgpgfcy3r"; sha256 = "1r2v3np74hzkzzndi15kwhl65wfy6aflfnj85ars0236bh2d786c"; }; @@ -18,7 +19,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "geo database"; - homepage = https://dev.maxmind.com/geoip/geoip2/geolite2/; + homepage = "https://dev.maxmind.com/geoip/geoip2/geolite2/"; license = licenses.MIT; platforms = platforms.linux; maintainers = with maintainers; [ mrVanDalo ]; diff --git a/pkgs/gitlog2json/shell.nix b/pkgs/gitlog2json/shell.nix index 61a54a4..345b5f8 100644 --- a/pkgs/gitlog2json/shell.nix +++ b/pkgs/gitlog2json/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: pkgs.mkShell { @@ -8,7 +8,7 @@ pkgs.mkShell { pkgs.python3Packages.elasticsearch pkgs.python3Packages.click - (pkgs.callPackage ./default.nix {}) + (pkgs.callPackage ./default.nix { }) ]; shellHook = '' diff --git a/pkgs/image-generator/default.nix b/pkgs/image-generator/default.nix index 1d29edb..2c8e911 100644 --- a/pkgs/image-generator/default.nix +++ b/pkgs/image-generator/default.nix @@ -1,7 +1,6 @@ -{ mkDerivation, base, colour, diagrams-cairo, diagrams-contrib -, diagrams-core, diagrams-lib, diagrams-svg, extra, fetchgit -, optparse-applicative, primes, random, stdenv -}: +{ mkDerivation, base, colour, diagrams-cairo, diagrams-contrib, diagrams-core +, diagrams-lib, diagrams-svg, extra, fetchgit, optparse-applicative, primes +, random, stdenv }: mkDerivation { pname = "image-generator"; version = "0.1.1.0"; @@ -15,8 +14,17 @@ mkDerivation { isExecutable = true; libraryHaskellDepends = [ base ]; executableHaskellDepends = [ - base colour diagrams-cairo diagrams-contrib diagrams-core - diagrams-lib diagrams-svg extra optparse-applicative primes random + base + colour + diagrams-cairo + diagrams-contrib + diagrams-core + diagrams-lib + diagrams-svg + extra + optparse-applicative + primes + random ]; doHaddock = false; homepage = "https://git.ingolf-wagner.de/palo/image-generator"; diff --git a/pkgs/landingpage/default.nix b/pkgs/landingpage/default.nix index 5557951..b5305b1 100644 --- a/pkgs/landingpage/default.nix +++ b/pkgs/landingpage/default.nix @@ -1,4 +1,5 @@ -{ lib, writeTextFile, jsonConfig ? {} , title ? "Landing Page", destination ? "/index.html", ... }: +{ lib, writeTextFile, jsonConfig ? { }, title ? "Landing Page" +, destination ? "/index.html", ... }: with lib; @@ -6,126 +7,127 @@ writeTextFile { name = "landingpage"; destination = destination; text = '' - - - - - ${title} - - - - + + + + + ${title} + + + + - + -${let + ${let - createItemRow = { titel ? null, text ? null, items ? []}: - '' -
- ${optionalString (titel != null) "

${title}

"} - ${optionalString (text != null) '' -
-
${text}
-
''} -
- ${concatStringsSep "\n" (map createSubItem items)} -
-
'' ; + createItemRow = { titel ? null, text ? null, items ? [ ] }: '' +
+ ${ + optionalString (titel != null) + ''

${title}

'' + } + ${ + optionalString (text != null) '' +
+
${text}
+
'' + } +
+ ${concatStringsSep "\n" (map createSubItem items)} +
+
''; + createSubItem = { label, href, image }: + # const shortLabel = (label.length > 28) ? `''${label.substring(0,25)}...` : label; - createSubItem = { label, href, image }: - # const shortLabel = (label.length > 28) ? `''${label.substring(0,25)}...` : label; + '' + ''; - '' - ''; + in concatStringsSep "\n" (map createItemRow jsonConfig.items)} - in - concatStringsSep "\n" (map createItemRow jsonConfig.items) - } - - - -''; + + + ''; } diff --git a/pkgs/lektor-with-plugins/lektor-git/shell.nix b/pkgs/lektor-with-plugins/lektor-git/shell.nix index f35227d..44d06fa 100644 --- a/pkgs/lektor-with-plugins/lektor-git/shell.nix +++ b/pkgs/lektor-with-plugins/lektor-git/shell.nix @@ -1,19 +1,16 @@ -{ pkgs ? import { } }: +{ pkgs ? import { } }: let callPackage = pkgs.lib.callPackageWith pkgs; - bin = callPackage ./default.nix {}; + bin = callPackage ./default.nix { }; -in -pkgs.mkShell { +in pkgs.mkShell { # needed pkgs # ----------- - buildInputs = with pkgs; [ - bin - ]; + buildInputs = with pkgs; [ bin ]; # run this on start # ----------------- diff --git a/pkgs/lektor-with-plugins/lektor-markdown-header-anchors/default.nix b/pkgs/lektor-with-plugins/lektor-markdown-header-anchors/default.nix index 6bb7f96..70b53ff 100644 --- a/pkgs/lektor-with-plugins/lektor-markdown-header-anchors/default.nix +++ b/pkgs/lektor-with-plugins/lektor-markdown-header-anchors/default.nix @@ -6,7 +6,7 @@ pkgs.python36.pkgs.buildPythonPackage rec { version = "0.3.1"; - src = fetchFromGitHub{ + src = fetchFromGitHub { owner = "lektor"; repo = "lektor-markdown-header-anchors"; rev = "${version}"; diff --git a/pkgs/lektor-with-plugins/lektor-shell/shell.nix b/pkgs/lektor-with-plugins/lektor-shell/shell.nix index f857281..4052a27 100644 --- a/pkgs/lektor-with-plugins/lektor-shell/shell.nix +++ b/pkgs/lektor-with-plugins/lektor-shell/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: let @@ -8,14 +8,11 @@ let # propagatedBuildInputs = [ pytest numpy pkgs.libsndfile ]; }; -in -pkgs.mkShell { +in pkgs.mkShell { # needed pkgs # ----------- - buildInputs = with pkgs; [ - bin - ]; + buildInputs = with pkgs; [ bin ]; # run this on start # ----------------- diff --git a/pkgs/lektor-with-plugins/requirements.nix b/pkgs/lektor-with-plugins/requirements.nix index 09aab30..5bb2832 100644 --- a/pkgs/lektor-with-plugins/requirements.nix +++ b/pkgs/lektor-with-plugins/requirements.nix @@ -5,8 +5,7 @@ # pypi2nix -V 3.6 -e lektor -E libffi -E openssl # -{ pkgs ? import {} -}: +{ pkgs ? import { } }: let @@ -14,34 +13,35 @@ let inherit (pkgs.stdenv.lib) fix' extends inNixShell; pythonPackages = - import "${toString pkgs.path}/pkgs/top-level/python-packages.nix" { - inherit pkgs; - inherit (pkgs) stdenv; - python = pkgs.python36; - # patching pip so it does not try to remove files when running nix-shell - overrides = - self: super: { + import "${toString pkgs.path}/pkgs/top-level/python-packages.nix" { + inherit pkgs; + inherit (pkgs) stdenv; + python = pkgs.python36; + # patching pip so it does not try to remove files when running nix-shell + overrides = self: super: { bootstrapped-pip = super.bootstrapped-pip.overrideDerivation (old: { patchPhase = old.patchPhase + '' sed -i -e "s|paths_to_remove.remove(auto_confirm)|#paths_to_remove.remove(auto_confirm)|" -e "s|self.uninstalled = paths_to_remove|#self.uninstalled = paths_to_remove|" $out/${pkgs.python35.sitePackages}/pip/req/req_install.py ''; }); }; - }; + }; commonBuildInputs = with pkgs; [ libffi openssl ]; commonDoCheck = false; withPackages = pkgs': let - pkgs = builtins.removeAttrs pkgs' ["__unfix__"]; + pkgs = builtins.removeAttrs pkgs' [ "__unfix__" ]; interpreter = pythonPackages.buildPythonPackage { name = "python36-interpreter"; buildInputs = [ makeWrapper ] ++ (builtins.attrValues pkgs); buildCommand = '' mkdir -p $out/bin ln -s ${pythonPackages.python.interpreter} $out/bin/${pythonPackages.python.executable} - for dep in ${builtins.concatStringsSep " " (builtins.attrValues pkgs)}; do + for dep in ${ + builtins.concatStringsSep " " (builtins.attrValues pkgs) + }; do if [ -d "$dep/bin" ]; then for prog in "$dep/bin/"*; do if [ -f $prog ]; then @@ -66,23 +66,26 @@ let mkDerivation = pythonPackages.buildPythonPackage; packages = pkgs; overrideDerivation = drv: f: - pythonPackages.buildPythonPackage (drv.drvAttrs // f drv.drvAttrs // { meta = drv.meta; }); - withPackages = pkgs'': - withPackages (pkgs // pkgs''); + pythonPackages.buildPythonPackage + (drv.drvAttrs // f drv.drvAttrs // { meta = drv.meta; }); + withPackages = pkgs'': withPackages (pkgs // pkgs''); }; - python = withPackages {}; + python = withPackages { }; generated = self: { "Babel" = python.mkDerivation { name = "Babel-2.6.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/be/cc/9c981b249a455fa0c76338966325fc70b7265521bad641bf2932f77712f4/Babel-2.6.0.tar.gz"; sha256 = "8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/be/cc/9c981b249a455fa0c76338966325fc70b7265521bad641bf2932f77712f4/Babel-2.6.0.tar.gz"; + sha256 = + "8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."pytz" - ]; + propagatedBuildInputs = [ self."pytz" ]; meta = with pkgs.stdenv.lib; { homepage = "http://babel.pocoo.org/"; license = licenses.bsdOriginal; @@ -90,11 +93,14 @@ let }; }; - - "Click" = python.mkDerivation { name = "Click-7.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/f8/5c/f60e9d8a1e77005f664b76ff8aeaee5bc05d0a91798afd7f53fc998dbc47/Click-7.0.tar.gz"; sha256 = "5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/f8/5c/f60e9d8a1e77005f664b76ff8aeaee5bc05d0a91798afd7f53fc998dbc47/Click-7.0.tar.gz"; + sha256 = + "5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -105,11 +111,14 @@ let }; }; - - "ExifRead" = python.mkDerivation { name = "ExifRead-2.1.2"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/7b/cb/92b644626830115910cf2b36d3dfa600adbec86dff3207a7de3bfd6c6a60/ExifRead-2.1.2.tar.gz"; sha256 = "79e244f2eb466709029e8806fe5e2cdd557870c3db5f68954db0ef548d9320ad"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/7b/cb/92b644626830115910cf2b36d3dfa600adbec86dff3207a7de3bfd6c6a60/ExifRead-2.1.2.tar.gz"; + sha256 = + "79e244f2eb466709029e8806fe5e2cdd557870c3db5f68954db0ef548d9320ad"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -120,62 +129,66 @@ let }; }; - - "Flask" = python.mkDerivation { name = "Flask-1.0.2"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/4b/12/c1fbf4971fda0e4de05565694c9f0c92646223cff53f15b6eb248a310a62/Flask-1.0.2.tar.gz"; sha256 = "2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/4b/12/c1fbf4971fda0e4de05565694c9f0c92646223cff53f15b6eb248a310a62/Flask-1.0.2.tar.gz"; + sha256 = + "2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."Click" - self."Jinja2" - self."Werkzeug" - self."itsdangerous" - ]; + propagatedBuildInputs = + [ self."Click" self."Jinja2" self."Werkzeug" self."itsdangerous" ]; meta = with pkgs.stdenv.lib; { homepage = "https://www.palletsprojects.com/p/flask/"; license = licenses.bsdOriginal; - description = "A simple framework for building complex web applications."; + description = + "A simple framework for building complex web applications."; }; }; - - "Jinja2" = python.mkDerivation { name = "Jinja2-2.10"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz"; sha256 = "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz"; + sha256 = + "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."Babel" - self."MarkupSafe" - ]; + propagatedBuildInputs = [ self."Babel" self."MarkupSafe" ]; meta = with pkgs.stdenv.lib; { homepage = "http://jinja.pocoo.org/"; license = licenses.bsdOriginal; - description = "A small but fast and easy to use stand-alone template engine written in pure python."; + description = + "A small but fast and easy to use stand-alone template engine written in pure python."; }; }; - - "Lektor" = python.mkDerivation { name = "Lektor-3.1.3"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/00/02/43e93399b2f3974d7dfc50364d2d74a000f98bd0eedc406fd391769643e2/Lektor-3.1.3.tar.gz"; sha256 = "60a83e7a100780a58553324b396b0df32a2f584452184efbf87acefed85e564d"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/00/02/43e93399b2f3974d7dfc50364d2d74a000f98bd0eedc406fd391769643e2/Lektor-3.1.3.tar.gz"; + sha256 = + "60a83e7a100780a58553324b396b0df32a2f584452184efbf87acefed85e564d"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ - self."Babel" - self."Click" - self."ExifRead" - self."Flask" - self."Jinja2" - self."inifile" - self."mistune" - self."requests" - self."watchdog" - ]; + self."Babel" + self."Click" + self."ExifRead" + self."Flask" + self."Jinja2" + self."inifile" + self."mistune" + self."requests" + self."watchdog" + ]; meta = with pkgs.stdenv.lib; { homepage = "http://github.com/lektor/lektor/"; license = licenses.bsdOriginal; @@ -183,11 +196,14 @@ let }; }; - - "MarkupSafe" = python.mkDerivation { name = "MarkupSafe-1.1.1"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"; sha256 = "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"; + sha256 = + "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -198,11 +214,14 @@ let }; }; - - "PyYAML" = python.mkDerivation { name = "PyYAML-5.1"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz"; sha256 = "436bc774ecf7c103814098159fbb84c2715d25980175292c648f2da143909f95"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz"; + sha256 = + "436bc774ecf7c103814098159fbb84c2715d25980175292c648f2da143909f95"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -213,16 +232,17 @@ let }; }; - - "Werkzeug" = python.mkDerivation { name = "Werkzeug-0.15.1"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/72/60/f628e8920cbf54afa2a83b75b32a1e69b559b95514d1deb841823dd97830/Werkzeug-0.15.1.tar.gz"; sha256 = "ca5c2dcd367d6c0df87185b9082929d255358f5391923269335782b213d52655"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/72/60/f628e8920cbf54afa2a83b75b32a1e69b559b95514d1deb841823dd97830/Werkzeug-0.15.1.tar.gz"; + sha256 = + "ca5c2dcd367d6c0df87185b9082929d255358f5391923269335782b213d52655"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."watchdog" - ]; + propagatedBuildInputs = [ self."watchdog" ]; meta = with pkgs.stdenv.lib; { homepage = "https://palletsprojects.com/p/werkzeug/"; license = licenses.bsdOriginal; @@ -230,11 +250,14 @@ let }; }; - - "argh" = python.mkDerivation { name = "argh-0.26.2"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/e3/75/1183b5d1663a66aebb2c184e0398724b624cecd4f4b679cb6e25de97ed15/argh-0.26.2.tar.gz"; sha256 = "e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/e3/75/1183b5d1663a66aebb2c184e0398724b624cecd4f4b679cb6e25de97ed15/argh-0.26.2.tar.gz"; + sha256 = + "e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -245,26 +268,33 @@ let }; }; - - "asn1crypto" = python.mkDerivation { name = "asn1crypto-0.24.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/fc/f1/8db7daa71f414ddabfa056c4ef792e1461ff655c2ae2928a2b675bfed6b4/asn1crypto-0.24.0.tar.gz"; sha256 = "9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/fc/f1/8db7daa71f414ddabfa056c4ef792e1461ff655c2ae2928a2b675bfed6b4/asn1crypto-0.24.0.tar.gz"; + sha256 = + "9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; meta = with pkgs.stdenv.lib; { homepage = "https://github.com/wbond/asn1crypto"; license = licenses.mit; - description = "Fast ASN.1 parser and serializer with definitions for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7, PKCS#8, PKCS#12, PKCS#5, X.509 and TSP"; + description = + "Fast ASN.1 parser and serializer with definitions for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7, PKCS#8, PKCS#12, PKCS#5, X.509 and TSP"; }; }; - - "certifi" = python.mkDerivation { name = "certifi-2019.3.9"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/06/b8/d1ea38513c22e8c906275d135818fee16ad8495985956a9b7e2bb21942a1/certifi-2019.3.9.tar.gz"; sha256 = "b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/06/b8/d1ea38513c22e8c906275d135818fee16ad8495985956a9b7e2bb21942a1/certifi-2019.3.9.tar.gz"; + sha256 = + "b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -275,16 +305,17 @@ let }; }; - - "cffi" = python.mkDerivation { name = "cffi-1.12.2"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/64/7c/27367b38e6cc3e1f49f193deb761fe75cda9f95da37b67b422e62281fcac/cffi-1.12.2.tar.gz"; sha256 = "e113878a446c6228669144ae8a56e268c91b7f1fafae927adc4879d9849e0ea7"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/64/7c/27367b38e6cc3e1f49f193deb761fe75cda9f95da37b67b422e62281fcac/cffi-1.12.2.tar.gz"; + sha256 = + "e113878a446c6228669144ae8a56e268c91b7f1fafae927adc4879d9849e0ea7"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."pycparser" - ]; + propagatedBuildInputs = [ self."pycparser" ]; meta = with pkgs.stdenv.lib; { homepage = "http://cffi.readthedocs.org"; license = licenses.mit; @@ -292,11 +323,14 @@ let }; }; - - "chardet" = python.mkDerivation { name = "chardet-3.0.4"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"; sha256 = "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"; + sha256 = + "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -307,32 +341,34 @@ let }; }; - - "cryptography" = python.mkDerivation { name = "cryptography-2.6.1"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449/cryptography-2.6.1.tar.gz"; sha256 = "26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449/cryptography-2.6.1.tar.gz"; + sha256 = + "26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."asn1crypto" - self."cffi" - self."idna" - self."pytz" - self."six" - ]; + propagatedBuildInputs = + [ self."asn1crypto" self."cffi" self."idna" self."pytz" self."six" ]; meta = with pkgs.stdenv.lib; { homepage = "https://github.com/pyca/cryptography"; license = licenses.bsdOriginal; - description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."; + description = + "cryptography is a package which provides cryptographic recipes and primitives to Python developers."; }; }; - - "idna" = python.mkDerivation { name = "idna-2.8"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7/idna-2.8.tar.gz"; sha256 = "c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/ad/13/eb56951b6f7950cadb579ca166e448ba77f9d24efc03edd7e55fa57d04b7/idna-2.8.tar.gz"; + sha256 = + "c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -343,11 +379,14 @@ let }; }; - - "inifile" = python.mkDerivation { name = "inifile-0.4"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/af/9e/1cd6be0edcbeeb89a6d6ee101dc371a43fa1a19ffaa06ffe99b9e92a3053/inifile-0.4.zip"; sha256 = "891bc629f81477708581b30a7b0583bb5c9c2ee3c070afd4675ecd4f96b0d78d"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/af/9e/1cd6be0edcbeeb89a6d6ee101dc371a43fa1a19ffaa06ffe99b9e92a3053/inifile-0.4.zip"; + sha256 = + "891bc629f81477708581b30a7b0583bb5c9c2ee3c070afd4675ecd4f96b0d78d"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -358,26 +397,33 @@ let }; }; - - "itsdangerous" = python.mkDerivation { name = "itsdangerous-1.1.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz"; sha256 = "321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/68/1a/f27de07a8a304ad5fa817bbe383d1238ac4396da447fa11ed937039fa04b/itsdangerous-1.1.0.tar.gz"; + sha256 = + "321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; meta = with pkgs.stdenv.lib; { homepage = "https://palletsprojects.com/p/itsdangerous/"; license = licenses.bsdOriginal; - description = "Various helpers to pass data to untrusted environments and back."; + description = + "Various helpers to pass data to untrusted environments and back."; }; }; - - "mistune" = python.mkDerivation { name = "mistune-0.8.4"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/2d/a4/509f6e7783ddd35482feda27bc7f72e65b5e7dc910eca4ab2164daf9c577/mistune-0.8.4.tar.gz"; sha256 = "59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/2d/a4/509f6e7783ddd35482feda27bc7f72e65b5e7dc910eca4ab2164daf9c577/mistune-0.8.4.tar.gz"; + sha256 = + "59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -388,11 +434,14 @@ let }; }; - - "pathtools" = python.mkDerivation { name = "pathtools-0.1.2"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz"; sha256 = "7c35c5421a39bb82e58018febd90e3b6e5db34c5443aaaf742b3f33d4655f1c0"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz"; + sha256 = + "7c35c5421a39bb82e58018febd90e3b6e5db34c5443aaaf742b3f33d4655f1c0"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -403,17 +452,17 @@ let }; }; - - "pyOpenSSL" = python.mkDerivation { name = "pyOpenSSL-19.0.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/40/d0/8efd61531f338a89b4efa48fcf1972d870d2b67a7aea9dcf70783c8464dc/pyOpenSSL-19.0.0.tar.gz"; sha256 = "aeca66338f6de19d1aa46ed634c3b9ae519a64b458f8468aec688e7e3c20f200"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/40/d0/8efd61531f338a89b4efa48fcf1972d870d2b67a7aea9dcf70783c8464dc/pyOpenSSL-19.0.0.tar.gz"; + sha256 = + "aeca66338f6de19d1aa46ed634c3b9ae519a64b458f8468aec688e7e3c20f200"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."cryptography" - self."six" - ]; + propagatedBuildInputs = [ self."cryptography" self."six" ]; meta = with pkgs.stdenv.lib; { homepage = "https://pyopenssl.org/"; license = licenses.asl20; @@ -421,11 +470,14 @@ let }; }; - - "pycparser" = python.mkDerivation { name = "pycparser-2.19"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz"; sha256 = "a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz"; + sha256 = + "a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -436,11 +488,14 @@ let }; }; - - "pytz" = python.mkDerivation { name = "pytz-2018.9"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/af/be/6c59e30e208a5f28da85751b93ec7b97e4612268bb054d0dff396e758a90/pytz-2018.9.tar.gz"; sha256 = "d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/af/be/6c59e30e208a5f28da85751b93ec7b97e4612268bb054d0dff396e758a90/pytz-2018.9.tar.gz"; + sha256 = + "d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -451,21 +506,24 @@ let }; }; - - "requests" = python.mkDerivation { name = "requests-2.21.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/52/2c/514e4ac25da2b08ca5a464c50463682126385c4272c18193876e91f4bc38/requests-2.21.0.tar.gz"; sha256 = "502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/52/2c/514e4ac25da2b08ca5a464c50463682126385c4272c18193876e91f4bc38/requests-2.21.0.tar.gz"; + sha256 = + "502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ - self."certifi" - self."chardet" - self."cryptography" - self."idna" - self."pyOpenSSL" - self."urllib3" - ]; + self."certifi" + self."chardet" + self."cryptography" + self."idna" + self."pyOpenSSL" + self."urllib3" + ]; meta = with pkgs.stdenv.lib; { homepage = "http://python-requests.org"; license = licenses.asl20; @@ -473,11 +531,14 @@ let }; }; - - "six" = python.mkDerivation { name = "six-1.12.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"; sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"; + sha256 = + "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; propagatedBuildInputs = [ ]; @@ -488,38 +549,37 @@ let }; }; - - "urllib3" = python.mkDerivation { name = "urllib3-1.24.1"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/b1/53/37d82ab391393565f2f831b8eedbffd57db5a718216f82f1a8b4d381a1c1/urllib3-1.24.1.tar.gz"; sha256 = "de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/b1/53/37d82ab391393565f2f831b8eedbffd57db5a718216f82f1a8b4d381a1c1/urllib3-1.24.1.tar.gz"; + sha256 = + "de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."certifi" - self."cryptography" - self."idna" - self."pyOpenSSL" - ]; + propagatedBuildInputs = + [ self."certifi" self."cryptography" self."idna" self."pyOpenSSL" ]; meta = with pkgs.stdenv.lib; { homepage = "https://urllib3.readthedocs.io/"; license = licenses.mit; - description = "HTTP library with thread-safe connection pooling, file post, and more."; + description = + "HTTP library with thread-safe connection pooling, file post, and more."; }; }; - - "watchdog" = python.mkDerivation { name = "watchdog-0.9.0"; - src = pkgs.fetchurl { url = "https://files.pythonhosted.org/packages/bb/e3/5a55d48a29300160779f0a0d2776d17c1b762a2039b36de528b093b87d5b/watchdog-0.9.0.tar.gz"; sha256 = "965f658d0732de3188211932aeb0bb457587f04f63ab4c1e33eab878e9de961d"; }; + src = pkgs.fetchurl { + url = + "https://files.pythonhosted.org/packages/bb/e3/5a55d48a29300160779f0a0d2776d17c1b762a2039b36de528b093b87d5b/watchdog-0.9.0.tar.gz"; + sha256 = + "965f658d0732de3188211932aeb0bb457587f04f63ab4c1e33eab878e9de961d"; + }; doCheck = commonDoCheck; buildInputs = commonBuildInputs; - propagatedBuildInputs = [ - self."PyYAML" - self."argh" - self."pathtools" - ]; + propagatedBuildInputs = [ self."PyYAML" self."argh" self."pathtools" ]; meta = with pkgs.stdenv.lib; { homepage = "http://github.com/gorakhargosh/watchdog"; license = licenses.asl20; @@ -534,13 +594,7 @@ let ]; allOverrides = - (if (builtins.pathExists localOverridesFile) - then [overrides] else [] ) ++ commonOverrides; + (if (builtins.pathExists localOverridesFile) then [ overrides ] else [ ]) + ++ commonOverrides; -in python.withPackages - (fix' (pkgs.lib.fold - extends - generated - allOverrides - ) - ) \ No newline at end of file +in python.withPackages (fix' (pkgs.lib.fold extends generated allOverrides)) diff --git a/pkgs/lektor-with-plugins/requirements_override.nix b/pkgs/lektor-with-plugins/requirements_override.nix index 54dc27d..572a2cb 100644 --- a/pkgs/lektor-with-plugins/requirements_override.nix +++ b/pkgs/lektor-with-plugins/requirements_override.nix @@ -7,16 +7,13 @@ let lektorShell = callPackage ./lektor-shell/default.nix { inherit pkgs; }; lektorGit = callPackage ./lektor-git/default.nix { inherit pkgs; }; - lektorMarkdownHeaderAnchors = callPackage ./lektor-markdown-header-anchors/default.nix { - inherit pkgs; - fetchFromGitHub = pkgs.fetchFromGitHub; - }; + lektorMarkdownHeaderAnchors = + callPackage ./lektor-markdown-header-anchors/default.nix { + inherit pkgs; + fetchFromGitHub = pkgs.fetchFromGitHub; + }; - inputs = [ - lektorShell - lektorGit - lektorMarkdownHeaderAnchors - ]; + inputs = [ lektorShell lektorGit lektorMarkdownHeaderAnchors ]; in { diff --git a/pkgs/memo/default.nix b/pkgs/memo/default.nix index c112cf0..6be6142 100644 --- a/pkgs/memo/default.nix +++ b/pkgs/memo/default.nix @@ -1,7 +1,5 @@ -{ fetchFromGitHub, silver-searcher, tree, man, stdenv, - git, - pandocSupport ? true, pandoc ? null - , ... }: +{ fetchFromGitHub, silver-searcher, tree, man, stdenv, git, pandocSupport ? true +, pandoc ? null, ... }: assert pandocSupport -> pandoc != null; @@ -12,9 +10,9 @@ stdenv.mkDerivation rec { version = "0.6"; src = fetchFromGitHub { - owner = "mrVanDalo"; - repo = "memo"; - rev = "${version}"; + owner = "mrVanDalo"; + repo = "memo"; + rev = "${version}"; sha256 = "1cvjs36f6vxzfz5d63yhyw8j7gdw5hn6cfzccf7ag08lamjhfhbr"; }; @@ -43,8 +41,8 @@ stdenv.mkDerivation rec { A simple tool written in bash to memorize stuff. Memo organizes is structured through topics which are folders in ~/memo. ''; - homepage = http://palovandalo.com/memo/; - downloadPage = https://github.com/mrVanDalo/memo/releases; + homepage = "http://palovandalo.com/memo/"; + downloadPage = "https://github.com/mrVanDalo/memo/releases"; license = stdenv.lib.licenses.gpl3; maintainers = [ stdenv.lib.maintainers.mrVanDalo ]; platforms = stdenv.lib.platforms.all; diff --git a/pkgs/otpmenu/default.nix b/pkgs/otpmenu/default.nix index c2d891f..8b75f59 100644 --- a/pkgs/otpmenu/default.nix +++ b/pkgs/otpmenu/default.nix @@ -1,56 +1,51 @@ -{ stdenv, symlinkJoin, rofi, gnused, pass-otp, writeTextFile, writeShellScriptBin, xdotool }: +{ stdenv, symlinkJoin, rofi, gnused, pass-otp, writeTextFile +, writeShellScriptBin, xdotool }: let name = "otpmenu"; - desktopFile = - writeTextFile { - name = "${name}.desktop" ; - destination = "/share/applications/${name}.desktop"; - text = '' - [Desktop Entry] - Categories=Application;Utility; - Comment=Enter MFA number with password otp plugins otp - Encoding=UTF-8 - Exec=${bin}/bin/${name} - Icon=gnome-lockscreen - Name=${name} - Terminal=false - Type=Application - ''; - }; + desktopFile = writeTextFile { + name = "${name}.desktop"; + destination = "/share/applications/${name}.desktop"; + text = '' + [Desktop Entry] + Categories=Application;Utility; + Comment=Enter MFA number with password otp plugins otp + Encoding=UTF-8 + Exec=${bin}/bin/${name} + Icon=gnome-lockscreen + Name=${name} + Terminal=false + Type=Application + ''; + }; + bin = writeShellScriptBin name # sh + '' + set -efu + x=$( + ${pass-otp}/bin/pass git ls-files '*/otp.gpg' \ + | ${gnused}/bin/sed 's:/otp\.gpg$::' \ + | ${rofi}/bin/rofi -dmenu -f -p OTP + ) - bin = writeShellScriptBin name /* sh */ '' - set -efu + otp=$(${pass-otp}/bin/pass otp code "$x/otp") - x=$( - ${pass-otp}/bin/pass git ls-files '*/otp.gpg' \ - | ${gnused}/bin/sed 's:/otp\.gpg$::' \ - | ${rofi}/bin/rofi -dmenu -f -p OTP - ) - - otp=$(${pass-otp}/bin/pass otp code "$x/otp") - - printf %s "$otp" | ${xdotool}/bin/xdotool type -f - + printf %s "$otp" | ${xdotool}/bin/xdotool type -f - ''; -in - symlinkJoin rec { - version = "1.0.0"; - name = "otpMenu-${version}"; - paths = [ - bin - desktopFile - ]; - meta = with stdenv.lib; { - description = "similar to passmenu shows and prints otp"; - homepage = https://your.mama; - license = licenses.gpl3; - platforms = platforms.linux; - maintainers = with maintainers; [ mrVanDalo ]; - }; - } +in symlinkJoin rec { + version = "1.0.0"; + name = "otpMenu-${version}"; + paths = [ bin desktopFile ]; + meta = with stdenv.lib; { + description = "similar to passmenu shows and prints otp"; + homepage = "https://your.mama"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ mrVanDalo ]; + }; +} diff --git a/pkgs/q/default.nix b/pkgs/q/default.nix index c5f8147..c4e855b 100644 --- a/pkgs/q/default.nix +++ b/pkgs/q/default.nix @@ -1,14 +1,8 @@ { pkgs, lib - # tzselect is your frind do find timezones - , timeZones ? [] - , timeColor ? 9 - , timeZoneColor ? 10 - , calBackgroundColor ? 10 - , calWeekColor ? 13 - , calDayColor ? 9 - , enableIntelBacklight ? true - , enableBattery ? true - , ... }: +# tzselect is your frind do find timezones +, timeZones ? [ ], timeColor ? 9, timeZoneColor ? 10, calBackgroundColor ? 10 +, calWeekColor ? 13, calDayColor ? 9, enableIntelBacklight ? true +, enableBattery ? true, ... }: let hrule = '' @@ -31,35 +25,37 @@ let hspace = 2; # Return number of columns required to print n calenders side by side. - need_width = n: - assert n >= 1; - n * calwidth + (n - 1) * hspace; + need_width = n: assert n >= 1; n * calwidth + (n - 1) * hspace; - lpad = n: c: s: - if lib.stringLength s < n - then lpad n c (c + s) - else s; + lpad = n: c: s: if lib.stringLength s < n then lpad n c (c + s) else s; - pad = ''{ - ${pkgs.gnused}/bin/sed ' - # rtrim - s/ *$// + pad = '' + { + ${pkgs.gnused}/bin/sed ' + # rtrim + s/ *$// - # delete last empty line - ''${/^$/d} - ' \ - | ${pkgs.gawk}/bin/awk '{printf "%-${toString calwidth}s\n", $0}' \ - | ${pkgs.gnused}/bin/sed " - # colorize header - 1,2s/.*/[38;5;${toString calBackgroundColor}m&/ + # delete last empty line + ''${/^$/d} + ' \ + | ${pkgs.gawk}/bin/awk '{printf "%-${ + toString calwidth + }s\n", $0}' \ + | ${pkgs.gnused}/bin/sed " + # colorize header + 1,2s/.*/[38;5;${toString calBackgroundColor}m&/ - # highlight current week - s/^$(${pkgs.coreutils}/bin/date +%W)/[38;5;${toString calWeekColor}m&/ + # highlight current week + s/^$(${pkgs.coreutils}/bin/date +%W)/[38;5;${ + toString calWeekColor + }m&/ - # colorize week number - s/^[ 1-9][0-9]/[38;5;${toString calBackgroundColor}m&/ - " - }''; + # colorize week number + s/^[ 1-9][0-9]/[38;5;${ + toString calBackgroundColor + }m&/ + " + }''; in '' cols=$(${pkgs.ncurses}/bin/tput cols) ${pkgs.coreutils}/bin/paste \ @@ -72,7 +68,9 @@ let ${pkgs.utillinux}/bin/cal -mw \ | ${pkgs.gnused}/bin/sed ' # colorize day of month - s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/[38;5;${toString calDayColor}m&/ + s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/[38;5;${ + toString calDayColor + }m&/ ' \ | ${pad} fi) \ @@ -89,14 +87,19 @@ let ''; q-timeZoneDate = zone: - let dateString = comment: '' '+%Y-%m-%dT[;38;5;${toString timeColor}m%H:%M:%S[;38;5;${toString timeZoneColor}m%:z ${comment}' ''; - timeZoneVariable = lib.optionalString (zone != null) "TZ=${zone}"; - comment = lib.optionalString (zone != null) " : ${zone}"; - in /* sh */ '' + let + dateString = comment: + "'+%Y-%m-%dT[;38;5;${ + toString timeColor + }m%H:%M:%S[;38;5;${toString timeZoneColor}m%:z ${comment}' "; + timeZoneVariable = lib.optionalString (zone != null) "TZ=${zone}"; + comment = lib.optionalString (zone != null) " : ${zone}"; + # sh + in '' ${timeZoneVariable} ${pkgs.coreutils}/bin/date ${dateString comment} ''; - q-timeZoneDates = if timeZones == [] then + q-timeZoneDates = if timeZones == [ ] then q-timeZoneDate null else lib.concatMapStringsSep "\n" q-timeZoneDate timeZones; @@ -311,10 +314,8 @@ let ${pkgs.taskwarrior}/bin/task export +ACTIVE status:pending | ${pkgs.jq}/bin/jq --raw-output '.[] | "⇒ \(.id) \(.description)"' ''; -in - -# bash needed for <(...) -pkgs.writers.writeBashBin "q" '' + # bash needed for <(...) +in pkgs.writers.writeBashBin "q" '' set -eu export PATH=/var/empty ${hrule} diff --git a/pkgs/sononym/default.nix b/pkgs/sononym/default.nix index da03603..7b004c1 100644 --- a/pkgs/sononym/default.nix +++ b/pkgs/sononym/default.nix @@ -1,37 +1,37 @@ -{ pkgs, stdenv, fetchurl}: +{ pkgs, stdenv, fetchurl }: with stdenv.lib; let -sononymPkg = stdenv.mkDerivation rec { + sononymPkg = stdenv.mkDerivation rec { - name = "sononym-${version}"; - version = "1.1.1"; + name = "sononym-${version}"; + version = "1.1.1"; + + src = fetchurl { + url = "https://www.sononym.net/download/sononym-${version}.tar.bz2"; + sha256 = "0snp624yg68k2g9myjpb7pam9s32ilbn2ixi5zfi0ya9ikdrk504"; + }; + + installPhase = '' + mkdir -p $out/usr/share/sononym + cp -r * $out/usr/share/sononym/ + + mkdir -p $out/bin + ln -s $out/usr/share/sononym/sononym $out/bin/sononym + ''; + + meta = { + description = "Modern tracker-based DAW"; + homepage = "http://www.renoise.com/"; + license = licenses.unfree; + maintainers = [ ]; + platforms = [ "x86_64-linux" ]; + }; - src = fetchurl { - url = "https://www.sononym.net/download/sononym-${version}.tar.bz2"; - sha256 = "0snp624yg68k2g9myjpb7pam9s32ilbn2ixi5zfi0ya9ikdrk504"; }; - installPhase = '' - mkdir -p $out/usr/share/sononym - cp -r * $out/usr/share/sononym/ - - mkdir -p $out/bin - ln -s $out/usr/share/sononym/sononym $out/bin/sononym - ''; - - meta = { - description = "Modern tracker-based DAW"; - homepage = http://www.renoise.com/; - license = licenses.unfree; - maintainers = []; - platforms = [ "x86_64-linux" ]; - }; - -}; - in (pkgs.buildFHSUserEnv { # name it @@ -42,75 +42,75 @@ in (pkgs.buildFHSUserEnv { # --------------------- # these are packages which are compiled for the target # system architecture - targetPkgs = pkgs: with pkgs; [ + targetPkgs = pkgs: + with pkgs; [ - sononymPkg + sononymPkg - # Reihenfolge ist anscheinend wichtig ! + # Reihenfolge ist anscheinend wichtig ! - # todo : das hier aufräumen - chromium - eudev - expat - freetype - fuse - gdk_pixbuf - glib - gtk2-x11 - mesa_glu - libresample - libtool - autoconf - automake - gnum4 - pkgconfig - gnumake - jack2Full - gcc49 - nodejs-10_x - mpg123 - libcxx - glibc - binutils - python27 - unzip + # todo : das hier aufräumen + chromium + eudev + expat + freetype + fuse + gdk_pixbuf + glib + gtk2-x11 + mesa_glu + libresample + libtool + autoconf + automake + gnum4 + pkgconfig + gnumake + jack2Full + gcc49 + nodejs-10_x + mpg123 + libcxx + glibc + binutils + python27 + unzip - alsaLib.out - atk.out - cairo.out - cups.lib - dbus_daemon.lib - fontconfig.lib - gcc-unwrapped.lib - gdk_pixbuf.out - glib.out - gnome2.GConf.out - gnome2.pango.out - gnome3.gtk.out - nspr.out - nssTools.out - wget - xlibs.libX11.out - xlibs.libXScrnSaver.out - xlibs.libXcomposite.out - xlibs.libXcursor.out - xlibs.libXdamage.out - xlibs.libXfixes.out - xlibs.libXi.out - xlibs.libXrandr.out - xlibs.libXrender.out - xlibs.libXtst.out - xlibs.libxcb.out - xorg_sys_opengl.out + alsaLib.out + atk.out + cairo.out + cups.lib + dbus_daemon.lib + fontconfig.lib + gcc-unwrapped.lib + gdk_pixbuf.out + glib.out + gnome2.GConf.out + gnome2.pango.out + gnome3.gtk.out + nspr.out + nssTools.out + wget + xlibs.libX11.out + xlibs.libXScrnSaver.out + xlibs.libXcomposite.out + xlibs.libXcursor.out + xlibs.libXdamage.out + xlibs.libXfixes.out + xlibs.libXi.out + xlibs.libXrandr.out + xlibs.libXrender.out + xlibs.libXtst.out + xlibs.libxcb.out + xorg_sys_opengl.out - ]; + ]; # multilib packages # ----------------- # these are packages compiled for multiple system # architectures (32bit/64bit) - multiPkgs = pkgs: with pkgs; [ - ]; + multiPkgs = pkgs: with pkgs; [ ]; # command # ------- diff --git a/system/all/default.nix b/system/all/default.nix index 086177f..e314990 100644 --- a/system/all/default.nix +++ b/system/all/default.nix @@ -1,5 +1,4 @@ -{ lib, config, pkgs, ... }: -{ +{ lib, config, pkgs, ... }: { imports = [ @@ -29,13 +28,9 @@ ]; - # provide overlays # ----------------- - nixpkgs.overlays = [ - (import "${}") - (import "${}/pkgs") - ]; + nixpkgs.overlays = [ (import "${}") (import "${}/pkgs") ]; # allow un-free # ------------- @@ -48,7 +43,7 @@ time.timeZone = lib.mkDefault "Pacific/Auckland"; i18n = { - consoleFont = "Lat2-Terminus16"; + consoleFont = "Lat2-Terminus16"; consoleKeyMap = "us"; defaultLocale = "en_US.UTF-8"; }; @@ -59,7 +54,6 @@ # 100 = always swapp boot.kernel.sysctl."vm.swappiness" = 0; - # rewire NIX_PATH # --------------- environment.variables.NIX_PATH = lib.mkForce "/var/src"; @@ -67,8 +61,8 @@ # Shell configuration # ------------------- programs.custom = { - bash.enable = true; - zsh.enable = true; + bash.enable = true; + zsh.enable = true; }; # This value determines the NixOS release with which your system is to be diff --git a/system/all/grub.nix b/system/all/grub.nix index 45dcf07..6424a04 100644 --- a/system/all/grub.nix +++ b/system/all/grub.nix @@ -1,12 +1,11 @@ -{ pkgs, lib, config , ... }: +{ pkgs, lib, config, ... }: let falloutGrubTheme = pkgs.fetchgit { url = "https://github.com/shvchk/fallout-grub-theme.git"; rev = "fe27cbc99e994d50bb4269a9388e3f7d60492ffa"; sha256 = "1z8zc4k2mh8d56ipql8vfljvdjczrrna5ckgzjsdyrndfkwv8ghw"; }; -in -{ +in { boot.loader.grub.extraConfig = '' set theme=($drive1)//themes/fallout-grub-theme/theme.txt diff --git a/system/all/networking-qos.nix b/system/all/networking-qos.nix index a1bca18..b8a0ef9 100644 --- a/system/all/networking-qos.nix +++ b/system/all/networking-qos.nix @@ -1,5 +1,4 @@ -{ pkgs, config, lib, ... }: -{ +{ pkgs, config, lib, ... }: { options.configuration.fireqos = with lib; { enable = mkEnableOption "enable"; @@ -27,24 +26,23 @@ }; }; - config = - let - kbits = number: - import (pkgs.runCommand "round-${toString number}" {} ''awk 'BEGIN{printf "\"%ikbit\"", ${toString number}}' > $out''); + config = let + kbits = number: + import (pkgs.runCommand "round-${toString number}" { } + ''awk 'BEGIN{printf "\"%ikbit\"", ${toString number}}' > $out''); - interface = config.configuration.fireqos.interface; - input = "${toString config.configuration.fireqos.input}kbit"; - output = "${toString config.configuration.fireqos.output}kbit"; - tincInput = kbits (config.configuration.fireqos.input * 0.7); - tincOutput = kbits (config.configuration.fireqos.output * 0.7); - useBalancedForExperimenting = false; + interface = config.configuration.fireqos.interface; + input = "${toString config.configuration.fireqos.input}kbit"; + output = "${toString config.configuration.fireqos.output}kbit"; + tincInput = kbits (config.configuration.fireqos.input * 0.7); + tincOutput = kbits (config.configuration.fireqos.output * 0.7); + useBalancedForExperimenting = false; - tincPorts = - lib.mapAttrsToList - (name: configuration: toString configuration.port) - config.module.cluster.services.tinc; + tincPorts = + lib.mapAttrsToList (name: configuration: toString configuration.port) + config.module.cluster.services.tinc; - in { + in { # https://firehol.org/tutorial/fireqos-new-user/ services.fireqos.enable = config.configuration.fireqos.enable; @@ -52,7 +50,9 @@ # ------------------- world - interface ${interface} world-in input rate ${input} ${lib.optionalString useBalancedForExperimenting "balanced"} + interface ${interface} world-in input rate ${input} ${ + lib.optionalString useBalancedForExperimenting "balanced" + } class ssh commit 300kbit match tcp port 22 @@ -69,7 +69,9 @@ class torrent match tcp dports ${toString config.services.custom.transmission.port} - interface ${interface} world-out output rate ${output} ${lib.optionalString useBalancedForExperimenting "balanced"} + interface ${interface} world-out output rate ${output} ${ + lib.optionalString useBalancedForExperimenting "balanced" + } class ssh commit 500kbit match tcp port 22 @@ -88,7 +90,9 @@ # ------------------- tinc - interface tinc.private tinc bidirectional input rate ${tincInput} output rate ${tincOutput} ${lib.optionalString useBalancedForExperimenting "balanced"} + interface tinc.private tinc bidirectional input rate ${tincInput} output rate ${tincOutput} ${ + lib.optionalString useBalancedForExperimenting "balanced" + } class ssh commit 300kbit match tcp port 22,2222 @@ -118,7 +122,7 @@ class syncthing match port 22000 - ''; + ''; }; diff --git a/system/all/nginx-landingpage.nix b/system/all/nginx-landingpage.nix index 1b47357..5421471 100644 --- a/system/all/nginx-landingpage.nix +++ b/system/all/nginx-landingpage.nix @@ -1,230 +1,258 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { services.nginx.virtualHosts."mia.${config.networking.hostName}.private" = { locations."/" = { - root = pkgs.landingpage.override{ jsonConfig = { - items = [ - { + root = pkgs.landingpage.override { + jsonConfig = { + items = [{ items = [ { - label= "github"; + label = "github"; href = "https://github.com/miaEngiadina"; - image = "https://media.giphy.com/media/l0MYEpMgixXtNRgrK/giphy.gif"; + image = + "https://media.giphy.com/media/l0MYEpMgixXtNRgrK/giphy.gif"; } { - label= "Confluence"; + label = "Confluence"; href = "https://fysitech.atlassian.net/wiki/spaces/DI/overview"; image = "https://media.giphy.com/media/TfMcfnr6USBtm/giphy.gif"; } { - label= "Kanban Board"; - href = "https://fysitech.atlassian.net/jira/software/projects/DPE/boards/1"; - image = "https://media.giphy.com/media/10zsjaH4g0GgmY/giphy.gif"; + label = "Kanban Board"; + href = + "https://fysitech.atlassian.net/jira/software/projects/DPE/boards/1"; + image = + "https://media.giphy.com/media/10zsjaH4g0GgmY/giphy.gif"; } ]; - } - ]; - }; }; + }]; + }; + }; }; }; services.nginx.virtualHosts."${config.networking.hostName}.private" = { default = true; locations."/" = { - root = pkgs.landingpage.override{ jsonConfig = { - items = [ - { - # text = "hallo"; - items = [ + root = pkgs.landingpage.override { + jsonConfig = { + items = [ + { + # text = "hallo"; + items = [ - { - label= "Dashboard"; - href = "http://grafana.workhorse.private"; - image = "https://media.giphy.com/media/eLmaUW5dJak2k/giphy.gif"; - } - { - label = "Prometheus"; - href = "http://prometheus.workhorse.private/"; - image = "https://media.giphy.com/media/1NLZYcJGLM9mo/giphy.gif"; - } - { - label = "Graylog"; - href = "http://graylog.workhorse.private/"; - image = "https://media.giphy.com/media/6oeRBKg7mwEZnSnYkn/giphy.gif"; - } - { - label = "Jenkins"; - href = "http://jenkins.workhorse.private/"; - image = "https://media.giphy.com/media/nQYnLFII2sFcQ/giphy.gif"; - } - { - label = "HomeAssistant"; - href = "http://porani.private:8123/lovelace/view_overview"; - image = "https://media.giphy.com/media/3o6ZtosYxN9Eo3AAZq/giphy.gif"; - } - { - label = "Kodi"; - href = "http://porani.private:8080/"; - image = "https://media.giphy.com/media/d9wPasV7ukkta/giphy.gif"; - } - { - label = "Hetzner Cloud"; - href = "https://console.hetzner.cloud/projects"; - image = "https://media.giphy.com/media/NECZ8crkbXR0k/giphy.gif"; - } - { - label = "Transmission"; - href = "http://transmission.kruck.private/"; - image = "https://media.giphy.com/media/9ryQgA3d0BVoe7iZl0/giphy.gif"; - } - { - label = "Pass the Popcorn"; - href = "https://passthepopcorn.me/"; - image = "https://media.giphy.com/media/NipFetnQOuKhW/giphy.gif"; - } - { - label = "redacted"; - href = "https://redacted.ch/"; - image = "https://media.giphy.com/media/ku5EcFe4PNGWA/giphy.gif"; - } - { - label = "Kibana Workhorse"; - href = "http://kibana.workhorse.private/"; - image = "https://media.giphy.com/media/24sVlirH2qPTO/giphy.gif"; - } - { - label = "Kibana Workout"; - href = "http://kibana.workout.private/"; - image = "https://media.giphy.com/media/24sVlirH2qPTO/giphy.gif"; - } - { - label = "Cups"; - href = "http://localhost:631/"; - image = "https://media.giphy.com/media/7hU7x4GPurk2c/giphy.gif"; - } - ]; - } - { - text = "Betfair"; - items = [ - { - label = "betfair"; - href = "https://www.betfair.com/exchange/plus/football"; - image = "https://media.giphy.com/media/3og0ILXHf8hmHmET1C/giphy.gif"; - } - { - label = "token"; - href = "https://docs.developer.betfair.com/visualisers/api-ng-account-operations/"; - image = "https://media.giphy.com/media/aeIlR57TpTimI/giphy.gif"; - } - { - label = "api doku"; - href = "https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Reference+Guide"; - image = "https://media.giphy.com/media/11bKAQfWd0Yo0w/giphy.gif"; - } - ]; - } - { - text = "Lektor"; - items = [ - { - label = "Terranix"; - href = "http://terranix.schasch.private"; - image = "https://media.giphy.com/media/nGtOFccLzujug/giphy.gif"; - } - { - label = "tech-blog"; - href = "http://techblog.schasch.private"; - image = "https://media.giphy.com/media/nGtOFccLzujug/giphy.gif"; - } - ]; - } - { - text = "NixOS"; - items = [ - { - label = "NixOS Manual"; - href = "https://nixos.org/nixos/manual/"; - image = "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; - } - { - label = "Nixpkgs Manual"; - href = "https://nixos.org/nixpkgs/manual/"; - image = "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; - } - { - label = "NixOS Reference"; - href = "https://storage.googleapis.com/files.tazj.in/nixdoc/manual.html#sec-functions-library"; - image = "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; - } - { - label = "Nix Packages"; - href = "https://nixos.org/nixos/packages.html"; - image = "https://media.giphy.com/media/l2YWlohvjPnsvkdEc/giphy.gif"; - } - { - label = "NixOS Options"; - href = "https://nixos.org/nixos/options.html"; - image = "https://media.giphy.com/media/3fiw51MvIWcGjMhy9a/giphy.gif"; - } - { - label = "NixOS Language specific helpers"; - href = "https://nixos.wiki/wiki/Language-specific_package_helpers"; - image = "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; - } - { - label = "NixOS Weekly"; - href = "https://weekly.nixos.org/"; - image = "https://media.giphy.com/media/lXiRLb0xFzmreM8k8/giphy.gif"; - } - { - label = "NixOS Security"; - href = "https://broken.sh/"; - image = "https://media.giphy.com/media/BqILAHjH1Ttm0/giphy.gif"; - } - { - label = "NixOS RFCs"; - href = "https://github.com/NixOS/rfcs/"; - image = "https://media.giphy.com/media/Uq9bGjGKg08M0/giphy.gif"; - } - ]; - } - { - text = "Syncthings"; - items = map ( - {name, host ? "${name}.private", ... }: - { + { + label = "Dashboard"; + href = "http://grafana.workhorse.private"; + image = + "https://media.giphy.com/media/eLmaUW5dJak2k/giphy.gif"; + } + { + label = "Prometheus"; + href = "http://prometheus.workhorse.private/"; + image = + "https://media.giphy.com/media/1NLZYcJGLM9mo/giphy.gif"; + } + { + label = "Graylog"; + href = "http://graylog.workhorse.private/"; + image = + "https://media.giphy.com/media/6oeRBKg7mwEZnSnYkn/giphy.gif"; + } + { + label = "Jenkins"; + href = "http://jenkins.workhorse.private/"; + image = + "https://media.giphy.com/media/nQYnLFII2sFcQ/giphy.gif"; + } + { + label = "HomeAssistant"; + href = "http://porani.private:8123/lovelace/view_overview"; + image = + "https://media.giphy.com/media/3o6ZtosYxN9Eo3AAZq/giphy.gif"; + } + { + label = "Kodi"; + href = "http://porani.private:8080/"; + image = + "https://media.giphy.com/media/d9wPasV7ukkta/giphy.gif"; + } + { + label = "Hetzner Cloud"; + href = "https://console.hetzner.cloud/projects"; + image = + "https://media.giphy.com/media/NECZ8crkbXR0k/giphy.gif"; + } + { + label = "Transmission"; + href = "http://transmission.kruck.private/"; + image = + "https://media.giphy.com/media/9ryQgA3d0BVoe7iZl0/giphy.gif"; + } + { + label = "Pass the Popcorn"; + href = "https://passthepopcorn.me/"; + image = + "https://media.giphy.com/media/NipFetnQOuKhW/giphy.gif"; + } + { + label = "redacted"; + href = "https://redacted.ch/"; + image = + "https://media.giphy.com/media/ku5EcFe4PNGWA/giphy.gif"; + } + { + label = "Kibana Workhorse"; + href = "http://kibana.workhorse.private/"; + image = + "https://media.giphy.com/media/24sVlirH2qPTO/giphy.gif"; + } + { + label = "Kibana Workout"; + href = "http://kibana.workout.private/"; + image = + "https://media.giphy.com/media/24sVlirH2qPTO/giphy.gif"; + } + { + label = "Cups"; + href = "http://localhost:631/"; + image = + "https://media.giphy.com/media/7hU7x4GPurk2c/giphy.gif"; + } + ]; + } + { + text = "Betfair"; + items = [ + { + label = "betfair"; + href = "https://www.betfair.com/exchange/plus/football"; + image = + "https://media.giphy.com/media/3og0ILXHf8hmHmET1C/giphy.gif"; + } + { + label = "token"; + href = + "https://docs.developer.betfair.com/visualisers/api-ng-account-operations/"; + image = + "https://media.giphy.com/media/aeIlR57TpTimI/giphy.gif"; + } + { + label = "api doku"; + href = + "https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Reference+Guide"; + image = + "https://media.giphy.com/media/11bKAQfWd0Yo0w/giphy.gif"; + } + ]; + } + { + text = "Lektor"; + items = [ + { + label = "Terranix"; + href = "http://terranix.schasch.private"; + image = + "https://media.giphy.com/media/nGtOFccLzujug/giphy.gif"; + } + { + label = "tech-blog"; + href = "http://techblog.schasch.private"; + image = + "https://media.giphy.com/media/nGtOFccLzujug/giphy.gif"; + } + ]; + } + { + text = "NixOS"; + items = [ + { + label = "NixOS Manual"; + href = "https://nixos.org/nixos/manual/"; + image = + "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; + } + { + label = "Nixpkgs Manual"; + href = "https://nixos.org/nixpkgs/manual/"; + image = + "https://media.giphy.com/media/dsdVyKkSqccEzoPufX/giphy.gif"; + } + { + label = "NixOS Reference"; + href = + "https://storage.googleapis.com/files.tazj.in/nixdoc/manual.html#sec-functions-library"; + image = + "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; + } + { + label = "Nix Packages"; + href = "https://nixos.org/nixos/packages.html"; + image = + "https://media.giphy.com/media/l2YWlohvjPnsvkdEc/giphy.gif"; + } + { + label = "NixOS Options"; + href = "https://nixos.org/nixos/options.html"; + image = + "https://media.giphy.com/media/3fiw51MvIWcGjMhy9a/giphy.gif"; + } + { + label = "NixOS Language specific helpers"; + href = + "https://nixos.wiki/wiki/Language-specific_package_helpers"; + image = + "https://media.giphy.com/media/LkjlH3rVETgsg/giphy.gif"; + } + { + label = "NixOS Weekly"; + href = "https://weekly.nixos.org/"; + image = + "https://media.giphy.com/media/lXiRLb0xFzmreM8k8/giphy.gif"; + } + { + label = "NixOS Security"; + href = "https://broken.sh/"; + image = + "https://media.giphy.com/media/BqILAHjH1Ttm0/giphy.gif"; + } + { + label = "NixOS RFCs"; + href = "https://github.com/NixOS/rfcs/"; + image = + "https://media.giphy.com/media/Uq9bGjGKg08M0/giphy.gif"; + } + ]; + } + { + text = "Syncthings"; + items = map ({ name, host ? "${name}.private", ... }: { label = name; href = "http://${host}:8384/"; - image = "https://media.giphy.com/media/JoyU4vuzwj6ZA7Ging/giphy.gif"; - } - ) ( - map - (name: { inherit name; }) - (lib.attrNames config.module.cluster.services.tinc."private".hosts) - ); - } - { - text = "netdata"; - items = map ( - {name, host ? "${name}.private", ... }: - { + image = + "https://media.giphy.com/media/JoyU4vuzwj6ZA7Ging/giphy.gif"; + }) (map (name: { inherit name; }) (lib.attrNames + config.module.cluster.services.tinc."private".hosts)); + } + { + text = "netdata"; + items = map ({ name, host ? "${name}.private", ... }: { label = name; href = "http://${host}:19999/"; image = "https://media.giphy.com/media/BkjdN6MQCDPaw/giphy.gif"; - } - ) ( - map - (name: { inherit name; }) - [ "workhorse" "porani" "sputnik" ] + }) (map (name: { inherit name; }) [ + "workhorse" + "porani" + "sputnik" + ] #(lib.attrNames config.module.cluster.services.tinc."private".hosts) - ); - } - ]; - };}; + ); + } + ]; + }; + }; }; }; } diff --git a/system/all/nginx.nix b/system/all/nginx.nix index edd37d4..c7cf959 100644 --- a/system/all/nginx.nix +++ b/system/all/nginx.nix @@ -2,8 +2,7 @@ let access_log_sink = "workhorse.private:12304"; error_log_sink = "workhorse.private:12305"; -in -{ +in { # for graylog logging services.nginx.commonHttpConfig = '' log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", ' diff --git a/system/all/packages.nix b/system/all/packages.nix index 4d5f247..77b3846 100644 --- a/system/all/packages.nix +++ b/system/all/packages.nix @@ -2,39 +2,44 @@ let - pastebin = pkgs.writers.writeDashBin "pastebin" /* sh */ '' - exec ${pkgs.bepasty-client-cli}/bin/bepasty-cli \ - --lifetime 1m \ - --url http://workhorse.private:8000 \ - --pass ${lib.fileContents } \ - "$@" | sed -e s/workhorse.private:8000/paste.ingolf-wagner.de/ - ''; + pastebin = pkgs.writers.writeDashBin "pastebin" # sh + '' + exec ${pkgs.bepasty-client-cli}/bin/bepasty-cli \ + --lifetime 1m \ + --url http://workhorse.private:8000 \ + --pass ${lib.fileContents } \ + "$@" | sed -e s/workhorse.private:8000/paste.ingolf-wagner.de/ + ''; - memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" /* sh */ '' - echo " %CPU %MEM MEM : PROCESS" - echo "------- ------- ------------- -------" - ps aux | awk '{mem[$11]+=int($6/1024)}; {cpuper[$11]+=$3};{memper[$11]+=$4}; END {for (i in mem) {printf "%6.2f%% %6.2f%% %10.2f MB : %s\n", cpuper[i],memper[i],mem[i],i}}' | sort -k3nr | head -n 5 - ''; + memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" # sh + '' + echo " %CPU %MEM MEM : PROCESS" + echo "------- ------- ------------- -------" + ps aux | awk '{mem[$11]+=int($6/1024)}; {cpuper[$11]+=$3};{memper[$11]+=$4}; END {for (i in mem) {printf "%6.2f%% %6.2f%% %10.2f MB : %s\n", cpuper[i],memper[i],mem[i],i}}' | sort -k3nr | head -n 5 + ''; - prefetch-git-rendered = pkgs.writeShellScriptBin "nix-prefetch-git-rendered" /* sh */ '' - ${pkgs.nix-prefetch-scripts}/bin/nix-prefetch-git "$@" \ - | ${pkgs.jq}/bin/jq --raw-output '"pkgs.fetchgit{ - url = \"\(.url)\"; - rev = \"\(.rev)\"; - sha256 = \"\(.sha256)\"; - };"' - ''; - - prefetch-url-rendered = pkgs.writeShellScriptBin "nix-prefetch-url-rendered" /* sh */ '' - HASH=$( ${pkgs.nix}/bin/nix-prefetch-url "$1" ) - cat <; repo = "sftp::backup/remote-${config.networking.hostName}"; - requires = []; + requires = [ ]; extraArguments = [ - "sftp.command='ssh backup@${server} -i ${toString } -s sftp'" + "sftp.command='ssh backup@${server} -i ${ + toString + } -s sftp'" ]; initialize = true; timerConfig = { @@ -42,11 +43,8 @@ in { - backup.services.restic = lib.zipAttrsWith - (name: vals: lib.head vals) - (map (server: { - "on-${server}" = setup "${server}.private"; - }) servers); + backup.services.restic = lib.zipAttrsWith (name: vals: lib.head vals) + (map (server: { "on-${server}" = setup "${server}.private"; }) servers); environment.etc."info/restic-${hostname}.json" = { enable = true; diff --git a/system/all/sftp-user.nix b/system/all/sftp-user.nix index 1351549..9192bbd 100644 --- a/system/all/sftp-user.nix +++ b/system/all/sftp-user.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { module.backup.sftpUser = { @@ -8,9 +7,9 @@ enable = true; initialize = true; home = toString /backup/remote/backup; - authorizedKeys.keyFiles = [ - ( toString ) - ] ++ config.users.users.root.openssh.authorizedKeys.keyFiles; + authorizedKeys.keyFiles = + [ (toString ) ] + ++ config.users.users.root.openssh.authorizedKeys.keyFiles; }; }; diff --git a/system/all/shell.nix b/system/all/shell.nix index e1d333c..18d0b32 100644 --- a/system/all/shell.nix +++ b/system/all/shell.nix @@ -1,5 +1,4 @@ { config, lib, ... }: { - } diff --git a/system/all/sshd-known-hosts-bootup.nix b/system/all/sshd-known-hosts-bootup.nix index 275796c..ab5482c 100644 --- a/system/all/sshd-known-hosts-bootup.nix +++ b/system/all/sshd-known-hosts-bootup.nix @@ -5,42 +5,45 @@ let computers = { workhorse = { onionId = fileContents ; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBB+sHmukNa2TmtBDCqN+LVaYblvHztD/ziK2cbKR8dEHztF0YBS60MHMpbGPOII5NVMUY6Z2OHFBQi9X6PG1YBY="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBB+sHmukNa2TmtBDCqN+LVaYblvHztD/ziK2cbKR8dEHztF0YBS60MHMpbGPOII5NVMUY6Z2OHFBQi9X6PG1YBY="; }; porani = { onionId = fileContents ; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGFaTRGqMd/rKpyMUP6wVbgiWFOUvUV2qS/B5Xe02UUch/wxR4fTCY+vnzku5K0V/qqJpjYLgHotwZFqO/8lFu4="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGFaTRGqMd/rKpyMUP6wVbgiWFOUvUV2qS/B5Xe02UUch/wxR4fTCY+vnzku5K0V/qqJpjYLgHotwZFqO/8lFu4="; }; }; -in -{ +in { - services.openssh.knownHosts = mapAttrs' (name: { onionId, publicKey, ... }: { - name = "${name}-init-ssh"; - value = { hostNames = [ onionId ]; inherit publicKey; }; - }) computers; + services.openssh.knownHosts = mapAttrs' (name: + { onionId, publicKey, ... }: { + name = "${name}-init-ssh"; + value = { + hostNames = [ onionId ]; + inherit publicKey; + }; + }) computers; - environment.systemPackages = - let + environment.systemPackages = let - ssh = mapAttrsToList (name: { onionId, ... }: + ssh = mapAttrsToList (name: + { onionId, ... }: pkgs.writers.writeDashBin "ssh-boot-to-${name}" '' ${pkgs.tor}/bin/torify ${pkgs.openssh}/bin/ssh root@${onionId} -p 23 '') computers; - password = mapAttrsToList (name: { onionId, ... }: + password = mapAttrsToList (name: + { onionId, ... }: pkgs.writers.writeDashBin "unlock-boot-${name}" '' - ${pkgs.tor}/bin/torify ${pkgs.openssh}/bin/ssh root@${onionId} -p 23 ' - echo -n "enter password : " - read password - echo "$password" > /crypt-ramfs/passphrase - ' + ${pkgs.tor}/bin/torify ${pkgs.openssh}/bin/ssh root@${onionId} -p 23 ' + echo -n "enter password : " + read password + echo "$password" > /crypt-ramfs/passphrase + ' '') computers; - in - ssh ++ password; - - + in ssh ++ password; } diff --git a/system/all/sshd-known-hosts-private.nix b/system/all/sshd-known-hosts-private.nix index 2a7d4ed..555a2e9 100644 --- a/system/all/sshd-known-hosts-private.nix +++ b/system/all/sshd-known-hosts-private.nix @@ -1,6 +1,5 @@ # generated by updateSshKeys.sh -{ config, lib, ... }: -{ +{ config, lib, ... }: { services.openssh.knownHosts = { "sterni.private" = { @@ -8,7 +7,8 @@ "sterni.private" config.module.cluster.services.tinc.private.hosts.sterni.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDyHmHJy2Va45p9mn+Hj3DyaY5yxnQIKvXeACHjzgSKt"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDyHmHJy2Va45p9mn+Hj3DyaY5yxnQIKvXeACHjzgSKt"; }; "workout.private" = { @@ -16,7 +16,8 @@ "workout.private" config.module.cluster.services.tinc.private.hosts.workout.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICjotuQJHDaL0fPY7yA2dIBVWRYOkp7/ablY60psMQ6w"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICjotuQJHDaL0fPY7yA2dIBVWRYOkp7/ablY60psMQ6w"; }; "sputnik.private" = { @@ -24,7 +25,8 @@ "sputnik.private" config.module.cluster.services.tinc.private.hosts.sputnik.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICTLXDTqUtl0BQgzH1O7CRulGCRN1P4KU8imL/wjYFh8"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICTLXDTqUtl0BQgzH1O7CRulGCRN1P4KU8imL/wjYFh8"; }; "workhorse.private" = { @@ -32,7 +34,8 @@ "workhorse.private" config.module.cluster.services.tinc.private.hosts.workhorse.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDaK0Vv33TuGQa/B5p54sGilgpYvfKkBaBGlEBpIk1QB"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDaK0Vv33TuGQa/B5p54sGilgpYvfKkBaBGlEBpIk1QB"; }; "porani.private" = { @@ -40,7 +43,8 @@ "porani.private" config.module.cluster.services.tinc.private.hosts.porani.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOWWUcI7Oc8iAJx0PABv2jhDTKIxFlOdoREsM6VdCQ8M"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOWWUcI7Oc8iAJx0PABv2jhDTKIxFlOdoREsM6VdCQ8M"; }; "pepe.private" = { @@ -48,12 +52,14 @@ "pepe.private" config.module.cluster.services.tinc.private.hosts.pepe.tincIp ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJPlva+Vdj8WmQPlbQLN3qicMz5AAsyTzK53BincxtAz"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJPlva+Vdj8WmQPlbQLN3qicMz5AAsyTzK53BincxtAz"; }; "cracksucht.de" = { hostNames = [ "cracksucht.de" ]; - publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVqpWzX+C7veO/1MDSdh5ukFhpI4cfXevbl6DVb9gVt1wdYB0JsiMiWfl13MZJy9iEP/KfwRLYmu8i36tDR9uJfHQyLK8G7q2DhrleIPgM3dFCdDU1QtulE8hEq/ZsqzMn/QIHYIipIqzNfmC/xnpX2gIo09T7EY+n863ALlj+GqxMb4nr2XDLY+Lllo2yMzylJIz9q8U5hOmzrlCnBpf2MPMwanHXnZXj2CmO80VyBHnAMJ/h72AN1qzDaHFlhxh0Li/POc1bpDjiVjiUPgimHZWpi3VObxWLLn2zf+RH2lx0yXMccSEnkWvHp+Ll5apIUUS+vTlDo3niWpEfGZLl root@debian"; + publicKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVqpWzX+C7veO/1MDSdh5ukFhpI4cfXevbl6DVb9gVt1wdYB0JsiMiWfl13MZJy9iEP/KfwRLYmu8i36tDR9uJfHQyLK8G7q2DhrleIPgM3dFCdDU1QtulE8hEq/ZsqzMn/QIHYIipIqzNfmC/xnpX2gIo09T7EY+n863ALlj+GqxMb4nr2XDLY+Lllo2yMzylJIz9q8U5hOmzrlCnBpf2MPMwanHXnZXj2CmO80VyBHnAMJ/h72AN1qzDaHFlhxh0Li/POc1bpDjiVjiUPgimHZWpi3VObxWLLn2zf+RH2lx0yXMccSEnkWvHp+Ll5apIUUS+vTlDo3niWpEfGZLl root@debian"; }; }; } diff --git a/system/all/sshd-known-hosts-public.nix b/system/all/sshd-known-hosts-public.nix index 1cca186..e2cb028 100644 --- a/system/all/sshd-known-hosts-public.nix +++ b/system/all/sshd-known-hosts-public.nix @@ -25,51 +25,61 @@ with lib; "35.159.8.160" "52.74.223.119" ]; - publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; + publicKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; }; gitlab = { hostNames = [ "gitlab.com" ]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY="; }; # c-base "bnd-cbase" = { hostNames = [ "bnd.cbrp3.c-base.org" ]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKDknNl4M2WZChp1N/eRIpem2AEOceGIqvjo0ptBuwxUn0w0B8MGTVqoI+pnUVypORJRoNrLPOAkmEVr32BDN3E="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKDknNl4M2WZChp1N/eRIpem2AEOceGIqvjo0ptBuwxUn0w0B8MGTVqoI+pnUVypORJRoNrLPOAkmEVr32BDN3E="; }; "shell.cbase" = { hostNames = [ "shell.c-base.org" ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOBKBn0mZtG3KWxpFqqcog8zvdIVrZmwj+ARujuNIAfo"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOBKBn0mZtG3KWxpFqqcog8zvdIVrZmwj+ARujuNIAfo"; }; "kgb.cbase" = { hostNames = [ "kgb.cbrp3.c-base.org" ]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAdyl7fnnCqomghJ1TDbh5FWFQWFwoO1Y1U/FpmWd8a9RcQvN0Izhg/7A+7ptDxbmpVii8hqfghlqUwtvVy7jo8="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAdyl7fnnCqomghJ1TDbh5FWFQWFwoO1Y1U/FpmWd8a9RcQvN0Izhg/7A+7ptDxbmpVii8hqfghlqUwtvVy7jo8="; }; "cns.cbase" = { hostNames = [ "cns.c-base.org" ]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOtlyLA2nMK9Uqpv4EbWS+rZ9Mx4bAjURmH+zrXkuRGBcU1cKm+TZfWe9/rPX57KaMPBDyIygOJIsM2T5SqX90A="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOtlyLA2nMK9Uqpv4EbWS+rZ9Mx4bAjURmH+zrXkuRGBcU1cKm+TZfWe9/rPX57KaMPBDyIygOJIsM2T5SqX90A="; }; "lassulus" = { hostNames = [ "[lassul.us]:45621" ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAsANFdMi825qWQXQbWLYuNZ6/fARt3lnh1KStQHQQMD"; + publicKey = + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAsANFdMi825qWQXQbWLYuNZ6/fARt3lnh1KStQHQQMD"; }; renoise = { hostNames = [ "*.renoise.com" "renoise.com" "94.130.128.97" ]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLXxhBlYQJxgcLqKywpl1tI1N/+B5bkptAnR2a3tsRybq0IHZnIkSRGUYcu5zPwJT+bitVw8BvIaGzxI+Zm2ivE="; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLXxhBlYQJxgcLqKywpl1tI1N/+B5bkptAnR2a3tsRybq0IHZnIkSRGUYcu5zPwJT+bitVw8BvIaGzxI+Zm2ivE="; }; git-renoise = { hostNames = [ "[git.renoise.com]:2229" "[94.130.128.97]:2229" ]; - publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmIOTjQsD1TaD9MiECcRqwfAXfRdbI+2pkuF+zhBUkrX41NA4LzifPY4Iw3PlklE0YGIOzYyNitzkdgxIWkeqa0Y9iL3gGZBuLFORj5YXWlDKB2RrPAsZRL8y69y4H6RWPpL6DHHsf9eT+HgRzWzzn5nUFLfkCsuM96BqjIKN1pinIBcE6gst1UUSwSTjK8XZA5d4BiSrLF4HiNXnDm+qniYGbGkzZcjn1ua+l0GdGbfg9TotFnSK/QXgN3MeHHDZKnIjOIkOXCY+L5URe0RHo6pBFdj+BLr211AJhB52MrDNudQcY6eSQiJ08LeE6SkcrsQO/VZ/JnOkHxHd2mOyH"; + publicKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmIOTjQsD1TaD9MiECcRqwfAXfRdbI+2pkuF+zhBUkrX41NA4LzifPY4Iw3PlklE0YGIOzYyNitzkdgxIWkeqa0Y9iL3gGZBuLFORj5YXWlDKB2RrPAsZRL8y69y4H6RWPpL6DHHsf9eT+HgRzWzzn5nUFLfkCsuM96BqjIKN1pinIBcE6gst1UUSwSTjK8XZA5d4BiSrLF4HiNXnDm+qniYGbGkzZcjn1ua+l0GdGbfg9TotFnSK/QXgN3MeHHDZKnIjOIkOXCY+L5URe0RHo6pBFdj+BLr211AJhB52MrDNudQcY6eSQiJ08LeE6SkcrsQO/VZ/JnOkHxHd2mOyH"; }; "git.ingolf-wagner.de" = { hostNames = [ "[git.ingolf-wagner.de]:443" ]; - publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvJoz+6Ew0L518+jhue69hm0nEzVBuyUWDRUM3QnOQCCmGgFFXq+iTxgYoo2e3qYFUV0CmYK548ZKBB/nGUmrRwT06sJXtOCmVsBCMxBX6KNEBxKns8urQqWZ/ShzuKhpZmC9EuB25QVXCkUuc1aXtVgLng8Ucke/kOHE/HcwB4Sb7SCNP7pF4/mBpuH9cONs21HkxE6Aj85LSSJCRwiyL+WBEibDcDVy+W5hicAp/m7sL+sezFkNzru0X10G1kuC01+HZT8I5Be3xQ9llWkMkVaO5L7N9+SUXxZSMtwI9uEU8iPuXhb9ETyIR530kipydOljD6nA3hRC12nnE2T0d"; + publicKey = + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvJoz+6Ew0L518+jhue69hm0nEzVBuyUWDRUM3QnOQCCmGgFFXq+iTxgYoo2e3qYFUV0CmYK548ZKBB/nGUmrRwT06sJXtOCmVsBCMxBX6KNEBxKns8urQqWZ/ShzuKhpZmC9EuB25QVXCkUuc1aXtVgLng8Ucke/kOHE/HcwB4Sb7SCNP7pF4/mBpuH9cONs21HkxE6Aj85LSSJCRwiyL+WBEibDcDVy+W5hicAp/m7sL+sezFkNzru0X10G1kuC01+HZT8I5Be3xQ9llWkMkVaO5L7N9+SUXxZSMtwI9uEU8iPuXhb9ETyIR530kipydOljD6nA3hRC12nnE2T0d"; }; "siteground" = { - hostNames = [ "[es5.siteground.eu]:18765" "[37.60.224.6]:18765"]; - publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZuvHooyHa69rU+SfOghM6yfc7bce5cMi9sh5JkoLPi+m8QEkX3oiG9rRpAhp0GYnB74M4l1+0XlxmG7/HVmq0="; + hostNames = [ "[es5.siteground.eu]:18765" "[37.60.224.6]:18765" ]; + publicKey = + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZuvHooyHa69rU+SfOghM6yfc7bce5cMi9sh5JkoLPi+m8QEkX3oiG9rRpAhp0GYnB74M4l1+0XlxmG7/HVmq0="; }; - }; } diff --git a/system/all/sshd.nix b/system/all/sshd.nix index 0c56cec..53e41d3 100644 --- a/system/all/sshd.nix +++ b/system/all/sshd.nix @@ -10,13 +10,10 @@ with lib; services.custom.ssh = { tools.enable = true; sshd = { - enable = true; - rootKeyFiles = [ - ( toString ) - ]; + enable = true; + rootKeyFiles = [ (toString ) ]; }; }; } - diff --git a/system/all/syncthing.nix b/system/all/syncthing.nix index 64486ae..c588ba6 100644 --- a/system/all/syncthing.nix +++ b/system/all/syncthing.nix @@ -1,47 +1,50 @@ { config, lib, pkgs, ... }: -with lib; -{ +with lib; { test.services.syncthing = { guiAddress = "${config.networking.hostName}.private:8384"; declarative = { overrideDevices = true; devices = let - device = name: id: - { + device = name: id: { "${name}" = { name = name; id = id; - addresses = [ "tcp://${name}.private:22000" "tcp://${name}.private:21027" ]; + addresses = + [ "tcp://${name}.private:22000" "tcp://${name}.private:21027" ]; }; }; - in - (device "workhorse" "AFSAKB6-JLH4QAS-DSRMPI3-6PVCIHF-IIAVLPC-STPNO3Y-YRDU5NW-QD445QI") - // (device "pepe" "SZLXFW3-VTAC7UB-V2Z7CHE-3VZAYPL-6D72AK6-OCDMPZP-G4FPY5P-FL6ZVAG") - // (device "workout" "DZOOAKG-GI2SVOS-QEVMFL7-TRHVTPQ-ADIJEVH-RH5WV3J-6M7MJHC-C53EOAC") - // (device "porani" "6YOIA4E-X52ZD5Z-FPNWPRS-77QIMMU-VDIXVZB-6BPQN7A-FFJDU4W-EXEGFAI") - // (device "sterni" "ZFNNKPD-ZSOAYJQ-VROXXDB-5MD3UTJ-GDCNTSQ-G5POVV3-UZG5HFT-CCAU3AD") - // { - smartphone = { - name = "smartphone"; - id = "PRCA4KO-PEMLUSO-ERUSKAP-GUDSW2I-AYTEB54-E5JJOXJ-23X2UYP-RLSMKQM"; - addresses = [ "dynamic" ]; + in (device "workhorse" + "AFSAKB6-JLH4QAS-DSRMPI3-6PVCIHF-IIAVLPC-STPNO3Y-YRDU5NW-QD445QI") + // (device "pepe" + "SZLXFW3-VTAC7UB-V2Z7CHE-3VZAYPL-6D72AK6-OCDMPZP-G4FPY5P-FL6ZVAG") + // (device "workout" + "DZOOAKG-GI2SVOS-QEVMFL7-TRHVTPQ-ADIJEVH-RH5WV3J-6M7MJHC-C53EOAC") + // (device "porani" + "6YOIA4E-X52ZD5Z-FPNWPRS-77QIMMU-VDIXVZB-6BPQN7A-FFJDU4W-EXEGFAI") + // (device "sterni" + "ZFNNKPD-ZSOAYJQ-VROXXDB-5MD3UTJ-GDCNTSQ-G5POVV3-UZG5HFT-CCAU3AD") // { + smartphone = { + name = "smartphone"; + id = + "PRCA4KO-PEMLUSO-ERUSKAP-GUDSW2I-AYTEB54-E5JJOXJ-23X2UYP-RLSMKQM"; + addresses = [ "dynamic" ]; + }; + } // { + bumba = { + name = "windows-bumba"; + id = + "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ"; + addresses = [ "dynamic" ]; + }; + } // { + mors = { + name = "lassulus-mors"; + id = + "ZPRS57K-YK32ROQ-7A6MRAV-VOYXQ3I-CQCXISZ-C5PCV2A-GSFLG3I-K7UGGAH"; + addresses = [ "tcp://mors.r:22000" ]; + }; }; - } - // { - bumba = { - name = "windows-bumba"; - id = "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ"; - addresses = [ "dynamic" ]; - }; - } - // { - mors = { - name = "lassulus-mors"; - id = "ZPRS57K-YK32ROQ-7A6MRAV-VOYXQ3I-CQCXISZ-C5PCV2A-GSFLG3I-K7UGGAH"; - addresses = [ "tcp://mors.r:22000" ]; - }; - }; folders = { diff --git a/system/all/tinc.nix b/system/all/tinc.nix index 8f4403e..eaeb3f2 100644 --- a/system/all/tinc.nix +++ b/system/all/tinc.nix @@ -7,8 +7,7 @@ let sha256 = "0z2b1pd7ki9wbz2079arygv83ckhqsijllj25iy64lgxk6arvbla"; }; -in -{ +in { imports = [ ]; @@ -28,19 +27,19 @@ in hosts = { pepe = { tincIp = "10.243.23.1"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; sterni = { tincIp = "10.243.23.3"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; workhorse = { tincIp = "10.243.23.5"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; workout = { tincIp = "10.243.23.4"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; }; }; @@ -54,24 +53,24 @@ in hosts = { workout = { tincIp = "10.23.42.27"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; pepe = { tincIp = "10.23.42.26"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; sterni = { tincIp = "10.23.42.24"; # publicKey = lib.fileContents ; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; porani = { tincIp = "10.23.42.31"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; workhorse = { tincIp = "10.23.42.21"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; sputnik = { realAddress = [ @@ -79,13 +78,12 @@ in "static.247.134.201.195.clients.your-server.de:443" ]; tincIp = "10.23.42.122"; - publicKey = lib.fileContents ; + publicKey = lib.fileContents ; }; }; }; }; - # retiolum stuff networking.extraHosts = builtins.readFile (toString "${retiolum}/etc.hosts"); systemd.services."tinc.retiolum" = { @@ -96,4 +94,3 @@ in } - diff --git a/system/desktop/audio.nix b/system/desktop/audio.nix index 3fdd231..e906680 100644 --- a/system/desktop/audio.nix +++ b/system/desktop/audio.nix @@ -4,60 +4,58 @@ let library = import { inherit pkgs lib; }; mixxxBin = pkgs.writeShellScriptBin "mixxx" - "${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library/mixxx"; + "${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library/mixxx"; mixxxDesktop = library.desktopFile mixxxBin { longName = "Mixxx"; }; mixxxFreeBin = pkgs.writeShellScriptBin "mixxx-free" - "${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library-free/mixxx"; + "${pkgs.mixxx}/bin/mixxx --settingsPath ${config.users.users.mainUser.home}/music-library-free/mixxx"; mixxxFreeDesktop = library.desktopFile mixxxFreeBin { longName = "Mixxx"; }; in { system.custom.audio = { enable = true; - sinks = [ - { - name = "movieLimiterSink"; - queue = [ - { - # compress all sounds - plugin = "dyson_compress_1403"; - label = "dysonCompress"; - control = [ - "0" # peak limit (dB) - "1" # release time (secons) - "0.2" # fast compression ration (unknown what that means) - "0.8" # compression ratio - ]; - } - { - # limit sound - plugin = "fast_lookahead_limiter_1913"; - label = "fastLookaheadLimiter"; - control = [ - "20" # input gain (db) - "-10" # limit (db) - "1.1" # release time (s) - ]; - } - { - # avoid deep sounds - plugin = "dj_eq_1901"; - label = "dj_eq"; - control = [ - "-9" # low gain (db) (100Hz) - "0" # mid gain (db) (1000Hz) - "0" # high gain (db) (10000Hz) - ]; - } - ]; - } - ]; + sinks = [{ + name = "movieLimiterSink"; + queue = [ + { + # compress all sounds + plugin = "dyson_compress_1403"; + label = "dysonCompress"; + control = [ + "0" # peak limit (dB) + "1" # release time (secons) + "0.2" # fast compression ration (unknown what that means) + "0.8" # compression ratio + ]; + } + { + # limit sound + plugin = "fast_lookahead_limiter_1913"; + label = "fastLookaheadLimiter"; + control = [ + "20" # input gain (db) + "-10" # limit (db) + "1.1" # release time (s) + ]; + } + { + # avoid deep sounds + plugin = "dj_eq_1901"; + label = "dj_eq"; + control = [ + "-9" # low gain (db) (100Hz) + "0" # mid gain (db) (1000Hz) + "0" # high gain (db) (10000Hz) + ]; + } + ]; + }]; }; programs.custom = { easytag.enable = true; - espeak.enable = true; + espeak.enable = true; }; environment.systemPackages = with pkgs; [ diff --git a/system/desktop/browser.nix b/system/desktop/browser.nix index 13d0981..11f41fe 100644 --- a/system/desktop/browser.nix +++ b/system/desktop/browser.nix @@ -39,7 +39,6 @@ in { homeBackup = "${backupFolder}/nz-browser"; }; - firefox-tmp = { browserType = "firefox"; home = "${homeFolder}/firefox-tmp"; @@ -56,7 +55,6 @@ in { homeBackup = "${backupFolder}google-tmp-browser"; }; - }; }; } diff --git a/system/desktop/cachix.nix b/system/desktop/cachix.nix index 11d6e64..64734c3 100644 --- a/system/desktop/cachix.nix +++ b/system/desktop/cachix.nix @@ -5,8 +5,9 @@ let folder = ./cachix; toImport = name: value: folder + ("/" + name); filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; - imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); + imports = lib.mapAttrsToList toImport + (lib.filterAttrs filterCaches (builtins.readDir folder)); in { inherit imports; - nix.binaryCaches = ["https://cache.nixos.org/"]; + nix.binaryCaches = [ "https://cache.nixos.org/" ]; } diff --git a/system/desktop/cachix/all-hies.nix b/system/desktop/cachix/all-hies.nix index 17818d6..2f89067 100644 --- a/system/desktop/cachix/all-hies.nix +++ b/system/desktop/cachix/all-hies.nix @@ -1,11 +1,8 @@ { nix = { - binaryCaches = [ - "https://all-hies.cachix.org" - ]; - binaryCachePublicKeys = [ - "all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k=" - ]; + binaryCaches = [ "https://all-hies.cachix.org" ]; + binaryCachePublicKeys = + [ "all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k=" ]; }; } diff --git a/system/desktop/default.nix b/system/desktop/default.nix index a11aded..b2e1040 100644 --- a/system/desktop/default.nix +++ b/system/desktop/default.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { imports = [ @@ -25,7 +24,7 @@ ./x11.nix ./xlock.nix ./yubikey.nix - ]; + ]; programs.custom = { @@ -47,20 +46,14 @@ q = { enable = true; - timeZones = [ - "Pacific/Auckland" - "Europe/Berlin" - "America/Los_Angeles" - ]; + timeZones = [ "Pacific/Auckland" "Europe/Berlin" "America/Los_Angeles" ]; }; }; services.urxvtd.enable = true; - system.custom = { - bluetooth.enable = true; - }; + system.custom = { bluetooth.enable = true; }; # overwrite use zram on small RAM systems fileSystems."/share/" = lib.mkDefault { @@ -76,4 +69,3 @@ } - diff --git a/system/desktop/direnv.nix b/system/desktop/direnv.nix index e5ae5b9..b84f975 100644 --- a/system/desktop/direnv.nix +++ b/system/desktop/direnv.nix @@ -1,5 +1,4 @@ -{ config, pkgs, ... }: -{ +{ config, pkgs, ... }: { environment.systemPackages = [ pkgs.direnv ]; diff --git a/system/desktop/dnsmasq.nix b/system/desktop/dnsmasq.nix index fccf45c..53fb997 100644 --- a/system/desktop/dnsmasq.nix +++ b/system/desktop/dnsmasq.nix @@ -6,11 +6,9 @@ with lib; services.dnsmasq = { enable = true; extraConfig = '' - ${concatStringsSep "\n" ( - flip mapAttrsToList config.module.cluster.services.tinc."private".hosts (name: attrs: - "address=/.${name}.private/${attrs.tincIp}" - ) - )} + ${concatStringsSep "\n" + (flip mapAttrsToList config.module.cluster.services.tinc."private".hosts + (name: attrs: "address=/.${name}.private/${attrs.tincIp}"))} ''; }; } diff --git a/system/desktop/home-manager.nix b/system/desktop/home-manager.nix index d345c4b..b573f68 100644 --- a/system/desktop/home-manager.nix +++ b/system/desktop/home-manager.nix @@ -2,31 +2,30 @@ with lib; let xmodmapConfig = pkgs.writeText "xmodmap" '' - ! - ! Swap Caps_Lock and Control_L - ! + ! + ! Swap Caps_Lock and Control_L + ! - ! replace capslock keys with Escape Keys - ! remove Lock = Caps_Lock - clear Lock - add Lock = Scroll_Lock + ! replace capslock keys with Escape Keys + ! remove Lock = Caps_Lock + clear Lock + add Lock = Scroll_Lock - keysym Caps_Lock = Escape + keysym Caps_Lock = Escape - ! Set Right function Key to Windows-key - keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R + ! Set Right function Key to Windows-key + keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R - ! Map umlauts to RIGHT ALT + - keycode 108 = Mode_switch - keysym e = e E EuroSign - keysym c = c C cent - keysym a = a A adiaeresis Adiaeresis - keysym o = o O odiaeresis Odiaeresis - keysym u = u U udiaeresis Udiaeresis - keysym s = s S ssharp + ! Map umlauts to RIGHT ALT + + keycode 108 = Mode_switch + keysym e = e E EuroSign + keysym c = c C cent + keysym a = a A adiaeresis Adiaeresis + keysym o = o O odiaeresis Odiaeresis + keysym u = u U udiaeresis Udiaeresis + keysym s = s S ssharp ''; -in -{ +in { imports = [ ./home-manager/spacemacs.nix @@ -63,7 +62,8 @@ in keyserver = "hkp://pgp.mit.edu"; personal-digest-preferences = "SHA512"; cert-digest-algo = "SHA512"; - default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed"; + default-preference-list = + "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed"; }; }; @@ -105,7 +105,6 @@ in theme=SolarizedBrightViolet ''; - xdg.configFile."Code/User/settings.json".text = builtins.toJSON { "keyboard.dispatch" = "keyCode"; "explorer.confirmDragAndDrop" = false; @@ -132,8 +131,7 @@ in image/jpeg=sxiv.desktop ''; - home.file.".xprofile".text = - '' + home.file.".xprofile".text = '' # load keyboard mappings ${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig} @@ -156,19 +154,21 @@ in }; - environment.systemPackages = - let - library = import { inherit pkgs lib; }; + environment.systemPackages = let + library = import { inherit pkgs lib; }; - fixKeyboard = pkgs.writeScriptBin "fix-Keyboard" /* sh */ '' + fixKeyboard = pkgs.writeScriptBin "fix-Keyboard" # sh + '' ${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig} - ''; + ''; - fixXhost = pkgs.writeScriptBin "fix-xhost" /* sh */ '' + fixXhost = pkgs.writeScriptBin "fix-xhost" # sh + '' ${pkgs.xorg.xhost}/bin/xhost + &> /dev/null - ''; + ''; - fixX = pkgs.writeScriptBin "fix-X" /* sh */ '' + fixX = pkgs.writeScriptBin "fix-X" # sh + '' ${fixKeyboard}/bin/fix-Keyboard @@ -185,13 +185,12 @@ in done ''; - in - [ - fixX - fixXhost - (library.desktopFile fixX { longName = "fix X";}) - fixKeyboard - (library.desktopFile fixKeyboard { longName = "fix keyboard";}) - ]; + in [ + fixX + fixXhost + (library.desktopFile fixX { longName = "fix X"; }) + fixKeyboard + (library.desktopFile fixKeyboard { longName = "fix keyboard"; }) + ]; } diff --git a/system/desktop/home-manager/spacemacs.nix b/system/desktop/home-manager/spacemacs.nix index a69d1f5..c13316e 100644 --- a/system/desktop/home-manager/spacemacs.nix +++ b/system/desktop/home-manager/spacemacs.nix @@ -6,17 +6,17 @@ let home = config.users.users.mainUser.home; fontSize = config.programs.custom.urxvt.fontSize; - startupBanner = pkgs.fetchurl{ - url = "https://github.com/NixOS/nixos-homepage/raw/master/logo/nix-wiki.png"; + startupBanner = pkgs.fetchurl { + url = + "https://github.com/NixOS/nixos-homepage/raw/master/logo/nix-wiki.png"; sha256 = "1hrz7wr7i0b2bips60ygacbkmdzv466lsbxi22hycg42kv4m0173"; }; ticks = "\"''\""; - unstable = import {}; + unstable = import { }; -in -{ +in { environment.systemPackages = [ # needed for the SPC p g @@ -27,223 +27,221 @@ in ]; # download git repositories into the home folder - systemd.services = - let - clone = - repository: folder: branch: - { - enable = true; - wantedBy = [ "multi-user.target" ]; - description = "clone ${repository} to ${folder}"; - serviceConfig.User = userName; - unitConfig.ConditionPathExists = "!${folder}"; - script = '' - ${pkgs.git}/bin/git clone ${repository} --branch ${branch} ${folder} - ''; - }; - in - { - spacemacs-pull = clone "https://github.com/syl20bnr/spacemacs" "${home}/.emacs.d" "master"; - # todo move this to spacevim.nix - spacevim-pull = clone "https://github.com/SpaceVim/SpaceVim.git" "${home}/.SpaceVim" "master"; + systemd.services = let + clone = repository: folder: branch: { + enable = true; + wantedBy = [ "multi-user.target" ]; + description = "clone ${repository} to ${folder}"; + serviceConfig.User = userName; + unitConfig.ConditionPathExists = "!${folder}"; + script = '' + ${pkgs.git}/bin/git clone ${repository} --branch ${branch} ${folder} + ''; }; + in { + spacemacs-pull = + clone "https://github.com/syl20bnr/spacemacs" "${home}/.emacs.d" "master"; + # todo move this to spacevim.nix + spacevim-pull = + clone "https://github.com/SpaceVim/SpaceVim.git" "${home}/.SpaceVim" + "master"; + }; home-manager.users."${user}" = { - # a file which needs to be included at the end - home.file.".spacemacs.d/hook-init.el".text = '' - ;; -*- mode: emacs-lisp -*- - ;; just add (load "~/.spacemacs.d/hook-init.el") in your dotspacemacs/init function + # a file which needs to be included at the end + home.file.".spacemacs.d/hook-init.el".text = '' + ;; -*- mode: emacs-lisp -*- + ;; just add (load "~/.spacemacs.d/hook-init.el") in your dotspacemacs/init function - ;; overrides of dotspacemacs/init () + ;; overrides of dotspacemacs/init () + (setq + + ;; List of themes, the first of the list is loaded when spacemacs starts. + ;; Press T n to cycle to the next theme in the list (works great + ;; with 2 themes variants, one dark and one lixft:inconsolata:pixelsizeght) + dotspacemacs-themes '(solarized-light solarized-dark) + + ;; Specify the startup banner. Default value is `official', it displays + ;; the official spacemacs logo. An integer value is the index of text + ;; banner, `random' chooses a random text banner in `core/banners' + ;; directory. A string value must be a path to an image format supported + ;; by your Emacs build. + ;; If the value is nil then no banner is displayed. (default 'official) + dotspacemacs-startup-banner "${startupBanner}" + + ;; Default font, or prioritized list of fonts. `powerline-scale' allows to + ;; quickly tweak the mode-line size to make separators look not too crappy. + dotspacemacs-default-font '("Terminus" + :size ${toString fontSize} + :weight normal + :width normal + :powerline-scale 1.1) + + ) ;; eof + + + ''; + + home.file.".spacemacs.d/hook-layers.el".text = '' + ;; -*- mode: emacs-lisp -*- + ;; just add (load "~/.spacemacs.d/hook-layers.el") in your dotspacemacs/layers function + + (let + ((user-layers dotspacemacs-configuration-layers)) (setq + dotspacemacs-configuration-layers + (append user-layers + '( python + ansible + rust + windows-scripts + javascript + typescript + html + yaml + auto-completion + git + markdown + restclient + emacs-lisp + nixos + spell-checking + syntax-checking + systemd + lua + terraform + graphviz + c-c++ + (haskell :variables + haskell-enable-hindent t + haskell-completion-backend 'lsp + haskell-enable-hindent-style "gibiansky" + haskell-process-type 'cabal-new-repl) + )))) - ;; List of themes, the first of the list is loaded when spacemacs starts. - ;; Press T n to cycle to the next theme in the list (works great - ;; with 2 themes variants, one dark and one lixft:inconsolata:pixelsizeght) - dotspacemacs-themes '(solarized-light solarized-dark) + (let + ((user-packages dotspacemacs-additional-packages )) + (setq + dotspacemacs-additional-packages + (append user-packages + '( lsp-mode + lsp-ui + lsp-haskell + direnv + )))) + ''; - ;; Specify the startup banner. Default value is `official', it displays - ;; the official spacemacs logo. An integer value is the index of text - ;; banner, `random' chooses a random text banner in `core/banners' - ;; directory. A string value must be a path to an image format supported - ;; by your Emacs build. - ;; If the value is nil then no banner is displayed. (default 'official) - dotspacemacs-startup-banner "${startupBanner}" + # a file which needs to be included at the end + home.file.".spacemacs.d/hook-user-config.el".text = '' + ;; -*- mode: emacs-lisp -*- + ;; just add (load "~/.spacemacs.d/hook-user-config.el") in your dotspacemacs/user-config function - ;; Default font, or prioritized list of fonts. `powerline-scale' allows to - ;; quickly tweak the mode-line size to make separators look not too crappy. - dotspacemacs-default-font '("Terminus" - :size ${toString fontSize} - :weight normal - :width normal - :powerline-scale 1.1) + (let ((n 2)) + (setq coffee-tab-width n) + (setq javascript-indent-level n) + (setq js-indent-level n) + (setq js2-basic-offset n) + (setq web-mode-markup-indent-offset n) + (setq web-mode-css-indent-offset n) + (setq web-mode-code-indent-offset n) + (setq css-indent-offset n)) - ) ;; eof + ;; configure indent function correctly + (add-hook 'nix-mode-hook + '(lambda () + (setq indent-tabs-mode nil) + (setq tab-width 2) + (setq indent-line-function (quote nix-indent-line)))) + ;; lsp setup for haskell + ;; hie-wrapper must be configured in the direnv setup + ;; make sure cabal update was executed once on the machine + (setq lsp-haskell-process-path-hie "hie-wrapper") + (setq lsp-response-timeout 60) + (require 'lsp-haskell) + ;; (add-hook 'haskell-mode-hook #'lsp) + (add-hook 'haskell-mode-hook #'direnv-update-environment) - ''; - - home.file.".spacemacs.d/hook-layers.el".text = '' - ;; -*- mode: emacs-lisp -*- - ;; just add (load "~/.spacemacs.d/hook-layers.el") in your dotspacemacs/layers function - - (let - ((user-layers dotspacemacs-configuration-layers)) - (setq - dotspacemacs-configuration-layers - (append user-layers - '( python - ansible - rust - windows-scripts - javascript - typescript - html - yaml - auto-completion - git - markdown - restclient - emacs-lisp - nixos - spell-checking - syntax-checking - systemd - lua - terraform - graphviz - c-c++ - (haskell :variables - haskell-enable-hindent t - haskell-completion-backend 'lsp - haskell-enable-hindent-style "gibiansky" - haskell-process-type 'cabal-new-repl) - )))) - - (let - ((user-packages dotspacemacs-additional-packages )) - (setq - dotspacemacs-additional-packages - (append user-packages - '( lsp-mode - lsp-ui - lsp-haskell - direnv - )))) - ''; - - # a file which needs to be included at the end - home.file.".spacemacs.d/hook-user-config.el".text = '' - ;; -*- mode: emacs-lisp -*- - ;; just add (load "~/.spacemacs.d/hook-user-config.el") in your dotspacemacs/user-config function - - (let ((n 2)) - (setq coffee-tab-width n) - (setq javascript-indent-level n) - (setq js-indent-level n) - (setq js2-basic-offset n) - (setq web-mode-markup-indent-offset n) - (setq web-mode-css-indent-offset n) - (setq web-mode-code-indent-offset n) - (setq css-indent-offset n)) - - ;; configure indent function correctly - (add-hook 'nix-mode-hook - '(lambda () - (setq indent-tabs-mode nil) - (setq tab-width 2) - (setq indent-line-function (quote nix-indent-line)))) - - ;; lsp setup for haskell - ;; hie-wrapper must be configured in the direnv setup - ;; make sure cabal update was executed once on the machine - (setq lsp-haskell-process-path-hie "hie-wrapper") - (setq lsp-response-timeout 60) - (require 'lsp-haskell) - ;; (add-hook 'haskell-mode-hook #'lsp) - (add-hook 'haskell-mode-hook #'direnv-update-environment) - - ;; setup run-assoc - ;; in dired mode use C- to open file in associated program - (load "~/.spacemacs.d/run-assoc.el") - (setq associated-program-alist - '( - ("${pkgs.evince}/bin/evince" "\\.pdf$") - ("${pkgs.libreoffice}/bin/libreoffice" "\\.odt$") - ("${pkgs.libreoffice}/bin/libreoffice" "\\.ods$") - ${ - let - suffixes = ["jpg" "jpeg" "png"]; - rule = suffix: ''("${pkgs.sxiv}/bin/sxiv" "\\.${suffix}$")''; - in - lib.concatStringsSep "\n " (builtins.map rule suffixes)} - ) + ;; setup run-assoc + ;; in dired mode use C- to open file in associated program + (load "~/.spacemacs.d/run-assoc.el") + (setq associated-program-alist + '( + ("${pkgs.evince}/bin/evince" "\\.pdf$") + ("${pkgs.libreoffice}/bin/libreoffice" "\\.odt$") + ("${pkgs.libreoffice}/bin/libreoffice" "\\.ods$") + ${ + let + suffixes = [ "jpg" "jpeg" "png" ]; + rule = suffix: ''("${pkgs.sxiv}/bin/sxiv" "\\.${suffix}$")''; + in lib.concatStringsSep "\n " (builtins.map rule suffixes) + } ) - ''; - - home.file.".spacemacs.d/run-assoc.el".source = pkgs.fetchurl { - url = "https://www.emacswiki.org/emacs/download/run-assoc.el"; - sha256 = "1rg0pa09zfslgqnhbqvaa6vdi2fmanrpyzq67ppiin0h1kdgs4im"; - }; - - home.file.".ctags.d/terraform.ctags".text = '' - --langdef=terraform - --langmap=terraform:.tf.tfvars - --regex-terraform=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/r,Resource/ - --regex-terraform=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/d,Data/ - --regex-terraform=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/ - --regex-terraform=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/ - --regex-terraform=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/ - --regex-terraform=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/ - --regex-terraform=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/ - ''; - - home.file.".spacemacs.d/old/polymode.el".text = '' - ;; not used at the moment - (define-hostmode poly-nix-hostmode - :mode 'nix-mode) - - (define-innermode poly-nix-lisp-metadata-innermode - :mode 'emacs-lisp-mode - :head-matcher (rx "/* lisp */" (one-or-more space) ${ticks} (zero-or-more space) line-end) - :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) - :head-mode 'host - :tail-mode 'host) - - (define-innermode poly-nix-shell-metadata-innermode - :mode 'shell-script-mode - :head-matcher (rx "/* sh */" (one-or-more space) ${ticks} (zero-or-more space) line-end) - :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) - :head-mode 'host - :tail-mode 'host) - - (define-innermode poly-nix-python-metadata-innermode - :mode 'python-mode - :head-matcher (rx "/* python */" (one-or-more space) ${ticks} (zero-or-more space) line-end) - :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) - :head-mode 'host - :tail-mode 'host) - - (define-innermode poly-nix-haskell-metadata-innermode - :mode 'haskell-mode - :head-matcher (rx "/* haskell */" (one-or-more space) ${ticks} (zero-or-more space) line-end) - :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) - :head-mode 'host - :tail-mode 'host) - - (define-polymode poly-nix-mode - :hostmode 'poly-nix-hostmode - :innermodes '(poly-nix-lisp-metadata-innermode - poly-nix-shell-metadata-innermode - poly-nix-haskell-metadata-innermode - poly-nix-python-metadata-innermode)) - - ;; remove nix-mode from auto load and replace it with poly-nix-mode - (setq auto-mode-alist (rassq-delete-all 'nix-mode auto-mode-alist)) - (add-to-list 'auto-mode-alist '("\\.nix\\'" . poly-nix-mode)) - ''; - + ) + ''; + home.file.".spacemacs.d/run-assoc.el".source = pkgs.fetchurl { + url = "https://www.emacswiki.org/emacs/download/run-assoc.el"; + sha256 = "1rg0pa09zfslgqnhbqvaa6vdi2fmanrpyzq67ppiin0h1kdgs4im"; }; + + home.file.".ctags.d/terraform.ctags".text = '' + --langdef=terraform + --langmap=terraform:.tf.tfvars + --regex-terraform=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/r,Resource/ + --regex-terraform=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/d,Data/ + --regex-terraform=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/ + --regex-terraform=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/ + --regex-terraform=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/ + --regex-terraform=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/ + --regex-terraform=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/ + ''; + + home.file.".spacemacs.d/old/polymode.el".text = '' + ;; not used at the moment + (define-hostmode poly-nix-hostmode + :mode 'nix-mode) + + (define-innermode poly-nix-lisp-metadata-innermode + :mode 'emacs-lisp-mode + :head-matcher (rx "/* lisp */" (one-or-more space) ${ticks} (zero-or-more space) line-end) + :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) + :head-mode 'host + :tail-mode 'host) + + (define-innermode poly-nix-shell-metadata-innermode + :mode 'shell-script-mode + :head-matcher (rx "/* sh */" (one-or-more space) ${ticks} (zero-or-more space) line-end) + :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) + :head-mode 'host + :tail-mode 'host) + + (define-innermode poly-nix-python-metadata-innermode + :mode 'python-mode + :head-matcher (rx "/* python */" (one-or-more space) ${ticks} (zero-or-more space) line-end) + :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) + :head-mode 'host + :tail-mode 'host) + + (define-innermode poly-nix-haskell-metadata-innermode + :mode 'haskell-mode + :head-matcher (rx "/* haskell */" (one-or-more space) ${ticks} (zero-or-more space) line-end) + :tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end) + :head-mode 'host + :tail-mode 'host) + + (define-polymode poly-nix-mode + :hostmode 'poly-nix-hostmode + :innermodes '(poly-nix-lisp-metadata-innermode + poly-nix-shell-metadata-innermode + poly-nix-haskell-metadata-innermode + poly-nix-python-metadata-innermode)) + + ;; remove nix-mode from auto load and replace it with poly-nix-mode + (setq auto-mode-alist (rassq-delete-all 'nix-mode auto-mode-alist)) + (add-to-list 'auto-mode-alist '("\\.nix\\'" . poly-nix-mode)) + ''; + + }; } diff --git a/system/desktop/home-manager/spacevim.nix b/system/desktop/home-manager/spacevim.nix index ce3dc54..5530c64 100644 --- a/system/desktop/home-manager/spacevim.nix +++ b/system/desktop/home-manager/spacevim.nix @@ -1,7 +1,6 @@ -{ lib, pkgs, ... }: -{ +{ lib, pkgs, ... }: { environment.systemPackages = let - spacevimRepo = pkgs.fetchgit{ + spacevimRepo = pkgs.fetchgit { url = "https://github.com/SpaceVim/SpaceVim.git"; rev = "9b354e05b4716b645ba6366e1265a5048a0c23d5"; sha256 = "1mn28hf857kp0jmbgd89cf5mk4dg53jcbqqrbr9zi3b854sa9ads"; @@ -28,8 +27,8 @@ " disable noisy indentLine let g:indentLine_enabled = 0 - ''; - in [ + ''; + in [ # vim (pkgs.writers.writeDashBin "spacevim" '' diff --git a/system/desktop/home-manager/ssh.nix b/system/desktop/home-manager/ssh.nix index 28489c7..a984bee 100644 --- a/system/desktop/home-manager/ssh.nix +++ b/system/desktop/home-manager/ssh.nix @@ -1,6 +1,5 @@ { lib, ... }: -with lib; -{ +with lib; { home-manager.users.mainUser = { programs.ssh.enable = true; diff --git a/system/desktop/home-manager/xmonad.nix b/system/desktop/home-manager/xmonad.nix index 22a6e96..7d77f9b 100644 --- a/system/desktop/home-manager/xmonad.nix +++ b/system/desktop/home-manager/xmonad.nix @@ -1,22 +1,28 @@ { pkgs, lib, config, ... }: let - nixCommands = { height, width }: pkgs.writeText "NixCommands.hs" /* haskell */ '' - module NixCommands where + nixCommands = { height, width }: + pkgs.writeText "NixCommands.hs" # haskell + '' + module NixCommands where - nixStartIrc = "${pkgs.rxvt_unicode}/bin/urxvt -e irc" - nixStartAudacious = "${pkgs.audacious}/bin/audacious" - nixStartFlameshot = "${pkgs.flameshot}/bin/flameshot gui -p /share/" - nixInvertColors = "${pkgs.xcalib}/bin/xcalib -invert -alter" - nixStartRedshift = "${pkgs.redshift}/bin/redshift -O 6100 -g 0.9:0.9:0.9 -b 0.9" - nixResetRedshift = "${pkgs.redshift}/bin/redshift -x" - nixSetCursorImage = "${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr" - nixSetBackground = "${pkgs.haskellPackages.image-generator}/bin/image-generator --height ${toString height} --width ${toString width} --output /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png" - nixStartAlbert = "${pkgs.albert}/bin/albert" - nixStartCopyq = "${pkgs.copyq}/bin/copyq" - nixShowCopyq = "${pkgs.copyq}/bin/copyq show" - nixStartTerminal = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc" -''; + nixStartIrc = "${pkgs.rxvt_unicode}/bin/urxvt -e irc" + nixStartAudacious = "${pkgs.audacious}/bin/audacious" + nixStartFlameshot = "${pkgs.flameshot}/bin/flameshot gui -p /share/" + nixInvertColors = "${pkgs.xcalib}/bin/xcalib -invert -alter" + nixStartRedshift = "${pkgs.redshift}/bin/redshift -O 6100 -g 0.9:0.9:0.9 -b 0.9" + nixResetRedshift = "${pkgs.redshift}/bin/redshift -x" + nixSetCursorImage = "${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr" + nixSetBackground = "${pkgs.haskellPackages.image-generator}/bin/image-generator --height ${ + toString height + } --width ${ + toString width + } --output /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png" + nixStartAlbert = "${pkgs.albert}/bin/albert" + nixStartCopyq = "${pkgs.copyq}/bin/copyq" + nixShowCopyq = "${pkgs.copyq}/bin/copyq show" + nixStartTerminal = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc" + ''; in { home-manager.users.mainUser = { @@ -25,7 +31,8 @@ in { height = config.configuration.desktop.height; width = config.configuration.desktop.width; }; - home.file.".xmonad/lib/SolarizedLight.hs".source = ./xmonad/SolarizedLight.hs; + home.file.".xmonad/lib/SolarizedLight.hs".source = + ./xmonad/SolarizedLight.hs; home.file.".xmonad/lib/SolarizedDark.hs".source = ./xmonad/SolarizedDark.hs; home.file.".xmonad/lib/FloatKeys.hs".source = ./xmonad/FloatKeys.hs; home.file.".xmonad/lib/TabbedFix.hs".source = ./xmonad/TabbedFix.hs; diff --git a/system/desktop/home-manager/xmonad/current-project.nix b/system/desktop/home-manager/xmonad/current-project.nix index 33755ba..c0febe3 100644 --- a/system/desktop/home-manager/xmonad/current-project.nix +++ b/system/desktop/home-manager/xmonad/current-project.nix @@ -1,15 +1,12 @@ -# created by cabal2nix -{ mkDerivation, base, deepseq, stdenv, xmonad, xmonad-contrib -, xmonad-extras -}: +# created by cabal2nix +{ mkDerivation, base, deepseq, stdenv, xmonad, xmonad-contrib, xmonad-extras }: mkDerivation { pname = "palos-xmonad"; version = "0.1.0.0"; src = ./.; isLibrary = false; isExecutable = true; - executableHaskellDepends = [ - base deepseq xmonad xmonad-contrib xmonad-extras - ]; + executableHaskellDepends = + [ base deepseq xmonad xmonad-contrib xmonad-extras ]; license = stdenv.lib.licenses.gpl3; } diff --git a/system/desktop/home-manager/xmonad/env.nix b/system/desktop/home-manager/xmonad/env.nix index 0953c8b..9709729 100644 --- a/system/desktop/home-manager/xmonad/env.nix +++ b/system/desktop/home-manager/xmonad/env.nix @@ -1,4 +1,4 @@ -{ pkgs ? import { +{ pkgs ? import { overlays = [ (self: super: { haskellPackages = super.haskellPackages.override { @@ -6,6 +6,7 @@ current-project = super.callPackage ./current-project.nix { }; }; }; - })]; -}}: + }) + ]; +} }: pkgs.haskellPackages.current-project.env diff --git a/system/desktop/home-manager/xmonad/lsp.nix b/system/desktop/home-manager/xmonad/lsp.nix index 04bab9a..e4cd960 100644 --- a/system/desktop/home-manager/xmonad/lsp.nix +++ b/system/desktop/home-manager/xmonad/lsp.nix @@ -1,13 +1,14 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: let - all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {}; -in -pkgs.mkShell { + all-hies = + import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") + { }; +in pkgs.mkShell { buildInputs = with pkgs; [ haskellPackages.hoogle haskellPackages.hindent haskellPackages.hlint haskellPackages.stylish-haskell - (all-hies.selection { selector = p: {inherit (p) ghc865; }; }) + (all-hies.selection { selector = p: { inherit (p) ghc865; }; }) ]; } diff --git a/system/desktop/home-manager/xmonad/shell.nix b/system/desktop/home-manager/xmonad/shell.nix index 95fd70f..f1e4df2 100644 --- a/system/desktop/home-manager/xmonad/shell.nix +++ b/system/desktop/home-manager/xmonad/shell.nix @@ -1,14 +1,9 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: let - updateCabal = pkgs.writeShellScriptBin "update-cabal" /* sh */ '' - cd ${toString ./.} - echo "# created by cabal2nix " > ${toString ./.}/current-project.nix - ${pkgs.cabal2nix}/bin/cabal2nix . >> ${toString ./.}/current-project.nix - ''; -in -pkgs.mkShell { - buildInputs = with pkgs; [ - updateCabal - cabal2nix - ]; -} + updateCabal = pkgs.writeShellScriptBin "update-cabal" # sh + '' + cd ${toString ./.} + echo "# created by cabal2nix " > ${toString ./.}/current-project.nix + ${pkgs.cabal2nix}/bin/cabal2nix . >> ${toString ./.}/current-project.nix + ''; +in pkgs.mkShell { buildInputs = with pkgs; [ updateCabal cabal2nix ]; } diff --git a/system/desktop/icecast.nix b/system/desktop/icecast.nix index ef6ed92..38bcee3 100644 --- a/system/desktop/icecast.nix +++ b/system/desktop/icecast.nix @@ -12,9 +12,8 @@ let password = "password"; mountPoint = "/radio.mp3"; maxListeners = 20; -in -{ +in { services.icecast = { enable = true; @@ -55,7 +54,7 @@ in # don't want to have the service running all the time # --------------------------------------------------- - systemd.services.icecast.wantedBy = lib.mkForce []; - systemd.services.icecast.after = lib.mkForce []; + systemd.services.icecast.wantedBy = lib.mkForce [ ]; + systemd.services.icecast.after = lib.mkForce [ ]; } diff --git a/system/desktop/mail-stuff.nix b/system/desktop/mail-stuff.nix index e6349f0..a2d9ec0 100644 --- a/system/desktop/mail-stuff.nix +++ b/system/desktop/mail-stuff.nix @@ -2,8 +2,7 @@ let passcmd = id: "${pkgs.pass}/bin/pass ${id}"; ticks = "''"; -in -{ +in { # Maildir <-> Server communication # -------------------------------- # mbsync: MailDir <-> IMAP @@ -34,9 +33,7 @@ in port = 465; }; notmuch.enable = true; - msmtp = { - enable = true; - }; + msmtp = { enable = true; }; }; ingolf-wagner-gmx = { primary = false; @@ -50,9 +47,7 @@ in port = 465; }; notmuch.enable = true; - msmtp = { - enable = true; - }; + msmtp = { enable = true; }; }; pali_palo = { primary = false; @@ -114,7 +109,8 @@ in msmtp = { enable = true; # msmtp --serverinfo --tls --tls-certcheck=off -a ingolf-wagner - tls.fingerprint = "33:B9:77:B6:69:2C:0C:BC:ED:28:12:79:02:AC:00:4E:E3:EE:31:EF:5E:C8:12:1C:02:5D:13:0B:BA:C0:1E:5F"; + tls.fingerprint = + "33:B9:77:B6:69:2C:0C:BC:ED:28:12:79:02:AC:00:4E:E3:EE:31:EF:5E:C8:12:1C:02:5D:13:0B:BA:C0:1E:5F"; }; gpg = { encryptByDefault = true; @@ -141,7 +137,8 @@ in msmtp = { enable = true; # msmtp --serverinfo --tls --tls-certcheck=off -a gaykraft - tls.fingerprint = "08:42:73:72:3E:68:7D:55:89:7A:30:02:4B:CD:30:35:F1:6D:3E:7A:DD:A8:B6:84:67:25:37:F0:4F:7F:86:FE"; + tls.fingerprint = + "08:42:73:72:3E:68:7D:55:89:7A:30:02:4B:CD:30:35:F1:6D:3E:7A:DD:A8:B6:84:67:25:37:F0:4F:7F:86:FE"; }; notmuch.enable = true; }; @@ -160,7 +157,8 @@ in msmtp = { enable = true; # msmtp --serverinfo --tls --tls-certcheck=off -a c-base - tls.fingerprint = "9C:82:3B:0F:31:CE:1B:8E:96:00:CC:C9:FF:E7:BE:66:95:92:4F:22:DD:D6:2E:0E:1D:90:76:BE:8E:9E:8E:16"; + tls.fingerprint = + "9C:82:3B:0F:31:CE:1B:8E:96:00:CC:C9:FF:E7:BE:66:95:92:4F:22:DD:D6:2E:0E:1D:90:76:BE:8E:9E:8E:16"; }; gpg = { encryptByDefault = true; @@ -188,10 +186,9 @@ in # configure astroid ui home-manager.users.mainUser.programs.astroid = { enable = true; - extraConfig = { - startup.queries.inbox = "tag:inbox AND NOT tag:killed"; - }; - externalEditor = "${pkgs.neovim-qt}/bin/nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1"; + extraConfig = { startup.queries.inbox = "tag:inbox AND NOT tag:killed"; }; + externalEditor = + "${pkgs.neovim-qt}/bin/nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1"; }; # configure alot @@ -202,10 +199,10 @@ in # v v v v v v #normal= 'bold,underline', '', 'light red, bold, underline', 'light green', 'light red, bold, underline', '#8f6' bindings.thread = { - r = "reply --all"; - R = "reply --all"; - g = "reply"; - h = "toggleheaders"; + r = "reply --all"; + R = "reply --all"; + g = "reply"; + h = "toggleheaders"; }; extraConfig = '' theme = "solarized_light_real" @@ -230,144 +227,143 @@ in ''; }; - home-manager.users.mainUser.xdg.configFile."alot/themes/solarized_light_real".text = '' + home-manager.users.mainUser.xdg.configFile."alot/themes/solarized_light_real".text = + '' -############################################################################### -# SOLARIZED LIGHT -# -# colour theme for alot. © 2012 Patrick Totzke, GNU GPL3+ -# http://ethanschoonover.com/solarized -# https://github.com/pazz/alot -############################################################################### -# -# Define mappings from solarized colour names to urwid attribute names for 16 -# and 256 colour modes. These work well assuming you use the solarized term -# colours via Xressources/Xdefaults. You might want to change this otherwise + ############################################################################### + # SOLARIZED LIGHT + # + # colour theme for alot. © 2012 Patrick Totzke, GNU GPL3+ + # http://ethanschoonover.com/solarized + # https://github.com/pazz/alot + ############################################################################### + # + # Define mappings from solarized colour names to urwid attribute names for 16 + # and 256 colour modes. These work well assuming you use the solarized term + # colours via Xressources/Xdefaults. You might want to change this otherwise -16_base3 = 'dark gray' -16_base2 = 'black' -16_base1 = 'light green' -16_base0 = 'yellow' -16_base00 = 'light blue' -16_base01 = 'light cyan' -16_base02 = 'light gray' -16_base03 = 'white' -16_yellow = 'brown' -16_orange = 'light red' -16_red = 'dark red' -16_magenta = 'dark magenta' -16_violet = 'light magenta' -16_blue = 'dark blue' -16_cyan = 'dark cyan' -16_green = 'dark green' + 16_base3 = 'dark gray' + 16_base2 = 'black' + 16_base1 = 'light green' + 16_base0 = 'yellow' + 16_base00 = 'light blue' + 16_base01 = 'light cyan' + 16_base02 = 'light gray' + 16_base03 = 'white' + 16_yellow = 'brown' + 16_orange = 'light red' + 16_red = 'dark red' + 16_magenta = 'dark magenta' + 16_violet = 'light magenta' + 16_blue = 'dark blue' + 16_cyan = 'dark cyan' + 16_green = 'dark green' -# Use a slightly different mapping here to be able to use "bold" in 256c mode - -256_base3 = 'dark gray' -256_base2 = 'black' -256_base1 = 'light green' -256_base0 = 'yellow' -256_base00 = 'g50' #808080 -256_base01 = 'g52' #848484 - approximates #8a8a8a -256_base02 = 'light gray' -256_base03 = 'white' -256_yellow = 'brown' -256_orange = 'light red' -256_red = 'dark red' -256_magenta = 'dark magenta' -256_violet = 'light magenta' -256_blue = 'dark blue' -256_cyan = '#0aa' #00afaf -256_green = 'dark green' - -# This is the actual alot theme -[global] - footer = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - notify_error = 'standout','default','%(16_base3)s','%(16_red)s','%(256_base3)s','%(256_red)s' - notify_normal = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - prompt = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - tag = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - tag_focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' -[help] - text = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - section = 'underline','default','%(16_base01)s,underline','%(16_base2)s','%(256_base01)s,underline','%(256_base2)s' - title = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' -[namedqueries] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' -[taglist] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' -[bufferlist] - line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' -[thread] - attachment = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - attachment_focus = 'underline','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - body_focus = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base2)s' - arrow_bars = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - arrow_heads = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - header_key = 'default','default','%(16_magenta)s','%(16_base2)s','%(256_magenta)s','%(256_base2)s' - header_value = 'default','default','%(16_blue)s','%(16_base2)s','%(256_blue)s','%(256_base2)s' - [[summary]] - even = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' - odd = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' -[envelope] - body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' - header_key = 'default','default','%(16_orange)s','%(16_base2)s','%(256_orange)s','%(256_base2)s' - header_value = 'default','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' -[search] - [[threadline]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - parts = mailcount,date,tags,authors,subject - [[[date]]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - [[[mailcount]]] - normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' - focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' - [[[tags]]] - normal = 'bold','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' - focus = 'bold','default','%(16_yellow)s,underline','%(16_base3)s','%(256_yellow)s,underline','%(256_base3)s' - [[[authors]]] - normal = 'default,underline','default','%(16_blue)s','%(16_base3)s','%(256_blue)s','%(256_base3)s' - focus = 'default,underline','default','%(16_blue)s,underline','%(16_base3)s','%(256_blue)s,underline','%(256_base3)s' - width = 'fit',0,30 - [[[subject]]] - normal = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' - focus = 'default','default','%(16_base00)s,underline','%(16_base3)s','%(256_base00)s,underline','%(256_base3)s' - width = 'weight',1 - [[[content]]] - normal = 'default','default','%(16_base1)s','%(16_base3)s','%(256_base1)s','%(256_base3)s' - focus = 'default','default','%(16_base1)s,underline','%(16_base3)s','%(256_base1)s,underline','%(256_base3)s' - [[threadline-unread]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - tagged_with = 'unread' - [[[date]]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - [[[mailcount]]] - normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' - [[[tags]]] - normal = 'bold','default','%(16_yellow)s','%(16_base2)s','%(256_yellow)s','%(256_base2)s' - [[[authors]]] - normal = 'default,underline','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' - [[[subject]]] - normal = 'default','default','%(16_base02)s,bold','%(16_base2)s','%(256_base02)s,bold','%(256_base2)s' - [[[content]]] - normal = 'default','default','%(16_base1)s,bold','%(16_base2)s','%(256_base1)s,bold','%(256_base2)s' - ''; + # Use a slightly different mapping here to be able to use "bold" in 256c mode + 256_base3 = 'dark gray' + 256_base2 = 'black' + 256_base1 = 'light green' + 256_base0 = 'yellow' + 256_base00 = 'g50' #808080 + 256_base01 = 'g52' #848484 - approximates #8a8a8a + 256_base02 = 'light gray' + 256_base03 = 'white' + 256_yellow = 'brown' + 256_orange = 'light red' + 256_red = 'dark red' + 256_magenta = 'dark magenta' + 256_violet = 'light magenta' + 256_blue = 'dark blue' + 256_cyan = '#0aa' #00afaf + 256_green = 'dark green' + # This is the actual alot theme + [global] + footer = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' + body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + notify_error = 'standout','default','%(16_base3)s','%(16_red)s','%(256_base3)s','%(256_red)s' + notify_normal = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + prompt = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + tag = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' + tag_focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' + [help] + text = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + section = 'underline','default','%(16_base01)s,underline','%(16_base2)s','%(256_base01)s,underline','%(256_base2)s' + title = 'standout','default','%(16_base01)s','%(16_base2)s','%(256_base01)s','%(256_base2)s' + [namedqueries] + line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' + line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + [taglist] + line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' + line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + [bufferlist] + line_focus = 'standout','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' + line_even = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + line_odd = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + [thread] + attachment = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + attachment_focus = 'underline','default','%(16_base2)s','%(16_yellow)s','%(256_base2)s','%(256_yellow)s' + body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + body_focus = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base2)s' + arrow_bars = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' + arrow_heads = 'default','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' + header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + header_key = 'default','default','%(16_magenta)s','%(16_base2)s','%(256_magenta)s','%(256_base2)s' + header_value = 'default','default','%(16_blue)s','%(16_base2)s','%(256_blue)s','%(256_base2)s' + [[summary]] + even = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + focus = 'standout','default','%(16_base3)s','%(16_yellow)s','%(256_base3)s','%(256_yellow)s' + odd = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + [envelope] + body = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + header = 'default','default','%(16_base00)s','%(16_base2)s','%(256_base00)s','%(256_base2)s' + header_key = 'default','default','%(16_orange)s','%(16_base2)s','%(256_orange)s','%(256_base2)s' + header_value = 'default','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' + [search] + [[threadline]] + normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' + focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' + parts = mailcount,date,tags,authors,subject + [[[date]]] + normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' + focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' + [[[mailcount]]] + normal = 'default','default','%(16_base01)s','%(16_base3)s','%(256_base01)s','%(256_base3)s' + focus = 'default','default','%(16_base01)s,underline','%(16_base3)s','%(256_base01)s,underline','%(256_base3)s' + [[[tags]]] + normal = 'bold','default','%(16_yellow)s','%(16_base3)s','%(256_yellow)s','%(256_base3)s' + focus = 'bold','default','%(16_yellow)s,underline','%(16_base3)s','%(256_yellow)s,underline','%(256_base3)s' + [[[authors]]] + normal = 'default,underline','default','%(16_blue)s','%(16_base3)s','%(256_blue)s','%(256_base3)s' + focus = 'default,underline','default','%(16_blue)s,underline','%(16_base3)s','%(256_blue)s,underline','%(256_base3)s' + width = 'fit',0,30 + [[[subject]]] + normal = 'default','default','%(16_base00)s','%(16_base3)s','%(256_base00)s','%(256_base3)s' + focus = 'default','default','%(16_base00)s,underline','%(16_base3)s','%(256_base00)s,underline','%(256_base3)s' + width = 'weight',1 + [[[content]]] + normal = 'default','default','%(16_base1)s','%(16_base3)s','%(256_base1)s','%(256_base3)s' + focus = 'default','default','%(16_base1)s,underline','%(16_base3)s','%(256_base1)s,underline','%(256_base3)s' + [[threadline-unread]] + normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' + tagged_with = 'unread' + [[[date]]] + normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' + [[[mailcount]]] + normal = 'default','default','%(16_base01)s,bold','%(16_base2)s','%(256_base01)s,bold','%(256_base2)s' + [[[tags]]] + normal = 'bold','default','%(16_yellow)s','%(16_base2)s','%(256_yellow)s','%(256_base2)s' + [[[authors]]] + normal = 'default,underline','default','%(16_violet)s','%(16_base2)s','%(256_violet)s','%(256_base2)s' + [[[subject]]] + normal = 'default','default','%(16_base02)s,bold','%(16_base2)s','%(256_base02)s,bold','%(256_base2)s' + [[[content]]] + normal = 'default','default','%(16_base1)s,bold','%(16_base2)s','%(256_base1)s,bold','%(256_base2)s' + ''; # enable html emails home-manager.users.mainUser.home.file.".mailcap".text = '' @@ -390,15 +386,6 @@ in ${mailSend}/bin/mail-send ${mailSync}/bin/mail-sync ''; - in - [ - pkgs.notmuch - pkgs.alot - pkgs.muchsync - mail - mailSync - mailView - mailSend - ]; + in [ pkgs.notmuch pkgs.alot pkgs.muchsync mail mailSync mailView mailSend ]; } diff --git a/system/desktop/mc.nix b/system/desktop/mc.nix index 2c651f4..141f8c5 100644 --- a/system/desktop/mc.nix +++ b/system/desktop/mc.nix @@ -326,10 +326,12 @@ in { name = "mc"; paths = [ (pkgs.writers.writeDashBin "mc" '' - export MC_DATADIR=${pkgs.write "mc-ext" { + export MC_DATADIR=${ + pkgs.write "mc-ext" { "/mc.ext".link = mcExt; "/sfs.ini".text = ""; - }}; + } + }; export TERM=xterm-256color exec ${pkgs.mc}/bin/mc -S xoria256 "$@" '') diff --git a/system/desktop/network.nix b/system/desktop/network.nix index 495b0da..323c57f 100644 --- a/system/desktop/network.nix +++ b/system/desktop/network.nix @@ -1,5 +1,4 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { system.custom.wifi = { enable = true; diff --git a/system/desktop/packages.nix b/system/desktop/packages.nix index 0047945..fafc3e4 100644 --- a/system/desktop/packages.nix +++ b/system/desktop/packages.nix @@ -4,7 +4,7 @@ with lib; let - unstablePkgs = import {}; + unstablePkgs = import { }; library = import { inherit pkgs lib; }; @@ -12,100 +12,102 @@ let # seafile-shared = unstablePkgs.seafile-shared; #}; - seafileClient = pkgs.seafile-client.override{ - seafile-shared = pkgs.seafile-shared; - }; + seafileClient = + pkgs.seafile-client.override { seafile-shared = pkgs.seafile-shared; }; - replaceLinks = pkgs.writers.writeBashBin "replace-link-with-content" /* sh */ '' - if [ ! -L "$1" ] - then - echo "$1 does not exist or is not a file" - exit 1 - fi + replaceLinks = pkgs.writers.writeBashBin "replace-link-with-content" # sh + '' + if [ ! -L "$1" ] + then + echo "$1 does not exist or is not a file" + exit 1 + fi - cp -rL "$1" "$1.backup" - unlink "$1" - mv "$1.backup" "$1" - ''; + cp -rL "$1" "$1.backup" + unlink "$1" + mv "$1.backup" "$1" + ''; - pandocScript = inputFormat: outputFormat: pkgs.writers.writeDashBin "pandoc-from-${inputFormat}-to-${outputFormat}" '' - ${pkgs.pandoc}/bin/pandoc \ - --from ${inputFormat} \ - --to ${outputFormat} \ - --standalone \ - "$@" - ''; + pandocScript = inputFormat: outputFormat: + pkgs.writers.writeDashBin "pandoc-from-${inputFormat}-to-${outputFormat}" '' + ${pkgs.pandoc}/bin/pandoc \ + --from ${inputFormat} \ + --to ${outputFormat} \ + --standalone \ + "$@" + ''; # show keyboard input on desktop for screencasts screenKey = pkgs.symlinkJoin { name = "screen-keys"; - paths = - let - screenKeyScript = { position ? "bottom", size ? "small", ... }: pkgs.writeShellScriptBin "screenkeys-${position}-${size}" /* sh */ '' - ${pkgs.screenkey}/bin/screenkey \ - --no-detach \ - --bg-color '#fdf6e3' \ - --font-color '#073642' \ - -p ${position} \ - -s ${size} \ - "$@" - ''; - in - lib.flatten ( - lib.flip map [ "large" "small" "medium" ] ( - size: - lib.flip map [ "top" "center" "bottom" ] ( - position: - screenKeyScript { inherit size position ;} - ) - ) - ); + paths = let + screenKeyScript = { position ? "bottom", size ? "small", ... }: + pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh + '' + ${pkgs.screenkey}/bin/screenkey \ + --no-detach \ + --bg-color '#fdf6e3' \ + --font-color '#073642' \ + -p ${position} \ + -s ${size} \ + "$@" + ''; + in lib.flatten (lib.flip map [ "large" "small" "medium" ] (size: + lib.flip map [ "top" "center" "bottom" ] + (position: screenKeyScript { inherit size position; }))); }; + connectToSpeaker = name: id: + pkgs.writeShellScriptBin "connect-to-speaker-${name}" # sh + '' + # hacky script because I have problems with + # automatically connecting to trusted bluetooth devices. - connectToSpeaker = name: id: pkgs.writeShellScriptBin "connect-to-speaker-${name}" /* sh */ '' - # hacky script because I have problems with - # automatically connecting to trusted bluetooth devices. + echo "Connect to Speaker ${name}" - echo "Connect to Speaker ${name}" + bluetoothctl <)) + (writeShellScriptBin "shrink-exports" + (fileContents )) - screenKey - replaceLinks + screenKey + replaceLinks - (pkgs.pidgin-with-plugins.override { - ## Add whatever plugins are desired (see nixos.org package listing). - plugins = [ - pkgs.pidgin-otr - pkgs.purple-facebook - pkgs.purple-discord - pkgs.purple-matrix - pkgs.purple-hangouts - pkgs.pidgin-latex - pkgs.pidgin-opensteamworks - pkgs.pidgin-skypeweb - pkgs.telegram-purple - pkgs.purple-lurch - ]; - }) + (pkgs.pidgin-with-plugins.override { + ## Add whatever plugins are desired (see nixos.org package listing). + plugins = [ + pkgs.pidgin-otr + pkgs.purple-facebook + pkgs.purple-discord + pkgs.purple-matrix + pkgs.purple-hangouts + pkgs.pidgin-latex + pkgs.pidgin-opensteamworks + pkgs.pidgin-skypeweb + pkgs.telegram-purple + pkgs.purple-lurch + ]; + }) - haskellPackages.image-generator + haskellPackages.image-generator - memo - nixfmt + memo + nixfmt - # etc-info stuff - (pkgs.writers.writeDashBin "etc-info-sync" - (lib.concatStringsSep "\n" - (map - (host: "rsync -avLz ${host}.private:/etc/info/ ~/.etc_info") - (attrNames config.module.cluster.services.tinc."private".hosts)))) + # etc-info stuff + (pkgs.writers.writeDashBin "etc-info-sync" (lib.concatStringsSep "\n" + (map (host: "rsync -avLz ${host}.private:/etc/info/ ~/.etc_info") + (attrNames config.module.cluster.services.tinc."private".hosts)))) - (pkgs.writers.writeBashBin "etc-info-restic" (lib.fileContents )) + (pkgs.writers.writeBashBin "etc-info-restic" + (lib.fileContents )) - - - ] ++ (lib.crossLists pandocScript [ ["markdown" "mediawiki"] ["mediawiki" "docbook5" "html5" "man"] ]); + ] ++ (lib.crossLists pandocScript [ + [ "markdown" "mediawiki" ] + [ "mediawiki" "docbook5" "html5" "man" ] + ]); } diff --git a/system/desktop/pass.nix b/system/desktop/pass.nix index 09e011c..37f893e 100644 --- a/system/desktop/pass.nix +++ b/system/desktop/pass.nix @@ -9,9 +9,9 @@ let # makes it possible to be used by other programs desktopFile = name: bin: pkgs.writeTextFile { - name = "${name}.desktop"; + name = "${name}.desktop"; destination = "/share/applications/${name}.desktop"; - text = '' + text = '' [Desktop Entry] Categories=Application;Utility; Comment=password dialog diff --git a/system/desktop/remote-install.nix b/system/desktop/remote-install.nix index a205df9..98f5e3e 100644 --- a/system/desktop/remote-install.nix +++ b/system/desktop/remote-install.nix @@ -1,11 +1,8 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { services.tor = { enable = true; client.enable = true; - hiddenServices.liveos.map = [ - { port = 1337; } - ]; + hiddenServices.liveos.map = [{ port = 1337; }]; }; environment.systemPackages = [ diff --git a/system/desktop/restic.nix b/system/desktop/restic.nix index 208ede9..5209fd4 100644 --- a/system/desktop/restic.nix +++ b/system/desktop/restic.nix @@ -6,8 +6,6 @@ "on-workout".enable = true; }; - backup.all.restic.dirs = [ - "/home/palo/.password-store" - ]; + backup.all.restic.dirs = [ "/home/palo/.password-store" ]; } diff --git a/system/desktop/sshd.nix b/system/desktop/sshd.nix index d7225aa..19951e3 100644 --- a/system/desktop/sshd.nix +++ b/system/desktop/sshd.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{ config, ... }: { # make sure ssh is only available trough the tinc networking.firewall.extraCommands = '' iptables -t nat -A PREROUTING ! -i tinc.private -p tcp -m tcp --dport 22 -j REDIRECT --to-ports 0 diff --git a/system/desktop/suspend.nix b/system/desktop/suspend.nix index bcec897..58b934a 100644 --- a/system/desktop/suspend.nix +++ b/system/desktop/suspend.nix @@ -4,14 +4,12 @@ systemd.services.screenlock = { before = [ "sleep.target" ]; requiredBy = [ "sleep.target" ]; - environment = - let - display = if (config.services.xserver.display != null) - then config.services.xserver.display - else 0; - in { - DISPLAY = ":${toString display}"; - }; + environment = let + display = if (config.services.xserver.display != null) then + config.services.xserver.display + else + 0; + in { DISPLAY = ":${toString display}"; }; script = '' ${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 & sleep 4 diff --git a/system/desktop/user.nix b/system/desktop/user.nix index 4430a32..4f35006 100644 --- a/system/desktop/user.nix +++ b/system/desktop/user.nix @@ -1,14 +1,11 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { programs.custom.zsh.mainUser = config.users.users.mainUser.name; system.custom.mainUser = { - enable = true; + enable = true; userName = "palo"; authorizedKeyFiles = config.users.users.root.openssh.authorizedKeys.keyFiles; }; - - } diff --git a/system/desktop/x11.nix b/system/desktop/x11.nix index bf4d292..e613dab 100644 --- a/system/desktop/x11.nix +++ b/system/desktop/x11.nix @@ -1,14 +1,9 @@ -{ config, pkgs, lib, ... }: -{ +{ config, pkgs, lib, ... }: { - environment.systemPackages = with pkgs; [ - xclip - xtrlock-pam - xorg.xev - ]; + environment.systemPackages = with pkgs; [ xclip xtrlock-pam xorg.xev ]; system.custom.x11 = { - enable = true; + enable = true; autoLoginUser = config.users.users.mainUser.name; }; @@ -16,4 +11,3 @@ } - diff --git a/system/desktop/xlock.nix b/system/desktop/xlock.nix index 9b83b8a..11e828f 100644 --- a/system/desktop/xlock.nix +++ b/system/desktop/xlock.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, pkgs, ... }: with lib; @@ -9,33 +9,28 @@ let # desktop file # ------------ # makes it possible to be used by other programs - desktopFile = - pkgs.writeTextFile { - name = "${name}.desktop" ; - destination = "/share/applications/${name}.desktop"; - text = '' - [Desktop Entry] - Categories=Application;Utility; - Comment=Screen Saver - Encoding=UTF-8 - Exec=${lockProgram}/bin/${name} - Icon=gnome-lockscreen - Name=${name} - Terminal=false - Type=Application - ''; - }; + desktopFile = pkgs.writeTextFile { + name = "${name}.desktop"; + destination = "/share/applications/${name}.desktop"; + text = '' + [Desktop Entry] + Categories=Application;Utility; + Comment=Screen Saver + Encoding=UTF-8 + Exec=${lockProgram}/bin/${name} + Icon=gnome-lockscreen + Name=${name} + Terminal=false + Type=Application + ''; + }; # the lock program - lockProgram = - pkgs.writeShellScriptBin "${name}" '' - ${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 - ''; + lockProgram = pkgs.writeShellScriptBin "${name}" '' + ${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 + ''; in { - environment.systemPackages = [ - lockProgram - desktopFile - ]; + environment.systemPackages = [ lockProgram desktopFile ]; } diff --git a/system/desktop/yubikey.nix b/system/desktop/yubikey.nix index 986a25a..1537419 100644 --- a/system/desktop/yubikey.nix +++ b/system/desktop/yubikey.nix @@ -1,8 +1,7 @@ # References: # * https://github.com/drduh/YubiKey-Guide # * https://nixos.wiki/wiki/Yubikey -{ pkgs, ... }: -{ +{ pkgs, ... }: { services.pcscd.enable = true; services.udev.packages = [ diff --git a/system/proxy/default.nix b/system/proxy/default.nix index d66d4c9..041c5fb 100644 --- a/system/proxy/default.nix +++ b/system/proxy/default.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { imports = [ diff --git a/system/server/default.nix b/system/server/default.nix index cab1f9e..cd5c7ea 100644 --- a/system/server/default.nix +++ b/system/server/default.nix @@ -1,5 +1,4 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: { imports = [ diff --git a/system/server/graylog-exporter.nix b/system/server/graylog-exporter.nix index e976bde..7a3fb00 100644 --- a/system/server/graylog-exporter.nix +++ b/system/server/graylog-exporter.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{ lib, ... }: { # send data to graylog services.SystemdJournal2Gelf.enable = lib.mkDefault true; services.SystemdJournal2Gelf.graylogServer = "workhorse.private:11201"; diff --git a/system/server/initssh.nix b/system/server/initssh.nix index 94a6d8d..81f4deb 100644 --- a/system/server/initssh.nix +++ b/system/server/initssh.nix @@ -15,9 +15,7 @@ in { type = with types; enum [ "disable" "prepare" "enabled" ]; }; - kernelModules = mkOption { - type = with types; listOf str; - }; + kernelModules = mkOption { type = with types; listOf str; }; port = mkOption { default = 23; @@ -26,11 +24,9 @@ in { authorizedKeys = mkOption { type = with types; listOf str; - default = config.users.users.root.openssh.authorizedKeys.keys ++ ( - map - (keyFile: lib.fileContents keyFile) - config.users.users.root.openssh.authorizedKeys.keyFiles - ); + default = config.users.users.root.openssh.authorizedKeys.keys + ++ (map (keyFile: lib.fileContents keyFile) + config.users.users.root.openssh.authorizedKeys.keyFiles); }; hostDSSKey = mkOption { @@ -66,16 +62,14 @@ in { services.tor = { enable = true; client.enable = true; - hiddenServices.bootup.map = [ - { port = 23; } - ]; + hiddenServices.bootup.map = [{ port = 23; }]; }; }) (mkIf (cfg.enable == "enabled") { # tor setup - boot.initrd.secrets = { + boot.initrd.secrets = { "/etc/tor/onion/bootup" = /var/lib/tor/onion/bootup; "/etc/tor/tor.rc" = (pkgs.writeText "tor.rc" '' DataDirectory /etc/tor @@ -90,33 +84,30 @@ in { copy_bin_and_libs ${pkgs.tor}/bin/tor ''; - boot.initrd.network.postCommands = - '' - echo "tor: preparing onion folder" - # have to do this otherwise tor does not want to start - chmod -R 700 /etc/tor + boot.initrd.network.postCommands = '' + echo "tor: preparing onion folder" + # have to do this otherwise tor does not want to start + chmod -R 700 /etc/tor - echo "tor: starting tor" - tor -f /etc/tor/tor.rc --verify-config - tor -f /etc/tor/tor.rc & - ''; + echo "tor: starting tor" + tor -f /etc/tor/tor.rc --verify-config + tor -f /etc/tor/tor.rc & + ''; - # ssh setup - # todo add the ssh host fingerprint to your trusted stuff - # todo set ssh host key here - boot.initrd.network.enable = true; - boot.initrd.network.ssh = { - enable = true; - authorizedKeys = cfg.authorizedKeys; - port = cfg.port; - }; - boot.initrd.availableKernelModules = cfg.kernelModules; - boot.initrd.network.ssh.hostDSSKey = cfg.hostDSSKey; - boot.initrd.network.ssh.hostECDSAKey = cfg.hostECDSAKey; - boot.initrd.network.ssh.hostRSAKey = cfg.hostRSAKey; + # ssh setup + # todo add the ssh host fingerprint to your trusted stuff + # todo set ssh host key here + boot.initrd.network.enable = true; + boot.initrd.network.ssh = { + enable = true; + authorizedKeys = cfg.authorizedKeys; + port = cfg.port; + }; + boot.initrd.availableKernelModules = cfg.kernelModules; + boot.initrd.network.ssh.hostDSSKey = cfg.hostDSSKey; + boot.initrd.network.ssh.hostECDSAKey = cfg.hostECDSAKey; + boot.initrd.network.ssh.hostRSAKey = cfg.hostRSAKey; }) ]; } - - diff --git a/system/server/netdata.nix b/system/server/netdata.nix index 4f52bba..5f33e28 100644 --- a/system/server/netdata.nix +++ b/system/server/netdata.nix @@ -1,5 +1,4 @@ -{ lib, pkgs, ... }: -{ +{ lib, pkgs, ... }: { services.netdata = { enable = lib.mkDefault true; # https://docs.netdata.cloud/daemon/config/ diff --git a/system/server/prometheus-exporters.nix b/system/server/prometheus-exporters.nix index 6f0e06f..f62479e 100644 --- a/system/server/prometheus-exporters.nix +++ b/system/server/prometheus-exporters.nix @@ -1,5 +1,4 @@ -{ config, lib, ... }: -{ +{ config, lib, ... }: { config = lib.mkMerge [ (lib.mkIf config.services.nginx.enable { services.prometheus.exporters.nginx.enable = true; diff --git a/system/server/restic.nix b/system/server/restic.nix index d46e299..f6032e4 100644 --- a/system/server/restic.nix +++ b/system/server/restic.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{ lib, ... }: { backup.services.restic = { "on-porani".enable = lib.mkDefault true; diff --git a/terranix/graylog/config.nix b/terranix/graylog/config.nix index 2a3dd12..dcce2a1 100644 --- a/terranix/graylog/config.nix +++ b/terranix/graylog/config.nix @@ -1,6 +1,5 @@ # https://github.com/suzuki-shunsuke/go-graylog/tree/master/terraform -{ pgks, lib, ... }: -{ +{ pgks, lib, ... }: { imports = [ ./modules @@ -26,16 +25,20 @@ index_prefix = "trash"; # https://godoc.org/github.com/suzuki-shunsuke/go-graylog#pkg-constants - rotation_strategy_class = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategy"; + rotation_strategy_class = + "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategy"; rotation_strategy = { - type = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig"; + type = + "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig"; max_size = 1024 * 1024 * 10; }; - retention_strategy_class = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"; + retention_strategy_class = + "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"; retention_strategy = { - type = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"; - max_number_of_indices = 10; + type = + "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"; + max_number_of_indices = 10; }; index_analyzer = "standard"; @@ -45,9 +48,7 @@ writable = "true"; }; - graylog.stream.junk = { - index_set_id = "\${graylog_index_set.junk.id}"; - }; + graylog.stream.junk = { index_set_id = "\${graylog_index_set.junk.id}"; }; # ---- [ thread ] @@ -56,16 +57,20 @@ index_prefix = "thread"; # https://godoc.org/github.com/suzuki-shunsuke/go-graylog#pkg-constants - rotation_strategy_class = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategy"; + rotation_strategy_class = + "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategy"; rotation_strategy = { - type = "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig"; + type = + "org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig"; max_size = 1024 * 1024 * 10; }; - retention_strategy_class = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"; + retention_strategy_class = + "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy"; retention_strategy = { - type = "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"; - max_number_of_indices = 20; + type = + "org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig"; + max_number_of_indices = 20; }; index_analyzer = "standard"; @@ -89,7 +94,6 @@ # #inverted = false; #}; - # not necessary because we have a geoip resolver #graylog.pipeline.processThreads = { diff --git a/terranix/graylog/config/elasticsearch.nix b/terranix/graylog/config/elasticsearch.nix index 8fb7390..f3682a0 100644 --- a/terranix/graylog/config/elasticsearch.nix +++ b/terranix/graylog/config/elasticsearch.nix @@ -30,7 +30,7 @@ }; - graylog.all_messages.rules = ["route elasticsearch message"]; + graylog.all_messages.rules = [ "route elasticsearch message" ]; graylog.stream.elasticsearch = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -45,5 +45,4 @@ description = "process messages of the elasticsearch stream(TF)"; }; - } diff --git a/terranix/graylog/config/gogs.nix b/terranix/graylog/config/gogs.nix index afb4986..a042a10 100644 --- a/terranix/graylog/config/gogs.nix +++ b/terranix/graylog/config/gogs.nix @@ -17,7 +17,7 @@ }; - graylog.all_messages.rules = ["route gogs message"]; + graylog.all_messages.rules = [ "route gogs message" ]; graylog.stream.gogs = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -32,5 +32,4 @@ # description = "process messages of the gogs stream(TF)"; #}; - } diff --git a/terranix/graylog/config/home-assistant.nix b/terranix/graylog/config/home-assistant.nix index 78f482d..aa05fbb 100644 --- a/terranix/graylog/config/home-assistant.nix +++ b/terranix/graylog/config/home-assistant.nix @@ -17,7 +17,7 @@ }; - graylog.all_messages.rules = ["route hass message"]; + graylog.all_messages.rules = [ "route hass message" ]; graylog.stream.homeassistant = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -33,5 +33,4 @@ # description = "process messages of the kernel stream(TF)"; #}; - } diff --git a/terranix/graylog/config/kernel.nix b/terranix/graylog/config/kernel.nix index 76d625d..ccc2585 100644 --- a/terranix/graylog/config/kernel.nix +++ b/terranix/graylog/config/kernel.nix @@ -15,7 +15,7 @@ ''; }; - extractFirewallDeny ={ + extractFirewallDeny = { description = "extract information form a firewall deny (TF)"; source = '' rule "extract firewall deny" @@ -31,7 +31,7 @@ }; - graylog.all_messages.rules = ["route kernel message"]; + graylog.all_messages.rules = [ "route kernel message" ]; graylog.stream.kernel = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -46,5 +46,4 @@ description = "process messages of the kernel stream(TF)"; }; - } diff --git a/terranix/graylog/config/nginx.nix b/terranix/graylog/config/nginx.nix index 2b7f108..54c6e09 100644 --- a/terranix/graylog/config/nginx.nix +++ b/terranix/graylog/config/nginx.nix @@ -1,6 +1,5 @@ # filters nginx messages -{ config, ... }: -{ +{ config, ... }: { resource."graylog_pipeline_rule" = { # not working for some reason @@ -29,7 +28,7 @@ resource.graylog_pipeline_connection.processNginxMessage = { stream_id = "\${data.graylog_stream.nginx.id}"; - pipeline_ids = ["\${graylog_pipeline.processNginxMessage.id}"]; + pipeline_ids = [ "\${graylog_pipeline.processNginxMessage.id}" ]; }; data.graylog_stream.nginx.title = "nginx"; diff --git a/terranix/graylog/config/sshd.nix b/terranix/graylog/config/sshd.nix index 966596d..ed32065 100644 --- a/terranix/graylog/config/sshd.nix +++ b/terranix/graylog/config/sshd.nix @@ -17,7 +17,7 @@ }; - graylog.all_messages.rules = ["route sshd message"]; + graylog.all_messages.rules = [ "route sshd message" ]; graylog.stream.sshd = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -32,5 +32,4 @@ # description = "process messages of the sshd stream(TF)"; #}; - } diff --git a/terranix/graylog/config/sshguard.nix b/terranix/graylog/config/sshguard.nix index ece427d..f6e55a6 100644 --- a/terranix/graylog/config/sshguard.nix +++ b/terranix/graylog/config/sshguard.nix @@ -15,7 +15,7 @@ ''; }; - extractAttack ={ + extractAttack = { description = "extract sshguard attack information (TF)"; source = '' rule "extract sshguard attack" @@ -31,7 +31,7 @@ }; - graylog.all_messages.rules = ["route sshguard message"]; + graylog.all_messages.rules = [ "route sshguard message" ]; graylog.stream.sshguard = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -46,5 +46,4 @@ description = "process messages of the sshguard stream(TF)"; }; - } diff --git a/terranix/graylog/config/sslh.nix b/terranix/graylog/config/sslh.nix index 9646d55..f11cdf9 100644 --- a/terranix/graylog/config/sslh.nix +++ b/terranix/graylog/config/sslh.nix @@ -31,7 +31,7 @@ }; - graylog.all_messages.rules = ["route sslh message"]; + graylog.all_messages.rules = [ "route sslh message" ]; graylog.stream.sslh = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -46,5 +46,4 @@ description = "process messages of the sslh stream(TF)"; }; - } diff --git a/terranix/graylog/config/tinc.nix b/terranix/graylog/config/tinc.nix index 7249c84..1731034 100644 --- a/terranix/graylog/config/tinc.nix +++ b/terranix/graylog/config/tinc.nix @@ -31,7 +31,7 @@ }; - graylog.all_messages.rules = ["route tinc message"]; + graylog.all_messages.rules = [ "route tinc message" ]; graylog.stream.tinc = { index_set_id = "\${data.graylog_index_set.default.id}"; @@ -46,5 +46,4 @@ description = "process messages of the tinc stream(TF)"; }; - } diff --git a/terranix/graylog/modules/all-messages.nix b/terranix/graylog/modules/all-messages.nix index 1bc5c30..d67236e 100644 --- a/terranix/graylog/modules/all-messages.nix +++ b/terranix/graylog/modules/all-messages.nix @@ -17,7 +17,7 @@ in { ''; }; rules = mkOption { - default = []; + default = [ ]; type = with types; listOf str; example = [ "route sshd" "route kernel" "mark junk" ]; description = '' @@ -27,15 +27,12 @@ in { }; }; - config = mkIf (cfg.rules != []) { + config = mkIf (cfg.rules != [ ]) { graylog.pipeline.mainsorting = { - source = - let - rules = map (rule: " rule \"${rule}\";") cfg.rules; - in - '' - stage 0 match either - ${concatStringsSep "\n" rules} + source = let rules = map (rule: " rule \"${rule}\";") cfg.rules; + in '' + stage 0 match either + ${concatStringsSep "\n" rules} ''; description = "main sorting pipeline (TF)"; diff --git a/terranix/graylog/modules/default.nix b/terranix/graylog/modules/default.nix index c93eab3..628db8b 100644 --- a/terranix/graylog/modules/default.nix +++ b/terranix/graylog/modules/default.nix @@ -1,8 +1 @@ -{ - imports = [ - ./all-messages.nix - ./provider.nix - ./pipeline.nix - ./stream.nix - ]; -} +{ imports = [ ./all-messages.nix ./provider.nix ./pipeline.nix ./stream.nix ]; } diff --git a/terranix/graylog/modules/pipeline.nix b/terranix/graylog/modules/pipeline.nix index f49a5cf..c0e490d 100644 --- a/terranix/graylog/modules/pipeline.nix +++ b/terranix/graylog/modules/pipeline.nix @@ -9,97 +9,77 @@ let in { options.graylog.pipeline = mkOption { - default = {}; - type = with types; attrsOf (submodule ({ name , ... }: { - options = { - name = mkOption { - type = with types; str; - default = name; - description = '' - name of the pipeline - ''; + default = { }; + type = with types; + attrsOf (submodule ({ name, ... }: { + options = { + name = mkOption { + type = with types; str; + default = name; + description = '' + name of the pipeline + ''; + }; + streamId = mkOption { + type = with types; nullOr str; + default = null; + example = "000000000000000001"; + description = '' + stream id on which this pipeline should operate + dont use terraform references here. + ''; + }; + description = mkOption { + type = with types; str; + default = ""; + description = '' + description of the pipeline + ''; + }; + # todo : create proper module system here + source = mkOption { + type = with types; str; + description = '' + source of the pipeline (without the header and the end) + ''; + }; }; - streamId = mkOption { - type = with types; nullOr str; - default = null; - example = "000000000000000001"; - description = '' - stream id on which this pipeline should operate - dont use terraform references here. - ''; - }; - description = mkOption { - type = with types; str; - default = ""; - description = '' - description of the pipeline - ''; - }; - # todo : create proper module system here - source = mkOption { - type = with types; str; - description = '' - source of the pipeline (without the header and the end) - ''; - }; - }; - })); + })); }; - config = - let - allPipelines = cfg; - allPipelineConnections = mapAttrsToList ( - name: values: - { - "${values.streamId}" = "\${graylog_pipeline.${name}.id}"; - } - ) (filterAttrs(name: values: values.streamId != null) allPipelines); - collected = foldAttrs (n: a: [n] ++ a) [] allPipelineConnections; - in - mkIf (cfg != {}) { + config = let + allPipelines = cfg; + allPipelineConnections = mapAttrsToList (name: values: { + "${values.streamId}" = "\${graylog_pipeline.${name}.id}"; + }) (filterAttrs (name: values: values.streamId != null) allPipelines); + collected = foldAttrs (n: a: [ n ] ++ a) [ ] allPipelineConnections; + in mkIf (cfg != { }) { - # create pipelines - resource."graylog_pipeline" = - mapAttrs ( - name: pipelineConfig: - { - source = '' - pipeline "${pipelineConfig.name}" - ${pipelineConfig.source} - end - ''; - description = pipelineConfig.description; - } - ) - allPipelines; + # create pipelines + resource."graylog_pipeline" = mapAttrs (name: pipelineConfig: { + source = '' + pipeline "${pipelineConfig.name}" + ${pipelineConfig.source} + end + ''; + description = pipelineConfig.description; + }) allPipelines; - resource."graylog_pipeline_connection" = - let - mapping = filter ( - name: - builtins.match ".*\\$.*" name != null - ) (builtins.attrNames collected); - in + resource."graylog_pipeline_connection" = let + mapping = filter (name: builtins.match ".*\\$.*" name != null) + (builtins.attrNames collected); - mkAssert ( mapping == [] ) - '' - graylog.pipeline..streamId = - ${concatStringsSep "\n " mapping} - is not valid. + in mkAssert (mapping == [ ]) '' + graylog.pipeline..streamId = + ${concatStringsSep "\n " mapping} + is not valid. - use graylog.stream..pipelines instead - '' - (mapAttrs ( - name: pipelineConfig: - { - stream_id = name; - pipeline_ids = pipelineConfig; - } - ) - collected); + use graylog.stream..pipelines instead + '' (mapAttrs (name: pipelineConfig: { + stream_id = name; + pipeline_ids = pipelineConfig; + }) collected); - - }; + }; } diff --git a/terranix/graylog/modules/stream.nix b/terranix/graylog/modules/stream.nix index fad29cb..1c776df 100644 --- a/terranix/graylog/modules/stream.nix +++ b/terranix/graylog/modules/stream.nix @@ -9,46 +9,39 @@ let in { options.graylog.stream = mkOption { - default = {}; - type = with types; attrsOf (submodule ({ name, ... }: { - options = { - title = mkOption { - default = name; - type = with types; str; + default = { }; + type = with types; + attrsOf (submodule ({ name, ... }: { + options = { + title = mkOption { + default = name; + type = with types; str; + }; + index_set_id = mkOption { type = with types; str; }; + disabled = mkOption { + default = false; + type = with types; bool; + }; + matching_type = mkOption { + default = "AND"; + type = with types; str; + }; + pipelines = mkOption { + default = [ ]; + type = with types; listOf str; + }; }; - index_set_id = mkOption { - type = with types; str; - }; - disabled = mkOption { - default = false; - type = with types; bool; - }; - matching_type = mkOption { - default = "AND"; - type = with types; str; - }; - pipelines = mkOption { - default = []; - type = with types; listOf str; - }; - }; - })); + })); }; - config = mkIf (cfg != {}) { - resource.graylog_stream = - mapAttrs ( - name: value: { inherit (value) title index_set_id disabled matching_type;}) - cfg; + config = mkIf (cfg != { }) { + resource.graylog_stream = mapAttrs (name: value: { + inherit (value) title index_set_id disabled matching_type; + }) cfg; - resource.graylog_pipeline_connection = - mapAttrs ( - name: pipelineConfig: - { - stream_id = "\${graylog_stream.${name}.id}"; - pipeline_ids = pipelineConfig.pipelines; - } - ) - cfg; + resource.graylog_pipeline_connection = mapAttrs (name: pipelineConfig: { + stream_id = "\${graylog_stream.${name}.id}"; + pipeline_ids = pipelineConfig.pipelines; + }) cfg; }; } diff --git a/terranix/graylog/shell.nix b/terranix/graylog/shell.nix index 318d268..30a604e 100644 --- a/terranix/graylog/shell.nix +++ b/terranix/graylog/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import { } }: +{ pkgs ? import { } }: let @@ -27,7 +27,7 @@ let postInstall = "mv $out/bin/terraform{,-provider-graylog_${version}}"; meta = with pkgs.stdenv.lib; { - homepage = https://github.com/suzuki-shunsuke/go-graylog; + homepage = "https://github.com/suzuki-shunsuke/go-graylog"; description = "Terraform provider is used to manage graylog."; platforms = platforms.linux; license = licenses.mpl20; @@ -35,9 +35,7 @@ let }; }; - terraform = pkgs.terraform.withPlugins(p: [ - graylog - ]); + terraform = pkgs.terraform.withPlugins (p: [ graylog ]); in pkgs.mkShell { diff --git a/terranix/servers/config.nix b/terranix/servers/config.nix index 65ba2ac..170f213 100644 --- a/terranix/servers/config.nix +++ b/terranix/servers/config.nix @@ -1,11 +1,9 @@ -{ config , ... }: +{ config, ... }: let - get = element: object: - "\${ ${object."_ref"}.${element} }"; + get = element: object: "\${ ${object."_ref"}.${element} }"; - getVariable = name: - "\${ var.${name} }"; + getVariable = name: "\${ var.${name} }"; in { @@ -19,9 +17,7 @@ in { backups = false; # datacenter = "nbg1-dc3"; location = "nbg1"; - labels = { - system = "nixos"; - }; + labels = { system = "nixos"; }; }; }; diff --git a/terranix/servers/modules/nix-server.nix b/terranix/servers/modules/nix-server.nix index 57f44f3..c0db9ad 100644 --- a/terranix/servers/modules/nix-server.nix +++ b/terranix/servers/modules/nix-server.nix @@ -27,9 +27,7 @@ in { server_type = "cx11"; location = "nbg1"; rescue = "linux64"; - labels = { - system = "nixos"; - }; + labels = { system = "nixos"; }; }; }; }; diff --git a/terranix/servers/shell.nix b/terranix/servers/shell.nix index a01a8f7..59aa1b9 100644 --- a/terranix/servers/shell.nix +++ b/terranix/servers/shell.nix @@ -1,30 +1,31 @@ -{ pkgs ? import {} }: +{ pkgs ? import { } }: let #terraform = terraform-current; terraform = pkgs.terraform; - terraform-current = pkgs.terraform.overrideAttrs( old: rec { - version = "0.11.10"; - name = "terraform-${version}"; - src = pkgs.fetchFromGitHub { - owner = "hashicorp"; - repo = "terraform"; - rev = "v${version}"; - sha256 = "08mapla89g106bvqr41zfd7l4ki55by6207qlxq9caiha54nx4nb"; - }; - }); + terraform-current = pkgs.terraform.overrideAttrs (old: rec { + version = "0.11.10"; + name = "terraform-${version}"; + src = pkgs.fetchFromGitHub { + owner = "hashicorp"; + repo = "terraform"; + rev = "v${version}"; + sha256 = "08mapla89g106bvqr41zfd7l4ki55by6207qlxq9caiha54nx4nb"; + }; + }); in pkgs.mkShell { # needed pkgs # ----------- - buildInputs = with pkgs; [ + buildInputs = with pkgs; + [ - (pkgs.writeShellScriptBin "terraform" '' - export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token` - ${terraform}/bin/terraform "$@" - '') - ]; + (pkgs.writeShellScriptBin "terraform" '' + export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token` + ${terraform}/bin/terraform "$@" + '') + ]; # run this on start # -----------------