From 5cedeec18c51c5dec8a7c3e750dedb8a5fea7a94 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 18:37:34 +0200 Subject: [PATCH 1/7] pkgs/den-http-get-updater: support list to prefetch --- inputs.nix | 48 ++++++----- .../de/den-http-get-updater/package.nix | 85 ++++++++++++++----- 2 files changed, 90 insertions(+), 43 deletions(-) diff --git a/inputs.nix b/inputs.nix index 1c6c039..78f008c 100644 --- a/inputs.nix +++ b/inputs.nix @@ -10,14 +10,16 @@ let self = { url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixos-vscode-server.sha256; previousVersion = lock.nixos-vscode-server.revision; versionUrl = "https://api.github.com/repos/nix-community/nixos-vscode-server/commits"; contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixos-vscode-server.url"; - }; + prefetchList = [{ + previousHash = lock.nixos-vscode-server.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixos-vscode-server.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -29,13 +31,15 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixpkgs.sha256; previousVersion = lock.nixpkgs.revision; versionUrl = "https://channels.nixos.org/nixos-24.11/git-revision"; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixpkgs.url"; - }; + prefetchList = [{ + previousHash = lock.nixpkgs.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -47,13 +51,15 @@ let self = { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.nixpkgs-unstable.sha256; previousVersion = lock.nixpkgs-unstable.revision; versionUrl = "https://channels.nixos.org/nixos-unstable/git-revision"; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "nixpkgs-unstable.url"; - }; + prefetchList = [{ + previousHash = lock.nixpkgs-unstable.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "nixpkgs-unstable.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; @@ -65,14 +71,16 @@ let self = { url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; updateScript = pkgs.den-http-get-updater { fileLocation = lockFile; - previousHash = lock.cosmic-modules.sha256; previousVersion = lock.cosmic-modules.revision; versionUrl = "https://api.github.com/repos/lilyinstarlight/nixos-cosmic/commits"; contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\""; - prefetchUrlLocation = { - file = ./inputs.nix; - attrpath = "cosmic-modules.url"; - }; + prefetchList = [{ + previousHash = lock.cosmic-modules.sha256; + prefetchUrlLocation = { + file = ./inputs.nix; + attrpath = "cosmic-modules.url"; + }; + }]; }; outPath = builtins.fetchTarball { inherit url; diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index d22b0ac..939c18f 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -11,10 +11,20 @@ { # location of file to modify fileLocation, - previousHash, previousVersion, versionUrl, - prefetchUrlLocation ? null, + + # { + # fileLocation: string?; + # previousHash: string; + # prefetchUrlLocation: { + # file: string; + # attrpath: string[]' + # }; + # }[] + # + prefetchList ? [], + # change newVersion variable in it, if the contents of the page # is not plaintext version # (json for example) @@ -24,23 +34,30 @@ name ? if unpack then "source" else null, }: -assert builtins.isNull prefetchUrlLocation || lib.isAttrs prefetchUrlLocation; -assert lib.isAttrs prefetchUrlLocation && ( - lib.isString prefetchUrlLocation.file or null || - lib.isPath prefetchUrlLocation.file or null -); -assert lib.isAttrs prefetchUrlLocation && lib.isString prefetchUrlLocation.attrpath or null; - let realFileLocation = builtins.toString fileLocation; - mark = builtins.hashString "sha256" previousHash; - mark' = lib.escapeShellArg mark; - prefetchUrlLocation' = lib.mapAttrs (_: lib.escapeShellArg) prefetchUrlLocation; + prefetchList' = lib.map (x: + assert builtins.isNull x.prefetchUrlLocation || lib.isAttrs x.prefetchUrlLocation; + assert lib.isAttrs x.prefetchUrlLocation && ( + lib.isString x.prefetchUrlLocation.file or null || + lib.isPath x.prefetchUrlLocation.file or null + ); + assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; + rec { + inherit fileLocation; + mark = builtins.hashString "sha256" x.previousHash; + markShellEscape = lib.escapeShellArg mark; + markShellRegexEscape = lib.escapeShellArg (lib.escapeRegex mark); + realFileLocation = builtins.toString x.fileLocation or fileLocation; + realFileLocationShellEscape = lib.escapeShellArg realFileLocation; + prefetchUrlLocationShellEscape = lib.mapAttrs (_: lib.escapeShellArg) x.prefetchUrlLocation; + previousHashShellRegexEscape = lib.escapeShellArg (lib.escapeRegex x.previousHash); + } // x) prefetchList; + realFileLocation' = lib.escapeShellArg realFileLocation; versionUrl' = lib.escapeShellArg versionUrl; - mark'' = lib.escapeShellArg (lib.escapeRegex mark); previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion); nixUnpack = lib.optionalString unpack "--unpack"; @@ -56,6 +73,7 @@ in writeScript "den-http-get-updater" ('' PATH="${lib.escapeShellArg path}" + prefetchFailed= newVersion=$(curl -L "${versionUrl'}") if [[ "$?" != 0 ]]; then @@ -63,15 +81,30 @@ writeScript "den-http-get-updater" ('' exit 1 fi newVersion=$(${contentParser}) - awk -i inplace "{ - sub(/${previousVersion''}/, \"$newVersion\") - # invalidate hash - sub(/${previousHash}/, \"${mark'}\") - }1" "${realFileLocation'}" -'' + lib.optionalString (!builtins.isNull prefetchUrlLocation) '' + awk -i inplace "{ sub(/${previousVersion''}/, \"$newVersion\") }1" "${realFileLocation'}" +'' + +# invalidate hashes ++ lib.concatStringsSep "\n" (lib.map ({ + markShellEscape, + previousHash, + previousHashShellRegexEscape, + realFileLocationShellEscape, + ... +}: '' + awk -i inplace "{ sub(/${previousHashShellRegexEscape}/, \"${markShellEscape}\") }1" "${realFileLocationShellEscape}" +'') prefetchList') + ++ lib.concatStringsSep "\n" (lib.map ({ + fileLocation, + markShellRegexEscape, + prefetchUrlLocationShellEscape, + realFileLocationShellEscape, + ... +}: '' nixUrlsResult=$(nix-instantiate --eval --json \ - "${prefetchUrlLocation'.file}" \ - -A "${prefetchUrlLocation'.attrpath}" + "${prefetchUrlLocationShellEscape.file}" \ + -A "${prefetchUrlLocationShellEscape.attrpath}" ) urlsType=$(jq -rc 'type' <<< "$nixUrlsResult") @@ -93,14 +126,20 @@ writeScript "den-http-get-updater" ('' echo "prefetch succeeded!" echo "hash: $expectedHash" awk -i inplace "{ - sub(/${mark''}/, \"$expectedHash\") - }1" "${realFileLocation'}" + sub(/${markShellRegexEscape}/, \"$expectedHash\") + }1" "${realFileLocationShellEscape}" prefetchSucceeded= break fi done if [[ -n "$prefetchSucceeded" ]]; then echo "warning: prefetch failed" 1>&2 + prefetchFailed=1 + fi +'') (lib.filter (x: !builtins.isNull x.prefetchUrlLocation) prefetchList')) + ++ '' + if [[ -n "$prefetchFailed" ]]; then exit 1 fi '') From 1ade7631610309eae7fb4a4e60ef2cb2fabdc85d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 19:41:27 +0200 Subject: [PATCH 2/7] pkgs/den-http-get-updater: add extraPackages argument useful for contentParser argument --- pkgs/by-name/de/den-http-get-updater/package.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index 939c18f..fe71697 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -25,6 +25,9 @@ # prefetchList ? [], + # extra packages to add to the path + extraPackages ? [], + # change newVersion variable in it, if the contents of the page # is not plaintext version # (json for example) @@ -63,12 +66,12 @@ let nixUnpack = lib.optionalString unpack "--unpack"; nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; - path = lib.makeBinPath [ + path = lib.makeBinPath ([ curl gawk jq nix - ]; + ] ++ extraPackages); in writeScript "den-http-get-updater" ('' From a361d016834af6ff64c02980eb2b51cd671579c6 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 19:42:09 +0200 Subject: [PATCH 3/7] pkgs/den-http-get-updater: use strict evaluation --- pkgs/by-name/de/den-http-get-updater/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index fe71697..c9dc96d 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -105,7 +105,7 @@ writeScript "den-http-get-updater" ('' realFileLocationShellEscape, ... }: '' - nixUrlsResult=$(nix-instantiate --eval --json \ + nixUrlsResult=$(nix-instantiate --eval --json --strict \ "${prefetchUrlLocationShellEscape.file}" \ -A "${prefetchUrlLocationShellEscape.attrpath}" ) From 890260024f26a183597394336e2c786ecb674a0e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:06:21 +0200 Subject: [PATCH 4/7] pkgs/den-http-get-updater: use sed instead of awk --- .../de/den-http-get-updater/package.nix | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index c9dc96d..7a00d66 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -2,7 +2,7 @@ lib, curl, - gawk, + gnused, jq, nix, writeScript, @@ -50,25 +50,24 @@ let rec { inherit fileLocation; mark = builtins.hashString "sha256" x.previousHash; - markShellEscape = lib.escapeShellArg mark; - markShellRegexEscape = lib.escapeShellArg (lib.escapeRegex mark); + markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; realFileLocationShellEscape = lib.escapeShellArg realFileLocation; prefetchUrlLocationShellEscape = lib.mapAttrs (_: lib.escapeShellArg) x.prefetchUrlLocation; - previousHashShellRegexEscape = lib.escapeShellArg (lib.escapeRegex x.previousHash); + previousHashRegexEscape = lib.escapeRegex x.previousHash; } // x) prefetchList; - realFileLocation' = lib.escapeShellArg realFileLocation; - versionUrl' = lib.escapeShellArg versionUrl; + realFileLocationShellEscape = lib.escapeShellArg realFileLocation; + versionUrlShellEscape = lib.escapeShellArg versionUrl; - previousVersion'' = lib.escapeShellArg (lib.escapeRegex previousVersion); + previousVersionRegexEscape = lib.escapeRegex previousVersion; nixUnpack = lib.optionalString unpack "--unpack"; nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; path = lib.makeBinPath ([ curl - gawk + gnused jq nix ] ++ extraPackages); @@ -78,29 +77,29 @@ writeScript "den-http-get-updater" ('' PATH="${lib.escapeShellArg path}" prefetchFailed= - newVersion=$(curl -L "${versionUrl'}") + newVersion=$(curl -L "${versionUrlShellEscape}") if [[ "$?" != 0 ]]; then echo "error: fetching new version failed" 1>&2 exit 1 fi newVersion=$(${contentParser}) - awk -i inplace "{ sub(/${previousVersion''}/, \"$newVersion\") }1" "${realFileLocation'}" + sed -Ei "s!${previousVersionRegexEscape}!$newVersion!g" "${realFileLocationShellEscape}" '' # invalidate hashes + lib.concatStringsSep "\n" (lib.map ({ - markShellEscape, + mark, previousHash, - previousHashShellRegexEscape, + previousHashRegexEscape, realFileLocationShellEscape, ... }: '' - awk -i inplace "{ sub(/${previousHashShellRegexEscape}/, \"${markShellEscape}\") }1" "${realFileLocationShellEscape}" + sed -Ei "s!${previousHashRegexEscape}!${mark}!g" "${realFileLocationShellEscape}" '') prefetchList') + lib.concatStringsSep "\n" (lib.map ({ fileLocation, - markShellRegexEscape, + markRegexEscape, prefetchUrlLocationShellEscape, realFileLocationShellEscape, ... @@ -128,9 +127,7 @@ writeScript "den-http-get-updater" ('' if [[ -n $expectedHash ]]; then echo "prefetch succeeded!" echo "hash: $expectedHash" - awk -i inplace "{ - sub(/${markShellRegexEscape}/, \"$expectedHash\") - }1" "${realFileLocationShellEscape}" + sed -Ei "s!${markRegexEscape}!$expectedHash!g" "${realFileLocationShellEscape}" prefetchSucceeded= break fi From 517ca95d8d0f775af33cfcb10c7f8784f548c2a2 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:16:20 +0200 Subject: [PATCH 5/7] pkgs/den-http-get-updater: support providing target hash --- pkgs/by-name/de/den-http-get-updater/package.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index 7a00d66..b6ba547 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -21,6 +21,8 @@ # file: string; # attrpath: string[]' # }; + # prefetchHash: string?; + # targetHash: string?; # }[] # prefetchList ? [], @@ -34,6 +36,8 @@ contentParser ? "echo \"$newVersion\"", unpack ? true, + hashAlgo ? "sha256", + hashFormat ? "sri", name ? if unpack then "source" else null, }: @@ -48,7 +52,7 @@ let ); assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; rec { - inherit fileLocation; + inherit fileLocation hashAlgo hashFormat; mark = builtins.hashString "sha256" x.previousHash; markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; @@ -123,7 +127,12 @@ writeScript "den-http-get-updater" ('' prefetchSucceeded=1 for url in "''${prefetchUrls[@]}"; do echo "trying prefetch '$url'..."; - expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName}) + expectedHash=$(nix-prefetch-url "$url" ${nixUnpack} ${nixName} --type "${hashAlgo}") + expectedHash=$(nix --extra-experimental-features "nix-command" hash convert \ + --hash-algo "${hashAlgo}" \ + --to "${hashFormat}" \ + "$expectedHash" + ) if [[ -n $expectedHash ]]; then echo "prefetch succeeded!" echo "hash: $expectedHash" From 735a41ca0fd13a2b32e6c14a356163c05351193d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:42:19 +0200 Subject: [PATCH 6/7] pkgs/den-http-get-updater: allow to provide unpack and name argument per prefetch --- pkgs/by-name/de/den-http-get-updater/package.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/de/den-http-get-updater/package.nix b/pkgs/by-name/de/den-http-get-updater/package.nix index b6ba547..484fa35 100644 --- a/pkgs/by-name/de/den-http-get-updater/package.nix +++ b/pkgs/by-name/de/den-http-get-updater/package.nix @@ -23,6 +23,8 @@ # }; # prefetchHash: string?; # targetHash: string?; + # unpack: bool?; + # name: string?; # }[] # prefetchList ? [], @@ -38,7 +40,6 @@ unpack ? true, hashAlgo ? "sha256", hashFormat ? "sri", - name ? if unpack then "source" else null, }: let @@ -52,7 +53,8 @@ let ); assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null; rec { - inherit fileLocation hashAlgo hashFormat; + inherit fileLocation hashAlgo hashFormat unpack; + name = if x.unpack or unpack then "source" else null; mark = builtins.hashString "sha256" x.previousHash; markRegexEscape = lib.escapeRegex mark; realFileLocation = builtins.toString x.fileLocation or fileLocation; @@ -66,8 +68,6 @@ let previousVersionRegexEscape = lib.escapeRegex previousVersion; - nixUnpack = lib.optionalString unpack "--unpack"; - nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; path = lib.makeBinPath ([ curl @@ -104,10 +104,15 @@ writeScript "den-http-get-updater" ('' + lib.concatStringsSep "\n" (lib.map ({ fileLocation, markRegexEscape, + name, prefetchUrlLocationShellEscape, realFileLocationShellEscape, + unpack, ... -}: '' +}: let + nixUnpack = lib.optionalString unpack "--unpack"; + nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\""; +in '' nixUrlsResult=$(nix-instantiate --eval --json --strict \ "${prefetchUrlLocationShellEscape.file}" \ -A "${prefetchUrlLocationShellEscape.attrpath}" From 5bddee458869053b44fc46137c98d780de4dde26 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 7 Apr 2025 21:56:41 +0200 Subject: [PATCH 7/7] nixos/nvidia: add updater for the driver package --- nix-os/nvidia.nix | 89 ++++++++++++++++++++++++++++++++++++++++++----- update-list.nix | 23 ++++++++++++ 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/nix-os/nvidia.nix b/nix-os/nvidia.nix index a9433f3..5da8b1d 100644 --- a/nix-os/nvidia.nix +++ b/nix-os/nvidia.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + self, + ... +}: { config = { @@ -16,14 +22,79 @@ powerManagement.enable = true; open = false; nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "570.133.07"; - sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; - sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; - openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; - settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; - persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; - }; + package = let + mkDriverArgs = { + version = "570.133.07"; + sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY="; + sha256_aarch64 = "sha256-yTovUno/1TkakemRlNpNB91U+V04ACTMwPEhDok7jI0="; + openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM="; + settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU="; + persistencedSha256 = "sha256-G1V7JtHQbfnSRfVjz/LE2fYTlh9okpCbE4dfX9oYSg8="; + }; + in ( config.boot.kernelPackages.nvidiaPackages.mkDriver mkDriverArgs ).overrideAttrs (super: { + passthru = super.passthru or {} // { + urls = { + x86_64 = [ + "https://download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run" + "https://us.download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run" + ]; + aarch64 = [ + "https://us.download.nvidia.com/XFree86/aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run" + "https://download.nvidia.com/XFree86/Linux-aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run" + ]; + }; + updateScript = pkgs.den-http-get-updater { + fileLocation = ( builtins.unsafeGetAttrPos "any" { any = null; } ).file; + previousVersion = mkDriverArgs.version; + versionUrl = "https://raw.githubusercontent.com/aaronp24/nvidia-versions/master/nvidia-versions.txt"; + extraPackages = with pkgs; [ + coreutils + gawk + gnugrep + ]; + contentParser = lib.concatStringsSep " | " [ + "echo \"$newVersion\"" + "grep current" + "awk '{print $3}'" + "sort -V" + "tail -n 1" + ]; + unpack = false; + prefetchList = lib.map (x: { + inherit (x) previousHash; + unpack = x.unpack or true; + prefetchUrlLocation = { + file = builtins.toString self + "/outputs.nix"; + # TODO: don't use already existing NixOS configuration + attrpath = "nixosConfigurations.main.config.hardware.nvidia.package.${x.locationAttrpath}"; + }; + }) [ + { + previousHash = mkDriverArgs.sha256_64bit; + locationAttrpath = "urls.x86_64"; + unpack = false; + } + { + previousHash = mkDriverArgs.sha256_aarch64; + locationAttrpath = "urls.aarch64"; + unpack = false; + } + { + previousHash = mkDriverArgs.openSha256; + locationAttrpath = "open.src.urls"; + } + { + previousHash = mkDriverArgs.settingsSha256; + locationAttrpath = "settings.src.urls"; + } + { + previousHash = mkDriverArgs.persistencedSha256; + locationAttrpath = "persistenced.src.urls"; + } + ]; + }; + }; + }); }; nixpkgs.config.nvidia.acceptLicense = true; }; diff --git a/update-list.nix b/update-list.nix index 9ce74c3..eaaa200 100644 --- a/update-list.nix +++ b/update-list.nix @@ -11,3 +11,26 @@ in { "inputs/cosmic-modules" = inputsWithPackages.cosmic-modules; "inputs/nixos-vscode-server" = inputsWithPackages.nixos-vscode-server; }) + +# MARK: NixOS modules +// ( let + pkgs = self.modifiedNixpkgsPure { + localSystem = builtins.currentSystem; + config.allowUnfree = true; + }; + lib = pkgs.lib; + mkUpdater = path: attrpath: extraModule: let + system = pkgs.nixos { + imports = [ path extraModule ]; + config = { + _module.args = { + inherit self; + inherit (self) inputs; + }; + system.stateVersion = lib.versions.pad 2 lib.trivial.verison; + }; + }; + in lib.getAttrFromPath ( [ "config" ] ++ attrpath ) system; +in { + "NixOS/nvidia" = mkUpdater ./nix-os/nvidia.nix [ "hardware" "nvidia" "package" ] {}; +})