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; [
|
environment.systemPackages = with pkgs; [
|
||||||
bluetuith
|
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";
|
description = "Mpris proxy";
|
||||||
after = [ "network.target" "sound.target" ];
|
after = [ "network.target" "sound.target" ];
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
|
@ -3,7 +3,7 @@ let
|
|||||||
cfg = config.grimmShared;
|
cfg = config.grimmShared;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = with cfg; lib.mkIf (enable && sound) {
|
config = with cfg; lib.mkIf (enable && sound.enable) {
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
hardware.pulseaudio.enable = false;
|
hardware.pulseaudio.enable = false;
|
||||||
|
|
||||||
@ -26,11 +26,8 @@ in
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./spotify.nix
|
./spotify.nix
|
||||||
|
./midi.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.grimmShared.sound = with lib; mkOption {
|
options.grimmShared.sound.enable = lib.mkEnableOption "whether to enable sound";
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
description = "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;
|
] ++ lib.optional graphical pkgs.spotify;
|
||||||
|
|
||||||
grimmShared = {
|
grimmShared = {
|
||||||
sound = true;
|
sound.enable = true;
|
||||||
network = true;
|
network = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@ let
|
|||||||
'';
|
'';
|
||||||
in
|
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; [
|
environment.systemPackages = with pkgs; [
|
||||||
spotifyd
|
spotifyd
|
||||||
spotifyd-dbus
|
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
|
services.pipewire.systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
|
||||||
|
|
||||||
# spotifyd config
|
# spotifyd config
|
||||||
|
@ -3,14 +3,22 @@ let
|
|||||||
cfg = config.grimmShared;
|
cfg = config.grimmShared;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./lilypond.nix
|
||||||
|
];
|
||||||
|
|
||||||
config = with cfg; lib.mkIf (enable && tooling.enable) {
|
config = with cfg; lib.mkIf (enable && tooling.enable) {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
|
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
|
||||||
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
|
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
|
||||||
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
|
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
|
||||||
(writeShellScriptBin "nixpkgs-review-head" "nixpkgs-review rev HEAD")
|
(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-review
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
nixd
|
||||||
gcc
|
gcc
|
||||||
jdk17
|
jdk17
|
||||||
python3
|
python3
|
||||||
@ -32,7 +40,6 @@ in
|
|||||||
pypy3
|
pypy3
|
||||||
util-linux
|
util-linux
|
||||||
visualvm
|
visualvm
|
||||||
ffmpeg-full
|
|
||||||
imagemagick
|
imagemagick
|
||||||
nmap
|
nmap
|
||||||
|
|
||||||
@ -44,6 +51,8 @@ in
|
|||||||
inputs.hammering.packages."${system}".default
|
inputs.hammering.packages."${system}".default
|
||||||
nix-output-monitor
|
nix-output-monitor
|
||||||
expect
|
expect
|
||||||
|
|
||||||
|
neovim-remote
|
||||||
] ++ lib.optionals cfg.graphical [
|
] ++ lib.optionals cfg.graphical [
|
||||||
qdirstat
|
qdirstat
|
||||||
libva-utils
|
libva-utils
|
||||||
@ -77,30 +86,36 @@ in
|
|||||||
# virtualisation.docker.enable = true;
|
# virtualisation.docker.enable = true;
|
||||||
|
|
||||||
|
|
||||||
|
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
|
||||||
|
vim-nix
|
||||||
|
vim-scala
|
||||||
|
fugitive
|
||||||
|
];
|
||||||
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
viAlias = true;
|
viAlias = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
configure = {
|
configure = {
|
||||||
customRC = ''
|
customRC =
|
||||||
set number
|
let
|
||||||
set hidden
|
luarc = pkgs.writeText "init.lua" (lib.concatLines tooling.nvim.extraLuaRC);
|
||||||
set fileencodings=utf-8
|
in
|
||||||
set nocompatible
|
''
|
||||||
set clipboard+=unnamedplus
|
set number
|
||||||
if filereadable($HOME . "/.vimrc")
|
set hidden
|
||||||
source ~/.vimrc
|
set fileencodings=utf-8
|
||||||
endif
|
set nocompatible
|
||||||
'';
|
set clipboard+=unnamedplus
|
||||||
packages.myVimPackage = with pkgs.vimPlugins; {
|
|
||||||
# loaded on launch
|
|
||||||
start = [
|
|
||||||
vim-nix
|
|
||||||
vim-scala
|
|
||||||
fugitive
|
|
||||||
];
|
|
||||||
|
|
||||||
# manually loadable by calling `:packadd $plugin-name`
|
luafile ${luarc}
|
||||||
|
|
||||||
|
if filereadable($HOME . "/.vimrc")
|
||||||
|
source ~/.vimrc
|
||||||
|
endif
|
||||||
|
'';
|
||||||
|
packages.myVimPackage = {
|
||||||
|
start = tooling.nvim.plugins;
|
||||||
opt = [ ];
|
opt = [ ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -124,6 +139,20 @@ in
|
|||||||
options.grimmShared.tooling = with lib; {
|
options.grimmShared.tooling = with lib; {
|
||||||
enable = mkEnableOption "grimm-tooling";
|
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 {
|
pass = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
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.
|
# Include the results of the hardware scan.
|
||||||
./modules/fonts.nix
|
./modules/fonts.nix
|
||||||
./modules/tabletdriver.nix
|
./modules/tabletdriver.nix
|
||||||
./modules/lilypond.nix
|
|
||||||
./sway
|
./sway
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -27,8 +26,12 @@
|
|||||||
network = true;
|
network = true;
|
||||||
tooling = {
|
tooling = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
lilypond = true;
|
||||||
|
};
|
||||||
|
sound = {
|
||||||
|
enable = true;
|
||||||
|
midi = true;
|
||||||
};
|
};
|
||||||
sound = true;
|
|
||||||
graphical = true;
|
graphical = true;
|
||||||
firefox = {
|
firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -10,7 +10,7 @@ with lib;
|
|||||||
./common/printing.nix
|
./common/printing.nix
|
||||||
./common/portals.nix
|
./common/portals.nix
|
||||||
./common/network
|
./common/network
|
||||||
./common/toolchains.nix
|
./common/tooling
|
||||||
./common/sound
|
./common/sound
|
||||||
./common/graphics
|
./common/graphics
|
||||||
./common/gaming.nix
|
./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
|
kcalc
|
||||||
rmview
|
rmview
|
||||||
krita
|
krita
|
||||||
|
weasis
|
||||||
kicad
|
kicad
|
||||||
prusa-slicer
|
prusa-slicer
|
||||||
freecad
|
freecad
|
||||||
|
Loading…
Reference in New Issue
Block a user