mirror of
https://github.com/sadan4/dotfiles.git
synced 2024-11-16 23:04:39 -05:00
94 current 2024-04-27 16:04:47 24.05.20240419.5c24cf2 6.6.28 *
This commit is contained in:
parent
08c66b6451
commit
4f069b3e2c
9 changed files with 4420 additions and 12 deletions
|
@ -16,6 +16,7 @@
|
|||
boot.loader.grub.efiSupport = true;
|
||||
boot.loader.grub.useOSProber = true;
|
||||
boot.loader.grub.efiInstallAsRemovable = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
|
||||
networking.hostName = "nix-desktop-evo4b5"; # Define your hostname.
|
||||
# Pick only one of the below networking options.
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
{ config, pkgs, inputs,... }:
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
# let
|
||||
# uns = import <nixos-unstable> {
|
||||
# config = {
|
||||
# allowUnfree = true;
|
||||
# };
|
||||
# }; in
|
||||
let
|
||||
cpkg = import ../../customPackages {inherit pkgs;};
|
||||
|
||||
in
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
programs.zsh.oh-my-zsh.enable = true;
|
||||
|
@ -24,7 +22,6 @@ programs.zsh.initExtra = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel1
|
|||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.11"; # Please read the comment before changing.
|
||||
|
||||
# The home.packages option allows you to install Nix packages into your
|
||||
# environment.
|
||||
home.packages = with pkgs;[
|
||||
|
@ -73,6 +70,7 @@ jdk19
|
|||
(discord.override {
|
||||
withVencord = true;
|
||||
})
|
||||
# cpkg.discord
|
||||
# uns.vesktop
|
||||
kitty
|
||||
rofi
|
||||
|
|
4
customPackages/default.nix
Normal file
4
customPackages/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{pkgs}:{
|
||||
# discord = nixpkgs.callPackage ./discord { };
|
||||
discord = pkgs.callPackage ./discord/default.nix {};
|
||||
}
|
106
customPackages/discord/default.nix
Normal file
106
customPackages/discord/default.nix
Normal file
|
@ -0,0 +1,106 @@
|
|||
{ branch ? "stable", callPackage, fetchurl, lib, stdenv }:
|
||||
let
|
||||
versions =
|
||||
if stdenv.isLinux then {
|
||||
stable = "0.0.50";
|
||||
ptb = "0.0.80";
|
||||
canary = "0.0.357";
|
||||
development = "0.0.17";
|
||||
} else {
|
||||
stable = "0.0.301";
|
||||
ptb = "0.0.109";
|
||||
canary = "0.0.477";
|
||||
development = "0.0.39";
|
||||
};
|
||||
version = versions.${branch};
|
||||
srcs = rec {
|
||||
x86_64-linux = {
|
||||
stable = fetchurl {
|
||||
url = "https://dl.discordapp.net/apps/linux/${version}/discord-${version}.tar.gz";
|
||||
hash = "sha256-6VXdVLk7Z8NGQMiSdgBRd8NIueUktkId6BXYKNABb+4=";
|
||||
};
|
||||
ptb = fetchurl {
|
||||
url = "https://dl-ptb.discordapp.net/apps/linux/${version}/discord-ptb-${version}.tar.gz";
|
||||
hash = "sha256-y/ntnHIYcY35Jszh0PrFy395eJ5dBWwLNpzHMoSZuNA=";
|
||||
};
|
||||
canary = fetchurl {
|
||||
url = "https://dl-canary.discordapp.net/apps/linux/${version}/discord-canary-${version}.tar.gz";
|
||||
hash = "sha256-sDwC5kPzAfvQmsrq6M/GPFtUaT9pNAEB4uGI5Mn3oXs=";
|
||||
};
|
||||
development = fetchurl {
|
||||
url = "https://dl-development.discordapp.net/apps/linux/${version}/discord-development-${version}.tar.gz";
|
||||
hash = "sha256-AmbaMVi/or+9QLuQO5u5btgKeKdrfo7bzZgGLILwgqo=";
|
||||
};
|
||||
};
|
||||
x86_64-darwin = {
|
||||
stable = fetchurl {
|
||||
url = "https://dl.discordapp.net/apps/osx/${version}/Discord.dmg";
|
||||
hash = "sha256-h7C1wCKtUGcMFUhoKVdD7Vq9TGUaXfmjlVhwmRdhqYw=";
|
||||
};
|
||||
ptb = fetchurl {
|
||||
url = "https://dl-ptb.discordapp.net/apps/osx/${version}/DiscordPTB.dmg";
|
||||
hash = "sha256-xxLnzELuI0X2r/weP1K2Bb51uRh1JjR72p7cXzy12Kc=";
|
||||
};
|
||||
canary = fetchurl {
|
||||
url = "https://dl-canary.discordapp.net/apps/osx/${version}/DiscordCanary.dmg";
|
||||
hash = "sha256-xEDtEtZNhOTtz+zRLLQBSeLbntlVAVQsocAGyAaVePM=";
|
||||
};
|
||||
development = fetchurl {
|
||||
url = "https://dl-development.discordapp.net/apps/osx/${version}/DiscordDevelopment.dmg";
|
||||
hash = "sha256-nZV9LK3eGpXK/2wQKJBn3K2Ud6uBk8aammkeE00rWx0=";
|
||||
};
|
||||
};
|
||||
aarch64-darwin = x86_64-darwin;
|
||||
};
|
||||
src = srcs.${stdenv.hostPlatform.system}.${branch};
|
||||
|
||||
meta = with lib; {
|
||||
description = "All-in-one cross-platform voice and text chat for gamers";
|
||||
homepage = "https://discordapp.com/";
|
||||
downloadPage = "https://discordapp.com/download";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ MP2E Scrumplex artturin infinidoge jopejoe1 ];
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
mainProgram = "discord";
|
||||
};
|
||||
package =
|
||||
if stdenv.isLinux
|
||||
then ./linux.nix
|
||||
else ./darwin.nix;
|
||||
|
||||
openasar = callPackage ./openasar.nix { };
|
||||
|
||||
packages = (
|
||||
builtins.mapAttrs
|
||||
(_: value:
|
||||
callPackage package (value
|
||||
// {
|
||||
inherit src version openasar branch;
|
||||
meta = meta // { mainProgram = value.binaryName; };
|
||||
}))
|
||||
{
|
||||
stable = rec {
|
||||
pname = "discord";
|
||||
binaryName = "Discord";
|
||||
desktopName = "Discord";
|
||||
};
|
||||
ptb = rec {
|
||||
pname = "discord-ptb";
|
||||
binaryName = if stdenv.isLinux then "DiscordPTB" else desktopName;
|
||||
desktopName = "Discord PTB";
|
||||
};
|
||||
canary = rec {
|
||||
pname = "discord-canary";
|
||||
binaryName = if stdenv.isLinux then "DiscordCanary" else desktopName;
|
||||
desktopName = "Discord Canary";
|
||||
};
|
||||
development = rec {
|
||||
pname = "discord-development";
|
||||
binaryName = if stdenv.isLinux then "DiscordDevelopment" else desktopName;
|
||||
desktopName = "Discord Development";
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
packages.${branch}
|
49
customPackages/discord/disable-breaking-updates.py
Normal file
49
customPackages/discord/disable-breaking-updates.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!@pythonInterpreter@
|
||||
# slightly tweaked from the script created by @lionirdeadman
|
||||
# https://github.com/flathub/com.discordapp.Discord/blob/master/disable-breaking-updates.py
|
||||
"""
|
||||
Disable breaking updates which will prompt users to download a deb or tar file
|
||||
and lock them out of Discord making the program unusable.
|
||||
|
||||
This will dramatically improve the experience :
|
||||
|
||||
1) The maintainer doesn't need to be worried at all times of an update which will break Discord.
|
||||
2) People will not be locked out of the program while the maintainer runs to update it.
|
||||
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
XDG_CONFIG_HOME = os.environ.get("XDG_CONFIG_HOME") or os.path.join(
|
||||
os.path.expanduser("~"), ".config"
|
||||
)
|
||||
|
||||
settings_path = Path(f"{XDG_CONFIG_HOME}/@configDirName@/settings.json")
|
||||
settings_path_temp = Path(f"{XDG_CONFIG_HOME}/@configDirName@/settings.json.tmp")
|
||||
|
||||
if os.path.exists(settings_path):
|
||||
with settings_path.open(encoding="utf-8") as settings_file:
|
||||
try:
|
||||
settings = json.load(settings_file)
|
||||
except json.JSONDecodeError:
|
||||
print("[Nix] settings.json is malformed, letting Discord fix itself")
|
||||
sys.exit(0)
|
||||
else:
|
||||
settings = {}
|
||||
|
||||
if settings.get("SKIP_HOST_UPDATE"):
|
||||
print("[Nix] Disabling updates already done")
|
||||
else:
|
||||
skip_host_update = {"SKIP_HOST_UPDATE": True}
|
||||
settings.update(skip_host_update)
|
||||
|
||||
os.makedirs(os.path.dirname(settings_path), exist_ok=True)
|
||||
|
||||
with settings_path_temp.open("w", encoding="utf-8") as settings_file_temp:
|
||||
json.dump(settings, settings_file_temp, indent=2)
|
||||
|
||||
settings_path_temp.rename(settings_path)
|
||||
print("[Nix] Disabled updates")
|
BIN
customPackages/discord/installer
Normal file
BIN
customPackages/discord/installer
Normal file
Binary file not shown.
175
customPackages/discord/linux.nix
Normal file
175
customPackages/discord/linux.nix
Normal file
|
@ -0,0 +1,175 @@
|
|||
{ pname, version, src, meta, binaryName, desktopName, autoPatchelfHook
|
||||
, makeDesktopItem, lib, stdenv, wrapGAppsHook, makeShellWrapper, alsa-lib, at-spi2-atk
|
||||
, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf
|
||||
, glib, gtk3, libcxx, libdrm, libglvnd, libnotify, libpulseaudio, libuuid, libX11
|
||||
, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext, libXfixes
|
||||
, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, mesa, nspr, nss
|
||||
, pango, systemd, libappindicator-gtk3, libdbusmenu, writeScript, python3, runCommand
|
||||
, libunity
|
||||
, speechd
|
||||
, wayland
|
||||
, branch
|
||||
, withOpenASAR ? false, openasar
|
||||
, withVencord ? true, vencord
|
||||
, withTTS ? true }:
|
||||
|
||||
let
|
||||
disableBreakingUpdates = runCommand "disable-breaking-updates.py"
|
||||
{
|
||||
pythonInterpreter = "${python3.interpreter}";
|
||||
configDirName = lib.toLower binaryName;
|
||||
meta.mainProgram = "disable-breaking-updates.py";
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
|
||||
substituteAllInPlace $out/bin/disable-breaking-updates.py
|
||||
chmod +x $out/bin/disable-breaking-updates.py
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version src meta;
|
||||
|
||||
nativeBuildInputs = [
|
||||
alsa-lib
|
||||
autoPatchelfHook
|
||||
cups
|
||||
libdrm
|
||||
libuuid
|
||||
libXdamage
|
||||
libX11
|
||||
libXScrnSaver
|
||||
libXtst
|
||||
libxcb
|
||||
libxshmfence
|
||||
mesa
|
||||
nss
|
||||
wrapGAppsHook
|
||||
makeShellWrapper
|
||||
];
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
libPath = lib.makeLibraryPath ([
|
||||
libcxx
|
||||
systemd
|
||||
libpulseaudio
|
||||
libdrm
|
||||
mesa
|
||||
stdenv.cc.cc
|
||||
alsa-lib
|
||||
atk
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
fontconfig
|
||||
freetype
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
libglvnd
|
||||
libnotify
|
||||
libX11
|
||||
libXcomposite
|
||||
libunity
|
||||
libuuid
|
||||
libXcursor
|
||||
libXdamage
|
||||
libXext
|
||||
libXfixes
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXtst
|
||||
nspr
|
||||
libxcb
|
||||
pango
|
||||
libXScrnSaver
|
||||
libappindicator-gtk3
|
||||
libdbusmenu
|
||||
wayland
|
||||
] ++ lib.optional withTTS speechd);
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{bin,opt/${binaryName},share/pixmaps,share/icons/hicolor/256x256/apps}
|
||||
mv * $out/opt/${binaryName}
|
||||
|
||||
chmod +x $out/opt/${binaryName}/${binaryName}
|
||||
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
|
||||
$out/opt/${binaryName}/${binaryName}
|
||||
|
||||
wrapProgramShell $out/opt/${binaryName}/${binaryName} \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" \
|
||||
${lib.strings.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \
|
||||
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
|
||||
--prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName} \
|
||||
--run "${lib.getExe disableBreakingUpdates}"
|
||||
|
||||
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
|
||||
# Without || true the install would fail on case-insensitive filesystems
|
||||
ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${
|
||||
lib.strings.toLower binaryName
|
||||
} || true
|
||||
|
||||
ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
|
||||
ln -s $out/opt/${binaryName}/discord.png $out/share/icons/hicolor/256x256/apps/${pname}.png
|
||||
|
||||
ln -s "$desktopItem/share/applications" $out/share/
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
cp "${./installer}" $out/opt/vencordInstaller
|
||||
chmod 770 $out/opt/vencordInstaller
|
||||
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
|
||||
$out/opt/vencordInstaller
|
||||
|
||||
VENCORD_USER_DATA_DIR="/home/meyer/.config/Vencord/dist" $out/opt/vencordInstaller -location $out/opt/Discord -install
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall =
|
||||
''
|
||||
# set -x
|
||||
# set -e
|
||||
#
|
||||
# cp "${./installer}" $out/bin/vencordInstaller
|
||||
#
|
||||
# chmod +x $out/bin/vencordInstaller
|
||||
# patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
|
||||
# $out/bin/vencordInstaller
|
||||
# $out/bin/vencordInstaller -location $out/opt/Discord -install
|
||||
'';
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = pname;
|
||||
exec = binaryName;
|
||||
icon = pname;
|
||||
inherit desktopName;
|
||||
genericName = meta.description;
|
||||
categories = [ "Network" "InstantMessaging" ];
|
||||
mimeTypes = [ "x-scheme-handler/discord" ];
|
||||
};
|
||||
|
||||
passthru = {
|
||||
# make it possible to run disableBreakingUpdates standalone
|
||||
inherit disableBreakingUpdates;
|
||||
updateScript = writeScript "discord-update-script" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnugrep common-updater-scripts
|
||||
set -eou pipefail;
|
||||
url=$(curl -sI "https://discordapp.com/api/download/${
|
||||
builtins.replaceStrings [ "discord-" "discord" ] [ "" "stable" ] pname
|
||||
}?platform=linux&format=tar.gz" | grep -oP 'location: \K\S+')
|
||||
version=''${url##https://dl*.discordapp.net/apps/linux/}
|
||||
version=''${version%%/*.tar.gz}
|
||||
update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch}
|
||||
'';
|
||||
};
|
||||
}
|
14
flake.nix
14
flake.nix
|
@ -4,21 +4,25 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
# let
|
||||
# boxes = [
|
||||
# "default"
|
||||
# ];
|
||||
# forAllSystems = nixpkgs.lib.genAttrs boxes;
|
||||
# in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
default = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules = [
|
||||
./boxes/desktop/configuration.nix
|
||||
inputs.home-manager.nixosModules.default
|
||||
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -29,5 +33,7 @@
|
|||
# inputs.home-manager.nixosModules.default
|
||||
# ];
|
||||
# };
|
||||
# cpkg = forAllSystems(system: import ./customPackages);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue