Initial commit

This commit is contained in:
soup 2024-10-27 12:02:43 -04:00
commit 958007079a
No known key found for this signature in database
3 changed files with 110 additions and 0 deletions

58
flake.lock Normal file
View file

@ -0,0 +1,58 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725930920,
"narHash": "sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM=",
"path": "/nix/store/20yis5w6g397plssim663hqxdiiah2wr-source",
"rev": "44a71ff39c182edaf25a7ace5c9454e7cba2c658",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

32
flake.nix Normal file
View file

@ -0,0 +1,32 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs";
};
outputs = inputs:
let lib = import ./lib.nix;
in
inputs.flake-utils.lib.eachDefaultSystem (system:
let
nixpkgs = inputs.nixpkgs.legacyPackages.${system};
versions = [
["2.0.3" "sha256-++wvqD6TunG47jp2SKW+clGOJ6Sy9CnEu2e6AgKP1X0="]
["2.0.0" "sha256-WQ4B0sT3qTVl4/Moj0FcFg5LDZIBPbnmcfUxwrmFyYY="]
["1.46.3" "sha256-vnDzegjO7XFqBj3dZ1T4TZfuFr3Ur2f4/2zlFUQUwSI="]
];
packages = builtins.listToAttrs (builtins.map (l:
let
version = builtins.elemAt l 0;
zipHash = builtins.elemAt l 1;
in {
name = "deno-${builtins.replaceStrings ["."] ["_"] version}";
value = lib.mkDeno { inherit version zipHash nixpkgs; };
}
) versions);
in { packages = packages // {
deno-latest = packages.deno-2_0_3;
};
});
}

20
lib.nix Normal file
View file

@ -0,0 +1,20 @@
{
mkDeno = { version, zipHash, nixpkgs }:
let url = "https://github.com/denoland/deno/releases/download/v${version}/deno-x86_64-unknown-linux-gnu.zip";
in nixpkgs.stdenv.mkDerivation {
inherit version;
pname = "deno";
src = nixpkgs.fetchzip { inherit url; hash = zipHash; };
nativeBuildInputs = with nixpkgs; [ autoPatchelfHook libgcc ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp $src/deno $out/bin/deno
runHook postInstall
'';
};
}