From db89ba3f106264160085f906ac23cac1f3185415 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Thu, 6 Apr 2023 09:45:02 +0700 Subject: [PATCH] random changes --- home/common/gui.nix | 4 +- home/common/i3-sway.nix | 4 +- home/common/nvim.nix | 2 +- home/flake.lock | 6 +-- home/flake.nix | 17 ++++++- home/hosts/nixmsi.nix | 35 ++++++++++++++- home/{ => pkgs}/home-daemon/.gitignore | 0 home/{ => pkgs}/home-daemon/Cargo.lock | 0 home/{ => pkgs}/home-daemon/Cargo.toml | 0 home/{ => pkgs}/home-daemon/default.nix | 0 home/{ => pkgs}/home-daemon/shell.nix | 0 home/{ => pkgs}/home-daemon/src/main.rs | 0 home/pkgs/lalrpop/default.nix | 44 +++++++++++++++++++ .../use-correct-binary-path-in-tests.patch | 13 ++++++ .../rofi-steam-game-list/.gitignore | 0 .../rofi-steam-game-list/Cargo.lock | 0 .../rofi-steam-game-list/Cargo.toml | 0 .../rofi-steam-game-list/default.nix | 0 .../rofi-steam-game-list/src/main.rs | 15 ++----- 19 files changed, 117 insertions(+), 23 deletions(-) rename home/{ => pkgs}/home-daemon/.gitignore (100%) rename home/{ => pkgs}/home-daemon/Cargo.lock (100%) rename home/{ => pkgs}/home-daemon/Cargo.toml (100%) rename home/{ => pkgs}/home-daemon/default.nix (100%) rename home/{ => pkgs}/home-daemon/shell.nix (100%) rename home/{ => pkgs}/home-daemon/src/main.rs (100%) create mode 100644 home/pkgs/lalrpop/default.nix create mode 100644 home/pkgs/lalrpop/use-correct-binary-path-in-tests.patch rename home/{ => pkgs}/rofi-steam-game-list/.gitignore (100%) rename home/{ => pkgs}/rofi-steam-game-list/Cargo.lock (100%) rename home/{ => pkgs}/rofi-steam-game-list/Cargo.toml (100%) rename home/{ => pkgs}/rofi-steam-game-list/default.nix (100%) rename home/{ => pkgs}/rofi-steam-game-list/src/main.rs (97%) diff --git a/home/common/gui.nix b/home/common/gui.nix index 1732d8e..571fb66 100644 --- a/home/common/gui.nix +++ b/home/common/gui.nix @@ -47,7 +47,6 @@ xdg.userDirs.enable = true; - # TODO sort out this mess with colors programs.mpv = { enable = true; defaultProfiles = [ "gpu-hq" ]; @@ -154,7 +153,8 @@ # vaapi-device / vulkan-device # screen / vulkan-display-display audio-device = "pipewire"; - ao = "pipewire,pulse,alsa,jack,"; + # because ao=pipewire doesn't work for whatever reason... + ao = "pulse,alsa,jack,pipewire,"; audio-file-auto = "fuzzy"; sub-auto = "fuzzy"; gpu-context = "waylandvk"; diff --git a/home/common/i3-sway.nix b/home/common/i3-sway.nix index 3e94f6d..5ec9ae2 100644 --- a/home/common/i3-sway.nix +++ b/home/common/i3-sway.nix @@ -80,7 +80,7 @@ commonConfig = { inherit modifier; startup = [ { command = builtins.toString (with pkgs; writeShellScript "init-wm" '' - ${callPackage ../home-daemon {}}/bin/dotfiles-home-daemon system76-scheduler& + ${callPackage ../pkgs/home-daemon {}}/bin/dotfiles-home-daemon system76-scheduler& ${gnome.zenity}/bin/zenity --password | (${keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&) # nextcloud and nheko need secret service access ${nextcloud-client}/bin/nextcloud --background& @@ -448,7 +448,7 @@ in }; terminal = config.terminalBin; extraConfig = { - modi = [ "steam:${pkgs.callPackage ../rofi-steam-game-list {}}/bin/rofi-steam-game-list" "drun" "run" "ssh" ]; + modi = [ "steam:${pkgs.callPackage ../pkgs/rofi-steam-game-list {}}/bin/rofi-steam-game-list" "drun" "run" "ssh" ]; icon-theme = "hicolor"; drun-match-fields = [ "name" "generic" "exec" "keywords" ]; show-icons = true; diff --git a/home/common/nvim.nix b/home/common/nvim.nix index 18e3267..d652dc2 100644 --- a/home/common/nvim.nix +++ b/home/common/nvim.nix @@ -239,7 +239,7 @@ }; }; formatting = { - format = arg1: vim_item: let kind = PROP vim_item "kind"; in L [ + format = entry: vim_item: let kind = PROP vim_item "kind"; in L [ SET kind (string.format "%s %s" (IDX lspkind kind) kind) _ vim_item ]; diff --git a/home/flake.lock b/home/flake.lock index 76c6faa..8c62c67 100644 --- a/home/flake.lock +++ b/home/flake.lock @@ -61,11 +61,11 @@ ] }, "locked": { - "lastModified": 1679313651, - "narHash": "sha256-SwYtZhHqcr5V5IF4XNHx8du+E5WLgZXzpiTp/6qy6W4=", + "lastModified": 1679341830, + "narHash": "sha256-7+tqtNEpj/rtL55KntBI1gKo3YEu8JuKOHoK4dMx58k=", "owner": "chayleaf", "repo": "notlua", - "rev": "f04a6916767ebed80e5560d529c5bd8d95edebbc", + "rev": "8a36fec181a1fdd314064f55aa90ec9e4744ebd1", "type": "github" }, "original": { diff --git a/home/flake.nix b/home/flake.nix index e8c5d52..5ad4b7f 100644 --- a/home/flake.nix +++ b/home/flake.nix @@ -26,8 +26,21 @@ getPriv = (hostname: with builtins; if hasAttr hostname priv then (getAttr hostname priv) else {}); in { homeConfigurations = { - "user@nixmsi" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."x86_64-linux"; + "user@nixmsi" = let system = "x86_64-linux"; in home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + inherit system; + binaryCachePublicKeys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + # "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" + ]; + binaryCaches = [ + "https://cache.nixos.org" + # "https://nixpkgs-wayland.cachix.org" + ]; + }; + extraSpecialArgs = { + # pkgs-wayland = nixpkgs-wayland.packages.${system}; + }; modules = [ notlua.nixosModules.default nur.nixosModules.nur diff --git a/home/hosts/nixmsi.nix b/home/hosts/nixmsi.nix index 7e7e436..c0190f9 100644 --- a/home/hosts/nixmsi.nix +++ b/home/hosts/nixmsi.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, pkgs-wayland, ... }: { imports = [ ../common/general.nix @@ -62,7 +62,34 @@ })) cutter openrgb piper steam-run steam - osu-lazer-bin taisei + ((osu-lazer-bin.override { + gmrun_enable = false; + }).overrideAttrs (old: { + paths = assert builtins.length old.paths == 2; + let + osu = builtins.head old.paths; + osu' = osu.overrideAttrs (old: { + installPhase = builtins.replaceStrings + ["runHook postInstall"] + ["sed -i 's:exec :exec ${obs-studio-plugins.obs-vkcapture}/bin/obs-gamecapture :g' $out/bin/osu-lazer\nrunHook postInstall"] + old.installPhase; + }); + in assert osu.pname == "osu-lazer-bin"; [ + osu' + (makeDesktopItem { + name = osu'.pname; + exec = "${osu'.outPath}/bin/osu-lazer"; + icon = "${osu'.outPath}/osu.png"; + comment = "A free-to-win rhythm game. Rhythm is just a *click* away!"; + desktopName = "osu!"; + categories = ["Game"]; + }) + ]; + })) + taisei + (wrapOBS { + plugins = with obs-studio-plugins; [ wlrobs obs-vkcapture ]; + }) easyeffects # wineWowPackages.waylandFull winetricks @@ -72,6 +99,10 @@ gimp krita blender tdesktop clang_latest rustc rustfmt cargo clippy + kdenlive + mediainfo + glaxnimate + (pkgs.callPackage ../pkgs/lalrpop { }) # waiting until the PR gets merged (looking-glass-client.overrideAttrs (old: { version = "B6"; diff --git a/home/home-daemon/.gitignore b/home/pkgs/home-daemon/.gitignore similarity index 100% rename from home/home-daemon/.gitignore rename to home/pkgs/home-daemon/.gitignore diff --git a/home/home-daemon/Cargo.lock b/home/pkgs/home-daemon/Cargo.lock similarity index 100% rename from home/home-daemon/Cargo.lock rename to home/pkgs/home-daemon/Cargo.lock diff --git a/home/home-daemon/Cargo.toml b/home/pkgs/home-daemon/Cargo.toml similarity index 100% rename from home/home-daemon/Cargo.toml rename to home/pkgs/home-daemon/Cargo.toml diff --git a/home/home-daemon/default.nix b/home/pkgs/home-daemon/default.nix similarity index 100% rename from home/home-daemon/default.nix rename to home/pkgs/home-daemon/default.nix diff --git a/home/home-daemon/shell.nix b/home/pkgs/home-daemon/shell.nix similarity index 100% rename from home/home-daemon/shell.nix rename to home/pkgs/home-daemon/shell.nix diff --git a/home/home-daemon/src/main.rs b/home/pkgs/home-daemon/src/main.rs similarity index 100% rename from home/home-daemon/src/main.rs rename to home/pkgs/home-daemon/src/main.rs diff --git a/home/pkgs/lalrpop/default.nix b/home/pkgs/lalrpop/default.nix new file mode 100644 index 0000000..d09146b --- /dev/null +++ b/home/pkgs/lalrpop/default.nix @@ -0,0 +1,44 @@ +{ lib +, rustPlatform +, rust +, fetchFromGitHub +, substituteAll +, stdenv +}: + +rustPlatform.buildRustPackage rec { + pname = "lalrpop"; + version = "0.19.9"; + + src = fetchFromGitHub { + owner = "lalrpop"; + repo = "lalrpop"; + rev = version; + hash = "sha256-1jXLcIlyObo9eIg0q6CyUTGhcAyZ8TDGmxxYhVxgcS8="; + }; + + cargoHash = "sha256-o1zpkwBmU1f/BZ4RrWuF5YvgjLhQOBOEdSbmouLPKAo="; + + patches = [ + (substituteAll { + src = ./use-correct-binary-path-in-tests.patch; + target_triple = rust.toRustTarget stdenv.hostPlatform; + }) + ]; + + buildAndTestSubdir = "lalrpop"; + + # there are some tests in lalrpop-test and some in lalrpop + checkPhase = '' + buildAndTestSubdir=lalrpop-test cargoCheckHook + cargoCheckHook + ''; + + meta = with lib; { + description = "LR(1) parser generator for Rust"; + homepage = "https://github.com/lalrpop/lalrpop"; + changelog = "https://github.com/lalrpop/lalrpop/blob/${src.rev}/RELEASES.md"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ chayleaf ]; + }; +} diff --git a/home/pkgs/lalrpop/use-correct-binary-path-in-tests.patch b/home/pkgs/lalrpop/use-correct-binary-path-in-tests.patch new file mode 100644 index 0000000..0f46463 --- /dev/null +++ b/home/pkgs/lalrpop/use-correct-binary-path-in-tests.patch @@ -0,0 +1,13 @@ +diff --git a/lalrpop-test/src/lib.rs b/lalrpop-test/src/lib.rs +index 087df01..9361a9e 100644 +--- a/lalrpop-test/src/lib.rs ++++ b/lalrpop-test/src/lib.rs +@@ -1031,7 +1031,7 @@ fn verify_lalrpop_generates_itself() { + // Don't remove the .rs file that already exist + fs::copy(&grammar_file, &copied_grammar_file).expect("no grammar file found"); + +- assert!(Command::new("../target/debug/lalrpop") ++ assert!(Command::new("../target/@target_triple@/release/lalrpop") + .args(&[ + "--force", + "--no-whitespace", diff --git a/home/rofi-steam-game-list/.gitignore b/home/pkgs/rofi-steam-game-list/.gitignore similarity index 100% rename from home/rofi-steam-game-list/.gitignore rename to home/pkgs/rofi-steam-game-list/.gitignore diff --git a/home/rofi-steam-game-list/Cargo.lock b/home/pkgs/rofi-steam-game-list/Cargo.lock similarity index 100% rename from home/rofi-steam-game-list/Cargo.lock rename to home/pkgs/rofi-steam-game-list/Cargo.lock diff --git a/home/rofi-steam-game-list/Cargo.toml b/home/pkgs/rofi-steam-game-list/Cargo.toml similarity index 100% rename from home/rofi-steam-game-list/Cargo.toml rename to home/pkgs/rofi-steam-game-list/Cargo.toml diff --git a/home/rofi-steam-game-list/default.nix b/home/pkgs/rofi-steam-game-list/default.nix similarity index 100% rename from home/rofi-steam-game-list/default.nix rename to home/pkgs/rofi-steam-game-list/default.nix diff --git a/home/rofi-steam-game-list/src/main.rs b/home/pkgs/rofi-steam-game-list/src/main.rs similarity index 97% rename from home/rofi-steam-game-list/src/main.rs rename to home/pkgs/rofi-steam-game-list/src/main.rs index a9dbe93..7855fef 100644 --- a/home/rofi-steam-game-list/src/main.rs +++ b/home/pkgs/rofi-steam-game-list/src/main.rs @@ -402,14 +402,6 @@ fn write_cache(k: &str, time: SystemTime, ids: &[(u32, String)]) { } } -struct PendingFut; -impl std::future::Future for PendingFut { - type Output = (); - fn poll(self: std::pin::Pin<&mut Self>, _: &mut std::task::Context<'_>) -> std::task::Poll<()> { - std::task::Poll::Pending - } -} - fn main() { let target_type = std::env::var("STEAM_GAME_LIST_TYPE").map_or_else( |_| "game,application".to_owned(), @@ -484,13 +476,14 @@ fn main() { }) .collect::>(); app_info_2.sort_by_key(|x| u32::MAX - history.get(&x.0).unwrap_or(&0)); + let mut stdout = std::io::stdout().lock(); for (app_id, n) in &app_info_2 { let icon = format!("{xdg_home3}/Steam/appcache/librarycache/{app_id}_icon.jpg"); - print!("{n}\0info\x1f{app_id}"); if std::fs::metadata(&icon).is_ok() { - print!("\x1ficon\x1f{icon}"); + writeln!(stdout, "{n}\0info\x1f{app_id}\x1ficon\x1f{icon}").unwrap(); + } else { + writeln!(stdout, "{n}\0info\x1f{app_id}").unwrap(); } - println!(); } let _ = daemon(true, false); if is_cache {