From 1bfe819a90a793a71452974e3743ab806c095009 Mon Sep 17 00:00:00 2001 From: Anish L Date: Mon, 29 Nov 2021 22:11:58 +1000 Subject: [PATCH] stuff slowly being added --- flake.nix | 2 +- hosts/curve/default.nix | 20 ++++++++++++++++ profiles/music/default.nix | 37 +++++++++++++++++++----------- profiles/sync/default.nix | 20 ++++++++++++++++ profiles/wireguard/default.nix | 30 ++++++++++++++++++++++++ secrets/curve-wg.age | 10 ++++++++ secrets/secrets.nix | 5 ++-- users/profiles/desktop/default.nix | 10 +++++++- users/profiles/desktop/kitty.conf | 2 ++ 9 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 profiles/sync/default.nix create mode 100644 profiles/wireguard/default.nix create mode 100644 secrets/curve-wg.age diff --git a/flake.nix b/flake.nix index 52f724d5..b08a7924 100644 --- a/flake.nix +++ b/flake.nix @@ -130,7 +130,7 @@ base = [ core users.root nvim users.anish ]; # TODO make anish non gui sealight = [ base ]; # matrix rsshub backup wireguard website mossnet = [ base ]; # shaarli wallabag nextcloud taskwarrior headphones - graphical = [ base users.profiles.firefox users.profiles.desktop bluetooth ]; + graphical = [ base users.profiles.firefox users.profiles.desktop bluetooth music sync]; curve = [ graphical ]; }; }; diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 89ec34d0..e8f7ccd8 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -7,6 +7,7 @@ #profiles.users.profiles.desktop profiles.users.profiles.email profiles.users.profiles.cal + profiles.wireguard profiles.mossnet-hosts ] ++ suites.curve; @@ -15,4 +16,23 @@ }; #bud.enable = true; + + # enable adb + # TODO move this (it's for KaiOS WebIDE devShell?) + programs.adb.enable = true; + virtualisation.docker.enable = true; # temp for KaiOS hack + services.udev.extraRules = '' + # Qualcomm EDL + SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0666", GROUP="plugdev" + + # Qualcomm Memory Debug + SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9006", MODE="0666", GROUP="plugdev" + ''; + boot.blacklistedKernelModules = [ "qcserial" ]; + users.users.anish.extraGroups = ["adbusers" "docker" "plugdev"]; + + # enable wireguard tunnel + # privKey = "/run/secrets/curve-wg"; -> local config + # publicKey = "..."; -> shipped to server config + # IP = "10.0.69.2"; -> shipped to both configs } diff --git a/profiles/music/default.nix b/profiles/music/default.nix index eae707b5..cc5ddb99 100644 --- a/profiles/music/default.nix +++ b/profiles/music/default.nix @@ -1,20 +1,28 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { environment.systemPackages = with pkgs; [ + qjackctl helm surge distrho orca-c carla + supercollider + dirt + #calf sunvox vcv-rack - reaper - renoise + lmms + #bespoke-synth + #ardour + #reaper + #renoise + helio-workstation projectm # milkdrop visualizer - ] + ]; - hardware.pulseaudio.enable = lib.mkForce false; + hardware.pulseaudio.enable = lib.mkForce false; security.rtkit.enable = true; services.pipewire = { @@ -22,20 +30,21 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + jack.enable = true; config = { - pipewire."context.properties"."default.clock.rate" = "192000"; + pipewire."context.properties"."default.clock.rate" = "48000"; pipewire-pulse."stream.properties"."resample.quality" = 15; client."stream.properties"."resample.quality" = 15; client-rt."stream.properties"."resample.quality" = 15; }; - media-session.config.bluez-monitor.properties = { - "bluez5.headset-roles" = [ "hsp_hs" "hsp_ag" ]; - "bluez5.codecs" = [ "aac" "ldac" "aptx_hd" ]; - }; + #media-session.config.bluez-monitor.properties = { + # "bluez5.headset-roles" = [ "hsp_hs" "hsp_ag" ]; + # "bluez5.codecs" = [ "aac" "ldac" "aptx_hd" ]; + #}; }; - systemd.services.bluethoot.serviceConfig.ExecStart = [ - "" - "${config.hardware.bluetooth.package}/libexec/bluetooth/bluetoothd --noplugin=sap" - ]; + #systemd.services.bluethoot.serviceConfig.ExecStart = [ + # "" + # "${config.hardware.bluetooth.package}/libexec/bluetooth/bluetoothd --noplugin=sap" + #]; } diff --git a/profiles/sync/default.nix b/profiles/sync/default.nix new file mode 100644 index 00000000..795fcb3e --- /dev/null +++ b/profiles/sync/default.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: + +{ + systemd.services.kitaab-sync = { + serviceConfig.Type = "oneshot"; + path = [ + pkgs.git + ]; + script = '' + cd /home/anish/vimwiki/ + git commit -am "syncing curve" + git push + ''; + }; + systemd.timers.kitaab-timer = { + wantedBy = [ "timers.target" ]; + partOf = [ "kitaab-sync.service" ]; + timerConfig.OnCalendar = [ "*-*-* *:00:00" ]; + }; +} diff --git a/profiles/wireguard/default.nix b/profiles/wireguard/default.nix new file mode 100644 index 00000000..7ce91362 --- /dev/null +++ b/profiles/wireguard/default.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: + +{ + # services.tailscale.enable = true; + networking.firewall.allowedUDPPorts = [ 60990 ]; + age.secrets.curve-wg.file = "/etc/nixos/secrets/curve-wg.age"; + age.secrets.curve-wg.owner = "anish"; + + networking.wireguard.interfaces = { + # TODO need some kind of module here to configure curve & box from hosts or something + wg0 = { + ips = [ "10.0.69.2/24" ]; + listenPort = 60990; # to match firewall allowedUDPPorts (without this wg uses random port numbers) + + privateKeyFile = "/run/secrets/curve-wg"; + peers = [ + # For a client configuration, one peer entry for the server will suffice. + { + publicKey = "c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI="; + allowedIPs = [ "10.0.69.0/24" ]; + # Set this to the server IP and port. + endpoint = "sealight.xyz:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 + + # Send keepalives every 25 seconds. Important to keep NAT tables alive. + persistentKeepalive = 25; + } + ]; + }; + }; +} diff --git a/secrets/curve-wg.age b/secrets/curve-wg.age new file mode 100644 index 00000000..ada0fb2f --- /dev/null +++ b/secrets/curve-wg.age @@ -0,0 +1,10 @@ +age-encryption.org/v1 +-> ssh-ed25519 E8y8hg ajjA98JsX1JBHd/6pPoTLCrMdkmgnviOZFTWUMtKfzk ++ekDAlEfkZ9G6oYfek6kBu0z1jbfQDQfH2ukwk4pvNU +-> ssh-ed25519 AiezdQ sZNx8/7RVk9XLvwxrbxjYb3q6uB8ny/DxktST7HMQSk +EdEXGSPGJ9j52llednOb8ViK3a+C+ru1weF7wOL3Lzk +-> B~GRUs-grease v) >0EI 7cA9 m&8 +iYaE+kBtuRHNi7zc9xtWYnNs6ThyHNvSPYnY1SYsugftuao1wkXyFvRrd8wubj1k +Y4e50A +--- GAVr4RrSEgBxdamubXJNhRPXOeXccN7Nw5GqGLPwdWI +7x╥$-*^;~ N{X=Z٦}Fۼ󖼇fޕǍc \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 1823af31..15998d87 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -8,6 +8,7 @@ in { "fastmail.age".publicKeys = allKeys; "mossnet.age".publicKeys = allKeys; - "nextcloud-db.age".publicKeys = mossnet; - "nextcloud-admin.age".publicKeys = mossnet; + "curve-wg.age".publicKeys = allKeys; + #"nextcloud-db.age".publicKeys = mossnet; + #"nextcloud-admin.age".publicKeys = mossnet; } diff --git a/users/profiles/desktop/default.nix b/users/profiles/desktop/default.nix index 68ec34c4..0fca1a20 100644 --- a/users/profiles/desktop/default.nix +++ b/users/profiles/desktop/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, config, lib, ... }: { # TODO modularize @@ -16,10 +16,18 @@ "\${XDG_BIN_HOME}" ]; }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "ripcord" + "vcv-rack" + ]; + environment.systemPackages = with pkgs; [ # TODO move somewhere meaningful tdesktop # TODO get rid of this once bridged on sealight + ripcord sublime-music + calibre nheko newsflash zeal diff --git a/users/profiles/desktop/kitty.conf b/users/profiles/desktop/kitty.conf index f8e081c4..643afbcf 100644 --- a/users/profiles/desktop/kitty.conf +++ b/users/profiles/desktop/kitty.conf @@ -3,3 +3,5 @@ font_family Hermit bold_font auto italic_font auto bold_italic_font auto +open_url_with default +mouse_map left click ungrabbed mouse_click_url_or_select