From ebdf050743bfac25a08944b2a348327909371ce2 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 18 Mar 2024 16:56:54 -0500 Subject: [PATCH] build: add nix flake --- .gitignore | 2 ++ nix/flake.lock | 27 +++++++++++++++++++++++++++ nix/flake.nix | 32 ++++++++++++++++++++++++++++++++ nix/lock.json | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 nix/flake.lock create mode 100644 nix/flake.nix create mode 100644 nix/lock.json diff --git a/.gitignore b/.gitignore index c0ed70c..42a7e95 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ src/nim.cfg nimbledeps nimble.develop nimble.paths + +result diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..535b53e --- /dev/null +++ b/nix/flake.lock @@ -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 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..f4ebcf3 --- /dev/null +++ b/nix/flake.nix @@ -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; + } + ); + }; +} diff --git a/nix/lock.json b/nix/lock.json new file mode 100644 index 0000000..674b5fe --- /dev/null +++ b/nix/lock.json @@ -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" + ] + } + ] +}