updates and fixes

This commit is contained in:
Patrick 2024-06-28 20:32:11 +02:00
parent 67d737041a
commit 449aa391c4
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
16 changed files with 557 additions and 151 deletions

View file

@ -8,10 +8,9 @@ lib.optionalAttrs (!minimal) {
services.xserver.videoDrivers = lib.mkForce ["nvidia"];
hardware = {
opengl = {
graphics = {
enable = true;
driSupport = true;
driSupport32Bit = true;
enable32Bit = true;
extraPackages = with pkgs; [
vaapiVdpau
nvidia-vaapi-driver

View file

@ -112,6 +112,7 @@ in {
};
};
stylix = {
enable = true;
autoEnable = false;
polarity = "dark";
image = config.lib.stylix.pixel "base00";

View file

@ -10,7 +10,7 @@
zone = config.secrets.secrets.global.domains.web;
protocol = "Cloudflare";
username = "token";
use = "web, web='https://cloudflare.com/cdn-cgi/trace', web-skip='ip='";
usev4 = "web, web='https://cloudflare.com/cdn-cgi/trace', web-skip='ip='";
passwordFile = config.age.secrets.cloudflare_token_dns.path;
domains = [config.secrets.secrets.global.domains.web];
};

View file

@ -78,7 +78,7 @@ in {
user = "git";
group = "git";
lfs.enable = true;
mailerPasswordFile = config.age.secrets.forgejo-mailer-passwd.path;
secrets.mailer.PASSWD = config.age.secrets.forgejo-mailer-passwd.path;
settings = {
DEFAULT.APP_NAME = "Patricks tolles git"; # tungsten inert gas?
actions = {

View file

@ -12,7 +12,7 @@
};
environment.persistence."/persist".directories = [
{
directory = "/var/lib/private/homebox/";
directory = "/var/lib/homebox";
user = "homebox";
group = "homebox";
mode = "750";

View file

@ -12,11 +12,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1716561646,
"narHash": "sha256-UIGtLO89RxKt7RF2iEgPikSdU53r6v/6WYB0RW3k89I=",
"lastModified": 1718371084,
"narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=",
"owner": "ryantm",
"repo": "agenix",
"rev": "c2fc0762bbe8feb06a2e59a364fa81b3a57671c9",
"rev": "3a56735779db467538fb2e577eda28a9daacaca6",
"type": "github"
},
"original": {
@ -151,15 +151,15 @@
"base16-vim": {
"flake": false,
"locked": {
"lastModified": 1663659192,
"narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=",
"owner": "chriskempson",
"lastModified": 1716150083,
"narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=",
"owner": "tinted-theming",
"repo": "base16-vim",
"rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d",
"rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d",
"type": "github"
},
"original": {
"owner": "chriskempson",
"owner": "tinted-theming",
"repo": "base16-vim",
"type": "github"
}
@ -356,11 +356,11 @@
]
},
"locked": {
"lastModified": 1717915259,
"narHash": "sha256-VsGPboaleIlPELHY5cNTrXK4jHVmgUra8uC6h7KVC5c=",
"lastModified": 1719401812,
"narHash": "sha256-QONBQ/arBsKZNJuSd3sMIkSYFlBoRJpvf1jGlMfcOuI=",
"owner": "nix-community",
"repo": "disko",
"rev": "1bbdb06f14e2621290b250e631cf3d8948e4d19b",
"rev": "b6a1262796b2990ec3cc60bb2ec23583f35b2f43",
"type": "github"
},
"original": {
@ -768,11 +768,11 @@
]
},
"locked": {
"lastModified": 1717664902,
"narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=",
"lastModified": 1719259945,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"type": "github"
},
"original": {
@ -936,11 +936,11 @@
]
},
"locked": {
"lastModified": 1717931644,
"narHash": "sha256-Sz8Wh9cAiD5FhL8UWvZxBfnvxETSCVZlqWSYWaCPyu0=",
"lastModified": 1719385710,
"narHash": "sha256-0yb5D0wCEtXoTi4ssNZxwvLTrahTwlHYPtx252FZ1MU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3d65009effd77cb0d6e7520b68b039836a7606cf",
"rev": "92a26bf6df1f00cbbed16a99d2547531ff4b3a83",
"type": "github"
},
"original": {
@ -957,11 +957,11 @@
]
},
"locked": {
"lastModified": 1717525419,
"narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=",
"lastModified": 1719180626,
"narHash": "sha256-vZAzm5KQpR6RGple1dzmSJw5kPivES2heCFM+ZWkt0I=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a7117efb3725e6197dd95424136f79147aa35e5b",
"rev": "6b1f90a8ff92e81638ae6eb48cd62349c3e387bb",
"type": "github"
},
"original": {
@ -978,11 +978,11 @@
]
},
"locked": {
"lastModified": 1714981474,
"narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
"lastModified": 1715930644,
"narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
"rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d",
"type": "github"
},
"original": {
@ -993,11 +993,11 @@
},
"impermanence": {
"locked": {
"lastModified": 1717932370,
"narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=",
"lastModified": 1719091691,
"narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f",
"rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a",
"type": "github"
},
"original": {
@ -1039,11 +1039,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1717935050,
"narHash": "sha256-UWi8G3J+pS+9LVMdjrpLJwncdiMQWrnuUd5ygxCHeNc=",
"lastModified": 1719144654,
"narHash": "sha256-3eKm5xwc2M4WJ1wQ4POID8jpDARWXEAMcuh1xDItJl8=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "1b6ea3be6ba37d4d3ba6e5041e2f152bb684ba2c",
"rev": "7f1a89b58b9d3ba655a381f8ab1806a8ccdfb03a",
"type": "github"
},
"original": {
@ -1076,11 +1076,11 @@
"spectrum": "spectrum"
},
"locked": {
"lastModified": 1717441449,
"narHash": "sha256-juxjgmLnFbl+/hhIO2cVtIa6caCO4pLKlZWUMwAOznM=",
"lastModified": 1719185120,
"narHash": "sha256-xsdESZDwOs0o96VlZNxThfLG8HW+qT2c7dYypGGUYXg=",
"owner": "astro",
"repo": "microvm.nix",
"rev": "e3a4dd5b381fb580804105594cc9c71dc45abdb5",
"rev": "146fec824fe8e06454e211a14ce29b5f692ad078",
"type": "github"
},
"original": {
@ -1097,11 +1097,11 @@
]
},
"locked": {
"lastModified": 1716993688,
"narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=",
"lastModified": 1719128254,
"narHash": "sha256-I7jMpq0CAOZA/i70+HDQO/ulLttyQu/K70cSESiMX7A=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4",
"rev": "50581970f37f06a4719001735828519925ef8310",
"type": "github"
},
"original": {
@ -1118,11 +1118,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1717698186,
"narHash": "sha256-e3/cvm7bAn0RsTBcPfHwuYOi2lwoO4jpTn4nmMSvHfU=",
"lastModified": 1719247822,
"narHash": "sha256-qbtex5uSOUQnK4797JztyTQWlnlhEsE8x5g5qs5DgvQ=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "b6169e08e76e10b673d1b54f944cddb1e7cbea97",
"rev": "9bed665aa71907dcacc8ae6dba1a3055a9ff2de7",
"type": "github"
},
"original": {
@ -1160,11 +1160,11 @@
]
},
"locked": {
"lastModified": 1717919703,
"narHash": "sha256-4i/c31+dnpv6KdUA3BhbMDS9Lvg/CDin78caYJlq0bY=",
"lastModified": 1719111455,
"narHash": "sha256-rnIxHx+fLpydjMQsbpZ21kblUr/lMqSaAtMA4+qMMEE=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "a157a81d0a4bc909b2b6666dd71909bcdc8cd0d6",
"rev": "4293f532d0107dfb7e6f8b34a0421dc8111320e6",
"type": "github"
},
"original": {
@ -1220,11 +1220,11 @@
"pre-commit-hooks": "pre-commit-hooks_3"
},
"locked": {
"lastModified": 1712921831,
"narHash": "sha256-5WVeVRFoO0QziYNeM+Wcxj12F2H8siNlQ0ueDZBD/e4=",
"lastModified": 1719361855,
"narHash": "sha256-JTIOZuYwFpVA7kvNx52gBiv28uY+mQv9oRGcaSd24Ho=",
"owner": "oddlama",
"repo": "nixos-extra-modules",
"rev": "fc2cef598dcf0f407d91cc2cde96144199fd1dca",
"rev": "28fdf3bfeab9e4907b8ad7c29e73c1013e74c113",
"type": "github"
},
"original": {
@ -1241,11 +1241,11 @@
]
},
"locked": {
"lastModified": 1716210724,
"narHash": "sha256-iqQa3omRcHGpWb1ds75jS9ruA5R39FTmAkeR3J+ve1w=",
"lastModified": 1718025593,
"narHash": "sha256-WZ1gdKq/9u1Ns/oXuNsDm+W0salonVA0VY1amw8urJ4=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "d14b286322c7f4f897ca4b1726ce38cb68596c94",
"rev": "35c20ba421dfa5059e20e0ef2343c875372bdcf3",
"type": "github"
},
"original": {
@ -1256,11 +1256,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1717828156,
"narHash": "sha256-YvstO0lobf3JWQuAfZCLYRTROC2ZDEgtWeQtWbO49p4=",
"lastModified": 1719391814,
"narHash": "sha256-zlRvpIUQrxMSOi+1lVFuJNvIJt9LB93c05tYQ1KSdRg=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "057a7996d012f342a38a26261ee529cebb1755ef",
"rev": "aab67495e34365045f9dfbe58725cc6fa03607b7",
"type": "github"
},
"original": {
@ -1308,11 +1308,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1717894324,
"narHash": "sha256-4q6ZO3BqHgdd3Aacb/xiQXB4g9TQKpQg/praTpD9vbI=",
"lastModified": 1719103869,
"narHash": "sha256-kbTUy+/lfjUrMfV7JkTJwxowsFhi9Tb3BdbiOcIGcsc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "13eac98dc5233fe7e52f0cd0e2cba7dcd77feca5",
"rev": "f820613f886cd1aa4bcfd1dbaa6c83c8a3dcd863",
"type": "github"
},
"original": {
@ -1387,11 +1387,11 @@
},
"nixpkgs-stable_5": {
"locked": {
"lastModified": 1710695816,
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
"lastModified": 1718811006,
"narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
"rev": "03d771e513ce90147b65fe922d87d3a0356fc125",
"type": "github"
},
"original": {
@ -1411,11 +1411,11 @@
]
},
"locked": {
"lastModified": 1717946219,
"narHash": "sha256-FtVXsRY/El4TAVUuM9BnJH2F5tSxd0UMK/AvVzZRsZA=",
"lastModified": 1719386145,
"narHash": "sha256-69nzxN6s6KmYDz73iOP3eXTq+xsj7IpJyFcK7ytK/bU=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "8c7518a4167eb65ca62da3ab49578e728ee9a769",
"rev": "1bd617718d90986d75190b5df5b172d1a189a817",
"type": "github"
},
"original": {
@ -1426,11 +1426,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1717786204,
"narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=",
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "051f920625ab5aabe37c920346e3e69d7d34400e",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"type": "github"
},
"original": {
@ -1442,11 +1442,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1715037484,
"narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=",
"lastModified": 1719082008,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ad7efee13e0d216bf29992311536fce1d3eefbef",
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github"
},
"original": {
@ -1502,11 +1502,11 @@
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1717922156,
"narHash": "sha256-C/TgTnKY4iWXnBmKocV9KeV+OtZGCh+1Pcw26Elx7JM=",
"lastModified": 1719379691,
"narHash": "sha256-aJ10tTQ3aJZYHOS0FixRKFHQqN+kPaCyw0q5pejv7hA=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "8a462dc9570bce1de5a7dd1beabd83f95958315b",
"rev": "b64ee08d6b08b36b33fd1644b374ec2a5fd1a193",
"type": "github"
},
"original": {
@ -1640,11 +1640,11 @@
"nixpkgs-stable": "nixpkgs-stable_5"
},
"locked": {
"lastModified": 1717664902,
"narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=",
"lastModified": 1719259945,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"type": "github"
},
"original": {
@ -1755,11 +1755,11 @@
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1717866166,
"narHash": "sha256-iOeRZXIhFpQJdxzNJ3nUAANyDfLqCslRhjGhLD2RstM=",
"lastModified": 1719235398,
"narHash": "sha256-yccyHeuMUdbG/89Yi1ZSqx0XlpIKb0WQI+mAnTf/GJw=",
"owner": "danth",
"repo": "stylix",
"rev": "ca3247ed8cfbf369f3fe1b7a421579812a95c101",
"rev": "7cdbd128172d7c4ec63f5073d49da5d0e7d6396c",
"type": "github"
},
"original": {
@ -1993,11 +1993,11 @@
]
},
"locked": {
"lastModified": 1717850719,
"narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=",
"lastModified": 1719243788,
"narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed",
"rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf",
"type": "github"
},
"original": {

View file

@ -43,7 +43,6 @@
};
services.xserver.xkb = {
layout = "de";
variant = "bone";
};
virtualisation.podman = {
enable = true;

View file

@ -8,7 +8,6 @@
[
inputs.nixos-hardware.nixosModules.common-pc
inputs.nixos-hardware.nixosModules.common-pc-ssd
inputs.nixos-hardware.nixosModules.common-pc-hdd
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
@ -30,7 +29,6 @@
services.xserver = {
xkb = {
layout = "de";
variant = "bone";
};
};
nixpkgs.hostPlatform = "x86_64-linux";

View file

@ -163,7 +163,7 @@ in {
(proxyProtect "ttrss" {port = 80;} true)
(blockOf "yourspotify" {port = 80;})
(blockOf "homebox" {})
(proxyProtect "ollama" {} true)
#(proxyProtect "ollama" {} true)
(proxyProtect "firefly" {port = 80;} true)
(blockOf "apispotify" {
port = 3000;
@ -269,7 +269,7 @@ in {
// mkContainer "oauth2-proxy" {}
// mkContainer "vaultwarden" {}
// mkContainer "ddclient" {}
// mkContainer "ollama" {}
#// mkContainer "ollama" {}
// mkContainer "murmur" {}
// mkContainer "homebox" {}
// mkContainer "ttrss" {}

View file

@ -10,7 +10,6 @@
];
services.xserver = {
layout = "de";
xkbVariant = "bone";
};
boot.mode = "bios";
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_net" "virtio_scsi" "virtio_blk"];

View file

@ -8,7 +8,6 @@
homebox = super.callPackage ./homebox.nix {};
deploy = super.callPackage ./deploy.nix {};
j-link = super.callPackage ./jlink.nix {};
firefly-iii = super.callPackage ./firefly-iii.nix {};
mongodb-bin = super.callPackage ./mongodb-bin.nix {};
awakened-poe-trade = super.callPackage ./awakened-poe-trade.nix {};
neovim-clean = super.neovim-unwrapped.overrideAttrs (_neovimFinal: neovimPrev: {
@ -36,6 +35,13 @@
passthru.enableSecretProvisioning = true;
doCheck = false;
});
pythonPackagesExtensions =
super.pythonPackagesExtensions
++ [
(pythonFinal: _pythonPrev: {
jaxlib = pythonFinal.callPackage ./jaxlib.nix {};
})
];
kanidm-provision = super.callPackage ./kanidm-provision.nix {};
})
]

View file

@ -1,59 +0,0 @@
{
lib,
fetchFromGitHub,
buildNpmPackage,
php83,
nixosTests,
dataDir ? "/var/lib/firefly-iii",
}: let
pname = "firefly-iii";
version = "6.1.18";
phpPackage = php83;
src = fetchFromGitHub {
owner = "firefly-iii";
repo = "firefly-iii";
rev = "v${version}";
hash = "sha256-mA7gvKhHouUUz1Aix7253O/+VcufoEFwdcJeZxnazEo=";
};
assets = buildNpmPackage {
pname = "${pname}-assets";
inherit version src;
npmDepsHash = "sha256-MoxkNxfVeIFkiNVzfehQ9FpC65kBj8ZmvwaRf4MVRIg=";
dontNpmBuild = true;
installPhase = ''
runHook preInstall
npm run prod --workspace=v1
npm run build --workspace=v2
cp -r ./public $out/
runHook postInstall
'';
};
in
phpPackage.buildComposerProject (_: {
inherit pname src version;
vendorHash = "sha256-EpMypgj6lZDz6T94bGoCUH9IVwh7VB4Ds08AcCsreRw=";
passthru = {
inherit phpPackage;
tests = nixosTests.firefly-iii;
};
postInstall = ''
mv $out/share/php/${pname}/* $out/
rm -R $out/share $out/storage $out/bootstrap/cache $out/public
cp -a ${assets} $out/public
ln -s ${dataDir}/storage $out/storage
ln -s ${dataDir}/cache $out/bootstrap/cache
'';
meta = {
changelog = "https://github.com/firefly-iii/firefly-iii/releases/tag/v${version}";
description = "Firefly III: a personal finances manager";
homepage = "https://github.com/firefly-iii/firefly-iii";
license = lib.licenses.agpl3Only;
maintainers = [lib.maintainers.savyajha];
};
})

461
pkgs/jaxlib.nix Normal file
View file

@ -0,0 +1,461 @@
{
lib,
pkgs,
# Build-time dependencies:
autoAddDriverRunpath,
bazel_6,
binutils,
buildBazelPackage,
buildPythonPackage,
curl,
cython,
fetchFromGitHub,
git,
jsoncpp,
nsync,
openssl,
pybind11,
setuptools,
symlinkJoin,
wheel,
build,
which,
# Python dependencies:
absl-py,
flatbuffers,
ml-dtypes,
numpy,
scipy,
six,
# Runtime dependencies:
double-conversion,
giflib,
libjpeg_turbo,
python,
snappy,
zlib,
config,
# CUDA flags:
cudaSupport ? config.cudaSupport,
cudaPackages,
# MKL:
mklSupport ? true,
} @ inputs: let
inherit
(cudaPackages)
cudaFlags
cudaVersion
cudnn
nccl
;
pname = "jaxlib";
version = "0.4.28";
# It's necessary to consistently use backendStdenv when building with CUDA
# support, otherwise we get libstdc++ errors downstream
stdenv = throw "Use effectiveStdenv instead";
effectiveStdenv =
if cudaSupport
then cudaPackages.backendStdenv
else inputs.stdenv;
meta = with lib; {
description = "JAX is Autograd and XLA, brought together for high-performance machine learning research";
homepage = "https://github.com/google/jax";
license = licenses.asl20;
maintainers = with maintainers; [ndl];
platforms = platforms.unix;
# aarch64-darwin is broken because of https://github.com/bazelbuild/rules_cc/pull/136
# however even with that fix applied, it doesn't work for everyone:
# https://github.com/NixOS/nixpkgs/pull/184395#issuecomment-1207287129
# NOTE: We always build with NCCL; if it is unsupported, then our build is broken.
broken = effectiveStdenv.isDarwin || nccl.meta.unsupported;
};
# These are necessary at build time and run time.
cuda_libs_joined = symlinkJoin {
name = "cuda-joined";
paths = with cudaPackages; [
cuda_cudart.lib # libcudart.so
cuda_cudart.static # libcudart_static.a
cuda_cupti.lib # libcupti.so
libcublas.lib # libcublas.so
libcufft.lib # libcufft.so
libcurand.lib # libcurand.so
libcusolver.lib # libcusolver.so
libcusparse.lib # libcusparse.so
];
};
# These are only necessary at build time.
cuda_build_deps_joined = symlinkJoin {
name = "cuda-build-deps-joined";
paths = with cudaPackages; [
cuda_libs_joined
# Binaries
cudaPackages.cuda_nvcc.bin # nvcc
# Headers
cuda_cccl.dev # block_load.cuh
cuda_cudart.dev # cuda.h
cuda_cupti.dev # cupti.h
cuda_nvcc.dev # See https://github.com/google/jax/issues/19811
cuda_nvml_dev # nvml.h
cuda_nvtx.dev # nvToolsExt.h
libcublas.dev # cublas_api.h
libcufft.dev # cufft.h
libcurand.dev # curand.h
libcusolver.dev # cusolver_common.h
libcusparse.dev # cusparse.h
];
};
backend_cc_joined = symlinkJoin {
name = "cuda-cc-joined";
paths = [
effectiveStdenv.cc
binutils.bintools # for ar, dwp, nm, objcopy, objdump, strip
];
};
# Copy-paste from TF derivation.
# Most of these are not really used in jaxlib compilation but it's simpler to keep it
# 'as is' so that it's more compatible with TF derivation.
tf_system_libs = [
"absl_py"
"astor_archive"
"astunparse_archive"
# Not packaged in nixpkgs
# "com_github_googleapis_googleapis"
# "com_github_googlecloudplatform_google_cloud_cpp"
# Issue with transitive dependencies after https://github.com/grpc/grpc/commit/f1d14f7f0b661bd200b7f269ef55dec870e7c108
# "com_github_grpc_grpc"
# ERROR: /build/output/external/bazel_tools/tools/proto/BUILD:25:6: no such target '@com_google_protobuf//:cc_toolchain':
# target 'cc_toolchain' not declared in package '' defined by /build/output/external/com_google_protobuf/BUILD.bazel
# "com_google_protobuf"
# Fails with the error: external/org_tensorflow/tensorflow/core/profiler/utils/tf_op_utils.cc:46:49: error: no matching function for call to 're2::RE2::FullMatch(absl::lts_2020_02_25::string_view&, re2::RE2&)'
# "com_googlesource_code_re2"
"curl"
"cython"
"dill_archive"
"double_conversion"
"flatbuffers"
"functools32_archive"
"gast_archive"
"gif"
"hwloc"
"icu"
"jsoncpp_git"
"libjpeg_turbo"
"lmdb"
"nasm"
"opt_einsum_archive"
"org_sqlite"
"pasta"
"png"
# ERROR: /build/output/external/pybind11/BUILD.bazel: no such target '@pybind11//:osx':
# target 'osx' not declared in package '' defined by /build/output/external/pybind11/BUILD.bazel
# "pybind11"
"six_archive"
"snappy"
"tblib_archive"
"termcolor_archive"
"typing_extensions_archive"
"wrapt"
"zlib"
];
arch =
# KeyError: ('Linux', 'arm64')
if effectiveStdenv.hostPlatform.isLinux && effectiveStdenv.hostPlatform.linuxArch == "arm64"
then "aarch64"
else effectiveStdenv.hostPlatform.linuxArch;
xla = effectiveStdenv.mkDerivation {
pname = "xla-src";
version = "unstable";
src = fetchFromGitHub {
owner = "openxla";
repo = "xla";
# Update this according to https://github.com/google/jax/blob/jaxlib-v${version}/third_party/xla/workspace.bzl.
rev = "e8247c3ea1d4d7f31cf27def4c7ac6f2ce64ecd4";
hash = "sha256-ZhgMIVs3Z4dTrkRWDqaPC/i7yJz2dsYXrZbjzqvPX3E=";
};
dontBuild = true;
# This is necessary for patchShebangs to know the right path to use.
nativeBuildInputs = [python];
# Main culprits we're targeting are third_party/tsl/third_party/gpus/crosstool/clang/bin/*.tpl
postPatch = ''
patchShebangs .
'';
installPhase = ''
cp -r . $out
'';
};
bazel-build = buildBazelPackage rec {
name = "bazel-build-${pname}-${version}";
# See https://github.com/google/jax/blob/main/.bazelversion for the latest.
bazel = bazel_6;
src = fetchFromGitHub {
owner = "google";
repo = "jax";
# google/jax contains tags for jax and jaxlib. Only use jaxlib tags!
rev = "refs/tags/${pname}-v${version}";
hash = "sha256-qSHPwi3is6Ts7pz5s4KzQHBMbcjGp+vAOsejW3o36Ek=";
};
nativeBuildInputs =
[
cython
pkgs.flatbuffers
git
setuptools
wheel
build
which
]
++ lib.optionals effectiveStdenv.isDarwin [];
buildInputs =
[
curl
double-conversion
giflib
jsoncpp
libjpeg_turbo
numpy
openssl
pkgs.flatbuffers
pkgs.protobuf
pybind11
scipy
six
snappy
zlib
]
++ lib.optionals effectiveStdenv.isDarwin []
++ lib.optionals (!effectiveStdenv.isDarwin) [nsync];
# We don't want to be quite so picky regarding bazel version
postPatch = ''
rm -f .bazelversion
'';
bazelRunTarget = "//jaxlib/tools:build_wheel";
runTargetFlags = [
"--output_path=$out"
"--cpu=${arch}"
# This has no impact whatsoever...
"--jaxlib_git_hash='12345678'"
];
removeRulesCC = false;
GCC_HOST_COMPILER_PREFIX = lib.optionalString cudaSupport "${backend_cc_joined}/bin";
GCC_HOST_COMPILER_PATH = lib.optionalString cudaSupport "${backend_cc_joined}/bin/gcc";
# The version is automatically set to ".dev" if this variable is not set.
# https://github.com/google/jax/commit/e01f2617b85c5bdffc5ffb60b3d8d8ca9519a1f3
JAXLIB_RELEASE = "1";
preConfigure =
# Dummy ldconfig to work around "Can't open cache file /nix/store/<hash>-glibc-2.38-44/etc/ld.so.cache" error
''
mkdir dummy-ldconfig
echo "#!${effectiveStdenv.shell}" > dummy-ldconfig/ldconfig
chmod +x dummy-ldconfig/ldconfig
export PATH="$PWD/dummy-ldconfig:$PATH"
''
+
# Construct .jax_configure.bazelrc. See https://github.com/google/jax/blob/b9824d7de3cb30f1df738cc42e486db3e9d915ff/build/build.py#L259-L345
# for more info. We assume
# * `cpu = None`
# * `enable_nccl = True`
# * `target_cpu_features = "release"`
# * `rocm_amdgpu_targets = None`
# * `enable_rocm = False`
# * `build_gpu_plugin = False`
# * `use_clang = False` (Should we use `effectiveStdenv.cc.isClang` instead?)
#
# Note: We should try just running https://github.com/google/jax/blob/ceb198582b62b9e6f6bdf20ab74839b0cf1db16e/build/build.py#L259-L266
# instead of duplicating the logic here. Perhaps we can leverage the
# `--configure_only` flag (https://github.com/google/jax/blob/ceb198582b62b9e6f6bdf20ab74839b0cf1db16e/build/build.py#L544-L548)?
''
cat <<CFG > ./.jax_configure.bazelrc
build --strategy=Genrule=standalone
build --repo_env PYTHON_BIN_PATH="${python}/bin/python"
build --action_env=PYENV_ROOT
build --python_path="${python}/bin/python"
build --distinct_host_configuration=false
build --define PROTOBUF_INCLUDE_PATH="${pkgs.protobuf}/include"
''
+ lib.optionalString cudaSupport ''
build --config=cuda
build --action_env CUDA_TOOLKIT_PATH="${cuda_build_deps_joined}"
build --action_env CUDNN_INSTALL_PATH="${cudnn}"
build --action_env TF_CUDA_PATHS="${cuda_build_deps_joined},${cudnn},${nccl}"
build --action_env TF_CUDA_VERSION="${lib.versions.majorMinor cudaVersion}"
build --action_env TF_CUDNN_VERSION="${lib.versions.major cudnn.version}"
build:cuda --action_env TF_CUDA_COMPUTE_CAPABILITIES="${builtins.concatStringsSep "," cudaFlags.realArches}"
''
+
# Note that upstream conditions this on `wheel_cpu == "x86_64"`. We just
# rely on `effectiveStdenv.hostPlatform.avxSupport` instead. So far so
# good. See https://github.com/google/jax/blob/b9824d7de3cb30f1df738cc42e486db3e9d915ff/build/build.py#L322
# for upstream's version.
lib.optionalString (effectiveStdenv.hostPlatform.avxSupport && effectiveStdenv.hostPlatform.isUnix)
''
build --config=avx_posix
''
+ lib.optionalString mklSupport ''
build --config=mkl_open_source_only
''
+ ''
CFG
'';
# Make sure Bazel knows about our configuration flags during fetching so that the
# relevant dependencies can be downloaded.
bazelFlags =
[
"-c opt"
# See https://bazel.build/external/advanced#overriding-repositories for
# information on --override_repository flag.
"--override_repository=xla=${xla}"
]
++ lib.optionals effectiveStdenv.cc.isClang [
# bazel depends on the compiler frontend automatically selecting these flags based on file
# extension but our clang doesn't.
# https://github.com/NixOS/nixpkgs/issues/150655
"--cxxopt=-x"
"--cxxopt=c++"
"--host_cxxopt=-x"
"--host_cxxopt=c++"
];
# We intentionally overfetch so we can share the fetch derivation across all the different configurations
fetchAttrs = {
TF_SYSTEM_LIBS = lib.concatStringsSep "," tf_system_libs;
# we have to force @mkl_dnn_v1 since it's not needed on darwin
bazelTargets = [
bazelRunTarget
"@mkl_dnn_v1//:mkl_dnn"
];
bazelFlags =
bazelFlags
++ [
"--config=avx_posix"
"--config=mkl_open_source_only"
]
++ lib.optionals cudaSupport [
# ideally we'd add this unconditionally too, but it doesn't work on darwin
# we make this conditional on `cudaSupport` instead of the system, so that the hash for both
# the cuda and the non-cuda deps can be computed on linux, since a lot of contributors don't
# have access to darwin machines
"--config=cuda"
];
sha256 =
(
if cudaSupport
then {x86_64-linux = "sha256-vUoAPkYKEnHkV4fw6BI0mCeuP2e8BMCJnVuZMm9LwSA=";}
else {
x86_64-linux = "sha256-R5Bm+0GYN1zJ1aEUBW76907MxYKAIawHHJoIb1RdsKE=";
aarch64-linux = "sha256-P5JEmJljN1DeRA0dNkzyosKzRnJH+5SD2aWdV5JsoiY=";
}
)
.${effectiveStdenv.system}
or (throw "jaxlib: unsupported system: ${effectiveStdenv.system}");
};
buildAttrs = {
outputs = ["out"];
TF_SYSTEM_LIBS = lib.concatStringsSep "," (
tf_system_libs
++ lib.optionals (!effectiveStdenv.isDarwin) [
"nsync" # fails to build on darwin
]
);
# Note: we cannot do most of this patching at `patch` phase as the deps
# are not available yet. Framework search paths aren't added by bintools
# hook. See https://github.com/NixOS/nixpkgs/pull/41914.
preBuild =
lib.optionalString effectiveStdenv.isDarwin ''
'';
};
inherit meta;
};
platformTag =
if effectiveStdenv.hostPlatform.isLinux
then "manylinux2014_${arch}"
else if effectiveStdenv.system == "x86_64-darwin"
then "macosx_10_9_${arch}"
else if effectiveStdenv.system == "aarch64-darwin"
then "macosx_11_0_${arch}"
else throw "Unsupported target platform: ${effectiveStdenv.hostPlatform}";
in
buildPythonPackage {
inherit meta pname version;
format = "wheel";
src = let
cp = "cp${builtins.replaceStrings ["."] [""] python.pythonVersion}";
in "${bazel-build}/jaxlib-${version}-${cp}-${cp}-${platformTag}.whl";
# Note that jaxlib looks for "ptxas" in $PATH. See https://github.com/NixOS/nixpkgs/pull/164176#discussion_r828801621
# for more info.
postInstall = lib.optionalString cudaSupport ''
mkdir -p $out/bin
ln -s ${cudaPackages.cuda_nvcc.bin}/bin/ptxas $out/bin/ptxas
find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
patchelf --add-rpath "${
lib.makeLibraryPath [
cuda_libs_joined
cudnn
nccl
]
}" "$lib"
done
'';
nativeBuildInputs = lib.optionals cudaSupport [autoAddDriverRunpath];
dependencies = [
absl-py
curl
double-conversion
flatbuffers
giflib
jsoncpp
libjpeg_turbo
ml-dtypes
numpy
scipy
six
snappy
];
pythonImportsCheck = [
"jaxlib"
# `import jaxlib` loads surprisingly little. These imports are actually bugs that appeared in the 0.4.11 upgrade.
"jaxlib.cpu_feature_guard"
"jaxlib.xla_client"
];
# Without it there are complaints about libcudart.so.11.0 not being found
# because RPATH path entries added above are stripped.
dontPatchELF = cudaSupport;
}

View file

@ -36,7 +36,7 @@
rainbow-delimiters.enable = true;
rustaceanvim = {
enable = true;
server.settings.files.excludeDirs = [".direnv"];
settings.server.settings.files.excludeDirs = [".direnv"];
};
indent-blankline = {
enable = true;

View file

@ -54,7 +54,7 @@
texlab.enable = true;
ocamllsp.enable = true;
java-language-server.enable = true;
nil_ls = {
nil-ls = {
enable = true;
settings = {
formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"];

View file

@ -26,6 +26,8 @@
ocamlPackages.mparser
ocamlPackages.ounit2
ocamlPackages.qcheck
via
];
};
}