From 15e5cf6933a319503697f53d287e817fcafe7949 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 5 Sep 2024 13:17:50 -0500 Subject: [PATCH] chore: use nim2nix on nix --- nix/flake.lock | 43 ++++++++++++++++++++++++++++++++---- nix/flake.nix | 59 +++++++++++++++++++++++++++++++++----------------- nix/lock.json | 52 -------------------------------------------- 3 files changed, 78 insertions(+), 76 deletions(-) delete mode 100644 nix/lock.json diff --git a/nix/flake.lock b/nix/flake.lock index 535b53e..f146d5d 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -1,12 +1,46 @@ { "nodes": { + "nim2nix": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1725469705, + "narHash": "sha256-4/iSUwB3XKmybdt4R87VhBPiD3z4BL6RrD9LyrrkesM=", + "owner": "daylinmorgan", + "repo": "nim2nix", + "rev": "42af12ca45025c7146bc24e27f5d8b65b003d663", + "type": "github" + }, + "original": { + "owner": "daylinmorgan", + "repo": "nim2nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1710765496, - "narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=", + "lastModified": 1724479785, + "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7", + "rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1725369773, + "narHash": "sha256-gT+rUDbw+TQuszQEzMUJWTW7QYtccZ5xxWmKOSrPvEw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8b4061fd60ccc3b3f44b73faa7c983eacf7a6f7b", "type": "github" }, "original": { @@ -18,7 +52,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nim2nix": "nim2nix", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/nix/flake.nix b/nix/flake.nix index f4ebcf3..194a689 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -2,31 +2,50 @@ description = "tsm"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nim2nix.url = "github:daylinmorgan/nim2nix"; }; - 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 { + outputs = + { + self, + nixpkgs, + nim2nix, + }: + let + inherit (nixpkgs.lib) genAttrs; + supportedSystems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + forAllSystems = + f: + genAttrs supportedSystems ( + system: + f (import nixpkgs { + inherit system; + overlays = [nim2nix.overlays.default]; + } + )); + in + { + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ + nim + nimble + ]; + }; + }); + packages = forAllSystems (pkgs: { + tsm = pkgs.buildNimblePackage { pname = "tsm"; version = "2024.1001"; src = ../.; - lockFile = ./lock.json; + nimbleDepsHash = "sha256-1J0Wt/XjFiSN1MTfgg9tE5dY3GnXH/UgG3zCL19GgpU="; }; default = self.packages.${pkgs.system}.tsm; - } - ); - }; + }); + }; } diff --git a/nix/lock.json b/nix/lock.json deleted file mode 100644 index 4f400fd..0000000 --- a/nix/lock.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "depends": [ - { - "method": "fetchzip", - "path": "/nix/store/k3sxzm7qnkgnwkrfd8hc3gkwzbayb1h1-source", - "rev": "99a120f7f69868b94f5d35ce7e21dd12535de70c", - "sha256": "0hiic5yjsaw6sgl1jzmfpm5g6a5ckzmd29c3pzg30glchn2g94sk", - "srcDir": "", - "url": "https://github.com/johnnovak/illwill/archive/99a120f7f69868b94f5d35ce7e21dd12535de70c.tar.gz", - "subDir": "", - "packages": [ - "illwill" - ] - }, - { - "method": "fetchzip", - "path": "/nix/store/pgajs406yg0ffw099np6fca3psf8zlvr-source", - "rev": "25574d165bb7f60900b36590bc49f3d90e47cea4", - "sha256": "0qf162bagcgnxjsjpg560cz6kdshhsyrkzq3j471a8pxrhwp608i", - "srcDir": "src", - "url": "https://github.com/usu-dev/usu-nim/archive/25574d165bb7f60900b36590bc49f3d90e47cea4.tar.gz", - "subDir": "", - "packages": [ - "usu" - ] - }, - { - "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/ws9bc49njd13lzlankiw9vz85h56n0sn-source", - "rev": "9a85d9ed028f06f1ed1ee6851480a51408a6004e", - "sha256": "04r9wincqd4a5hmxixbsw0zjpvlrpckny4jkzahvbnh8s5f1xlc6", - "srcDir": "src", - "url": "https://github.com/daylinmorgan/bbansi/archive/9a85d9ed028f06f1ed1ee6851480a51408a6004e.tar.gz", - "subDir": "", - "packages": [ - "bbansi" - ] - } - ] -} \ No newline at end of file