Skip to content

Commit

Permalink
Add automatic NVIDIA package builder
Browse files Browse the repository at this point in the history
  • Loading branch information
42LoCo42 committed May 21, 2024
1 parent c457896 commit f0499cd
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/nvidia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build NVIDIA stuff every day at 3:00

on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *"

jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install Nix
uses: cachix/install-nix-action@v25
with:
extra_nix_config: |
substituters = https://42loco42.cachix.org https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= 42loco42.cachix.org-1:6HvWFER3RdTSqEZDznqahkqaoI6QCOiX2gRpMMsThiQ=
- name: Update, build, push
run: |
set -euo pipefail
old="$(sha256sum flake.lock)"
nix flake update nixpkgs-new
new="$(sha256sum flake.lock)"
if [ "$old" != "$new" ]; then
export NIXPKGS_ALLOW_UNFREE=1
nix build \
--impure \
--no-link \
--print-out-paths \
.#nvidia \
| cachix push 42loco42
fi
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Commit flake updates
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Automatic update of nixpkgs-new"
25 changes: 22 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

# nsc.url = "github:snowfallorg/nix-software-center";
# nsc.inputs.nixpkgs.follows = "nixpkgs";

nixpkgs.url = "github:nixos/nixpkgs/a0c9e3aee1000ac2bfb0e5b98c94c946a5d180a9";
nixpkgs-new.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};

outputs = { self, nixpkgs }:
outputs = { self, nixpkgs, nixpkgs-new }:
let
inherit (nixpkgs.lib) mapAttrsToList pipe recursiveUpdate;

Expand Down Expand Up @@ -173,6 +176,17 @@
| cachix push 42loco42
'';
};

nvidia =
let
targets = with (import nixpkgs-new { inherit (pkgs) system; }); [
linuxPackages.nvidiaPackages.stable
nvtopPackages.nvidia
linuxPackages.nvidiaPackages.stable.persistenced
linuxPackages.nvidiaPackages.stable.settings
];
in
pkgs.linkFarmFromDrvs "nvidia" targets;
}
];
}

0 comments on commit f0499cd

Please sign in to comment.