build: add nix flake

This commit is contained in:
Daylin Morgan 2024-03-18 16:56:54 -05:00
parent e58307358d
commit ebdf050743
Signed by: daylin
GPG key ID: 950D13E9719334AD
4 changed files with 101 additions and 0 deletions

2
.gitignore vendored
View file

@ -10,3 +10,5 @@ src/nim.cfg
nimbledeps
nimble.develop
nimble.paths
result

27
nix/flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1710765496,
"narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

32
nix/flake.nix Normal file
View file

@ -0,0 +1,32 @@
{
description = "tsm";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {
self,
nixpkgs,
}: let
inherit (nixpkgs.lib) genAttrs;
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system});
in {
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [ nim nimble ];
};
});
packages = forAllSystems (
pkgs: {
tsm = pkgs.buildNimPackage {
pname = "tsm";
version = "2024.1001";
src = ../.;
lockFile = ./lock.json;
};
default = self.packages.${pkgs.system}.tsm;
}
);
};
}

40
nix/lock.json Normal file
View file

@ -0,0 +1,40 @@
{
"depends": [
{
"method": "fetchzip",
"path": "/nix/store/x91md8lmrxxdd4xizg0r9gcbl8sqn8vk-source",
"rev": "6ba6045038a01d1855208c4a9be7d4826d774001",
"sha256": "13hrcvpynlyr8hqx1h6qkfd32ihg255yd8wmk6l4q6bmiw8frw09",
"srcDir": "",
"url": "https://github.com/inv2004/illwill/archive/6ba6045038a01d1855208c4a9be7d4826d774001.tar.gz",
"subDir": "",
"packages": [
"illwill"
]
},
{
"method": "fetchzip",
"path": "/nix/store/4h59kkd5db97j5m92szryjydxyr9bnwg-source",
"rev": "4193f802796f15559c81c6dd56724d6f20345917",
"sha256": "04w4hy5zbcmp173jx72b89jk9l7rnpqv9d3cgs8lwmfcagjac7zz",
"srcDir": "",
"url": "https://github.com/c-blake/cligen/archive/4193f802796f15559c81c6dd56724d6f20345917.tar.gz",
"subDir": "",
"packages": [
"cligen"
]
},
{
"method": "fetchzip",
"path": "/nix/store/8ilhirvpc8qi3jbbh1fi3a8psr780cz4-source",
"rev": "a7eb31407d50bb773bebc8b590ae25fa5af1bbec",
"sha256": "06s4198pbqjga7nqrvajyxqxx3df83fk3qn21pv7axshl19kh9bq",
"srcDir": "src",
"url": "https://github.com/daylinmorgan/bbansi/archive/a7eb31407d50bb773bebc8b590ae25fa5af1bbec.tar.gz",
"subDir": "",
"packages": [
"bbansi"
]
}
]
}