Skip to content

Commit 0c6d823

Browse files
committed
add
1 parent 9e911d8 commit 0c6d823

File tree

5 files changed

+42
-25
lines changed

5 files changed

+42
-25
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ jobs:
1616
# If you chose API tokens for write access OR if you have a private cache
1717
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
1818
- run: nix-build
19-
- run: nix-shell --run "echo OK"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
result
2+
result-*

default.nix

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
1-
{ nixpkgs ? import <nixpkgs> {} }: with nixpkgs;
2-
let
3-
gcc = (callPackage ./gcc-luogu {}).gcc;
4-
5-
kotlin-native = callPackage ./kotlin-native {};
6-
7-
python3 = python39.withPackages(p: with p; [
8-
numpy
9-
]);
10-
11-
python2 = python27.withPackages(p: with p; [
12-
numpy
13-
]);
14-
15-
pypy2 = pypy;
16-
in {
1+
with (import <nixpkgs> {
2+
overlays = [
3+
(import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
4+
];
5+
}); {
176
# C, C++
18-
inherit gcc;
7+
gcc = (callPackage ./gcc-luogu {}).gcc;
198

209
# Rust
21-
inherit rustc;
10+
rust = rust-bin.nightly.latest.default;
2211

2312
# Haskell
2413
inherit ghc;
@@ -36,12 +25,16 @@ in {
3625
inherit perl;
3726

3827
# Python 3
39-
inherit python3;
40-
inherit pypy3;
28+
python3 = python39.withPackages(p: with p; [
29+
numpy
30+
]);
31+
pypy3 = pypy3;
4132

4233
# Python 2
43-
inherit python2;
44-
inherit pypy2;
34+
python2 = python27.withPackages(p: with p; [
35+
numpy
36+
]);
37+
pypy2 = pypy;
4538

4639
# C#, F#, Visual Basic
4740
inherit mono;
@@ -71,5 +64,5 @@ in {
7164
inherit kotlin;
7265

7366
# Kotlin/Native
74-
inherit kotlin-native;
67+
kotlin-native = callPackage ./kotlin-native {};
7568
}

kotlin-native/default.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,21 @@ in stdenv.mkDerivation {
4646
buildInputs = [ makeWrapper unwrapped ];
4747
propagatedBuildInputs = [ jre ];
4848

49+
dependenciesLinkHelper = ''#!/bin/bash
50+
konan_dir=''${KONAN_DATA_DIR:-''${HOME:-/tmp}/.konan}
51+
if [ ! -d "$konan_dir/dependencies" ]; then
52+
mkdir -p $konan_dir
53+
ln -s ${unwrapped}/konan-data/dependencies $konan_dir/dependencies
54+
fi
55+
'';
4956
installPhase = ''
5057
mkdir -p $out/bin
58+
echo "$dependenciesLinkHelper" > $out/dependenciesLinkHelper.sh
59+
chmod a+x $out/dependenciesLinkHelper.sh
5160
for p in $(ls ${unwrapped}/bin/); do
5261
makeWrapper ${unwrapped}/bin/$p $out/bin/$p \
5362
--prefix PATH ":" ${jre}/bin \
54-
--set KONAN_DATA_DIR ${unwrapped}/konan-data \
63+
--run $out/dependenciesLinkHelper.sh \
5564
;
5665
done
5766
'';

shell.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
with (import <nixpkgs> {});
2+
let pkgs = (import ./default.nix);
3+
in with pkgs; pkgs // {
4+
gcc = mkShell { packages = [ gcc ]; };
5+
6+
python2 = python2.env;
7+
pypy2 = mkShell { packages = [ pypy2 ]; };
8+
python3 = python3.env;
9+
pypy3 = mkShell { packages = [ pypy3 ]; };
10+
11+
rust = mkShell { packages = [ rust ]; };
12+
13+
kotlin-native = mkShell { packages = [ kotlin-native ]; };
14+
}

0 commit comments

Comments
 (0)