From 6bbfc7cdc01b0c40a354b1a88975bb6bf89e96f6 Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Mon, 19 Jul 2021 07:57:47 +0200 Subject: [PATCH] Pro audio + fixes --- home.nix | 14 ++++++---- modules/alacritty.nix | 3 ++- modules/bspwm.nix | 4 ++- modules/grobi.nix | 11 ++------ modules/kakoune.nix | 17 ++++++++++++ modules/picom.nix | 2 +- modules/pro_audio.nix | 43 ++++++++++++++++++++++++++++++ modules/security.nix | 12 +++++++++ modules/ssh.nix | 4 +++ nixos/base.nix | 47 +++++++++++++++++++-------------- nixos/pro_audio.nix | 61 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 181 insertions(+), 37 deletions(-) create mode 100644 modules/pro_audio.nix create mode 100644 modules/security.nix create mode 100644 nixos/pro_audio.nix diff --git a/home.nix b/home.nix index fa9a9d6..0e300f6 100644 --- a/home.nix +++ b/home.nix @@ -62,11 +62,13 @@ in keyboard.layout = "it"; keyboard.options = [ "terminate:ctrl_alt_bksp" "compose:rctrl" ]; packages = with pkgs; [ + pulseaudio + arandr - # audacity authy - # blender + blender catgirl # IRC + cava ckan discord evolution @@ -126,11 +128,10 @@ in zoom-us zotero - hunspellDicts.it_IT hunspellDicts.en_GB-large hunspellDicts.en_US-large + hunspellDicts.it_IT - blender ( dwarf-fortress-packages.dwarf-fortress-full.override { enableLegendsBrowser = false; @@ -176,7 +177,7 @@ in ./modules/gpg.nix ./modules/grobi.nix ./modules/info.nix - ./modules/joystickwake.nix + # ./modules/joystickwake.nix ./modules/jq.nix ./modules/kakoune.nix ./modules/keepassxc.nix @@ -207,6 +208,9 @@ in ./modules/zoxide.nix ./modules/zsh.nix + ./modules/pro_audio.nix + ./modules/security.nix + ./modules/shell_aliases.nix ]; diff --git a/modules/alacritty.nix b/modules/alacritty.nix index c8ac86f..ac2b890 100644 --- a/modules/alacritty.nix +++ b/modules/alacritty.nix @@ -8,7 +8,8 @@ in programs.alacritty = { enable = true; settings = { - env.TERM = "xterm-256color"; + # env.TERM = "xterm-256color"; + env.TERM = "alacritty"; scrolling.history = 3000; font = { normal.family = pkgs.rice.font.monospace.name; diff --git a/modules/bspwm.nix b/modules/bspwm.nix index 16f4b82..32789ec 100644 --- a/modules/bspwm.nix +++ b/modules/bspwm.nix @@ -34,11 +34,13 @@ in ${pkgs.polybar}/bin/polybar-msg cmd restart if grep DP-1-1 <(${xrandr} --listactivemonitors); then - ${xrandr} --output DP-1-1 --auto --above eDP-1-1 + ${xrandr} --output DP-1-1 --auto --left-of HDMI-0 --rotate right || + ${xrandr} --output DP-1-1 --auto --left-of eDP-1-1 --rotate right elif grep DP1 <(${xrandr} --listactivemonitors); then ${xrandr} --output DP-1-1 --auto --above eDP1; fi + systemctl --user restart polybar.service update-background.service || true ''; startupPrograms = []; }; diff --git a/modules/grobi.nix b/modules/grobi.nix index 7e222fd..14d1121 100644 --- a/modules/grobi.nix +++ b/modules/grobi.nix @@ -5,15 +5,8 @@ rules = [ { name = "Nvidia2screens"; - outputs_connected = [ "eDP-1-1" "HDMI-0" ]; - configure_row = [ "eDP-1-1" "HDMI-0" ]; - primary = "HDMI-0"; - } - { - name = "Nvidia3screens"; - outputs_connected = [ "DP-1-1" "eDP-1-1" "HDMI-0" ]; - configure_row = [ "eDP-1-1" "HDMI-0" ]; - configure_column = [ "DP-1-1" "eDP-1-1" ]; + outputs_connected = [ "HDMI-0" "eDP-1-1" ]; + configure_column = [ "HDMI-0" "eDP-1-1" ]; primary = "HDMI-0"; } { diff --git a/modules/kakoune.nix b/modules/kakoune.nix index f9320f6..dfc11e1 100644 --- a/modules/kakoune.nix +++ b/modules/kakoune.nix @@ -134,4 +134,21 @@ in }; xdg.configFile."kak/colors/nord.kak".source = ../configs/kak/colors/nord.kak; xdg.configFile."kak-lsp/kak-lsp.toml".source = ../configs/kak-lsp/kak-lsp.toml; + + xdg.dataFile."applications/kakoune.desktop".source = + let + desktopItem = pkgs.makeDesktopItem { + name = "kakoune"; + type = "Application"; + exec = "${kakCmd} %U"; + icon = "kakoune"; + desktopName = "Kakoune"; + comment = "Kakoune text editor"; + terminal = true; + categories = "Development;Office;"; + mimeType = "text/plain;text/*"; + }; + in + builtins.toPath "${desktopItem}/share/applications/kakoune.desktop"; + } diff --git a/modules/picom.nix b/modules/picom.nix index 99c97b5..2e613ce 100644 --- a/modules/picom.nix +++ b/modules/picom.nix @@ -5,7 +5,7 @@ blur = true; experimentalBackends = true; - fade = true; + fade = false; shadow = true; vSync = true; extraOptions = '' diff --git a/modules/pro_audio.nix b/modules/pro_audio.nix new file mode 100644 index 0000000..a4caaf5 --- /dev/null +++ b/modules/pro_audio.nix @@ -0,0 +1,43 @@ +{ pkgs, ... }: +let + variables = { + + DSSI_PATH = "$HOME/.dssi:$HOME/.nix-profile/lib/dssi:/run/current-system/sw/lib/dssi"; + LADSPA_PATH = "$HOME/.ladspa:$HOME/.nix-profile/lib/ladspa:/run/current-system/sw/lib/ladspa"; + LV2_PATH = "$HOME/.lv2:$HOME/.nix-profile/lib/lv2:/run/current-system/sw/lib/lv2"; + LXVST_PATH = "$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst"; + VST_PATH = "$HOME/.vst:$HOME/.nix-profile/lib/vst:/run/current-system/sw/lib/vst"; + VST3_PATH = "$HOME/.vst3:$HOME/.nix-profile/lib/vst3:/run/current-system/sw/lib/vst3"; + }; +in +{ + home.packages = with pkgs; [ + ardour + + carla + + artyFX + boops + geonkick + lsp-plugins + noise-repellent + speech-denoiser + stochas + surge + talentedhack + tunefish + x42-plugins + + ]; + + home.sessionVariables = variables; + + # home.file = { + # ".lv2" = { source = ~/.nix-profile/lib/lv2; }; + # # ".dssi" = { source= ~/.nix-profile/lib/dssi; }; + # ".ladspa" = { source = ~/.nix-profile/lib/ladspa; }; + # # ".lxvst" = { source = ~/.nix-profile/lib/lxvst; }; + # ".vst" = { source = ~/.nix-profile/lib/vst; }; + # ".vst3" = { source = ~/.nix-profile/lib/vst3; }; + # }; +} diff --git a/modules/security.nix b/modules/security.nix new file mode 100644 index 0000000..37e0741 --- /dev/null +++ b/modules/security.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + # WEB + postman + burpsuite + httpie + + # REVERSING + ghidra-bin + ]; +} diff --git a/modules/ssh.nix b/modules/ssh.nix index f4c801c..563419f 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -37,6 +37,10 @@ identityFile = "~/.ssh/local"; identitiesOnly = true; }; + "*moon-cloud.eu" = { + identityFile = "~/.ssh/moon-cloud"; + identitiesOnly = true; + }; "*" = { identityFile = "~/.ssh/id_ed25519"; }; diff --git a/nixos/base.nix b/nixos/base.nix index 5c0aadf..abf82d4 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -1,13 +1,13 @@ -{ pkgs, ... }: { +{ config, pkgs, lib, ... }: { - imports = - [ - # Include the results of the hardware scan. - /etc/nixos/hardware-configuration.nix - ./laptop.nix - ./pentablet.nix - ]; + imports = [ + # Include the results of the hardware scan. + /etc/nixos/hardware-configuration.nix + ./laptop.nix + ./pentablet.nix + ./pro_audio.nix + ]; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; @@ -81,17 +81,24 @@ services.printing.enable = true; # Enable sound. - sound.enable = true; - hardware.pulseaudio.enable = true; - # services.pipewire = { - # enable = true; - # pulse.enable = true; - # jack.enable = true; - # alsa = { - # enable = true; - # support32Bit = true; - # }; - # }; + # PULSE + # sound.enable = true; + # hardware.pulseaudio.enable = true; + + # PIPEWIRE + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + pulse.enable = true; + jack.enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + # media-session.enable = true; + }; + environment.sessionVariables.LD_LIBRARY_PATH = lib.mkForce "${config.services.pipewire.package.jack}/lib"; # Temporary fix for WebKitGTK # # Tablet # hardware.opentabletdriver = { @@ -216,7 +223,7 @@ services.clamav = { daemon.enable = true; updater.enable = true; }; # Virtualisation - virtualisation = { kvmgt.enable = true; libvirtd.enable = true; }; + virtualisation = { kvmgt.enable = true; libvirtd.enable = true; podman.enable = true; }; # Allow completion for system packages environment.pathsToLink = [ "/share/zsh" ]; diff --git a/nixos/pro_audio.nix b/nixos/pro_audio.nix new file mode 100644 index 0000000..7db8bfc --- /dev/null +++ b/nixos/pro_audio.nix @@ -0,0 +1,61 @@ +{ pkgs, lib, ... }: { + boot = { + # kernelModules = [ "snd-seq" "snd-rawmidi" ]; + # kernel.sysctl = { "vm.swappiness" = 10; "fs.inotify.max_user_watches" = 524288; }; + # kernelParams = [ "threadirq" ]; + + # kernelPatches = lib.singleton { + # name = "pro_audio"; + # patch = null; + # extraConfig = '' + # PREEMPT_RT y + # PREEMPT y + # IOSCHED_DEADLINE y + # DEFAULT_DEADLINE y + # DEFAULT_IOSCHED "deadline" + # HPET_TIMER y + # CPU_FREQ n + # TREE_RCU_TRACE n + # ''; + # }; + + # postBootCommands = '' + # echo 2048 > /sys/class/rtc/rtc0/max_user_freq + # echo 2048 > /proc/sys/dev/hpet/max-user-freq + # # setpci -v -d *:* latency_timer=b0 + # # setpci -v -s $00:1b.0 latency_timer=ff + # ''; + # The SOUND_CARD_PCI_ID can be obtained like so: + # $ lspci ¦ grep -i audio + }; + + # powerManagement.cpuFreqGovernor = "performance"; + + # fileSystems."/" = { options = "noatime errors=remount-ro"; }; + + # security.pam.loginLimits = [ + # { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } + # { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } + # { domain = "@audio"; item = "nofile"; type = "soft"; value = "99999"; } + # { domain = "@audio"; item = "nofile"; type = "hard"; value = "99999"; } + # ]; + + # services = { + # udev = { + # packages = [ pkgs.ffado ]; # If you have a FireWire audio interface + # extraRules = '' + # KERNEL=="rtc0", GROUP="audio" + # KERNEL=="hpet", GROUP="audio" + # ''; + # }; + # cron.enable = false; + # }; + + environment.shellInit = '' + export VST_PATH=/nix/var/nix/profiles/default/lib/vst:/var/run/current-system/sw/lib/vst:~/.vst + export LXVST_PATH=/nix/var/nix/profiles/default/lib/lxvst:/var/run/current-system/sw/lib/lxvst:~/.lxvst + export LADSPA_PATH=/nix/var/nix/profiles/default/lib/ladspa:/var/run/current-system/sw/lib/ladspa:~/.ladspa + export LV2_PATH=/nix/var/nix/profiles/default/lib/lv2:/var/run/current-system/sw/lib/lv2:~/.lv2 + export DSSI_PATH=/nix/var/nix/profiles/default/lib/dssi:/var/run/current-system/sw/lib/dssi:~/.dssi + ''; +}