Skip to content

Commit

Permalink
Merge pull request fractalide#1 from sjmackenzie/master
Browse files Browse the repository at this point in the history
Problem: no initial framework for xin - equivalent hello world app
  • Loading branch information
clacke authored Sep 10, 2018
2 parents 0ce51ca + 45fddf2 commit d5f45a7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
24 changes: 24 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ racket2nix ? import ./racket2nix {}
}:

with racket2nix;

let
src = (builtins.filterSource (path: type:
let basePath = baseNameOf path; in
(type != "symlink" || null == builtins.match "result.*" basePath) &&
(null == builtins.match ".*[.]nix" basePath) &&
(null == builtins.match "[.].*[.]swp" basePath) &&
(null == builtins.match "[.][#].*" basePath) &&
(null == builtins.match "[#].*[#]" basePath) &&
(null == builtins.match ".*~" basePath)
) ./src);
attrs = rec {
catalog = buildRacketCatalog [
src
];
xin = buildRacket { package = src; inherit catalog; };
};
in

attrs.xin // attrs
10 changes: 10 additions & 0 deletions info.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#lang info
(define collection "xin")
(define deps '("base" "typed-map-lib" "typed-racket-more" "redex-lib"))
(define build-deps '())
(define scribblings '())
(define pkg-desc "a configuration language, like a typed nix or a dhall with fixpoint recursion and reflection")
(define version "0.0")
(define pkg-authors '("[email protected]"))
(define racket-launcher-names '("xin"))
(define racket-launcher-libraries '("src/main.rkt"))
44 changes: 44 additions & 0 deletions racket2nix/bump-racket2nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash findutils gawk git nix-prefetch-git

set -e
set -u
set -o pipefail

owner=fractalide
repo=racket2nix
branch=master

SCRIPT_NAME=${BASH_SOURCE[0]##*/}

cd "${BASH_SOURCE[0]%$SCRIPT_NAME}"

if (( $# > 1 )); then
echo "Usage: $SCRIPT_NAME [revision]"
exit 2
fi

if (( $# == 1 )); then
rev=$1
else
rev=$(git ls-remote https://github.com/$owner/$repo |
awk "/$branch/"' { print $1 }')
fi

sha256=$(nix-prefetch-git --no-deepClone https://github.com/$owner/$repo.git $rev |
awk -F '"' '/sha256/ { print $4 }')

tee default.nix.new <<EOF
let
bootPkgs = import <nixpkgs> {};
pinnedPkgs = bootPkgs.fetchFromGitHub {
owner = "$owner";
repo = "$repo";
rev = "$rev";
sha256 = "$sha256";
};
in
import pinnedPkgs
EOF

mv default.nix{.new,}
10 changes: 10 additions & 0 deletions racket2nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let
bootPkgs = import <nixpkgs> {};
pinnedPkgs = bootPkgs.fetchFromGitHub {
owner = "fractalide";
repo = "racket2nix";
rev = "8bce4cc234a6f2a327b61bb4c28f843cec90f550";
sha256 = "095fpa1ipiwx4f67awggxnv8jfhnl1907gqvx45sj5lyw7mfskwk";
};
in
import pinnedPkgs
1 change: 1 addition & 0 deletions src/main.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(define hello-world "helloworld")

0 comments on commit d5f45a7

Please sign in to comment.