Add nix flake

This commit is contained in:
Junji Hashimoto 2023-08-22 11:56:51 +09:00
parent 6094e71f5b
commit 06ad4919c5
2 changed files with 114 additions and 0 deletions

77
flake.lock Normal file
View File

@ -0,0 +1,77 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1692351612,
"narHash": "sha256-KTGonidcdaLadRnv9KFgwSMh1ZbXoR/OBmPjeNMhFwU=",
"owner": "nix-community",
"repo": "naersk",
"rev": "78789c30d64dea2396c9da516bbcc8db3a475207",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692557222,
"narHash": "sha256-TCOtZaioLf/jTEgfa+nyg0Nwq5Uc610Z+OFV75yUgGw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0b07d4957ee1bd7fd3bdfd12db5f361bd70175a6",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1692557222,
"narHash": "sha256-TCOtZaioLf/jTEgfa+nyg0Nwq5Uc610Z+OFV75yUgGw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0b07d4957ee1bd7fd3bdfd12db5f361bd70175a6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View File

@ -0,0 +1,37 @@
{
description = "Tokenizers";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
naersk.url = "github:nix-community/naersk";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, naersk, ... }:
let systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
in {
packages = forAllSystems (system:
let pkgs = import nixpkgs {
overlays = [
overlay
naersk.overlay
];
inherit system;
};
overlay = final: prev: {
tokenizersPackages = import ./nix/rust.nix {
inherit pkgs;
stdenv = pkgs.stdenv;
};
};
in {
tokenizers = pkgs.tokenizersPackages.tokenizers;
tokenizers-haskell = pkgs.tokenizersPackages.tokenizers-haskell;
}
);
defaultPackage = forAllSystems (system: self.packages.${system}.tokenizers-haskell);
# lib = pkgs;
};
}