Skip to content

Commit

Permalink
Update and add flake (#8)
Browse files Browse the repository at this point in the history
* Update and add flake

* [WIP] try make nodePackages.nodejs overridable
  • Loading branch information
postsolar authored Jan 31, 2024
1 parent c016033 commit a09771d
Show file tree
Hide file tree
Showing 8 changed files with 1,548 additions and 119 deletions.
1 change: 1 addition & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ generated-docs/
.purs*
.psa*
.spago

.envrc
.direnv
result
42 changes: 42 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ stdenvNoCC
, writeText
, purix
, esbuild
, purs-backend-es
, nodePackages
}:

let

spagoLock = purix.buildSpagoLock {
src = ./.;
lockfile = ./spago.lock;
corefn = true;
};

inherit (nodePackages) nodejs;

in

stdenvNoCC.mkDerivation rec {
pname = "kak-jump";
version = "0.2.1";

src = ./.;

nativeBuildInputs = [ purs-backend-es esbuild ];

buildPhase = ''
cp -r ${spagoLock.kak-jump}/output .
purs-backend-es build
purs-backend-es bundle-app --platform=node
'';

installPhase = ''
mkdir $out
substituteInPlace jump.kak --replace node "${nodejs}/bin/node"
cp jump.kak package.json performJump.js index.js $out
'';

}

87 changes: 87 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs@{ self, nixpkgs, ... }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;

nixpkgsFor = forAllSystems (system: import inputs.nixpkgs {
inherit system;
config = {};
overlays = builtins.attrValues inputs.self.overlays;
});
in
{
overlays = {
purescript = inputs.purescript-overlay.overlays.default;
};

packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.callPackage ./default.nix { nodePackages = pkgs.nodePackages_latest; };
});

devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.mkShell {
name = "kak-jump devshell";
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; [
# kakoune
kakoune-unwrapped

# node
nodejs-slim_21
esbuild

# purescript
purs
spago-unstable
purs-tidy
purs-backend-es
purescript-language-server
];
};
});

};
}

121 changes: 4 additions & 117 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,55 +111,12 @@ var runSTFn2 = function runSTFn22(fn) {
};

// output-es/Data.Array.ST/foreign.js
var pushAllImpl = function(as, xs) {
return xs.push.apply(xs, as);
var pushImpl = function(a, xs) {
return xs.push(a);
};
var sortByImpl = function() {
function mergeFromTo(compare, fromOrdering, xs1, xs2, from, to) {
var mid;
var i;
var j;
var k;
var x;
var y;
var c;
mid = from + (to - from >> 1);
if (mid - from > 1)
mergeFromTo(compare, fromOrdering, xs2, xs1, from, mid);
if (to - mid > 1)
mergeFromTo(compare, fromOrdering, xs2, xs1, mid, to);
i = from;
j = mid;
k = from;
while (i < mid && j < to) {
x = xs2[i];
y = xs2[j];
c = fromOrdering(compare(x)(y));
if (c > 0) {
xs1[k++] = y;
++j;
} else {
xs1[k++] = x;
++i;
}
}
while (i < mid) {
xs1[k++] = xs2[i++];
}
while (j < to) {
xs1[k++] = xs2[j++];
}
}
return function(compare, fromOrdering, xs) {
if (xs.length < 2)
return xs;
mergeFromTo(compare, fromOrdering, xs, xs.slice(0), 0, xs.length);
return xs;
};
}();

// output-es/Data.Array.ST/index.js
var push = (a) => runSTFn2(pushAllImpl)([a]);
var push = /* @__PURE__ */ runSTFn2(pushImpl);

// output-es/Data.Foldable/foreign.js
var foldrArray = function(f) {
Expand Down Expand Up @@ -249,7 +206,7 @@ var unsafeCoerce = function(x) {
};

// output-es/Data.Traversable/foreign.js
var traverseArrayImpl = function() {
var traverseArrayImpl = /* @__PURE__ */ function() {
function array1(a) {
return [a];
}
Expand Down Expand Up @@ -327,31 +284,6 @@ var replicatePolyfill = function(count, value) {
return result;
};
var replicateImpl = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
var fromFoldableImpl = function() {
function Cons(head, tail) {
this.head = head;
this.tail = tail;
}
var emptyList = {};
function curryCons(head) {
return function(tail) {
return new Cons(head, tail);
};
}
function listToArray(list) {
var result = [];
var count = 0;
var xs = list;
while (xs !== emptyList) {
result[count++] = xs.head;
xs = xs.tail;
}
return result;
}
return function(foldr, xs) {
return listToArray(foldr(curryCons)(emptyList)(xs));
};
}();
var unconsImpl = function(empty2, next, xs) {
return xs.length === 0 ? empty2({}) : next(xs[0])(xs.slice(1));
};
Expand All @@ -362,51 +294,6 @@ var findIndexImpl = function(just, nothing, f, xs) {
}
return nothing;
};
var sortByImpl2 = function() {
function mergeFromTo(compare, fromOrdering, xs1, xs2, from, to) {
var mid;
var i;
var j;
var k;
var x;
var y;
var c;
mid = from + (to - from >> 1);
if (mid - from > 1)
mergeFromTo(compare, fromOrdering, xs2, xs1, from, mid);
if (to - mid > 1)
mergeFromTo(compare, fromOrdering, xs2, xs1, mid, to);
i = from;
j = mid;
k = from;
while (i < mid && j < to) {
x = xs2[i];
y = xs2[j];
c = fromOrdering(compare(x)(y));
if (c > 0) {
xs1[k++] = y;
++j;
} else {
xs1[k++] = x;
++i;
}
}
while (i < mid) {
xs1[k++] = xs2[i++];
}
while (j < to) {
xs1[k++] = xs2[j++];
}
}
return function(compare, fromOrdering, xs) {
var out;
if (xs.length < 2)
return xs;
out = xs.slice(0);
mergeFromTo(compare, fromOrdering, out, xs.slice(0), 0, xs.length);
return out;
};
}();
var sliceImpl = function(s, e, l) {
return l.slice(s, e);
};
Expand Down
Loading

0 comments on commit a09771d

Please sign in to comment.