Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"safify",
"supabase",
"swiper",
"lefthook"
"lefthook",
"stdenv",
"rustc"
],
"dictionaries": [
"softwareTerms",
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ GNU Make が導入されています。以下は、ユーザーが使うこと

- 以下をインストールします:

- Bun (js)
- Bun
- Node.js
- GNU Make
- nvm (optional)
- lefthook
Expand Down
49 changes: 15 additions & 34 deletions flake.lock

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

84 changes: 47 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,61 @@
# unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix/monthly";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { nixpkgs, flake-utils, fenix, /* unstable, */ ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# unstable-pkgs = unstable.legacyPackages.${system};
rust-toolchain = import ./nix/rust-toolchain.nix { inherit fenix system; };
outputs = {
nixpkgs,
flake-utils,
rust-overlay,
/*
unstable,
*/
...
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
# unstable-pkgs = unstable.legacyPackages.${system};
rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./scraper/rust-toolchain.toml;

common = {
buildInputs = with pkgs; [
gnumake
bun
biome
lefthook
dotenv-cli
prisma
prisma-engines
];

shellHook = with pkgs; ''
# requird by prisma
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine";
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node";
export PRISMA_INTROSPECTION_ENGINE_BINARY="${prisma-engines}/bin/introspection-engine";
export PRISMA_FMT_BINARY="${prisma-engines}/bin/prisma-fmt";
common = {
packages = with pkgs; [
gnumake
bun
nodejs-slim
biome
lefthook
dotenv-cli
prisma
stdenv.cc.cc.lib
];

export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib
'';
env = with pkgs; {
# requird by prisma
PRISMA_QUERY_ENGINE_BINARY = "${prisma-engines}/bin/query-engine";
PRISMA_QUERY_ENGINE_LIBRARY = "${prisma-engines}/lib/libquery_engine.node";
PRISMA_INTROSPECTION_ENGINE_BINARY = "${prisma-engines}/bin/introspection-engine";
PRISMA_FMT_BINARY = "${prisma-engines}/bin/prisma-fmt";
};
in
{
devShells.default = pkgs.mkShell common;
devShells.scraper = pkgs.mkShell {
buildInputs = common.buildInputs ++ [
};
in {
packages.scraper = pkgs.callPackage ./scraper {toolchain = rust-bin;};
devShells.default = pkgs.mkShell common;
devShells.scraper = pkgs.mkShell {
inherit (common) env;
packages =
common.packages
++ [
pkgs.pkg-config
pkgs.openssl
rust-toolchain
rust-bin
];
shellHook = common.shellHook;
};
});
};
});
}

5 changes: 0 additions & 5 deletions nix/rust-toolchain.nix

This file was deleted.

4 changes: 2 additions & 2 deletions scraper/Cargo.lock

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

2 changes: 1 addition & 1 deletion scraper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "course-mate-scraper"
name = "coursemate-scraper"
version = "0.1.0"
edition = "2021"

Expand Down
21 changes: 21 additions & 0 deletions scraper/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
lib,
stdenv,
openssl,
pkg-config,
makeRustPlatform,
toolchain,
}: let
rustPlatform = makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
in
rustPlatform.buildRustPackage {
buildInputs = lib.lists.optional stdenv.isLinux openssl;
nativeBuildInputs = lib.lists.optional stdenv.isLinux pkg-config;
pname = "coursemate-scraper";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}
4 changes: 2 additions & 2 deletions scraper/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.82.0"
targets = ["aarch64-apple-darwin", "x86_64-unknown-linux-gnu"]
channel = "stable"
components = ["rustc", "cargo", "rustfmt", "clippy"]
targets = []
Loading