diff --git a/flake.lock b/flake.lock index ef8f259..e02f043 100644 --- a/flake.lock +++ b/flake.lock @@ -356,11 +356,11 @@ ] }, "locked": { - "lastModified": 1719401812, - "narHash": "sha256-QONBQ/arBsKZNJuSd3sMIkSYFlBoRJpvf1jGlMfcOuI=", + "lastModified": 1720056646, + "narHash": "sha256-BymcV4HWtx2VFuabDCM4/nEJcfivCx0S02wUCz11mAY=", "owner": "nix-community", "repo": "disko", - "rev": "b6a1262796b2990ec3cc60bb2ec23583f35b2f43", + "rev": "64679cd7f318c9b6595902b47d4585b1d51d5f9e", "type": "github" }, "original": { @@ -561,11 +561,11 @@ ] }, "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "lastModified": 1719877454, + "narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "rev": "4e3583423212f9303aa1a6337f8dffb415920e4f", "type": "github" }, "original": { @@ -936,11 +936,11 @@ ] }, "locked": { - "lastModified": 1719385710, - "narHash": "sha256-0yb5D0wCEtXoTi4ssNZxwvLTrahTwlHYPtx252FZ1MU=", + "lastModified": 1720289319, + "narHash": "sha256-E3CjSsXNDWYqoNjrKQLPdEZDLR+mVI9HMa+jY//FjBY=", "owner": "nix-community", "repo": "home-manager", - "rev": "92a26bf6df1f00cbbed16a99d2547531ff4b3a83", + "rev": "10486e6b311b3c5ae1c3477fee058704cea7cb4a", "type": "github" }, "original": { @@ -957,11 +957,11 @@ ] }, "locked": { - "lastModified": 1719180626, - "narHash": "sha256-vZAzm5KQpR6RGple1dzmSJw5kPivES2heCFM+ZWkt0I=", + "lastModified": 1719827439, + "narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=", "owner": "nix-community", "repo": "home-manager", - "rev": "6b1f90a8ff92e81638ae6eb48cd62349c3e387bb", + "rev": "59ce796b2563e19821361abbe2067c3bb4143a7d", "type": "github" }, "original": { @@ -1039,11 +1039,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1719144654, - "narHash": "sha256-3eKm5xwc2M4WJ1wQ4POID8jpDARWXEAMcuh1xDItJl8=", + "lastModified": 1719749459, + "narHash": "sha256-sAZRJNJ9FRUPvseuH21kmh9s+Q6AfQWPNxKVm534wgk=", "owner": "nix-community", "repo": "lib-aggregate", - "rev": "7f1a89b58b9d3ba655a381f8ab1806a8ccdfb03a", + "rev": "a15b020a1d0fc483386eb001ec6735b8a30bec81", "type": "github" }, "original": { @@ -1076,11 +1076,11 @@ "spectrum": "spectrum" }, "locked": { - "lastModified": 1719185120, - "narHash": "sha256-xsdESZDwOs0o96VlZNxThfLG8HW+qT2c7dYypGGUYXg=", + "lastModified": 1720034501, + "narHash": "sha256-fzZpuVnhw5uOtA4OuXw3a+Otpy8C+QV0Uu5XfhGEPSg=", "owner": "astro", "repo": "microvm.nix", - "rev": "146fec824fe8e06454e211a14ce29b5f692ad078", + "rev": "a808af7775f508a2afedd1e4940a382fe1194f21", "type": "github" }, "original": { @@ -1097,11 +1097,11 @@ ] }, "locked": { - "lastModified": 1719128254, - "narHash": "sha256-I7jMpq0CAOZA/i70+HDQO/ulLttyQu/K70cSESiMX7A=", + "lastModified": 1719845423, + "narHash": "sha256-ZLHDmWAsHQQKnmfyhYSHJDlt8Wfjv6SQhl2qek42O7A=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "50581970f37f06a4719001735828519925ef8310", + "rev": "ec12b88104d6c117871fad55e931addac4626756", "type": "github" }, "original": { @@ -1160,11 +1160,11 @@ ] }, "locked": { - "lastModified": 1719111455, - "narHash": "sha256-rnIxHx+fLpydjMQsbpZ21kblUr/lMqSaAtMA4+qMMEE=", + "lastModified": 1719832725, + "narHash": "sha256-dr8DkeS74KVNTgi8BE0BiUKALb+EKlMIV86G2xPYO64=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "4293f532d0107dfb7e6f8b34a0421dc8111320e6", + "rev": "2917972ed34ce292309b3a4976286f8b5c08db27", "type": "github" }, "original": { @@ -1196,11 +1196,11 @@ }, "nixlib": { "locked": { - "lastModified": 1712450863, - "narHash": "sha256-K6IkdtMtq9xktmYPj0uaYc8NsIqHuaAoRBaMgu9Fvrw=", + "lastModified": 1719708727, + "narHash": "sha256-XFNKtyirrGNdehpg7lMNm1skEcBApjqGhaHc/OI95HY=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "3c62b6a12571c9a7f65ab037173ee153d539905f", + "rev": "1bba8a624b3b9d4f68db94fb63aaeb46039ce9e6", "type": "github" }, "original": { @@ -1241,11 +1241,11 @@ ] }, "locked": { - "lastModified": 1718025593, - "narHash": "sha256-WZ1gdKq/9u1Ns/oXuNsDm+W0salonVA0VY1amw8urJ4=", + "lastModified": 1720055043, + "narHash": "sha256-SKizewU4UeYrkZWPUjur8EoxscGoNb0pGcrNL4YzAIg=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "35c20ba421dfa5059e20e0ef2343c875372bdcf3", + "rev": "168b220231a70e47cc1f0919048fa5914415fb18", "type": "github" }, "original": { @@ -1256,11 +1256,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1719391814, - "narHash": "sha256-zlRvpIUQrxMSOi+1lVFuJNvIJt9LB93c05tYQ1KSdRg=", + "lastModified": 1719895800, + "narHash": "sha256-xNbjISJTFailxass4LmdWeV4jNhAlmJPwj46a/GxE6M=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "aab67495e34365045f9dfbe58725cc6fa03607b7", + "rev": "6e253f12b1009053eff5344be5e835f604bb64cd", "type": "github" }, "original": { @@ -1308,11 +1308,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1719103869, - "narHash": "sha256-kbTUy+/lfjUrMfV7JkTJwxowsFhi9Tb3BdbiOcIGcsc=", + "lastModified": 1719708727, + "narHash": "sha256-XFNKtyirrGNdehpg7lMNm1skEcBApjqGhaHc/OI95HY=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "f820613f886cd1aa4bcfd1dbaa6c83c8a3dcd863", + "rev": "1bba8a624b3b9d4f68db94fb63aaeb46039ce9e6", "type": "github" }, "original": { @@ -1411,11 +1411,11 @@ ] }, "locked": { - "lastModified": 1719386145, - "narHash": "sha256-69nzxN6s6KmYDz73iOP3eXTq+xsj7IpJyFcK7ytK/bU=", + "lastModified": 1720297047, + "narHash": "sha256-RXwn9ABn7cdMcachf8m6iu5nHDfY621movgpIM6M9vw=", "owner": "nix-community", "repo": "nixpkgs-wayland", - "rev": "1bd617718d90986d75190b5df5b172d1a189a817", + "rev": "6cebaff2235ddd938eac062c48dfc14477e56b82", "type": "github" }, "original": { @@ -1426,11 +1426,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1719254875, - "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", + "lastModified": 1720031269, + "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", "type": "github" }, "original": { @@ -1502,11 +1502,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1719379691, - "narHash": "sha256-aJ10tTQ3aJZYHOS0FixRKFHQqN+kPaCyw0q5pejv7hA=", + "lastModified": 1720298683, + "narHash": "sha256-CNtfHBwlKuTTanwmUI85Z/HkHShnqZs+WYyxQR8zRFY=", "owner": "nix-community", "repo": "nixvim", - "rev": "b64ee08d6b08b36b33fd1644b374ec2a5fd1a193", + "rev": "6674dea8403747827431d4d8497c34023f93d047", "type": "github" }, "original": { @@ -1755,11 +1755,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1719235398, - "narHash": "sha256-yccyHeuMUdbG/89Yi1ZSqx0XlpIKb0WQI+mAnTf/GJw=", + "lastModified": 1719525570, + "narHash": "sha256-xSO/H67GAHEW0siD2PHoO/e97MbROL3r3s5SpF6A6Dc=", "owner": "danth", "repo": "stylix", - "rev": "7cdbd128172d7c4ec63f5073d49da5d0e7d6396c", + "rev": "1ff9d37d27377bfe8994c24a8d6c6c1734ffa116", "type": "github" }, "original": { @@ -1993,11 +1993,11 @@ ] }, "locked": { - "lastModified": 1719243788, - "narHash": "sha256-9T9mSY35EZSM1KAwb7K9zwQ78qTlLjosZgtUGnw4rn4=", + "lastModified": 1719887753, + "narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "065a23edceff48f948816b795ea8cc6c0dee7cdf", + "rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c", "type": "github" }, "original": { diff --git a/hosts/elisabeth/guests.nix b/hosts/elisabeth/guests.nix index 296f21f..a279ce1 100644 --- a/hosts/elisabeth/guests.nix +++ b/hosts/elisabeth/guests.nix @@ -162,8 +162,8 @@ in { (blockOf "paperless" {maxBodySize = "5G";}) (proxyProtect "ttrss" {port = 80;} true) (blockOf "yourspotify" {port = 80;}) - (blockOf "homebox" {}) - #(proxyProtect "ollama" {} true) + #(blockOf "homebox" {}) + (proxyProtect "ollama" {} true) (proxyProtect "firefly" {port = 80;} true) (blockOf "apispotify" { port = 3000; @@ -269,9 +269,9 @@ in { // mkContainer "oauth2-proxy" {} // mkContainer "vaultwarden" {} // mkContainer "ddclient" {} - #// mkContainer "ollama" {} + // mkContainer "ollama" {} // mkContainer "murmur" {} - // mkContainer "homebox" {} + #// mkContainer "homebox" {} // mkContainer "ttrss" {} // mkContainer "firefly" {} // mkContainer "yourspotify" {} diff --git a/pkgs/default.nix b/pkgs/default.nix index 69cf151..2c324e7 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -35,13 +35,6 @@ passthru.enableSecretProvisioning = true; doCheck = false; }); - pythonPackagesExtensions = - super.pythonPackagesExtensions - ++ [ - (pythonFinal: _pythonPrev: { - jaxlib = pythonFinal.callPackage ./jaxlib.nix {}; - }) - ]; kanidm-provision = super.callPackage ./kanidm-provision.nix {}; }) ] diff --git a/pkgs/jaxlib.nix b/pkgs/jaxlib.nix deleted file mode 100644 index 42fef5b..0000000 --- a/pkgs/jaxlib.nix +++ /dev/null @@ -1,461 +0,0 @@ -{ - 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/-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 < ./.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; - } diff --git a/users/common/graphical/wayland/hyprland.nix b/users/common/graphical/wayland/hyprland.nix index 2270964..75ebdf1 100644 --- a/users/common/graphical/wayland/hyprland.nix +++ b/users/common/graphical/wayland/hyprland.nix @@ -13,6 +13,37 @@ flip concatMap ; + #from https://github.com/hyprwm/Hyprland/issues/3835 + float_script = pkgs.writeShellScript "hyprland-bitwarden-resize" '' + handle() { + case $1 in + windowtitle*) + # Extract the window ID from the line + window_id=''${1#*>>} + + # Fetch the list of windows and parse it using jq to find the window by its decimal ID + window_info=$(hyprctl clients -j | ${pkgs.jq}/bin/jq --arg id "0x$window_id" '.[] | select(.address == ($id))') + + # Extract the title from the window info + window_title=$(echo "$window_info" | ${pkgs.jq}/bin/jq '.title') + + # Check if the title matches the characteristics of the Bitwarden popup window + if [[ "$window_title" == *"(Bitwarden - Free Password Manager) - Bitwarden"* ]]; then + + # echo $window_id, $window_title + # hyprctl dispatch togglefloating address:0x$window_id + # hyprctl dispatch resizewindowpixel exact 20% 40%,address:0x$window_id + # hyprctl dispatch movewindowpixel exact 40% 30%,address:0x$window_id + + hyprctl --batch "dispatch togglefloating address:0x$window_id ; dispatch resizewindowpixel exact 20% 40%,address:0x$window_id ; dispatch movewindowpixel exact 40% 30%,address:0x$window_id" + fi + ;; + esac + } + + # Listen to the Hyprland socket for events and process each line with the handle function + ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done + ''; in { wayland.windowManager.hyprland = { enable = true; @@ -100,7 +131,7 @@ in { "SUPER,m,exec,thunderbird" "SUPER,t,exec,kitty" ",Menu,exec,fuzzel" - "SUPER,,exec,${lib.getExe pkgs.scripts.clone-term}" + "SUPER,c,exec,${lib.getExe pkgs.scripts.clone-term}" "CTRL,F7,sendshortcut,SHIFT+CTRL,m,WebCord" "CTRL,F8,sendshortcut,CTRL+SHIFT,d,WebCord" @@ -168,7 +199,6 @@ in { }; windowrulev2 = [ "immediate, class:^(cs2)$" - "float,class:(firefox),title:^(.*)(Bitwarden)(.*)$" ]; } (mkIf (nixosConfig.node.name == "desktopnix") { @@ -227,6 +257,7 @@ in { submap=reset exec-once = ${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 + exec-once = ${float_script} env = XCURSOR_SIZE,48 binds {