attempt lilypond and ddc

This commit is contained in:
LordGrimmauld 2024-04-26 10:25:17 +02:00
parent 984fe942d3
commit 919f5d17e4
15 changed files with 203 additions and 47 deletions

View File

@ -48,16 +48,14 @@ in
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
Preferences = lib.mkMerge ([{
Preferences = {
"pdfjs.enableScripting" = false;
"media.hardware-video-decoding.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"media.navigator.mediadatadecoder_vpx_enabled" = true;
}]
++ lib.optional cfg.sway.enable { "browser.tabs.inTitlebar" = 0; }
);
} // lib.optionalAttrs cfg.sway.enable { "browser.tabs.inTitlebar" = 0; };
};
};
};

View File

@ -6,22 +6,28 @@ in
config = with cfg; lib.mkIf (enable && graphical) {
qt = {
enable = true;
style = "kvantum";
style = "breeze";
platformTheme = "qt5ct";
};
environment.systemPackages = with pkgs; [
libsForQt5.qtstyleplugin-kvantum
catppuccin-kvantum
environment.systemPackages = with pkgs; with kdePackages; [
# qtstyleplugin-kvantum
# catppuccin-kvantum
catppuccin-sddm-corners
libsForQt5.qtgraphicaleffects
catppuccin-kvantum
# catppuccin-kvantum
kdePackages.audiocd-kio
xcb-util-cursor
qt6ct
libsForQt5.dolphin
dolphin
papirus-icon-theme
qtwayland
libsForQt5.kirigami2
kdePackages.kirigami
breeze-icons
libsForQt5.breeze-qt5
breeze
okular
];
# environment.etc."kvantum".source = "${pkgs.catppuccin-kvantum}/share/Kvantum";

View File

@ -146,8 +146,8 @@ in
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1
export WLR_RENDERER=vulkan
export DRI_PRIME=1
# export WLR_RENDERER=vulkan
# export DRI_PRIME=1
export NIXOS_OZONE_WL=1
'';
};

View File

@ -11,14 +11,40 @@ in
pciutils
usbutils
powertop
ddcutil
# tlpui
] ++ lib.optionals graphical [
ddcui
];
services.ddccontrol.enable = true;
# services.ddccontrol.enable = true;
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
hardware.i2c.enable = true;
services.xserver.libinput.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
services.udev.extraRules = ''
SUBSYSTEM=="i2c-dev", ACTION=="add",\
ATTR{name}=="NVIDIA i2c adapter*",\
TAG+="ddcci",\
TAG+="systemd",\
ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"
'';
systemd.services."ddcci@" = {
scriptArgs = "%i";
script = ''
sleep 20
echo Trying to attach ddcci to $1
i=0
id=$(echo $1 | cut -d "-" -f 2)
if ${pkgs.ddcutil}/bin/ddcutil getvcp 10 -b $id; then
echo ddcci 0x37 > /sys/bus/i2c/devices/$1/new_device
fi
'';
serviceConfig.Type = "oneshot";
};
boot = {
kernelParams = [
@ -30,8 +56,26 @@ in
"mmio_stale_data=full,nosmt"
"pcie_aspm=off"
]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
kernelModules = [ "kvm-intel" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ];
blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
extraModulePackages = [
(config.boot.kernelPackages.ddcci-driver.overrideAttrs
(old: {
patches = [
(pkgs.fetchpatch {
url = "https://gitlab.com/Sweenu/ddcci-driver-linux/-/commit/7f851f5fb8fbcd7b3a93aaedff90b27124e17a7e.patch";
hash = "sha256-Y1ktYaJTd9DtT/mwDqtjt/YasW9cVm0wI43wsQhl7Bg=";
})
];
}))
];
kernelModules = [
"kvm-intel"
"vfio_pci"
"vfio_iommu_type1"
"vfio"
"ddcci_backlight"
"i2c-dev"
];
# blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
};
services.power-profiles-daemon.enable = false;

View File

@ -17,6 +17,7 @@ in
environment.systemPackages = with pkgs; (lib.optionals cfg.graphical [
kdePackages.skanpage
# libsForQt5.skanpage
]);
};

View File

@ -29,6 +29,7 @@ in
wget
tree
file
pypy3
util-linux
visualvm
ffmpeg-full

View File

@ -5,6 +5,7 @@
# Include the results of the hardware scan.
./modules/fonts.nix
./modules/tabletdriver.nix
./modules/lilypond.nix
./sway
];

View File

@ -78,11 +78,11 @@
"yafas": "yafas"
},
"locked": {
"lastModified": 1713554347,
"narHash": "sha256-Li6DK5JqKesOhTBwSoqxWzOxUR0pcPxE/L7vVyEsZpM=",
"lastModified": 1713731828,
"narHash": "sha256-htFugddDpE7ziY/MdxKxD40+JejADwCkN6Ln5D8a0oY=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "72c35184e8260a612b00977d0bb26d63cb385cb0",
"rev": "60b608762452d4c17ce620cb1075078827f22108",
"type": "github"
},
"original": {
@ -364,11 +364,11 @@
]
},
"locked": {
"lastModified": 1713524465,
"narHash": "sha256-T1ZUTzBv5QHjus49MpKk/KJ8LEyJI1g+2NhwUhRT6bY=",
"lastModified": 1713682182,
"narHash": "sha256-2RSqVmQMFmn6OjQ21SXnWC+HuSeqDLWLftRv/ZhEDZE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "b1a5b3d6a524c80c7dd20888bff227d52adf5f03",
"rev": "4cec20dbf5c0a716115745ae32531e34816ecbbe",
"type": "github"
},
"original": {
@ -386,11 +386,11 @@
]
},
"locked": {
"lastModified": 1713333160,
"narHash": "sha256-iz4Uz3vykqsZwIY2hxEMfRrc1DvBgxHVCfSxppuj40s=",
"lastModified": 1713606448,
"narHash": "sha256-JMKo6uoAcUip9N10a3r1T2IoLz+pUStwIFrsVW/R4MA=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "d3ce25a385ec7ed899ffb282d1e54ccb4ac9ef0d",
"rev": "96cbbcd3712a0cb7f128c54b21ec2af0950d88d0",
"type": "github"
},
"original": {
@ -412,11 +412,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1713499612,
"narHash": "sha256-IpvUlRDZkBXstPGwB1HDQWHwsUCUGybViAqD6G6siLc=",
"lastModified": 1713647546,
"narHash": "sha256-oiLxCGkICL2LXHZV6hhm3858JC/+6oANV5guVaRM6Wg=",
"owner": "martinvonz",
"repo": "jj",
"rev": "449fc423b864e5b83043b93f80114a793b05a9f2",
"rev": "77eaf67f96c6ea438e2dd1a5636f34b6a321e6be",
"type": "github"
},
"original": {
@ -449,11 +449,11 @@
]
},
"locked": {
"lastModified": 1713523626,
"narHash": "sha256-BJX9d+IXZsmfiOyZv3n3ujom/q5iEvisxNTtoZ8MYRk=",
"lastModified": 1713620717,
"narHash": "sha256-YuYowUw5ecPa78bhT72zY2b99wn68mO3vVkop8hnb8M=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "b98b95883def5cd726c1e96a006f9cd7498d1730",
"rev": "6a80078259ca3e3854b0748a15e98c7293d0822a",
"type": "github"
},
"original": {
@ -485,11 +485,11 @@
]
},
"locked": {
"lastModified": 1713173715,
"narHash": "sha256-l2pXDP1VMx/Jy4/G09Gh6xKSJ+vAXnUKlBtFRN6NEZs=",
"lastModified": 1713748476,
"narHash": "sha256-FB+tCte2nOOLI7i3YvHFZZsFWDjaq+f5nn4wxt6akTQ=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "32843d6cbb0dc010e077930b3b34ff7fd318be41",
"rev": "5dba7fd39730e14f3c54787df23c533dc98e1e0f",
"type": "github"
},
"original": {
@ -544,11 +544,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1713537308,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
"lastModified": 1713714899,
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
"type": "github"
},
"original": {
@ -594,11 +594,11 @@
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1713344939,
"narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=",
"lastModified": 1713725259,
"narHash": "sha256-9ZR/Rbx5/Z/JZf5ehVNMoz/s5xjpP0a22tL6qNvLt5E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd",
"rev": "a5e4bbcb4780c63c79c87d29ea409abf097de3f7",
"type": "github"
},
"original": {

View File

@ -42,6 +42,7 @@
inherit system;
specialArgs = { inherit inputs system stable; };
modules = [
(import ./overlays)
agenix.nixosModules.default
chaotic.nixosModules.default
nix-gaming.nixosModules.pipewireLowLatency
@ -51,7 +52,6 @@
./modules/users.nix
./modules/system-packages.nix
./modules/kvm.nix
./overlays
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];
};

16
modules/default.ly Normal file
View File

@ -0,0 +1,16 @@
\version "@version@"
\include "english.ly"
\score {
\new Staff {
\key c \major
\numericTimeSignature
\time 4/4
<cs' d'' b''>16 <cs' d'' b''>8.
%% Here: the tie on the D's looks funny
%% Too tall? Left-hand endpoint is not aligned with the B tie?
~
<cs' d'' b''>8 [ <b d'' a''> ]
}
}

64
modules/lilypond.nix Normal file
View File

@ -0,0 +1,64 @@
{ 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
'')
];
}

View File

@ -3,7 +3,21 @@
isNormalUser = true;
# shell = pkgs.xonsh;
description = "grimmauld";
extraGroups = [ "networkmanager" "kvm" "wheel" "input" "video" "lp" "scanner" "libvirt" "libvirt-qemu" "libvirtd" "pipewire" "gamemode" ];
extraGroups = [
"networkmanager"
"kvm"
"wheel"
"input"
"video"
"lp"
"scanner"
"libvirt"
"libvirt-qemu"
"libvirtd"
"pipewire"
"gamemode"
"i2c"
];
syncPaths = [
{ remote = "3d"; }

11
overlays/ddc_patch.nix Normal file
View File

@ -0,0 +1,11 @@
{ final, prev, ... }: {
ddcci-driver = prev.ddcci-driver.overrideAttrs
(old: {
patches = [
(prev.fetchpatch {
url = "https://gitlab.com/Sweenu/ddcci-driver-linux/-/commit/7f851f5fb8fbcd7b3a93aaedff90b27124e17a7e.patch";
hash = "sha256-Y1ktYaJTd9DtT/mwDqtjt/YasW9cVm0wI43wsQhl7Bg=";
})
];
});
}

View File

@ -1,6 +1,6 @@
{ lib, config, ... }: {
nixpkgs.overlays = map (f: (final: prev: (import f { inherit final prev lib config;})))
[
./wlr_flicker.nix
];
nixpkgs.overlays = map (f: (final: prev: (import f { inherit final prev lib config; })))
[
./wlr_flicker.nix
];
}

View File

@ -146,7 +146,7 @@
"lxqt-policykit-agent"
"otd-daemon"
swaynotificationcenter
(pkgs.writeShellScriptBin "rmenu-cache-clear" "rm -r $HOME/.cache/rmenu") # invalidate rmenu cache on sway restart
# (pkgs.writeShellScriptBin "rmenu-cache-clear" "rm -r $HOME/.cache/rmenu") # invalidate rmenu cache on sway restart
"dbus-update-activation-environment"
];
extraConfig = ''