diff --git a/default.nix b/default.nix index f607bd2..4cda275 100644 --- a/default.nix +++ b/default.nix @@ -1,17 +1,11 @@ self: super: { - buildNimblePackage = super.callPackage ./pkgs/nim-packages/generic.nix { }; - cadet-gtk = super.callPackage ./pkgs/cadet-gtk/default.nix { }; - c2nim = super.callPackage ./pkgs/nim-packages/c2nim.nix { }; + #gnutls-latest-debug = super.enableDebugging self.gnutls-latest; - gintro = super.callPackage ./pkgs/nim-packages/gintro/default.nix { }; - - gnutls-latest-debug = super.enableDebugging self.gnutls-latest; - - groupchat = super.callPackage ./pkgs/nim-packages/groupchat.nix { }; + helix = super.callPackage ./pkgs/helix/default.nix { }; hid = super.callPackage ./pkgs/hid/default.nix { }; easyhid = super.callPackage ./pkgs/easyhid/default.nix { }; @@ -25,9 +19,6 @@ self: super: nghttp3-debug = super.enableDebugging self.nghttp3; - inherit (super.callPackages ./pkgs/nim { }) - nim-unwrapped nimble-unwrapped nim; - picotls = super.callPackage ./pkgs/picotls/default.nix { }; picoquic = super.callPackage ./pkgs/picoquic/default.nix { }; @@ -36,7 +27,5 @@ self: super: squashfs-avm-be = super.callPackage ./pkgs/squashfs-avm-be/default.nix { }; - ui = super.callPackage ./pkgs/nim-packages/ui.nix { }; - widelands = super.callPackage ./pkgs/widelands/default.nix { }; } diff --git a/pkgs/helix/default.nix b/pkgs/helix/default.nix new file mode 100644 index 0000000..cda6632 --- /dev/null +++ b/pkgs/helix/default.nix @@ -0,0 +1,37 @@ +{ fetchzip, lib, rustPlatform, installShellFiles, makeWrapper }: + +rustPlatform.buildRustPackage rec { + pname = "helix"; + version = "22.12"; + + # This release tarball includes source code for the tree-sitter grammars, + # which is not ordinarily part of the repository. + src = fetchzip { + url = "https://github.com/helix-editor/helix/releases/download/${version}/helix-${version}-source.tar.xz"; + sha256 = "sha256-En6SOyAPNPPzDGdm2XTjbGG0NQFGBVzjjoyCbdnHFao="; + stripRoot = false; + }; + + cargoSha256 = "sha256-oSS0LkLg2JSRLYoF0+FVQzFUJtFuVKtU2MWYenmFC0s="; + + nativeBuildInputs = [ installShellFiles makeWrapper ]; + + postInstall = '' + # not needed at runtime + rm -r runtime/grammars/sources + mkdir -p $out/lib + cp -r runtime $out/lib + installShellCompletion contrib/completion/hx.{bash,fish,zsh} + ''; + postFixup = '' + wrapProgram $out/bin/hx --set HELIX_RUNTIME $out/lib/runtime + ''; + + meta = with lib; { + description = "A post-modern modal text editor"; + homepage = "https://helix-editor.com"; + license = licenses.mpl20; + mainProgram = "hx"; + maintainers = with maintainers; [ danth yusdacra ]; + }; +} diff --git a/pkgs/nim-packages/c2nim.nix b/pkgs/nim-packages/c2nim.nix deleted file mode 100644 index 8c218d3..0000000 --- a/pkgs/nim-packages/c2nim.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ stdenv, buildNimblePackage, fetchFromGitHub }: - -buildNimblePackage rec { - name = "c2nim-${version}"; - version = "0.9.18"; - - src = fetchFromGitHub { - owner = "nim-lang"; - repo = "c2nim"; - rev = "7e4edb9e419f9267463cca7df5fcbf6c7c63eed5"; - sha256 = "12fsm7kxkfbi2inkais8hvamrrqmgazl5515v4hvxgl8mjk7srmm"; - }; -} diff --git a/pkgs/nim-packages/generic.nix b/pkgs/nim-packages/generic.nix deleted file mode 100644 index 850afc8..0000000 --- a/pkgs/nim-packages/generic.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ lib, stdenv, nim }: - -{ - name, - src, - nimDeps ? [], - nativeBuildInputs ? [], - buildInputs ? [], - patches ? [], - patchPhase ? "", - preBuild ? "", - postBuild ? "", - preInstall ? "", - postInstall ? "", - ... -}: - -with lib; - -let - getRecursiveInputs = getInputsFn: deps: - optionals (deps != []) ((getInputsFn (head deps)) ++ - (getRecursiveInputs getInputsFn (head deps).nimDeps) ++ - (getRecursiveInputs getInputsFn (tail deps))); - - rNativeBuildInputs = - nativeBuildInputs ++ (getRecursiveInputs (i: i.nativeBuildInputs) nimDeps); - - rBuildInputs = - buildInputs ++ (getRecursiveInputs (i: i.buildInputs) nimDeps); - - copyNimDeps = '' - mkdir -p $NIMBLE_DIR/pkgs - echo "[]" > $NIMBLE_DIR/packages_official.json - '' + toString (map (dep: '' - if [ -d ${dep}/.nimble ]; then - cp -R ${dep}/.nimble/pkgs $NIMBLE_DIR - else - cp -R ${dep} $NIMBLE_DIR/pkgs/${dep.name} - fi - '' - ) nimDeps) + '' - # nimble >= 0.20.0 wants to store nimblemeta.json here - chmod -R u+w $NIMBLE_DIR/pkgs - ''; -in -stdenv.mkDerivation { - name = name; - src = src; - patches = patches; - nativeBuildInputs = [ nim ] ++ (filter (i: i != nim) rNativeBuildInputs); - buildInputs = rBuildInputs; - nimDeps = nimDeps; - patchPhase = patchPhase; - preBuild = preBuild; - postBuild = postBuild; - preInstall = preInstall; - postInstall = postInstall; - LD_LIBRARY_PATH = makeLibraryPath (rBuildInputs ++ rNativeBuildInputs); - - buildPhase = '' - runHook preBuild - - HOME=$TMPDIR - NIMBLE_DIR=$HOME/.nimble - '' + copyNimDeps + '' - nimble install - - runHook PostBuild - ''; - - installPhase = '' - runHook preInstall - - mkdir $out - if [ -d $NIMBLE_DIR/bin ]; then - cp -RL $NIMBLE_DIR/bin $out - fi - numberNimFiles=$(find $NIMBLE_DIR/pkgs/${name} -type f -name "*.nim" | wc -l) - numberDirectories=$(find $NIMBLE_DIR/pkgs/${name} -mindepth 1 -type d | wc -l) - if [ $numberNimFiles -gt 0 ] || [ $numberDirectories -gt 0 ]; then - mkdir -p $out/.nimble - cp -R $NIMBLE_DIR/pkgs $out/.nimble - fi - - runHook postInstall - ''; - - shellHook = '' - export NIMBLE_DIR=$PWD/.nimble - '' + copyNimDeps; -} - diff --git a/pkgs/nim-packages/gintro/allow-preinstalled-oldgtk3.patch b/pkgs/nim-packages/gintro/allow-preinstalled-oldgtk3.patch deleted file mode 100644 index 43313b7..0000000 --- a/pkgs/nim-packages/gintro/allow-preinstalled-oldgtk3.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff --git a/gintro.nimble b/gintro.nimble -index 937984d..e4378bf 100644 ---- a/gintro.nimble -+++ b/gintro.nimble -@@ -31,8 +31,6 @@ proc prep = - # quit("gintro: tmp directory already exists!") - mkDir(wd) - cd(wd) -- mkDir("ngtk3") -- cd("ngtk3") - - cpFile(this / "tests" / "gen.nim", td / wd / "gen.nim") - cpFile(this / "tests" / "combinatorics.nim", td / wd / "combinatorics.nim") -@@ -40,6 +38,8 @@ proc prep = - cd(td) - cd(wd) - -+ mkDir("oldgtk3") -+ cd("oldgtk3") - try: - exec("wget https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gobject.nim -O gobject.nim") - exec("wget https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/glib.nim -O glib.nim") -@@ -57,6 +57,7 @@ proc prep = - echo "Nimgrab should be available in Nim/tools directory. You may compile it with 'nim c -d:ssl nimgrab.nim'" - echo "and put it into your search path" - echo "For the unlikely case that you have already full oldgtk3 package installed, we will just try to continue..." -+ cd("..") - - exec("nim c gen.nim") - mkDir("nim_gi") -@@ -70,7 +71,6 @@ proc prep = - - #task prepare, "preparing gintro": - before install: -- - echo "preparing gintro" - prep() - -diff --git a/tests/gen.nim b/tests/gen.nim -index ef3becf..d13eab4 100644 ---- a/tests/gen.nim -+++ b/tests/gen.nim -@@ -31,8 +31,8 @@ - # This module is really ugly currently -- the first goal was to get a working gi solution - - from os import `/` --import gir --import glib -+import oldgtk3/gir -+import oldgtk3/glib - import strutils - import sequtils - import streams diff --git a/pkgs/nim-packages/gintro/default.nix b/pkgs/nim-packages/gintro/default.nix deleted file mode 100644 index 1ad629f..0000000 --- a/pkgs/nim-packages/gintro/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, buildNimblePackage, fetchFromGitHub, glib, gobjectIntrospection, - gnome3, cairo, pango, librsvg, libnotify, hicolor-icon-theme, wrapGAppsHook }: - -let - oldgtk3 = buildNimblePackage rec { - name = "oldgtk3-${version}"; - version = "0.1.0"; - src = fetchFromGitHub { - owner = "StefanSalewski"; - repo = "oldgtk3"; - rev = "8ad4bc7e790c2c4b01eff9ff4f7d7ecc2cac25e3"; - sha256 = "1kfv4cwgfygbxfgnsyzcwvy5l17082zx9vb9kc75zj27qhlq9ygd"; - }; - }; - -in buildNimblePackage rec { - name = "gintro-${version}"; - version = "0.4.22"; - - src = fetchFromGitHub { - owner = "StefanSalewski"; - repo = "gintro"; - rev = "v${version}"; - sha256 = "0a6qz51gl3bczisrac99nq3a1bqxwaqgvk21j8fdmi3xmylzx54g"; - }; - - patches = [ ./allow-preinstalled-oldgtk3.patch ]; - - nimDeps = [ oldgtk3 ]; - - nativeBuildInputs = [ gobjectIntrospection wrapGAppsHook ]; - - buildInputs = [ - glib - gnome3.gdk_pixbuf - gnome3.gtk - gnome3.gtksourceview - gnome3.vte - gnome3.adwaita-icon-theme - hicolor-icon-theme - cairo - pango - librsvg - libnotify - ]; - - meta = with lib; { - description = "High level GObject-Introspection based GTK3 bindings for Nim language"; - homepage = https://github.com/StefanSalewski/gintro; - license = licenses.mit; - maintainers = with maintainers; [ lurchi ]; - platforms = platforms.gnu ++ platforms.linux; - }; -} diff --git a/pkgs/nim-packages/groupchat.nix b/pkgs/nim-packages/groupchat.nix deleted file mode 100644 index 60c8f88..0000000 --- a/pkgs/nim-packages/groupchat.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ stdenv, fetchgit, buildNimblePackage, gnunet, makeWrapper }: - -let - gnunet_nim = buildNimblePackage rec { - name = "gnunet_nim-${version}"; - version = "0.1.0"; - src = fetchgit { - url = https://git.gnunet.org/gnunet-nim.git; - rev = "8c4e5fac40d2efb780d802bd800697e9d15b7ed9"; - sha256 = "1v417w22n8jdbqzq0qni4wxwa8n711x51sijm3wln805d6gsqwfy"; - }; - - buildInputs = [ gnunet ]; - }; -in -buildNimblePackage rec { - name = "groupchat-${version}"; - version = "0.1.0"; - - src = fetchgit { - url = https://git.gnunet.org/groupchat.git; - rev = "229b1173eecd8e27e1a5cf96b5f6b08c3b76f971"; - sha256 = "007fmfjjhpbrl7nrh8yqxz1r1i1lc9mbrxsasb2jsvf765mfascj"; - }; - - nimDeps = [ gnunet_nim ]; - - buildInputs = [ makeWrapper ]; - - postInstall = '' - wrapProgram $out/bin/groupchat --prefix LD_LIBRARY_PATH : ${gnunet}/lib --prefix PATH : ${gnunet}/bin - ''; -} diff --git a/pkgs/nim-packages/ui.nix b/pkgs/nim-packages/ui.nix deleted file mode 100644 index 25d8619..0000000 --- a/pkgs/nim-packages/ui.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ lib, stdenv, buildNimblePackage, fetchFromGitHub, pkg-config, gtk3, - wrapGAppsHook }: - -buildNimblePackage rec { - name = "ui-${version}"; - version = "0.9.3"; - - src = fetchFromGitHub { - owner = "nim-lang"; - repo = "ui"; - rev = "2a2fd1e9050981dc5fa59529d4d2fbd6daaf793c"; - sha256 = "1dc6i8qrw6la2mzxlhcvvk1sm3gsi21bilrq213zqn949wsjxbzb"; - fetchSubmodules = true; - }; - - patchPhase = '' - rm ui/libui/common/OLD_table.c - rm ui/libui/unix/OLD_table.c - rm ui/libui/darwin/OLD_table.m - ''; - - nativeBuildInputs = [ pkg-config wrapGAppsHook ]; - - buildInputs = [ gtk3 ]; - - meta = with lib; { - description = "Beginnings of what might become Nim's official UI library"; - homepage = https://github.com/nim-lang/ui; - license = licenses.mit; - maintainers = with maintainers; [ lurchi ]; - platforms = platforms.gnu ++ platforms.linux; - }; -} - - diff --git a/pkgs/nim/NIM_CONFIG_DIR.patch b/pkgs/nim/NIM_CONFIG_DIR.patch deleted file mode 100644 index 61e05b7..0000000 --- a/pkgs/nim/NIM_CONFIG_DIR.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim -index a470179bd..73cfa1a23 100644 ---- a/compiler/nimconf.nim -+++ b/compiler/nimconf.nim -@@ -225,10 +225,15 @@ proc getUserConfigPath*(filename: RelativeFile): AbsoluteFile = - proc getSystemConfigPath*(conf: ConfigRef; filename: RelativeFile): AbsoluteFile = - # try standard configuration file (installation did not distribute files - # the UNIX way) -- let p = getPrefixDir(conf) -- result = p / RelativeDir"config" / filename -+ let -+ prefix = getPrefixDir(conf) -+ env = getEnv("NIM_CONFIG_PATH") -+ if env != "": -+ result = env.toAbsoluteDir / filename -+ else: -+ result = prefix / RelativeDir"config" / filename - when defined(unix): -- if not fileExists(result): result = p / RelativeDir"etc/nim" / filename -+ if not fileExists(result): result = prefix / RelativeDir"etc/nim" / filename - if not fileExists(result): result = AbsoluteDir"/etc/nim" / filename - - proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) = diff --git a/pkgs/nim/default.nix b/pkgs/nim/default.nix deleted file mode 100644 index 2a65c3f..0000000 --- a/pkgs/nim/default.nix +++ /dev/null @@ -1,337 +0,0 @@ -# https://nim-lang.github.io/Nim/packaging.html -# https://nim-lang.org/docs/nimc.html - -{ lib, callPackage, buildPackages, stdenv, fetchurl, fetchgit, fetchFromGitHub -, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, nim-unwrapped -, nimble-unwrapped }: - -let - parseCpu = platform: - with platform; - # Derive a Nim CPU identifier - if isAarch32 then - "arm" - else if isAarch64 then - "arm64" - else if isAlpha then - "alpha" - else if isAvr then - "avr" - else if isMips && is32bit then - "mips" - else if isMips && is64bit then - "mips64" - else if isMsp430 then - "msp430" - else if isPower && is32bit then - "powerpc" - else if isPower && is64bit then - "powerpc64" - else if isRiscV && is64bit then - "riscv64" - else if isSparc then - "sparc" - else if isx86_32 then - "i386" - else if isx86_64 then - "amd64" - else - abort "no Nim CPU support known for ${config}"; - - parseOs = platform: - with platform; - # Derive a Nim OS identifier - if isAndroid then - "Android" - else if isDarwin then - "MacOSX" - else if isFreeBSD then - "FreeBSD" - else if isGenode then - "Genode" - else if isLinux then - "Linux" - else if isNetBSD then - "NetBSD" - else if isNone then - "Standalone" - else if isOpenBSD then - "OpenBSD" - else if isWindows then - "Windows" - else if isiOS then - "iOS" - else - abort "no Nim OS support known for ${config}"; - - parsePlatform = p: { - cpu = parseCpu p; - os = parseOs p; - }; - - nimHost = parsePlatform stdenv.hostPlatform; - nimTarget = parsePlatform stdenv.targetPlatform; - - bootstrapCompiler = let - revision = "561b417c65791cd8356b5f73620914ceff845d10"; - in stdenv.mkDerivation { - pname = "nim-bootstrap"; - version = "g${lib.substring 0 7 revision}"; - - src = fetchFromGitHub { - owner = "nim-lang"; - repo = "csources_v1"; - rev = revision; - sha256 = "sha256-gwBFuR7lzO4zttR/6rgdjXMRxVhwKeLqDwpmOwMyU7A="; - }; - - enableParallelBuilding = true; - - installPhase = '' - runHook preInstall - install -Dt $out/bin bin/nim - runHook postInstall - ''; - }; - -in { - - nim-unwrapped = stdenv.mkDerivation rec { - pname = "nim-unwrapped"; - version = "1.6.6"; - strictDeps = true; - - src = fetchurl { - url = "https://nim-lang.org/download/nim-${version}.tar.xz"; - hash = "sha256-Z7ERzm84YVA7n8wcrln8NNASJWbT7P7zoGSiF0EhpFI="; - }; - - buildInputs = [ boehmgc openssl pcre readline sqlite ]; - - patches = [ - ./NIM_CONFIG_DIR.patch - # Override compiler configuration via an environmental variable - - ./nixbuild.patch - # Load libraries at runtime by absolute path - ] ++ lib.optional (!stdenv.hostPlatform.isWindows) ./toLocation.patch; - - configurePhase = '' - runHook preConfigure - cp ${bootstrapCompiler}/bin/nim bin/ - echo 'define:nixbuild' >> config/nim.cfg - runHook postConfigure - ''; - - kochArgs = [ - "--cpu:${nimHost.cpu}" - "--os:${nimHost.os}" - "-d:release" - "-d:useGnuReadline" - ] ++ lib.optional (stdenv.isDarwin || stdenv.isLinux) "-d:nativeStacktrace"; - - buildPhase = '' - runHook preBuild - local HOME=$TMPDIR - ./bin/nim c koch - ./koch boot $kochArgs --parallelBuild:$NIX_BUILD_CORES - ./koch toolsNoExternal $kochArgs --parallelBuild:$NIX_BUILD_CORES - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - install -Dt $out/bin bin/* - ln -sf $out/nim/bin/nim $out/bin/nim - ./install.sh $out - runHook postInstall - ''; - - meta = with lib; { - description = "Statically typed, imperative programming language"; - homepage = "https://nim-lang.org/"; - license = licenses.mit; - maintainers = with maintainers; [ ehmry ]; - }; - }; - - nimble-unwrapped = stdenv.mkDerivation rec { - pname = "nimble-unwrapped"; - version = "0.13.1"; - strictDeps = true; - - src = fetchFromGitHub { - owner = "nim-lang"; - repo = "nimble"; - rev = "v${version}"; - sha256 = "1idb4r0kjbqv16r6bgmxlr13w2vgq5332hmnc8pjbxiyfwm075x8"; - }; - - depsBuildBuild = [ nim-unwrapped ]; - buildInputs = [ openssl ]; - - nimFlags = [ "--cpu:${nimHost.cpu}" "--os:${nimHost.os}" "-d:release" ]; - - buildPhase = '' - runHook preBuild - HOME=$NIX_BUILD_TOP nim c $nimFlags src/nimble - runHook postBuild - ''; - - installPhase = '' - runHook preBuild - install -Dt $out/bin src/nimble - runHook postBuild - ''; - - meta = with lib; { - description = "Package manager for the Nim programming language"; - homepage = "https://github.com/nim-lang/nimble"; - license = licenses.bsd3; - maintainers = with maintainers; [ ehmry ]; - mainProgram = "nimble"; - }; - }; - - nim = let - nim' = buildPackages.nim-unwrapped; - nimble' = buildPackages.nimble-unwrapped; - inherit (stdenv) targetPlatform; - self = stdenv.mkDerivation { - name = "${targetPlatform.config}-nim-wrapper-${nim'.version}"; - inherit (nim') version; - preferLocalBuild = true; - strictDeps = true; - - nativeBuildInputs = [ makeWrapper ]; - - patches = [ - ./nim.cfg.patch - # Remove configurations that clash with ours - ]; - - unpackPhase = '' - runHook preUnpack - tar xf ${nim'.src} nim-$version/config - cd nim-$version - runHook postUnpack - ''; - - dontConfigure = true; - - buildPhase = - # Configure the Nim compiler to use $CC and $CXX as backends - # The compiler is configured by two configuration files, each with - # a different DSL. The order of evaluation matters and that order - # is not documented, so duplicate the configuration across both files. - '' - runHook preBuild - cat >> config/config.nims << WTF - - switch("os", "${nimTarget.os}") - switch("cpu", "${nimTarget.cpu}") - switch("define", "nixbuild") - - # Configure the compiler using the $CC set by Nix at build time - import strutils - let cc = getEnv"CC" - if cc.contains("gcc"): - switch("cc", "gcc") - elif cc.contains("clang"): - switch("cc", "clang") - WTF - - mv config/nim.cfg config/nim.cfg.old - cat > config/nim.cfg << WTF - os = "${nimTarget.os}" - cpu = "${nimTarget.cpu}" - define:"nixbuild" - WTF - - cat >> config/nim.cfg < config/nim.cfg.old - rm config/nim.cfg.old - - cat >> config/nim.cfg << WTF - - clang.cpp.exe %= "\$CXX" - clang.cpp.linkerexe %= "\$CXX" - clang.exe %= "\$CC" - clang.linkerexe %= "\$CC" - gcc.cpp.exe %= "\$CXX" - gcc.cpp.linkerexe %= "\$CXX" - gcc.exe %= "\$CC" - gcc.linkerexe %= "\$CC" - WTF - - runHook postBuild - ''; - - wrapperArgs = [ - "--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${ - placeholder "out" - }/bin" - # Used by nim-gdb - - "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl pcre ]}" - # These libraries may be referred to by the standard library. - # This is broken for cross-compilation because the package - # set will be shifted back by nativeBuildInputs. - - "--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim" - # Use the custom configuration - - ''--set NIX_HARDENING_ENABLE "''${NIX_HARDENING_ENABLE/fortify}"'' - # Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds. - ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin $out/etc - - cp -r config $out/etc/nim - - for binpath in ${nim'}/bin/nim?*; do - local binname=`basename $binpath` - makeWrapper \ - $binpath $out/bin/${targetPlatform.config}-$binname \ - $wrapperArgs - ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname - done - - makeWrapper \ - ${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \ - --set-default CC $(command -v $CC) \ - --set-default CXX $(command -v $CXX) \ - $wrapperArgs - ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim - - makeWrapper \ - ${nim'}/bin/testament $out/bin/${targetPlatform.config}-testament \ - $wrapperArgs - ln -s $out/bin/${targetPlatform.config}-testament $out/bin/testament - - makeWrapper \ - ${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \ - --suffix PATH : $out/bin - ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble - - runHook postInstall - ''; - - passthru = { - nim = nim'; - nimble = nimble'; - }; - - meta = nim'.meta // { - description = nim'.meta.description - + " (${targetPlatform.config} wrapper)"; - platforms = with lib.platforms; unix ++ genode; - }; - }; - in self // { - pkgs = callPackage ../../../top-level/nim-packages.nix { nim = self; }; - }; - -} diff --git a/pkgs/nim/nim.cfg.patch b/pkgs/nim/nim.cfg.patch deleted file mode 100644 index 7195132..0000000 --- a/pkgs/nim/nim.cfg.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/config/nim.cfg b/config/nim.cfg -index 3b964d124..850ed0ed9 100644 ---- a/config/nim.cfg -+++ b/config/nim.cfg -@@ -8,26 +8,12 @@ - # Environment variables can be accessed like so: - # gcc.path %= "$CC_PATH" - --cc = gcc -- - # additional options always passed to the compiler: - --parallel_build: "0" # 0 to auto-detect number of processors - - hint[LineTooLong]=off - #hint[XDeclaredButNotUsed]=off - --# Examples of how to setup a cross-compiler: -- --# Cross-compiling for Raspberry Pi. --# (This compiler is available in gcc-arm-linux-gnueabihf package on Ubuntu) --arm.linux.gcc.exe = "arm-linux-gnueabihf-gcc" --arm.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc" -- --# For OpenWRT, you will also need to adjust PATH to point to your toolchain. --mips.linux.gcc.exe = "mips-openwrt-linux-gcc" --mips.linux.gcc.linkerexe = "mips-openwrt-linux-gcc" -- -- - path="$lib/deprecated/core" - path="$lib/deprecated/pure" - path="$lib/pure/collections" diff --git a/pkgs/nim/nixbuild.patch b/pkgs/nim/nixbuild.patch deleted file mode 100644 index bdfd047..0000000 --- a/pkgs/nim/nixbuild.patch +++ /dev/null @@ -1,51 +0,0 @@ -commit 164ba50fc74b980f77047080b2ae1ea099ae9b27 -Author: Emery Hemingway -Date: Mon Sep 7 14:09:22 2020 +0200 - - Load libaries by absolute path on NixOS - - If "nixbuild" is defined then choose dynamic runtime libraries by - searching $NIX_LDFLAGS at compile-time. - - Fix #15194 - -diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim -index f31ae94dd..debed9c07 100644 ---- a/lib/pure/dynlib.nim -+++ b/lib/pure/dynlib.nim -@@ -56,6 +56,9 @@ - - import strutils - -+when defined(nixbuild): -+ import os -+ - type - LibHandle* = pointer ## a handle to a dynamically loaded library - -@@ -95,6 +98,25 @@ proc libCandidates*(s: string, dest: var seq[string]) = - libCandidates(prefix & middle & suffix, dest) - else: - add(dest, s) -+ when defined(nixbuild): -+ # Nix doesn't have a global library directory so -+ # load libraries using an absolute path if one -+ # can be derived from NIX_LDFLAGS. -+ # -+ # During Nix/NixOS packaging the line "define:nixbuild" -+ # should be appended to the ../../config/nim.cfg file -+ # to enable this behavior by default. -+ # -+ var libDirs = split(getEnv("LD_LIBRARY_PATH"), ':') -+ for flag in split(getEnv("NIX_LDFLAGS")): -+ if flag.startsWith("-L"): -+ libDirs.add(flag[2..flag.high]) -+ for lib in dest: -+ for dir in libDirs: -+ let abs = dir / lib -+ if existsFile(abs): -+ dest = @[abs] -+ return - - proc loadLibPattern*(pattern: string, globalSymbols = false): LibHandle = - ## loads a library with name matching `pattern`, similar to what `dlimport` diff --git a/pkgs/nim/toLocation.patch b/pkgs/nim/toLocation.patch deleted file mode 100644 index a3db460..0000000 --- a/pkgs/nim/toLocation.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/lib/std/private/miscdollars.nim b/lib/std/private/miscdollars.nim -index 840fedf54..6c3436308 100644 ---- a/lib/std/private/miscdollars.nim -+++ b/lib/std/private/miscdollars.nim -@@ -6,9 +6,8 @@ template toLocation*(result: var string, file: string | cstring, line: int, col: - # it can be done in a single place. - result.add file - if line > 0: -- result.add "(" -+ result.add ":" - addInt(result, line) - if col > 0: -- result.add ", " -+ result.add ":" - addInt(result, col) -- result.add ")"