This commit is contained in:
Your Name 2024-02-18 15:41:01 +03:00
parent 2cbdf0c8b2
commit 6adc5e377c
9 changed files with 677 additions and 23 deletions

BIN
TAS2XXX38BB.bin Normal file

Binary file not shown.

BIN
TIAS2781RCA4.bin Normal file

Binary file not shown.

89
audiorelay.nix Normal file
View file

@ -0,0 +1,89 @@
{ lib, pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation rec {
name = "audio-relay";
version = "0.26.3";
src = builtins.fetchurl {
url = "https://dl.audiorelay.net/setups/linux/audiorelay-0.26.3.tar.gz";
sha256 = "sha256:05553s1gp9bimr79nvagdk0l8ahmbwkqg6i6csavvzw40kisj49r";
};
nativeBuildInputs = with pkgs; [
autoPatchelfHook
makeWrapper
];
buildInputs = with pkgs; [
jdk
alsaLib
file
fontconfig.lib
freetype
libglvnd
libpulseaudio
stdenv.cc.cc.lib
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXrender
xorg.libXtst
xorg.libXrandr
xorg.libXinerama
zlib
];
dontAutoPatchelf = true;
postFixup = ''
autoPatchelf \
$out/bin \
$out/lib/runtime/lib/jexec \
$out/lib/runtime/lib/jspawnhelper \
#$(find "$out/lib/runtime/lib" -type f -name 'lib*.so' -a -not -name 'libj*.so')
wrapProgram $out/bin/AudioRelay \
--prefix LD_LIBRARY_PATH : $out/lib/runtime/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.alsaLib}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.fontconfig.lib}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.freetype}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.libglvnd}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.libpulseaudio}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.stdenv.cc.cc.lib}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.xorg.libX11}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.xorg.libXext}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.xorg.libXi}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.xorg.libXrender}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.xorg.libXtst}/lib/ \
--prefix LD_LIBRARY_PATH : ${pkgs.zlib}/lib/
'';
installPhase = ''
mkdir -p $out/share/icons/hicolor/512x512/apps
ln -sf AudioRelay bin/audio-relay
cp -rp bin lib $out/
cp lib/AudioRelay.png $out/share/icons/hicolor/512x512/apps/audiorelay.png
cp -r ${desktopItem}/share/applications $out/share
cp $out/lib/app/AudioRelay.cfg $out/lib/app/.AudioRelay-wrapped.cfg
'';
desktopItem = pkgs.makeDesktopItem {
name = "AudioRelay";
exec = "audio-relay";
genericName = "AudioRelay audio bridge";
comment = "AudioRelay sound server/player";
categories = [ "Network" "Audio" ];
desktopName = "AudioRelay";
mimeTypes = [];
icon = "audiorelay";
};
sourceRoot = ".";
meta = with lib; {
description = "An application to stream audio between devices";
homepage = "https://audiorelay.net";
license = licenses.unfree;
# platforms = platforms.x86_64-linux;
maintainers = with maintainers; [];
};
}

View file

@ -2,20 +2,71 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { inputs, unstable, config, pkgs, ... }:
{ {
nix.settings.experimental-features = [ "flakes" "nix-command" ]; nix.settings.experimental-features = [ "flakes" "nix-command" ];
nix.settings.auto-optimise-store = true;
environment.sessionVariables = {
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
NIXOS_OZONE_WL = "1";
};
environment.etc."wireplumber/main.lua.d/99-enable-soft-mixer.lua".text = ''
-- alsa_monitor.rules[1].apply_properties["api.alsa.use-acp"] = true;
'';
programs.hyprland.enable = true;
boot.kernel.sysctl."kernel.sysrq" = 1;
users.users.socks = {
group = "socks";
isSystemUser = true;
};
users.groups.socks = {};
systemd.services.singboxaus = {
enable = true;
description = "avoid censorship";
wantedBy = [ "multi-user.target" ];
serviceConfig = { Restart = "on-failure"; RestartSec = "15"; User = "socks"; Group = "socks"; };
script = "sing-box run -c /etc/sing-box/config.json";
path = with unstable; [ shadowsocks-libev shadowsocks-v2ray-plugin sing-box];
};
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.extraInstallCommands = '' boot.loader.systemd-boot.extraInstallCommands = ''
patch_slim7_ssdt=$( patch_slim7_ssdt=$(
cp -fq ./slim7-ssdt /boot/EFI/nixos/slim7-ssdt
${pkgs.coreutils}/bin/cp -f ${./slim7-ssdt} /boot/EFI/nixos/slim7-ssdt
for file in /boot/loader/entries/nixos-generation-*.conf; do
${pkgs.gnused}/bin/sed -i '0,/^initrd\s/{s/^initrd\s/initrd \/efi\/nixos\/slim7-ssdt\n&/}' "$file"
done
) )
''; '';
boot.kernelParams = [ "rtc_cmos.use_acpi_alarm=1" "ideapad_laptop.allow_v4_dytc=1" ];
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
programs.firejail.enable = true;
security.wrappers = {
firejail = {
source = "${pkgs.firejail.out}/bin/firejail";
};
};
programs.command-not-found.enable = false;
programs.fish.enable = true;
programs.fish.promptInit = ''
set TERM "xterm-256color"
set fish_greeting
any-nix-shell fish --info-right | source
'';
users.defaultUserShell = pkgs.fish;
networking.hostName = "dlaptop"; # Define your hostname. networking.hostName = "dlaptop"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
@ -57,7 +108,19 @@
xkbVariant = ""; xkbVariant = "";
}; };
# Enable CUPS to print documents. virtualisation = {
podman = {
enable = true;
dockerCompat = true;
};
spiceUSBRedirection.enable = true;
libvirtd.enable = true;
};
programs.steam.enable = true;
programs.gamemode.enable = true;
services.flatpak.enable = true;
# Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;
# Enable sound with pipewire. # Enable sound with pipewire.
@ -66,6 +129,7 @@
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;
wireplumber.enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
@ -77,6 +141,10 @@
#media-session.enable = true; #media-session.enable = true;
}; };
sound.extraConfig = ''
'';
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;
@ -84,11 +152,10 @@
users.users.delta = { users.users.delta = {
isNormalUser = true; isNormalUser = true;
description = "delta"; description = "delta";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" "libvirtd" ];
packages = with pkgs; [ #packages = with pkgs; [
firefox # inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
git #];
];
}; };
# Allow unfree packages # Allow unfree packages
@ -97,10 +164,24 @@
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. gnomeExtensions.appindicator
# wget gnomeExtensions.activate-window-by-title
gnomeExtensions.unite
gnomeExtensions.tailscale-qs
gnomeExtensions.gsconnect
gnomeExtensions.clipboard-indicator
gnome.gnome-tweaks
mojave-gtk-theme
adw-gtk3
any-nix-shell
openconnect
micro
oath-toolkit
expect
]; ];
systemd.services.NetworkManager-wait-online.enable = false; # Sometimes it stops the PC from shutdown :/
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
@ -118,7 +199,7 @@
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; networking.firewall.enable = false;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View file

@ -1,21 +1,163 @@
{ {
"nodes": { "nodes": {
"nixpkgs": { "cachix": {
"locked": { "locked": {
"lastModified": 1708105575, "lastModified": 1635350005,
"narHash": "sha256-sS4AItZeUnAei6v8FqxNlm+/27MPlfoGym/TZP0rmH0=", "narHash": "sha256-tAMJnUwfaDEB2aa31jGcu7R7bzGELM9noc91L2PbVjg=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26", "rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixos-23.11", "ref": "nixos-20.09",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"firefox": {
"inputs": {
"cachix": "cachix",
"flake-compat": "flake-compat",
"lib-aggregate": "lib-aggregate",
"mozilla": "mozilla",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1708217961,
"narHash": "sha256-RQNcQRu6LYZgrGo9ZNfP4PMUW16r4pIGoNmhhDPpQIU=",
"owner": "nix-community",
"repo": "flake-firefox-nightly",
"rev": "8e53e0b26e93e03e668060ded53da7eb2751b7d4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-firefox-nightly",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1706981411,
"narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "652fda4ca6dafeb090943422c34ae9145787af37",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.11",
"repo": "home-manager",
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1707653303,
"narHash": "sha256-DSnssBCh1rPPyxGxFawGzWJjfmDB5AL18QHzzDMarqc=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "48d8001225a9148f1a97ee519ad53d8272cd8c73",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "lib-aggregate",
"type": "github"
}
},
"mozilla": {
"flake": false,
"locked": {
"lastModified": 1704373101,
"narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1708118438,
"narHash": "sha256-kk9/0nuVgA220FcqH/D2xaN6uGyHp/zoxPNUmPCMmEE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5863c27340ba4de8f83e7e3c023b9599c3cb3c80",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1707612395,
"narHash": "sha256-iqWiOQY+OwL0Yqdqy1dEWsMMpht+0eSlmtpZ5Rws16Y=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "240f2ff0ed2aac2b91efa29ba3d325526824205b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1708118438, "lastModified": 1708118438,
@ -32,11 +174,44 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1708161998,
"narHash": "sha256-6KnemmUorCvlcAvGziFosAVkrlWZGIc6UNT9GUYr0jQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "84d981bae8b5e783b3b548de505b22880559515f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "firefox": "firefox",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -2,9 +2,12 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
firefox.url = "github:nix-community/flake-firefox-nightly";
}; };
outputs = inputs @ { nixpkgs, nixpkgs-unstable, ... }: { outputs = inputs @ { nixpkgs, nixpkgs-unstable, home-manager, firefox, ... }: {
nixosConfigurations.dlaptop = nixpkgs.lib.nixosSystem { nixosConfigurations.dlaptop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { specialArgs = {
@ -14,6 +17,16 @@
modules = [ modules = [
./configuration.nix ./configuration.nix
./hardware-configuration.nix ./hardware-configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.delta = import ./home.nix;
home-manager.extraSpecialArgs = {
inherit inputs;
unstable = import nixpkgs-unstable { system = "x86_64-linux"; config = { allowUnfree = true; }; };
};
}
]; ];
}; };
}; };

View file

@ -8,9 +8,16 @@
[ (modulesPath + "/installer/scan/not-detected.nix") [ (modulesPath + "/installer/scan/not-detected.nix")
]; ];
hardware.firmware = [
(pkgs.runCommandNoCC "subwoofer" { } ''
mkdir -p $out/lib/firmware/
cp ${./TAS2XXX38BB.bin} $out/lib/firmware/TAS2XXX38BB.bin
cp ${./TIAS2781RCA4.bin} $out/lib/firmware/TIAS2781RCA4.bin
'')
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.initrd.extraFiles."slim7-ssdt".source = "./slim7-ssdt";
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.kernelPackages = unstable.linuxPackages_zen; boot.kernelPackages = unstable.linuxPackages_zen;
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];

211
home.nix Normal file
View file

@ -0,0 +1,211 @@
{ unstable, inputs, home, config, lib, pkgs, specialArgs, ... }:
{
home.username = "delta";
home.stateVersion = "23.11";
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 16;
};
nixpkgs.overlays = [
(final: prev: {
discordtmp = prev.discord.override {
withOpenASAR = true;
withVencord = true;
};
})
(final: prev: let
commandLineArgs = toString [
"--enable-accelerated-mjpeg-decode"
"--enable-accelerated-video"
"--enable-accelerated-video-decode"
"--enable-zero-copy"
"--use-gl=desktop"
#"--enable-features=UseOzonePlatform,WaylandWindowDecorations,VaapiVideoDecodeLinuxGL"
"--enable-features=UseOzonePlatform,WaylandWindowDecorations,VaapiVideoDecodeLinuxGL,VaapiVideoEncoder"
"--ozone-platform=wayland"
"--no-sandbox"
"\"$@\""
];
gpuCommandLineArgs = " " + toString [
"--ignore-gpu-blacklist"
"--enable-native-gpu-memory-buffers"
"--enable-gpu-rasterization"
"--enable-native-gpu-memory-buffers"
"--enable-gpu-compositing"
"--enable-raw-draw"
"--use-vulkan"
"--enable-oop-rasterization"
"--canvas-oop-rasterization"
] + " " + commandLineArgs;
#mkDiscord = args: pkgs.symlinkJoin {
# name = "discord";
# paths = [
# #prev.discord
# (pkgs.writeShellScriptBin "discord" "exec ${prev.discordtmp}/bin/discord ${args}")
# (pkgs.writeShellScriptBin "Discord" "exec ${prev.discordtmp}/bin/Discord ${args}")
# ];
#};
mkDiscord = args: pkgs.symlinkJoin {
name = "discord";
paths = let
aliases = ["discord" "Discord" "disc" "dis"];
in
map (alias: pkgs.writeShellScriptBin alias "exec ${prev.discordtmp}/bin/discord ${args}") aliases;
};
in {
discord = mkDiscord commandLineArgs;
discord-gpu = mkDiscord gpuCommandLineArgs;
})
# VSCODIUM ###############
(final: prev: let
commandLineArgs = toString [
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
"--no-sandbox"
"\"$@\""
];
mkVscode = args: pkgs.symlinkJoin {
name = "vscode";
paths = let
aliases = ["code" "codium" "vscodium" "vscode"];
in
map (alias: pkgs.writeShellScriptBin alias "exec ${prev.vscodium}/bin/codium ${args}") aliases;
};
in {
vscodium = mkVscode commandLineArgs;
})
];
programs.vscode = {
enable = true;
package = pkgs.vscodium;
};
home.packages = with pkgs; [
firefox
git
unstable.foot
wl-clipboard
wl-clipboard-x11
(callPackage ./audiorelay.nix {})
(callPackage ./spotify.nix {})
(unstable.telegram-desktop.overrideAttrs (oldAttrs: {
patches = (oldAttrs.patches or []) ++ [
(fetchpatch {
url = "https://raw.githubusercontent.com/Layerex/telegram-desktop-patches/master/0001-Disable-sponsored-messages.patch";
hash = "sha256-o2Wxyag6hpEDgGm8FU4vs6aCpL9aekazKiNeZPLI9po=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Layerex/telegram-desktop-patches/master/0002-Disable-saving-restrictions.patch";
hash = "sha256-sQsyXlvhXSvouPgzYSiRB8ieICo3GDXWH5MaZtBjtqw=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Layerex/telegram-desktop-patches/master/0003-Disable-invite-peeking-restrictions.patch";
hash = "sha256-8mJD6LOjz11yfAdY4QPK/AUz9o5W3XdupXxy7kRrbC8=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/Layerex/telegram-desktop-patches/master/0004-Disable-accounts-limit.patch";
hash = "sha256-PZWCFdGE/TTJ1auG1JXNpnTUko2rCWla6dYKaQNzreg=";
})
];
}))
];
dconf.settings = {
"org/gnome/mutter" = {
experimental-features = [ "scale-monitor-framebuffer" ];
};
};
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
obs-pipewire-audio-capture
];
};
programs.mpv = {
enable = true;
config = {
hwdec = "auto";
slang = "en,eng";
alang = "en,eng";
subs-fallback = "default";
subs-with-matching-audio = "yes";
save-position-on-quit = "yes";
};
scripts = with pkgs; [
mpvScripts.autoload
mpvScripts.cutter
];
scriptOpts = {
autoload = {
disabled = "no";
images = "no";
videos = "yes";
audio = "yes";
additional_image_exts = "list,of,ext";
additional_video_exts = "list,of,ext";
additional_audio_exts = "list,of,ext";
ignore_hidden = "yes";
};
};
};
gtk = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
};
programs.fish = {
enable = true;
shellAliases = {
rebuild = "sudo nixos-rebuild switch --flake ~/Documents/dotfiles/";
rollback = "sudo nixos-rebuild switch --rollback --flake ~/Documents/dotfiles/";
run = "~/.local/share/run";
};
shellInit = ''
any-nix-shell fish --info-right | source
'';
};
wayland.windowManager.hyprland = {
enable = true;
#plugins =
};
xdg.dataFile."run" = {
enable = true;
executable = true;
text = ''
#!/bin/sh
if [[ $# -eq 0 ]]; then
echo "Error: Missing argument."
else
nix run nixpkgs#"$1" -- "''\${@:2}"
fi
'';
};
}

78
spotify.nix Normal file
View file

@ -0,0 +1,78 @@
{
spotify,
stdenv,
rustPlatform,
fetchFromGitHub,
xorg,
pkgs
}: let
spotify-adblock = rustPlatform.buildRustPackage {
pname = "spotify-adblock";
version = "1.0.3";
src = fetchFromGitHub {
owner = "abba23";
repo = "spotify-adblock";
rev = "5a3281dee9f889afdeea7263558e7a715dcf5aab";
hash = "sha256-UzpHAHpQx2MlmBNKm2turjeVmgp5zXKWm3nZbEo0mYE=";
};
cargoSha256 = "sha256-wPV+ZY34OMbBrjmhvwjljbwmcUiPdWNHFU3ac7aVbIQ=";
patchPhase = ''
substituteInPlace src/lib.rs \
--replace 'config.toml' $out/etc/spotify-adblock/config.toml
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/etc/spotify-adblock
install -D --mode=644 config.toml $out/etc/spotify-adblock
mkdir -p $out/lib
install -D --mode=644 --strip target/release/libspotifyadblock.so $out/lib
'';
};
spotifywm = stdenv.mkDerivation {
name = "spotifywm";
src = fetchFromGitHub {
owner = "dasj";
repo = "spotifywm";
rev = "8624f539549973c124ed18753881045968881745";
hash = "sha256-AsXqcoqUXUFxTG+G+31lm45gjP6qGohEnUSUtKypew0=";
};
buildInputs = [xorg.libX11];
installPhase = "mv spotifywm.so $out";
};
in
spotify.overrideAttrs (
old: {
postInstall =
(old.postInstall or "")
+ ''
mkdir spotify-xpui
mv $out/share/spotify/Apps/xpui.spa .
${pkgs.unzip}/bin/unzip -qq xpui.spa -d spotify-xpui/
cd spotify-xpui/
${pkgs.perl}/bin/perl -pi -w -e 's|adsEnabled:!0|adsEnabled:!1|' xpui.js
${pkgs.perl}/bin/perl -pi -w -e 's|allSponsorships||' xpui.js
${pkgs.perl}/bin/perl -pi -w -e 's/(return|.=.=>)"free"===(.+?)(return|.=.=>)"premium"===/$1"premium"===$2$3"free"===/g' xpui.js
${pkgs.perl}/bin/perl -pi -w -e 's/(case .:|async enable\(.\)\{)(this.enabled=.+?\(.{1,3},"audio"\),|return this.enabled=...+?\(.{1,3},"audio"\))((;case 4:)?this.subscription=this.audioApi).+?this.onAdMessage\)/$1$3.cosmosConnector.increaseStreamTime(-100000000000)/' xpui.js
${pkgs.perl}/bin/perl -pi -w -e 's|(Enables quicksilver in-app messaging modal",default:)(!0)|$1false|' xpui.js
${pkgs.perl}/bin/perl -pi -w -e 's/(\.WiPggcPDzbwGxoxwLWFf\s*{)/$1 height: 0;/;' home-hpto.css
${pkgs.zip}/bin/zip -qq -r xpui.spa .
mv xpui.spa $out/share/spotify/Apps/xpui.spa
cd ..
rm xpui.spa
ln -s ${spotify-adblock}/lib/libspotifyadblock.so $libdir
sed -i "s:^Name=Spotify.*:Name=Spotify-adblock:" "$out/share/spotify/spotify.desktop"
wrapProgram $out/bin/spotify \
--set LD_PRELOAD "${spotify-adblock}/lib/libspotifyadblock.so"
'';
}
)