From fcce234a1007cb7115374414c374c2440cd8e4fa Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Wed, 26 Oct 2022 11:47:17 +0530 Subject: [PATCH] initial commit Signed-off-by: Amneesh Singh --- .gitignore | 3 ++ README.org | 5 +++ haskell/Lib.hs | 1 + haskell/README.org | 8 ++++ haskell/flake.lock | 43 +++++++++++++++++++++ haskell/flake.nix | 31 +++++++++++++++ rust/.gitignore | 2 + rust/Cargo.lock | 7 ++++ rust/Cargo.toml | 4 ++ rust/README.org | 5 +++ rust/flake.lock | 94 +++++++++++++++++++++++++++++++++++++++++++++ rust/flake.nix | 36 +++++++++++++++++ rust/gentoml | 26 +++++++++++++ rust/rust-toolchain | 3 ++ rust/src/lib.rs | 0 15 files changed, 268 insertions(+) create mode 100644 .gitignore create mode 100644 README.org create mode 100644 haskell/Lib.hs create mode 100644 haskell/README.org create mode 100644 haskell/flake.lock create mode 100644 haskell/flake.nix create mode 100644 rust/.gitignore create mode 100644 rust/Cargo.lock create mode 100644 rust/Cargo.toml create mode 100644 rust/README.org create mode 100644 rust/flake.lock create mode 100644 rust/flake.nix create mode 100755 rust/gentoml create mode 100644 rust/rust-toolchain create mode 100644 rust/src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..883b7e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +*~ +\#*# diff --git a/README.org b/README.org new file mode 100644 index 0000000..1c50a16 --- /dev/null +++ b/README.org @@ -0,0 +1,5 @@ +Personal repo for practicing random stuff from Project Euler and try to learn haskell after my similar last attempt over an year ago + +- Do not cheat +- My solutions suck anyway (probably) +- They need not be the best diff --git a/haskell/Lib.hs b/haskell/Lib.hs new file mode 100644 index 0000000..6d85a26 --- /dev/null +++ b/haskell/Lib.hs @@ -0,0 +1 @@ +module Lib where diff --git a/haskell/README.org b/haskell/README.org new file mode 100644 index 0000000..e0639b2 --- /dev/null +++ b/haskell/README.org @@ -0,0 +1,8 @@ +* Compile +Just run =ghc p.hs= where is the problem number + +* Run +Just run =runhaskell p.hs= where is the problem number + +* Environment +If you use nix just run =nix develop= or =nix develop .#withLsp= if you want haskell-language-server. diff --git a/haskell/flake.lock b/haskell/flake.lock new file mode 100644 index 0000000..2507d9e --- /dev/null +++ b/haskell/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1666610816, + "narHash": "sha256-q4F2VNe5bpxXOvp16DyLwE1SgNZMbNO29ZQJPIomedg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6107f97012a0c134c5848125b5aa1b149b76d2c9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/haskell/flake.nix b/haskell/flake.nix new file mode 100644 index 0000000..339434a --- /dev/null +++ b/haskell/flake.nix @@ -0,0 +1,31 @@ +{ + description = "eulerfunt in haskell"; + + inputs = { + nixpkgs.url = github:nixos/nixpkgs/release-22.05; + utils.url = github:numtide/flake-utils; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + devShells = with pkgs; rec { + default = mkShell { + buildInputs = [ ghc ]; + }; + withLsp = mkShell { + buildInputs = [ + ghc + haskell-language-server + ]; + }; + }; + } + ); +} diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 0000000..e2a3069 --- /dev/null +++ b/rust/.gitignore @@ -0,0 +1,2 @@ +/target +*~ diff --git a/rust/Cargo.lock b/rust/Cargo.lock new file mode 100644 index 0000000..d4516bc --- /dev/null +++ b/rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "eulerfunt" +version = "0.1.0" diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..d22155a --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "eulerfunt" +version = "0.1.0" +edition = "2021" diff --git a/rust/README.org b/rust/README.org new file mode 100644 index 0000000..2031530 --- /dev/null +++ b/rust/README.org @@ -0,0 +1,5 @@ +* Run +Just run =cargo run --bin p= where is the problem number + +* Environment +If you use nix just run =nix develop= or =nix develop .#withLsp= if you want rust-analyzer. diff --git a/rust/flake.lock b/rust/flake.lock new file mode 100644 index 0000000..5ddd79d --- /dev/null +++ b/rust/flake.lock @@ -0,0 +1,94 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666610816, + "narHash": "sha256-q4F2VNe5bpxXOvp16DyLwE1SgNZMbNO29ZQJPIomedg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6107f97012a0c134c5848125b5aa1b149b76d2c9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "utils": "utils" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1666752703, + "narHash": "sha256-8l/yUNj3eH89T5uPDOZKjYNeOTSmn8xJCRC0c/Jedl8=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b20d7b01b37268f240d185f5a2902d5fecb48ad3", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/rust/flake.nix b/rust/flake.nix new file mode 100644 index 0000000..d12c471 --- /dev/null +++ b/rust/flake.nix @@ -0,0 +1,36 @@ +{ + description = "eulerfunt in Rust"; + + inputs = { + nixpkgs.url = github:nixos/nixpkgs/release-22.05; + utils.url = github:numtide/flake-utils; + rust-overlay.url = github:oxalica/rust-overlay; + }; + + outputs = { self, nixpkgs, utils, rust-overlay }: + utils.lib.eachDefaultSystem + (system: + let + overlays = [ rust-overlay.overlays.default ]; + + pkgs = import nixpkgs { + inherit system overlays; + }; + + toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; + in + { + devShells = rec { + default = pkgs.mkShell { + buildInputs = [ toolchain ]; + }; + withLsp = pkgs.mkShell { + buildInputs = [ + toolchain + pkgs.rust-analyzer + ]; + }; + }; + } + ); +} diff --git a/rust/gentoml b/rust/gentoml new file mode 100755 index 0000000..951a0d8 --- /dev/null +++ b/rust/gentoml @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +toml=Cargo.toml +name=eulerfunt + +cat > $toml <> $toml <