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 81b0658
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/nvidia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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: |
old="$(sha256sum flake.lock)"
nix flake update nixpkgs-new
new="$(sha256sum flake.lock)"
if [ "$old" != "$new" ]; then
export NIXPKGS_ALLOW_UNFREE=1
nix run -L --impure .#nvidia
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.

32 changes: 31 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,33 @@
| cachix push 42loco42
'';
};

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

paths = pipe targets [
(pkgs.linkFarmFromDrvs "nvidia")
(x: pipe x [
builtins.readDir
builtins.attrNames
(map (n: x + "/" + n))
(builtins.concatStringsSep " ")
])
];
in
pkgs.writeShellApplication {
name = "nvidia";
runtimeInputs = with pkgs; [ cachix ];
text = ''
cachix push 42loco42 ${paths}
'';
};
}
];
}

0 comments on commit 81b0658

Please sign in to comment.