rework lilypond and nvim
This commit is contained in:
parent
0b1fd4f45b
commit
2a1acc6285
@ -109,3 +109,4 @@ in
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ in
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
bluetuith
|
||||
] ++ lib.optional sound pkgs.bluez;
|
||||
] ++ lib.optional sound.enable pkgs.bluez;
|
||||
|
||||
systemd.user.services.mpris-proxy = lib.mkIf sound {
|
||||
systemd.user.services.mpris-proxy = lib.mkIf sound.enable {
|
||||
description = "Mpris proxy";
|
||||
after = [ "network.target" "sound.target" ];
|
||||
wantedBy = [ "default.target" ];
|
||||
|
@ -3,7 +3,7 @@ let
|
||||
cfg = config.grimmShared;
|
||||
in
|
||||
{
|
||||
config = with cfg; lib.mkIf (enable && sound) {
|
||||
config = with cfg; lib.mkIf (enable && sound.enable) {
|
||||
sound.enable = true;
|
||||
hardware.pulseaudio.enable = false;
|
||||
|
||||
@ -26,11 +26,8 @@ in
|
||||
|
||||
imports = [
|
||||
./spotify.nix
|
||||
./midi.nix
|
||||
];
|
||||
|
||||
options.grimmShared.sound = with lib; mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "whether to enable sound";
|
||||
};
|
||||
options.grimmShared.sound.enable = lib.mkEnableOption "whether to enable sound";
|
||||
}
|
||||
|
23
common/sound/midi.nix
Normal file
23
common/sound/midi.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.grimmShared;
|
||||
sound_font = pkgs.soundfont-fluid;
|
||||
in
|
||||
{
|
||||
config = with cfg; lib.mkIf (enable && sound.midi) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mpv
|
||||
timidity
|
||||
ffmpeg-full
|
||||
sound_font
|
||||
];
|
||||
|
||||
environment.pathsToLink = [
|
||||
"/share/soundfonts"
|
||||
];
|
||||
|
||||
environment.etc."timidity/timidity.cfg".text = "soundfont ${sound_font}/share/soundfonts/FluidR3_GM2-2.sf2";
|
||||
};
|
||||
|
||||
options.grimmShared.sound.midi = lib.mkEnableOption "enable midi";
|
||||
}
|
@ -9,7 +9,7 @@ in
|
||||
] ++ lib.optional graphical pkgs.spotify;
|
||||
|
||||
grimmShared = {
|
||||
sound = true;
|
||||
sound.enable = true;
|
||||
network = true;
|
||||
};
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
config = with cfg; lib.mkIf (enable && spotify.enable && spotify.spotifyd.enable) {
|
||||
config = with cfg; lib.mkIf (enable && spotify.spotifyd.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
spotifyd
|
||||
spotifyd-dbus
|
||||
@ -39,6 +39,11 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
grimmShared = {
|
||||
sound.enable = true;
|
||||
network = true;
|
||||
};
|
||||
|
||||
services.pipewire.systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
|
||||
|
||||
# spotifyd config
|
||||
|
@ -3,14 +3,22 @@ let
|
||||
cfg = config.grimmShared;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./lilypond.nix
|
||||
];
|
||||
|
||||
config = with cfg; lib.mkIf (enable && tooling.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
|
||||
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
|
||||
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
|
||||
(writeShellScriptBin "nixpkgs-review-head" "nixpkgs-review rev HEAD")
|
||||
(writeShellScriptBin "fmt-all" "find ./**.nix -readable -writable -type f | xargs nixpkgs-fmt")
|
||||
(writeShellScriptBin "lsiommu" ./lsiommu)
|
||||
|
||||
nixpkgs-review
|
||||
nixpkgs-fmt
|
||||
nixd
|
||||
gcc
|
||||
jdk17
|
||||
python3
|
||||
@ -32,7 +40,6 @@ in
|
||||
pypy3
|
||||
util-linux
|
||||
visualvm
|
||||
ffmpeg-full
|
||||
imagemagick
|
||||
nmap
|
||||
|
||||
@ -44,6 +51,8 @@ in
|
||||
inputs.hammering.packages."${system}".default
|
||||
nix-output-monitor
|
||||
expect
|
||||
|
||||
neovim-remote
|
||||
] ++ lib.optionals cfg.graphical [
|
||||
qdirstat
|
||||
libva-utils
|
||||
@ -77,30 +86,36 @@ in
|
||||
# virtualisation.docker.enable = true;
|
||||
|
||||
|
||||
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
|
||||
vim-nix
|
||||
vim-scala
|
||||
fugitive
|
||||
];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
defaultEditor = true;
|
||||
configure = {
|
||||
customRC = ''
|
||||
set number
|
||||
set hidden
|
||||
set fileencodings=utf-8
|
||||
set nocompatible
|
||||
set clipboard+=unnamedplus
|
||||
if filereadable($HOME . "/.vimrc")
|
||||
source ~/.vimrc
|
||||
endif
|
||||
'';
|
||||
packages.myVimPackage = with pkgs.vimPlugins; {
|
||||
# loaded on launch
|
||||
start = [
|
||||
vim-nix
|
||||
vim-scala
|
||||
fugitive
|
||||
];
|
||||
customRC =
|
||||
let
|
||||
luarc = pkgs.writeText "init.lua" (lib.concatLines tooling.nvim.extraLuaRC);
|
||||
in
|
||||
''
|
||||
set number
|
||||
set hidden
|
||||
set fileencodings=utf-8
|
||||
set nocompatible
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
# manually loadable by calling `:packadd $plugin-name`
|
||||
luafile ${luarc}
|
||||
|
||||
if filereadable($HOME . "/.vimrc")
|
||||
source ~/.vimrc
|
||||
endif
|
||||
'';
|
||||
packages.myVimPackage = {
|
||||
start = tooling.nvim.plugins;
|
||||
opt = [ ];
|
||||
};
|
||||
};
|
||||
@ -124,6 +139,20 @@ in
|
||||
options.grimmShared.tooling = with lib; {
|
||||
enable = mkEnableOption "grimm-tooling";
|
||||
|
||||
nvim = {
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = "Extra vim plugins to include";
|
||||
};
|
||||
|
||||
extraLuaRC = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = [ ];
|
||||
description = "Extra init LUA scripts";
|
||||
};
|
||||
};
|
||||
|
||||
pass = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
49
common/tooling/lilypond.nix
Normal file
49
common/tooling/lilypond.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.grimmShared;
|
||||
viewer_pkg = pkgs.zathura;
|
||||
viewer_def = lib.optionalString cfg.graphical ''pdf_viewer = "${lib.getExe pkgs.zathura}",'';
|
||||
in
|
||||
{
|
||||
config = with cfg; lib.mkIf (enable && tooling.enable && tooling.lilypond) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
lilypond-with-fonts
|
||||
] ++ lib.optional graphical viewer_pkg;
|
||||
environment.sessionVariables = {
|
||||
LYEDITOR = "${lib.getExe pkgs.neovim-remote} -s +:'dr %(file)s | call cursor(%(line)s,%(char)s+1)'";
|
||||
};
|
||||
|
||||
grimmShared.sound.midi = true;
|
||||
|
||||
grimmShared.tooling.nvim = {
|
||||
extraLuaRC = lib.singleton ''
|
||||
require('nvls').setup({
|
||||
lilypond = {
|
||||
options = {
|
||||
${viewer_def}
|
||||
},
|
||||
},
|
||||
latex = {
|
||||
options = {
|
||||
${viewer_def}
|
||||
},
|
||||
},
|
||||
player = {
|
||||
options = {
|
||||
fluidsynth_flags = {
|
||||
"/run/current-system/sw/share/soundfonts/FluidR3_GM2-2.sf2"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
'';
|
||||
};
|
||||
|
||||
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
|
||||
nvim-lilypond-suite
|
||||
];
|
||||
};
|
||||
|
||||
options.grimmShared.tooling.lilypond = lib.mkEnableOption "enable lilypond tooling";
|
||||
|
||||
}
|
5
common/tooling/lsiommu
Executable file
5
common/tooling/lsiommu
Executable file
@ -0,0 +1,5 @@
|
||||
for d in $(find /sys/kernel/iommu_groups/ -type l | sort -n -k5 -t/); do
|
||||
n=${d#*/iommu_groups/*}; n=${n%%/*}
|
||||
printf 'IOMMU Group %s ' "$n"
|
||||
lspci -nns "${d##*/}"
|
||||
done;
|
@ -5,7 +5,6 @@
|
||||
# Include the results of the hardware scan.
|
||||
./modules/fonts.nix
|
||||
./modules/tabletdriver.nix
|
||||
./modules/lilypond.nix
|
||||
./sway
|
||||
];
|
||||
|
||||
@ -27,8 +26,12 @@
|
||||
network = true;
|
||||
tooling = {
|
||||
enable = true;
|
||||
lilypond = true;
|
||||
};
|
||||
sound = {
|
||||
enable = true;
|
||||
midi = true;
|
||||
};
|
||||
sound = true;
|
||||
graphical = true;
|
||||
firefox = {
|
||||
enable = true;
|
||||
|
@ -10,7 +10,7 @@ with lib;
|
||||
./common/printing.nix
|
||||
./common/portals.nix
|
||||
./common/network
|
||||
./common/toolchains.nix
|
||||
./common/tooling
|
||||
./common/sound
|
||||
./common/graphics
|
||||
./common/gaming.nix
|
||||
|
@ -1,64 +0,0 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
cfg = config.grimmShared;
|
||||
lily-pkg = pkgs.lilypond-with-fonts;
|
||||
defaultPond = pkgs.substituteAll {
|
||||
src = ./default.ly;
|
||||
version = lib.getVersion lily-pkg;
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
configure = {
|
||||
|
||||
packages.myVimPackage = with pkgs.vimPlugins; {
|
||||
# loaded on launch
|
||||
start = [
|
||||
nvim-lilypond-suite
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
lily-pkg
|
||||
] ++ lib.optionals (cfg.sway.enable) [
|
||||
zathura
|
||||
(with lib; writeShellScriptBin "lilypond-edit" ''
|
||||
if [ "$1" == "" ] || [ $# -gt 1 ]; then
|
||||
echo "useage: lilypond-edit [file-path]"
|
||||
exit 0
|
||||
fi
|
||||
if ! test -f "$1"; then
|
||||
touch "$1"
|
||||
cat ${defaultPond} > "$1"
|
||||
fi
|
||||
if ! test -f "$1"; then
|
||||
echo "could not create file: $1"
|
||||
exit 0
|
||||
fi
|
||||
pdf_path=$(echo "$1" | sed -E "s/(\.ly)?$//")
|
||||
generate_cmd="lilypond --pdf -o $pdf_path -s $1"
|
||||
editor_pid=$(${getExe alacritty} --command ${getExe neovim} -c "autocmd BufWritePost * :silent !$generate_cmd" $1 &> /dev/null & echo $!)
|
||||
$generate_cmd
|
||||
|
||||
swaymsg [pid="$editor_pid"] focus
|
||||
swaymsg splith
|
||||
viewer_pid=$(${getExe zathura} "$pdf_path.pdf" &> /dev/null & echo $!)
|
||||
sleep 1
|
||||
swaymsg [pid="$editor_pid"] focus
|
||||
|
||||
echo "viewer pid is: $viewer_pid"
|
||||
echo "editor pid is: $editor_pid"
|
||||
|
||||
while ps -p $viewer_pid > /dev/null && ps -p $editor_pid > /dev/null; do
|
||||
sleep .1
|
||||
done
|
||||
|
||||
kill $viewer_pid &> /dev/null
|
||||
kill $editor_pid &> /dev/null
|
||||
'')
|
||||
];
|
||||
|
||||
}
|
@ -37,6 +37,7 @@
|
||||
kcalc
|
||||
rmview
|
||||
krita
|
||||
weasis
|
||||
kicad
|
||||
prusa-slicer
|
||||
freecad
|
||||
|
Loading…
Reference in New Issue
Block a user