From 5feac28066441a40570e8213fd28a8be4a8db18b Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Mon, 19 Feb 2024 23:18:59 +0100 Subject: [PATCH] Update flake inputs; move to buildNimPackage --- flake.lock | 71 ++++++++++++++---------------------------------------- flake.nix | 37 ++++------------------------ lock.json | 40 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 85 deletions(-) create mode 100644 lock.json diff --git a/flake.lock b/flake.lock index 4b7457b..720dd09 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -15,46 +18,13 @@ "type": "github" } }, - "lscolors": { - "flake": false, - "locked": { - "lastModified": 1583438517, - "narHash": "sha256-xFnP0VPVQIszR2tYFjcR1q2OmG70mFX91o5RQyCGRhQ=", - "owner": "joachimschmidt557", - "repo": "nim-lscolors", - "rev": "668b46c835944254a445b9cc6dfb887e38fa13f1", - "type": "github" - }, - "original": { - "owner": "joachimschmidt557", - "ref": "v0.3.3", - "repo": "nim-lscolors", - "type": "github" - } - }, - "nimbox": { - "flake": false, - "locked": { - "lastModified": 1560456726, - "narHash": "sha256-oRPLd/mLsHfHj+mLazuodKBNrZMFHGSyxawH1V3ToZc=", - "owner": "dom96", - "repo": "nimbox", - "rev": "6a56e76c01481176f16ae29b7d7c526bd83f229b", - "type": "github" - }, - "original": { - "owner": "dom96", - "repo": "nimbox", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1641528457, - "narHash": "sha256-FyU9E63n1W7Ql4pMnhW2/rO9OftWZ37pLppn/c1aisY=", + "lastModified": 1708296515, + "narHash": "sha256-FyF489fYNAUy7b6dkYV6rGPyzp+4tThhr80KNAaF/yY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ff377a78794d412a35245e05428c8f95fef3951f", + "rev": "b98a4e1746acceb92c509bc496ef3d0e5ad8d4aa", "type": "github" }, "original": { @@ -67,26 +37,21 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "lscolors": "lscolors", - "nimbox": "nimbox", - "nixpkgs": "nixpkgs", - "wcwidth": "wcwidth" + "nixpkgs": "nixpkgs" } }, - "wcwidth": { - "flake": false, + "systems": { "locked": { - "lastModified": 1665667912, - "narHash": "sha256-VuLaocfWV4/96+xiNr1US6f8UFySfidrqq8zuTD1aRk=", - "owner": "shoyu777", - "repo": "wcwidth-nim", - "rev": "86f8db1a883f6a64e590a56aed81e788389b7196", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "shoyu777", - "ref": "v0.1.3", - "repo": "wcwidth-nim", + "owner": "nix-systems", + "repo": "default", "type": "github" } } diff --git a/flake.nix b/flake.nix index 37376a5..e36f14d 100644 --- a/flake.nix +++ b/flake.nix @@ -4,22 +4,7 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.nimbox = { - url = "github:dom96/nimbox"; - flake = false; - }; - - inputs.lscolors = { - url = "github:joachimschmidt557/nim-lscolors/v0.3.3"; - flake = false; - }; - - inputs.wcwidth = { - url = "github:shoyu777/wcwidth-nim/v0.1.3"; - flake = false; - }; - - outputs = { self, nixpkgs, flake-utils, nimbox, lscolors, wcwidth }: + outputs = { self, nixpkgs, flake-utils }: (flake-utils.lib.eachDefaultSystem (system: @@ -27,30 +12,18 @@ rec { packages.nimmm = - pkgs.stdenv.mkDerivation { + pkgs.buildNimPackage { pname = "nimmm"; version = "master"; src = self; - nativeBuildInputs = with pkgs; [ nim ]; - buildInputs = with pkgs; [ termbox pcre ]; - - NIX_LDFLAGS = "-lpcre"; + lockFile = ./lock.json; - buildPhase = '' - export HOME=$TMPDIR; - nim --threads:on -p:${nimbox} -p:${lscolors}/src -p:${wcwidth}/src c -d:release src/nimmm.nim - ''; - - installPhase = '' - install -Dt $out/bin src/nimmm - ''; + buildInputs = with pkgs; [ termbox pcre ]; }; defaultPackage = packages.nimmm; - })) // { - hydraJobs.nimmm.x86_64-linux = self.packages.x86_64-linux.nimmm; - }; + })); } diff --git a/lock.json b/lock.json new file mode 100644 index 0000000..fb705b4 --- /dev/null +++ b/lock.json @@ -0,0 +1,40 @@ +{ + "depends": [ + { + "method": "fetchzip", + "packages": [ + "lscolors" + ], + "path": "/nix/store/h2rqjnvjg3xihh88f2hm72506vpklilz-source", + "ref": "v0.3.3", + "rev": "668b46c835944254a445b9cc6dfb887e38fa13f1", + "sha256": "0526hqh46lcfsvymb67ldsc8xbfn24vicn3b8wrqnh6mag8wynf4", + "srcDir": "src", + "url": "https://github.com/joachimschmidt557/nim-lscolors/archive/668b46c835944254a445b9cc6dfb887e38fa13f1.tar.gz" + }, + { + "method": "fetchzip", + "packages": [ + "nimbox" + ], + "path": "/nix/store/dyv48md5gaz0x61fxi2zc69h05a3jvfq-source", + "ref": "master", + "rev": "6a56e76c01481176f16ae29b7d7c526bd83f229b", + "sha256": "15x1sdfxa1xcqnr68705jfnlv83lm0xnp2z9iz3pgc4bz5vwn4x1", + "srcDir": "", + "url": "https://github.com/dom96/nimbox/archive/6a56e76c01481176f16ae29b7d7c526bd83f229b.tar.gz" + }, + { + "method": "fetchzip", + "packages": [ + "wcwidth" + ], + "path": "/nix/store/inpq6nm27r7ixyjsdsm4sg6qna7d2vbc-source", + "ref": "v0.1.3", + "rev": "fd60d2dd10fd945a471450551ba471c3be80df52", + "sha256": "06b9ylqbjcxgm9mjfzljbi8gr9sbajykcqpcxgyqymynqyhxmqjn", + "srcDir": "src", + "url": "https://github.com/shoyu777/wcwidth-nim/archive/fd60d2dd10fd945a471450551ba471c3be80df52.tar.gz" + } + ] +}