system: fix build; rofi-steam-game-list: hardcode xdg-open path

This commit is contained in:
chayleaf 2023-04-12 16:04:07 +07:00
parent 76fa8cf4e0
commit d1c41443c2
4 changed files with 44 additions and 11 deletions

View file

@ -1,10 +1,23 @@
{ lib, rustPlatform, nix-gitignore }: { lib
, substituteAll
, nix-gitignore
, rustPlatform
, xdg-utils
, ... }:
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {
pname = "rofi-steam-game-list"; pname = "rofi-steam-game-list";
version = "0.1"; version = "0.1";
src = nix-gitignore.gitignoreSource ["/target" "default.nix"] (lib.cleanSource ./.); src = nix-gitignore.gitignoreSource ["/target" "default.nix"] (lib.cleanSource ./.);
patches = [
(substituteAll {
src = ./hardcode_xdg_open.patch;
xdg_open = "${xdg-utils}/bin/xdg-open";
})
];
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
meta = with lib; { meta = with lib; {

View file

@ -0,0 +1,13 @@
diff --git a/src/main.rs b/src/main.rs
index ba9b0dd..00df815 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -395,7 +395,7 @@ fn main() {
);
if let Ok(appid) = std::env::var("ROFI_INFO") {
let _ = daemon(true, false);
- let mut cmd = std::process::Command::new("xdg-open")
+ let mut cmd = std::process::Command::new("@xdg_open@")
.arg(&format!("steam://rungameid/{appid}"))
.spawn()
.unwrap();

View file

@ -108,11 +108,18 @@ in {
USB_DENYLIST = "0bda:8156"; USB_DENYLIST = "0bda:8156";
}; };
# see common/vfio.nix # see modules/vfio.nix
vfio.enable = true; vfio.enable = true;
vfio.pciIDs = [ "1002:73df" "1002:ab28" ]; vfio.pciIDs = [ "1002:73df" "1002:ab28" ];
vfio.libvirtdGroup = [ "user" ]; vfio.libvirtdGroup = [ "user" ];
# because libvirtd's nat is broken for some reason...
networking.nat = {
enable = true;
internalInterfaces = [ "virbr0" ];
externalInterface = "enp7s0f4u1c2";
};
fileSystems = let fileSystems = let
device = cryptroot; device = cryptroot;
fsType = "btrfs"; fsType = "btrfs";
@ -214,7 +221,6 @@ in {
networking.useDHCP = true; networking.useDHCP = true;
# networking.firewall.enable = false; # networking.firewall.enable = false;
# KDE connect: 1714-1764
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
27015 27015
25565 25565
@ -223,6 +229,7 @@ in {
# kde connect # kde connect
++ (lib.range 1714 1764); ++ (lib.range 1714 1764);
networking.firewall.allowedUDPPorts = lib.range 1714 1764; networking.firewall.allowedUDPPorts = lib.range 1714 1764;
# networking.hostName = "nixmsi"; # networking.hostName = "nixmsi";
networking.wireless.iwd.enable = true; networking.wireless.iwd.enable = true;
#networking.networkmanager.enable = true; #networking.networkmanager.enable = true;

View file

@ -36,6 +36,7 @@ in {
description = "PCI passthrough IDs"; description = "PCI passthrough IDs";
}; };
lookingGlass = mkOption { lookingGlass = mkOption {
default = { };
type = types.submodule { type = types.submodule {
options = { options = {
enable = mkOption { enable = mkOption {
@ -70,12 +71,11 @@ in {
}; };
}; };
description = "VFIO settings"; description = "VFIO settings";
default = { };
}; };
config = lib.mkIf config.vfio.enable config = let
(let
gpuIDs = lib.concatStringsSep "," cfg.pciIDs;
enableIvshmem = config.vfio.lookingGlass.enable && (builtins.length config.vfio.lookingGlass.ivshmem) > 0; enableIvshmem = config.vfio.lookingGlass.enable && (builtins.length config.vfio.lookingGlass.ivshmem) > 0;
in { in lib.mkIf config.vfio.enable {
# add a custom kernel param for early loading vfio drivers # add a custom kernel param for early loading vfio drivers
# because if we change boot.initrd options in a specialization, two initrds will be built # because if we change boot.initrd options in a specialization, two initrds will be built
# and we don't want to build two initrds # and we don't want to build two initrds
@ -129,10 +129,10 @@ in {
with config.boot.kernelPackages; with config.boot.kernelPackages;
lib.mkIf enableIvshmem [ kvmfr ]; lib.mkIf enableIvshmem [ kvmfr ];
extraModprobeConfig = '' extraModprobeConfig = ''
options vfio-pci ids=${gpuIDs} disable_idle_d3=1 options vfio-pci ids=${builtins.concatStringsSep "," cfg.pciIDs} disable_idle_d3=1
options kvm ignore_msrs=1 options kvm ignore_msrs=1
${if enableIvshmem then '' ${if enableIvshmem then ''
options kvmfr static_size_mb=${lib.concatStringsSep "," (map (x: toString x.size) cfg.lookingGlass.ivshmem)}'' options kvmfr static_size_mb=${builtins.concatStringsSep "," (map (x: toString x.size) cfg.lookingGlass.ivshmem)}''
else ""} else ""}
''; '';
kernelParams = [ kernelParams = [
@ -145,7 +145,7 @@ in {
}; };
services.udev.extraRules = lib.mkIf enableIvshmem services.udev.extraRules = lib.mkIf enableIvshmem
(builtins.concatStringsSep (builtins.concatStringsSep
"\n" ""
(lib.imap0 (lib.imap0
(i: ivshmem: '' (i: ivshmem: ''
SUBSYSTEM=="kvmfr", KERNEL=="kvmfr${toString i}", OWNER="${ivshmem.owner}", GROUP="kvm", MODE="0660" SUBSYSTEM=="kvmfr", KERNEL=="kvmfr${toString i}", OWNER="${ivshmem.owner}", GROUP="kvm", MODE="0660"
@ -181,5 +181,5 @@ in {
}; };
virtualisation.spiceUSBRedirection.enable = true; virtualisation.spiceUSBRedirection.enable = true;
users.groups.libvirtd.members = [ "root" ] ++ cfg.libvirtdGroup; users.groups.libvirtd.members = [ "root" ] ++ cfg.libvirtdGroup;
}); };
} }