refactor: Move nix
outside of .config
dir
Technically not a config but a compose file, so I think it's better to have outside of `.config` dir
This commit is contained in:
parent
3484b4154a
commit
93a26accd1
22 changed files with 0 additions and 0 deletions
105
nix/overlays/darwin/brew.nix
Normal file
105
nix/overlays/darwin/brew.nix
Normal file
|
@ -0,0 +1,105 @@
|
|||
# Modified version of brew-nix/casks.nix
|
||||
#
|
||||
# REF: https://github.com/BatteredBunny/brew-nix/blob/9dfab294afea5029922bbc59a10ae487c7318d59/casks.nix
|
||||
{ system, mac-version ? "ventura", nixpkgs, brew-api, ... }:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
hasBinary = cask: pkgs.lib.hasAttr "binary" (getArtifacts cask);
|
||||
hasApp = cask: pkgs.lib.hasAttr "app" (getArtifacts cask);
|
||||
hasPkg = cask: pkgs.lib.hasAttr "pkg" (getArtifacts cask);
|
||||
|
||||
getName = cask: builtins.elemAt cask.name 0;
|
||||
|
||||
getBinary = cask: builtins.elemAt (getArtifacts cask).binary 0;
|
||||
getApp = cask: builtins.elemAt (getArtifacts cask).app 0;
|
||||
getArtifacts = cask: pkgs.lib.mergeAttrsList cask.artifacts;
|
||||
|
||||
getUrl = cask: (cask.variations.${mac-version} or cask).url;
|
||||
getHash = cask: (cask.variations.${mac-version} or cask).sha256; # TODO: convert it to SRI
|
||||
|
||||
caskToDerivation = cask: pkgs.stdenv.mkDerivation rec {
|
||||
pname = cask.token;
|
||||
version = cask.version;
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = (getUrl cask);
|
||||
sha256 = pkgs.lib.optionalString ((getHash cask) != "no_check") (getHash cask);
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
undmg
|
||||
unzip
|
||||
gzip
|
||||
_7zz
|
||||
makeWrapper
|
||||
] ++ pkgs.lib.optional (hasPkg cask) (with pkgs; [
|
||||
xar
|
||||
cpio
|
||||
]);
|
||||
|
||||
unpackPhase =
|
||||
if (hasPkg cask) then ''
|
||||
xar -xf $src
|
||||
for pkg in $(cat Distribution | grep -oE "#.+\.pkg" | sed -e "s/^#//" -e "s/$/\/Payload/"); do
|
||||
zcat $pkg | cpio -i
|
||||
done
|
||||
'' else if (hasApp cask) then ''
|
||||
undmg $src || 7zz x -snld $src
|
||||
'' else if (hasBinary cask) then ''
|
||||
if [ "$(file --mime-type -b "$src")" == "application/gzip" ]; then
|
||||
gunzip $src -c > ${getBinary cask}
|
||||
elif [ "$(file --mime-type -b "$src")" == "application/x-mach-binary" ]; then
|
||||
cp $src ${getBinary cask}
|
||||
fi
|
||||
'' else "";
|
||||
|
||||
sourceRoot = pkgs.lib.optionalString (hasApp cask) (getApp cask);
|
||||
|
||||
installPhase =
|
||||
if (hasPkg cask) then ''
|
||||
mkdir -p $out/Applications
|
||||
cp -R Applications/* $out/Applications/
|
||||
|
||||
if [ -d "Resources" ]; then
|
||||
mkdir -p $out/Resources
|
||||
cp -R Resources/* $out/Resources/
|
||||
fi
|
||||
|
||||
if [ -d "Library" ]; then
|
||||
mkdir -p $out/Library
|
||||
cp -R Library/* $out/Library/
|
||||
fi
|
||||
'' else if (hasApp cask) then ''
|
||||
mkdir -p "$out/Applications/${sourceRoot}"
|
||||
cp -R . "$out/Applications/${sourceRoot}"
|
||||
|
||||
if [[ -e "$out/Applications/${sourceRoot}/Contents/MacOS/${getName cask}" ]]; then
|
||||
makeWrapper "$out/Applications/${sourceRoot}/Contents/MacOS/${getName cask}" $out/bin/${cask.token}
|
||||
elif [[ -e "$out/Applications/${sourceRoot}/Contents/MacOS/${pkgs.lib.removeSuffix ".app" sourceRoot}" ]]; then
|
||||
makeWrapper "$out/Applications/${sourceRoot}/Contents/MacOS/${pkgs.lib.removeSuffix ".app" sourceRoot}" $out/bin/${cask.token}
|
||||
fi
|
||||
'' else if (hasBinary cask && !hasApp cask) then ''
|
||||
mkdir -p $out/bin
|
||||
cp -R ./* $out/bin
|
||||
'' else "";
|
||||
|
||||
meta = {
|
||||
homepage = cask.homepage;
|
||||
description = cask.desc;
|
||||
platforms = pkgs.lib.platforms.darwin;
|
||||
mainProgram = if (hasBinary cask && !hasApp cask) then (getBinary cask) else (cask.token);
|
||||
};
|
||||
};
|
||||
|
||||
casks = builtins.fromJSON (builtins.readFile (brew-api + "/cask.json"));
|
||||
in final: prev: {
|
||||
casks = builtins.listToAttrs (builtins.map
|
||||
(cask: {
|
||||
name = cask.token;
|
||||
value = caskToDerivation cask;
|
||||
})
|
||||
casks);
|
||||
}
|
28
nix/overlays/darwin/heliport.nix
Normal file
28
nix/overlays/darwin/heliport.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix
|
||||
final: prev:
|
||||
|
||||
let
|
||||
mkApp = import ../../lib/darwin/mkApp.nix;
|
||||
version = "1.5.0";
|
||||
in {
|
||||
heliport = mkApp {
|
||||
inherit (final) stdenv undmg _7zz;
|
||||
|
||||
pname = "HeliPort";
|
||||
appFileName = "HeliPort.app";
|
||||
inherit version;
|
||||
|
||||
src = final.fetchurl {
|
||||
url = "https://github.com/OpenIntelWireless/HeliPort/releases/download/v${version}/HeliPort.dmg";
|
||||
sha256 = "49cbe7abea742a3c662a836f14c05b79b3e6e6577c897b57101f5bd0a086eec8";
|
||||
};
|
||||
|
||||
meta = with final.lib; {
|
||||
description = "Intel WiFi Client for itlwm";
|
||||
homepage = "https://github.com/OpenIntelWireless/HeliPort";
|
||||
license = licenses.bsd3;
|
||||
platforms = platforms.darwin;
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
};
|
||||
}
|
28
nix/overlays/darwin/vesktop.nix
Normal file
28
nix/overlays/darwin/vesktop.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix
|
||||
final: prev:
|
||||
|
||||
let
|
||||
mkApp = import ../../lib/darwin/mkApp.nix;
|
||||
version = "1.5.3";
|
||||
in {
|
||||
vesktop = mkApp {
|
||||
inherit (final) stdenv undmg _7zz;
|
||||
|
||||
pname = "Vesktop";
|
||||
appFileName = "Vesktop*.app";
|
||||
inherit version;
|
||||
|
||||
src = final.fetchurl {
|
||||
url = "https://github.com/Vencord/Vesktop/releases/download/v${version}/Vesktop-${version}-universal.dmg";
|
||||
hash = "sha256-ceOUNHSOaEqCbzkM64RtUu0Yhrq4tThcXZTDd+OsEXI";
|
||||
};
|
||||
|
||||
meta = with final.lib; {
|
||||
description = "An alternate client for Discord with Vencord built-in";
|
||||
homepage = "https://github.com/Vencord/Vesktop";
|
||||
license = licenses.gpl3Only;
|
||||
platforms = platforms.darwin;
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
};
|
||||
}
|
21
nix/overlays/python.nix
Normal file
21
nix/overlays/python.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
final: prev:
|
||||
|
||||
let
|
||||
disablePyChecks = pkg: pkg.overridePythonAttrs (old: {
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
dontCheck = true;
|
||||
});
|
||||
in {
|
||||
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
|
||||
(pyfinal: pyprev: {
|
||||
dnspython = (disablePyChecks pyprev.dnspython).overridePythonAttrs (old: {
|
||||
disabledTests = [
|
||||
"test_resolver" # Relying too much on internet connection, Indonesian internet couldn't cope with it
|
||||
] ++ old.disabledTests;
|
||||
});
|
||||
pillow = disablePyChecks pyprev.pillow; # Inconsistent test result
|
||||
cherrypy = disablePyChecks pyprev.cherrypy; # Inconsistent test result
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue