diff --git a/inputs.nix b/inputs.nix index 1979433..1c6c039 100644 --- a/inputs.nix +++ b/inputs.nix @@ -1,29 +1,84 @@ let self = { - lock ? import ./lock.nix -, lib ? import "${(self {}).nixpkgs}/lib" + lock ? import lockFile, + lockFile ? ./lock.nix, + pkgs ? throw "inputs called without pkgs", }: { inherit lock; - nixos-vscode-server = builtins.fetchTarball { - name = "nixos-vscode-server"; + nixos-vscode-server = rec { url = "https://github.com/nix-community/nixos-vscode-server/archive/${lock.nixos-vscode-server.revision}.tar.gz"; - sha256 = "${lock.nixos-vscode-server.sha256}"; + 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"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixos-vscode-server"; + sha256 = "${lock.nixos-vscode-server.sha256}"; + }; }; - nixpkgs = builtins.fetchTarball { - name = "nixpkgs"; + nixpkgs = rec { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs.revision}.tar.gz"; - sha256 = "${lock.nixpkgs.sha256}"; + 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"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixpkgs"; + sha256 = "${lock.nixpkgs.sha256}"; + }; }; - nixpkgs-unstable = builtins.fetchTarball { - name = "nixpkgs-unstable"; + nixpkgs-unstable = rec { url = "https://github.com/NixOS/nixpkgs/archive/${lock.nixpkgs-unstable.revision}.tar.gz"; - sha256 = "${lock.nixpkgs-unstable.sha256}"; + 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"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "nixpkgs-unstable"; + sha256 = "${lock.nixpkgs-unstable.sha256}"; + }; }; - cosmic-modules = builtins.fetchTarball { - name = "cosmic-modules"; + cosmic-modules = rec { url = "https://github.com/lilyinstarlight/nixos-cosmic/archive/${lock.cosmic-modules.revision}.tar.gz"; - sha256 = "${lock.cosmic-modules.sha256}"; + 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"; + }; + }; + outPath = builtins.fetchTarball { + inherit url; + name = "cosmic-modules"; + sha256 = "${lock.cosmic-modules.sha256}"; + }; }; }; in self