├── lib ├── README.md └── default.nix ├── .git-blame-ignore-revs ├── Makefile ├── .github ├── dependabot.yml └── workflows │ └── flake-update.yml ├── default.nix ├── LICENSE ├── flake.nix ├── flake.lock └── README.md /lib/README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED: `` proxy 2 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | 2797dd4317f74b192d6db83b24667c933d14ab48 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | joblist: *.nix *.lock 2 | rm -rf joblist 3 | nix eval -f joblist.nix --write-to joblist 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | lockFile = builtins.fromJSON (builtins.readFile ../flake.lock); 3 | nixpkgsNodeName = lockFile.nodes.root.inputs.nixpkgs; 4 | nixpkgsNode = lockFile.nodes.${nixpkgsNodeName}; 5 | nixpkgs = 6 | with nixpkgsNode; 7 | builtins.fetchGit { 8 | url = "https://github.com/${locked.owner}/${locked.repo}.git"; 9 | rev = locked.rev; 10 | ref = original.ref; 11 | }; 12 | in 13 | assert nixpkgsNode.locked.type == "github"; 14 | import "${nixpkgs}/lib" 15 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | defaultConfig = { 3 | allowUnfree = true; 4 | cudaSupport = true; 5 | }; 6 | in 7 | 8 | { 9 | config ? defaultConfig, 10 | ... 11 | }@userArgs: 12 | 13 | let 14 | flake = builtins.getFlake (builtins.toString ./.); 15 | system = builtins.currentSystem; 16 | 17 | args = userArgs // { 18 | inherit config; 19 | }; 20 | newInstance = import flake.inputs.nixpkgs args; 21 | defaultOutput = flake.legacyPackages.${builtins.currentSystem}; 22 | spawn1000Instances = !(args == { config = defaultConfig; }); 23 | in 24 | if spawn1000Instances then newInstance else defaultOutput 25 | -------------------------------------------------------------------------------- /.github/workflows/flake-update.yml: -------------------------------------------------------------------------------- 1 | # Adapted from https://github.com/numtide/nixpkgs-unfree/blob/main/.github/workflows/sync.yml 2 | 3 | name: Sync channels 4 | 5 | on: 6 | schedule: 7 | - cron: "15 11 * * *" # daily 8 | workflow_dispatch: # on button click 9 | jobs: 10 | sync: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 17 | - uses: cachix/install-nix-action@v15 18 | - name: Update flake.lock 19 | uses: DeterminateSystems/update-flake-lock@main 20 | with: 21 | pr-title: "nix: update flake.lock" 22 | pr-labels: | 23 | nix 24 | token: ${{ secrets.GIT_PUSH_PAT }} 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Jonas Chevalier 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "nixpkgs with the unfree bits enabled"; 3 | 4 | inputs = { 5 | nixpkgs.follows = "nixpkgs-master"; 6 | 7 | # Which revisions to build, NB the nixpkgs-$branch pattern 8 | nixpkgs-master.url = "github:NixOS/nixpkgs/master"; 9 | nixpkgs-nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 10 | nixpkgs-nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; 11 | nixpkgs-release.url = "github:NixOS/nixpkgs/nixos-24.05"; 12 | nixpkgs-release-staging.url = "github:NixOS/nixpkgs/staging-24.05"; 13 | 14 | hercules-ci-effects = { 15 | url = "github:hercules-ci/hercules-ci-effects"; 16 | inputs.nixpkgs.follows = "nixpkgs"; 17 | inputs.flake-parts.follows = "flake-parts"; 18 | }; 19 | flake-parts = { 20 | url = "github:hercules-ci/flake-parts"; 21 | inputs.nixpkgs-lib.follows = "nixpkgs"; 22 | }; 23 | }; 24 | 25 | nixConfig = { 26 | extra-substituters = [ "https://cuda-maintainers.cachix.org" ]; 27 | extra-trusted-public-keys = [ 28 | "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" 29 | ]; 30 | }; 31 | 32 | outputs = 33 | inputs@{ self, flake-parts, ... }: 34 | let 35 | systems = [ "x86_64-linux" ]; 36 | inherit (inputs) nixpkgs; 37 | inherit (nixpkgs) lib; 38 | in 39 | flake-parts.lib.mkFlake { inherit inputs; } { 40 | inherit systems; 41 | flake = 42 | let 43 | eachSystem = lib.genAttrs systems; 44 | eachBranch = lib.genAttrs [ "master" ]; 45 | in 46 | { 47 | herculesCI.onPush.default.outputs = eachSystem ( 48 | system: 49 | (eachBranch ( 50 | branch: 51 | import (inputs.nixpkgs + "/pkgs/top-level/release-cuda.nix") { 52 | inherit system; 53 | packageSet = import inputs."nixpkgs-${branch}"; 54 | } 55 | )) 56 | ); 57 | }; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-parts": { 4 | "inputs": { 5 | "nixpkgs-lib": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1727826117, 11 | "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", 12 | "owner": "hercules-ci", 13 | "repo": "flake-parts", 14 | "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "hercules-ci", 19 | "repo": "flake-parts", 20 | "type": "github" 21 | } 22 | }, 23 | "hercules-ci-effects": { 24 | "inputs": { 25 | "flake-parts": [ 26 | "flake-parts" 27 | ], 28 | "nixpkgs": [ 29 | "nixpkgs" 30 | ] 31 | }, 32 | "locked": { 33 | "lastModified": 1724947644, 34 | "narHash": "sha256-MHHrHasTngp7EYQOObHJ1a/IsRF+wodHqOckhH6uZbk=", 35 | "owner": "hercules-ci", 36 | "repo": "hercules-ci-effects", 37 | "rev": "dba4367b9a9d9615456c430a6d6af716f6e84cef", 38 | "type": "github" 39 | }, 40 | "original": { 41 | "owner": "hercules-ci", 42 | "repo": "hercules-ci-effects", 43 | "type": "github" 44 | } 45 | }, 46 | "nixpkgs-master": { 47 | "locked": { 48 | "lastModified": 1728904098, 49 | "narHash": "sha256-oESLuOhNNshFD3rLC9uP4rOWLUJrZa4UlRayLUsBX50=", 50 | "owner": "NixOS", 51 | "repo": "nixpkgs", 52 | "rev": "890217570a9f6b293d896c64ecb24ab3ce8b5a20", 53 | "type": "github" 54 | }, 55 | "original": { 56 | "owner": "NixOS", 57 | "ref": "master", 58 | "repo": "nixpkgs", 59 | "type": "github" 60 | } 61 | }, 62 | "nixpkgs-nixos-unstable": { 63 | "locked": { 64 | "lastModified": 1728492678, 65 | "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", 66 | "owner": "NixOS", 67 | "repo": "nixpkgs", 68 | "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", 69 | "type": "github" 70 | }, 71 | "original": { 72 | "owner": "NixOS", 73 | "ref": "nixos-unstable", 74 | "repo": "nixpkgs", 75 | "type": "github" 76 | } 77 | }, 78 | "nixpkgs-nixpkgs-unstable": { 79 | "locked": { 80 | "lastModified": 1728538411, 81 | "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", 82 | "owner": "NixOS", 83 | "repo": "nixpkgs", 84 | "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", 85 | "type": "github" 86 | }, 87 | "original": { 88 | "owner": "NixOS", 89 | "ref": "nixpkgs-unstable", 90 | "repo": "nixpkgs", 91 | "type": "github" 92 | } 93 | }, 94 | "nixpkgs-release": { 95 | "locked": { 96 | "lastModified": 1728740863, 97 | "narHash": "sha256-u+rxA79a0lyhG+u+oPBRtTDtzz8kvkc9a6SWSt9ekVc=", 98 | "owner": "NixOS", 99 | "repo": "nixpkgs", 100 | "rev": "a3f9ad65a0bf298ed5847629a57808b97e6e8077", 101 | "type": "github" 102 | }, 103 | "original": { 104 | "owner": "NixOS", 105 | "ref": "nixos-24.05", 106 | "repo": "nixpkgs", 107 | "type": "github" 108 | } 109 | }, 110 | "nixpkgs-release-staging": { 111 | "locked": { 112 | "lastModified": 1728865087, 113 | "narHash": "sha256-O0PMB926lB7I570TxGFsRVgLmlH54t6sEC7NwtZ6WGc=", 114 | "owner": "NixOS", 115 | "repo": "nixpkgs", 116 | "rev": "f31f95446863dc280d828563968386f3e4fa48d8", 117 | "type": "github" 118 | }, 119 | "original": { 120 | "owner": "NixOS", 121 | "ref": "staging-24.05", 122 | "repo": "nixpkgs", 123 | "type": "github" 124 | } 125 | }, 126 | "root": { 127 | "inputs": { 128 | "flake-parts": "flake-parts", 129 | "hercules-ci-effects": "hercules-ci-effects", 130 | "nixpkgs": [ 131 | "nixpkgs-master" 132 | ], 133 | "nixpkgs-master": "nixpkgs-master", 134 | "nixpkgs-nixos-unstable": "nixpkgs-nixos-unstable", 135 | "nixpkgs-nixpkgs-unstable": "nixpkgs-nixpkgs-unstable", 136 | "nixpkgs-release": "nixpkgs-release", 137 | "nixpkgs-release-staging": "nixpkgs-release-staging" 138 | } 139 | } 140 | }, 141 | "root": "root", 142 | "version": 7 143 | } 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nixpkgs-cuda-ci 2 | 3 | This project is discontinued in favour of the [CUDA-enabled Nixpkgs release in-tree](https://github.com/NixOS/nixpkgs/pull/324379), 4 | built on the ["community Hydra"](https://hydra.nix-community.org/jobset/nixpkgs/cuda) 5 | and cached at [nix-community.cachix.org](https://nix-community.org/cache/) 6 | within the nix-community infrastructure team's [effort](https://github.com/nix-community/infra/pull/1335). 7 | Nix-Community's infrastructure is funded via an [OpenCollective project](https://nix-community.org/open-collective): consider committing for a monthly donation to ensure its continuing availability. 8 | 9 | --- 10 | 11 | > # ORIGINAL DESCRIPTION 12 | > 13 | > 14 | > First, a word of warning: this is just a development repo that ought to be 15 | > replaced with something sustainable later. For an up-to-date information about 16 | > CUDA in nixpkgs seek in: 17 | > 18 | > - [#cuda:nixos.org](https://matrix.to/#/#cuda:nixos.org) 19 | > - https://nixos.wiki/wiki/CUDA 20 | > - https://nixos.org/manual/nixpkgs/unstable/#cuda 21 | > - [discourse.nixos.org](https://discourse.nixos.org/t/announcing-the-nixos-cuda-maintainers-team-and-a-call-for-maintainers/) 22 | > 23 | > With the above in mind, let's proceed. 24 | > 25 | > ## Latest warnings 26 | > 27 | > - 2024-08-15: As of https://github.com/SomeoneSerge/nixpkgs-cuda-ci/pull/33, 28 | > this repo no longer maintains any jobsets and consumes instead the new 29 | > `release-cuda.nix` maintained in Nixpkgs 30 | > - 2024-06-09: I had been having issues with the Hercules CI's "effects" queue 31 | > getting jammed, effectively shutting down the "flake-update" effect. The 32 | > effects were disabled and replaced with a flake-update github action, which 33 | > triggers HCI to rebuild the "default" job against the new master. Other jobs 34 | > may be at times be building stale nixpgs revisions... 35 | > This is all rather flaky and I haven't had time to debug this. 36 | > - 2023-03-05: Repo no longer tries to be a drop-in substitute for nixpkgs. We 37 | > just build. The flake is now used to track all nixpkgs branches (-> 38 | > flake.lock is much larger), and hercules CI's `onSchedule`, rather than a 39 | > GitHub workflow, is used to trigger builds. For a drop-in nixpkgs replacement 40 | > cf. [numtide/nixpkgs-unfree](https://github.com/numtide/nixpkgs-unfree) 41 | > 42 | > We build for different cuda architectures at a different frequencies, 43 | > which means that to make use of the cache you might need to import nixpkgs 44 | > as e.g. `import { ...; config.cudaCapabilities = [ "8.6" ]; }`. 45 | > Cf. the flake for details 46 | > 47 | > ## What is this 48 | > 49 | > - The repo is used to build and cache the [nixpkgs](https://github.com/NixOS/nixpkgs) 50 | > world with `cudaSupport = true`. 51 | > See the dashboard at: [https://hercules-ci.com/github/SomeoneSerge/nixpkgs-cuda-ci](https://hercules-ci.com/github/SomeoneSerge/nixpkgs-cuda-ci) 52 | > - This means you can use pre-built pytorch, tensorflow, jax and blender with Nix 53 | > - This also means that [we](https://github.com/orgs/NixOS/teams/cuda-maintainers) notice and can act when things break in development branches. 54 | > [We build](https://github.com/SomeoneSerge/nixpkgs-unfree/blob/7c716ccef51332e90777589c53265a09a3c0fbfa/.github/workflows/sync.yml#L14): 55 | > 56 | > - [`master`](https://github.com/NixOS/nixpkgs/tree/master/), 57 | > - [`nixos-unstable`](https://github.com/NixOS/nixpkgs/tree/nixos-unstable), 58 | > - [`nixpkgs-unstable`](https://github.com/NixOS/nixpkgs/tree/nixpkgs-unstable), 59 | > - and the last release, at the time of writing - `nixos-23.05` 60 | > 61 | > We might build different branches at different frequency. We also might 62 | > prioritize certain `cudaCapabilities`. 63 | > - The cachix is limited in space and has garbage collection on. This means that 64 | > you'd need to stay up-to-date to benefit from the cache (as we build newer 65 | > packages, the old cache is eventually discarded) 66 | > - The builds currently run on volunteers' machines. We plan to soon make and 67 | > maintain the exact list [on wiki](https://nixos.wiki/wiki/CUDA). Each machine 68 | > uses its own key to push the build results to cachix and these keys can be 69 | > revoked without breaking the whole chain. You consume just one public key 70 | > listed at https://cuda-maintainers.cachix.org/. The cachix `cuda-maintainers` 71 | > cache and cachix keys are currently managed by 72 | > [@samuela](https://github.com/samuela/). Our cachix space is courtesy of 73 | > @domenkozar. 74 | > 75 | > We hope one day to arrive at a more sustainable and trust-worthy solution, 76 | > but right now we're working on this as on a proof-of-concept. 77 | > 78 | > ## How to use 79 | > 80 | > - To use the cache, get [cachix](https://cachix.org/), and execute: 81 | > 82 | > ```bash 83 | > cachix use cuda-maintainers 84 | > ``` 85 | > - To use the cache on NixOS, check the following snippet for your `configuration.nix` module: 86 | > 87 | > ```nix 88 | > nix.binaryCachePublicKeys = [ 89 | > "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" 90 | > ]; 91 | > nix.binaryCaches = [ 92 | > "https://cuda-maintainers.cachix.org" 93 | > ]; 94 | > ``` 95 | > 96 | > Verify that the public key comes from https://cuda-maintainers.cachix.org 97 | > - You can also suggest the cache to users of your flake, with 98 | > 99 | > ```nix 100 | > # ... 101 | > 102 | > nixConfig = { 103 | > extra-substituters = [ 104 | > "https://cuda-maintainers.cachix.org" 105 | > ]; 106 | > extra-trusted-public-keys = [ 107 | > "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" 108 | > ]; 109 | > }; 110 | > 111 | > outputs = { ... }: { 112 | > # ... 113 | > }; 114 | > ``` 115 | > 116 | > When interacting with your flake, the users would be asked whether they want to use that cache and trust that key. 117 | > - The most consistent albeit most expensive way to use cuda-enabled packages 118 | > from nixpkgs is to import them with the global `config.cudaSupport`: 119 | > 120 | > ```nix 121 | > pkgs = import nixpkgs { config.allowUnfree = true; config.cudaSupport = true; } 122 | > ``` 123 | > 124 | > With that, `pkgs.python3Packages.jax`, `pkgs.python3Packages.pytorch`, etc evaluate into packages with cuda support. 125 | > - This flake attempts to play a drop-in replacement (rather, a proxy) for `nixpkgs`. 126 | > The following usages are expected to work: 127 | > 128 | > - Executing `nix run github:SomeoneSerge/nixpkgs-unfree/nixpkgs-unstable#blender` to run blender built with cuda-support 129 | > - Using in flake inputs: 130 | > 131 | > ```nix 132 | > inputs.nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable; 133 | > inputs.nixpkgs-unfree.url = github:SomeoneSerge/nixpkgs-unfree; 134 | > inputs.nixpkgs-unfree.inputs.nixpkgs.follows = "nixpkgs"; 135 | > ``` 136 | > - _DEPRECATED: Using in flake inputs as a drop-in replacement for nixpkgs (unless someone does something special)_ 137 | > 138 | > ```nix 139 | > inputs.nixpkgs.url = github:SomeoneSerge/nixpkgs-unfree/nixpkgs-unstable; 140 | > inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; 141 | > ``` 142 | > - _DEPRECATED: Importing as nixpkgs:_ 143 | > 144 | > ```nix 145 | > inputs.nixpkgs = github:SomeoneSerge/nixpkgs-unfree/nixpkgs-unstable; 146 | > outputs = { nixpkgs }: 147 | > let 148 | > system = "x86_64-linux"; 149 | > overlay = final: prev: { }; 150 | > pkgs = import nixpkgs { overlays = [ overlay ]; }; 151 | > in 152 | > { 153 | > # ... 154 | > } 155 | > ``` 156 | > 157 | > Note that if you pass `config` in the arguments, you must again include `cudaSupport` and `allowUnfree` 158 | > - _NOTE: Setting `` to point at this repo has proven a somewhat painful 159 | > experience. Most problems concentrate around tools using 160 | > `import `. There's a proxy in [./lib](./lib) right now which makes these import 161 | > work, but almost certainly at the cost of downloading a yet another copy of 162 | > nixpkgs..._ 163 | > - If you're only enabling the cache on a per-project or per-user basis, you might need to set `trusted-users = ${yourName}` in `/etc/nix/nix.conf`. 164 | --------------------------------------------------------------------------------