From b2ec9599373c7e0f5428694c5712c8fc0be06264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 14 Mar 2024 09:35:13 +0100 Subject: Load of updates and module simplification --- nixos/modules/default.nix | 2 +- nixos/modules/desktop.nix | 14 +++++++------- nixos/modules/develop.nix | 27 +++++++++++++++++++++++---- nixos/modules/generic.nix | 10 ++++++++-- nixos/modules/home-assistant.nix | 6 +++--- nixos/modules/hosts.nix | 20 +++++++++++++++++++- nixos/modules/openvpn.nix | 1 - nixos/modules/switch.nix | 4 ++-- nixos/modules/syncthing.nix | 1 - nixos/modules/wifi-adm.nix | 5 ++--- nixos/modules/wifi-spt.nix | 11 +++++++++-- nixos/modules/wireguad.nix | 18 ++++++++++++++++++ 12 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 nixos/modules/wireguad.nix (limited to 'nixos/modules') diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 9d707e9..7afdc95 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -3,7 +3,7 @@ self: let inherit (self.inputs.nixpkgs.lib) filterAttrs nameValuePair mapAttrs' hasSuffix removeSuffix; in mapAttrs' - (n: v: nameValuePair "cynerd-${removeSuffix ".nix" n}" (import (./. + "/${n}"))) + (n: v: nameValuePair "cynerd-${removeSuffix ".nix" n}" (./. + "/${n}")) (filterAttrs (n: v: v == "regular" && hasSuffix ".nix" n && n != "default.nix") (readDir ./.)) diff --git a/nixos/modules/desktop.nix b/nixos/modules/desktop.nix index 87dc12e..e33a8d9 100644 --- a/nixos/modules/desktop.nix +++ b/nixos/modules/desktop.nix @@ -66,7 +66,7 @@ in { #khal #khard gnupg - pinentry-gnome + pinentry-gnome3 pinentry-curses (pass.withExtensions (exts: [ exts.pass-otp @@ -166,7 +166,6 @@ in { acpi ]); }; - vim.package = pkgs.vimHugeX; firefox = { enable = true; languagePacks = ["en-US" "cs"]; @@ -210,12 +209,10 @@ in { alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + extraConfig.pipewire."10-zeroconf" = { + "context.modules" = [{name = "libpipewire-module-zeroconf-discover";}]; + }; }; - environment.etc."pipewire/pipewire.conf.d/zeroconf.conf".text = '' - context.modules = [ - { name = libpipewire-module-zeroconf-discover } - ] - ''; security.rtkit.enable = true; services.printing = { @@ -236,6 +233,7 @@ in { networking.firewall.allowedUDPPorts = [3702]; fonts.packages = with pkgs; [ + nerdfonts arkpandora_ttf corefonts dejavu_fonts @@ -324,6 +322,8 @@ in { services.locate.enable = true; + services.davfs2.enable = true; + # Support running app images boot.binfmt.registrations.appimage = { wrapInterpreterInShell = false; diff --git a/nixos/modules/develop.nix b/nixos/modules/develop.nix index 3ef6ce6..cc8ce76 100644 --- a/nixos/modules/develop.nix +++ b/nixos/modules/develop.nix @@ -30,15 +30,19 @@ in { tio vim-vint nodePackages.vim-language-server - ctags + vale + + # Required for neovim plugins + editorconfig-checker + go + gcc # Nix dev cachix nurl nix-universal-prefetch - rnix-lsp - nixd + nil alejandra statix deadnix @@ -49,10 +53,14 @@ in { bats shellcheck shfmt + nodePackages.bash-language-server jq yq fq + # C + clang-tools + # Python (python3.withPackages (pypkgs: with pypkgs; [ @@ -73,9 +81,14 @@ in { python-gitlab PyGithub ])) + ruff geckodriver chromedriver + # Lua + selene + stylua + # Julia julia @@ -99,7 +112,7 @@ in { barcode # D-Bus - dfeet + d-spy # Documentation man-pages @@ -152,5 +165,11 @@ in { "develop" "libvirtd" ]; + + # Allow using latest git version from registry + nixpkgs.flake = { + setNixPath = false; + setFlakeRegistry = false; + }; }; } diff --git a/nixos/modules/generic.nix b/nixos/modules/generic.nix index ea8bd74..5c6e2fe 100644 --- a/nixos/modules/generic.nix +++ b/nixos/modules/generic.nix @@ -4,8 +4,9 @@ pkgs, ... }: let - inherit (lib) mkOverride mkDefault mkIf optionals; + inherit (lib) mkOverride mkDefault optionals; isNative = config.nixpkgs.hostPlatform == config.nixpkgs.buildPlatform; + isArm = config.nixpkgs.hostPlatform.isAarch; in { config = { system.stateVersion = "24.05"; @@ -154,7 +155,12 @@ in { syntaxHighlighting.enable = isNative; }; shellrc = true; - vim.defaultEditor = mkDefault true; + vim.defaultEditor = isArm; + neovim = { + enable = !isArm; + defaultEditor = true; + withNodeJs = true; + }; wireshark.enable = true; }; diff --git a/nixos/modules/home-assistant.nix b/nixos/modules/home-assistant.nix index 862b31c..267f725 100644 --- a/nixos/modules/home-assistant.nix +++ b/nixos/modules/home-assistant.nix @@ -152,14 +152,14 @@ in { securetar pyipp ]; - packageOverrides = self: super: { + packageOverrides = _: super: { scapy = super.scapy.override { withPlottingSupport = false; }; - s3transfer = super.s3transfer.overridePythonAttrs (oldAttrs: { + s3transfer = super.s3transfer.overridePythonAttrs { dontUsePytestCheck = true; dontUseSetuptoolsCheck = true; - }); + }; }; }; }; diff --git a/nixos/modules/hosts.nix b/nixos/modules/hosts.nix index 8a9318c..b9a40a6 100644 --- a/nixos/modules/hosts.nix +++ b/nixos/modules/hosts.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: let inherit (lib) mkOption types mkIf; @@ -20,6 +19,7 @@ in { description = "Use my personal static hosts"; }; vpn = staticZoneOption; + wg = staticZoneOption; spt = staticZoneOption; adm = staticZoneOption; }; @@ -38,6 +38,17 @@ in { "spt-omnia" = "10.8.0.50"; "adm-omnia" = "10.8.0.51"; }; + wg = { + "lipwig" = "10.8.1.1"; + # Portable + "binky" = "10.8.1.10"; + "android" = "10.8.1.30"; + # Endpoints + "spt-omnia" = "10.8.1.50"; + "adm-omnia" = "10.8.1.51"; + # Endpoints without routing + "dean" = "10.8.1.59"; + }; spt = { # Network "omnia" = "10.8.2.1"; @@ -74,6 +85,13 @@ in { "${cnf.vpn.binky}" = ["binky.vpn"]; "${cnf.vpn.spt-omnia}" = ["spt.vpn"]; "${cnf.vpn.adm-omnia}" = ["adm.vpn"]; + # Wireguard + "${cnf.wg.lipwig}" = ["lipwig.wg"]; + "${cnf.wg.binky}" = ["binky.wg"]; + "${cnf.wg.android}" = ["android.wg"]; + "${cnf.wg.spt-omnia}" = ["spt.wg"]; + "${cnf.wg.adm-omnia}" = ["adm.wg"]; + "${cnf.wg.dean}" = ["dean.wg"]; # Spt "${cnf.spt.omnia}" = ["omnia.spt"]; "${cnf.spt.mox}" = ["mox.spt"]; diff --git a/nixos/modules/openvpn.nix b/nixos/modules/openvpn.nix index 57d59ee..d80dd9d 100644 --- a/nixos/modules/openvpn.nix +++ b/nixos/modules/openvpn.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: let inherit (lib) mkOption types mkIf; diff --git a/nixos/modules/switch.nix b/nixos/modules/switch.nix index 16d57bc..669b6ab 100644 --- a/nixos/modules/switch.nix +++ b/nixos/modules/switch.nix @@ -2,8 +2,8 @@ config, lib, ... -}: -with lib; let +}: let + inherit (lib) mkEnableOption mkOption types mkIf; cnf = config.cynerd.switch; in { options = { diff --git a/nixos/modules/syncthing.nix b/nixos/modules/syncthing.nix index b93ecdb..d6b65e6 100644 --- a/nixos/modules/syncthing.nix +++ b/nixos/modules/syncthing.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: let inherit (lib) filterAttrs mkOption types mkIf any mkDefault recursiveUpdate genAttrs; diff --git a/nixos/modules/wifi-adm.nix b/nixos/modules/wifi-adm.nix index 733f167..40210e7 100644 --- a/nixos/modules/wifi-adm.nix +++ b/nixos/modules/wifi-adm.nix @@ -1,10 +1,9 @@ { config, lib, - pkgs, ... -}: -with lib; let +}: let + inherit (lib) mkOption mkEnableOption types mkIf hostapd elemAt; cnf = config.cynerd.wifiAP.adm; wOptions = card: channelDefault: { diff --git a/nixos/modules/wifi-spt.nix b/nixos/modules/wifi-spt.nix index 769449d..11554a7 100644 --- a/nixos/modules/wifi-spt.nix +++ b/nixos/modules/wifi-spt.nix @@ -1,10 +1,9 @@ { config, lib, - pkgs, ... }: let - inherit (lib) mkOption mkEnableOption types mkIf mkMerge hostapd elemAt; + inherit (lib) mkOption mkEnableOption types mkIf mkForce mkMerge hostapd elemAt; cnf = config.cynerd.wifiAP.spt; wOptions = card: channelDefault: { @@ -57,6 +56,10 @@ in { mode = "wpa2-sha256"; wpaPasswordFile = "/run/secrets/hostapd-TurrisRules.pass"; }; + settings = { + ieee80211w = 0; + wpa_key_mgmt = mkForce "WPA-PSK"; # force use without sha256 + }; }; #"${cnf.ar9287.interface}.guest" = { # bssid = elemAt cnf.ar9287.bssids 1; @@ -99,6 +102,10 @@ in { mode = "wpa2-sha256"; wpaPasswordFile = "/run/secrets/hostapd-TurrisRules.pass"; }; + settings = { + ieee80211w = 0; + wpa_key_mgmt = mkForce "WPA-PSK"; # force use without sha256 + }; }; #"${cnf.qca988x.interface}.guest" = { # bssid = elemAt cnf.qca988x.bssids 1; diff --git a/nixos/modules/wireguad.nix b/nixos/modules/wireguad.nix new file mode 100644 index 0000000..67bd8d5 --- /dev/null +++ b/nixos/modules/wireguad.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + ... +}: let + inherit (lib) mkEnableOption mkIf; + cnf = config.cynerd.wireguard; +in { + options = { + cynerd.wireguard = { + enable = mkEnableOption "Enable Wireguard"; + }; + }; + + config = + mkIf cnf.enable { + }; +} -- cgit v1.2.3