-
-
Save DeCentN2Madness/20cc9a74af8abcc93112c2bcae9a2031 to your computer and use it in GitHub Desktop.
Revisions
-
masaeedu revised this gist
Dec 22, 2019 . 1 changed file with 96 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,44 +1,118 @@ #!/usr/bin/env bash set -Eeuxo pipefail # Set up git git init gitignore haskell echo '*.cabal' >> .gitignore # Set up niv niv init niv add hercules-ci/ghcide-nix niv add -n iohk-nixpkgs input-output-hk/nixpkgs -b a8f81dc037a5977414a356dd068f2621b3c89b60 niv add -n iohk-hnix input-output-hk/haskell.nix -b master export author="Asad Saeeduddin" export email="[email protected]" export ghc="ghc865" export projectname=${PWD##*/} # Create hpack project cat <<EOF > ./package.yaml spec-version: 0.30.0 name: $projectname author: ${author} maintainer: ${email} license: MIT build-type: Simple source-dirs: src dependencies: - { name: "base", version: '>=4.12 && <4.13' } ghc-options: -Wall default-extensions: - GADTs - StandaloneDeriving - ScopedTypeVariables - RankNTypes - QuantifiedConstraints - TypeApplications - TypeOperators - MultiParamTypeClasses - ConstraintKinds - DataKinds - PolyKinds - KindSignatures - FlexibleInstances - FlexibleContexts library: {} executable: main: Main.hs EOF mkdir src cat <<EOF > ./src/Main.hs module Main where main :: IO () main = putStrLn "Hello, Haskell!" EOF cat <<EOF > ./hie.yaml cradle: { cabal: {} } EOF # Add default.nix cat <<EOF > ./default.nix let sources = import ./nix/sources.nix; compilerVersion = "${ghc}"; pkgs = (import sources.iohk-nixpkgs) (import sources.iohk-hnix); in pkgs.haskell-nix.cabalProject { src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; }; ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.\${compilerVersion}; } EOF cat << EOF > ./shell.nix let sources = import ./nix/sources.nix; compilerVersion = "${ghc}"; ghcide = (import sources.ghcide-nix {})."ghcide-\${compilerVersion}"; pkgs = import sources.iohk-nixpkgs {}; hspkgs = import ./default.nix; in hspkgs.shellFor { withHoogle = true; buildInputs = [ ghcide pkgs.haskellPackages.ghcid ]; } EOF # Create direnv file # TODO: Remove the grep stuff once https://github.com/hercules-ci/ghcide-nix/issues/26 is resolved cat << 'EOF' > .envrc use nix source <(grep 'export NIX_' $(which ghc)) EOF cat << 'EOF' > CACHES.md This project uses various nix expressions for building code. In order to avoid building a huge amount of stuff at once, you might want to enable the following [cachix](https://cachix.org/) caches: - nix-tools - hercules-ci EOF git add . direnv allow -
masaeedu revised this gist
Aug 31, 2019 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,28 @@ #!/usr/bin/env bash set -Eeuxo pipefail # Set up niv niv init niv update nixpkgs -b nixos-unstable niv add Infinisil/all-hies # Create cabal project export currentdir=${PWD##*/} cabal init -n -m --is-libandexe --source-dir src --main-is Main.hs -p $currentdir # Add default.nix cat << 'EOF' > ./default.nix let compilerVersion = "ghc865"; sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs {}; hie = (import sources.all-hies {}).versions."${compilerVersion}"; in with pkgs; let hpkgs = haskell.packages."${compilerVersion}"; btools = [ hpkgs.cabal-install hpkgs.ghcid -
masaeedu revised this gist
Jul 17, 2019 . 1 changed file with 0 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +0,0 @@ -
masaeedu revised this gist
Jul 17, 2019 . 3 changed files with 58 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,21 @@ let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs {}; hie = (import sources.all-hies {}).versions.ghc865; in with pkgs; let hpkgs = haskellPackages; btools = [ hpkgs.cabal-install hpkgs.ghcid hpkgs.hoogle hpkgs.stylish-cabal hie ]; modifier = drv: haskell.lib.addBuildTools drv btools; in hpkgs.developPackage { root = ./.; inherit modifier; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #!/usr/bin/env bash set -euxo pipefail # Set up niv niv init niv update nixpkgs -b nixos-unstable niv add Infinisil/all-hies # Create cabal project cabal init -n # Add default.nix cat << 'EOF' > ./default.nix let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs {}; hie = (import sources.all-hies {}).versions.ghc865; in with pkgs; let hpkgs = haskellPackages; btools = [ hpkgs.cabal-install hpkgs.ghcid hpkgs.hoogle hpkgs.stylish-cabal hie ]; modifier = drv: haskell.lib.addBuildTools drv btools; in hpkgs.developPackage { root = ./.; inherit modifier; } EOF # Create direnv file cat << 'EOF' > .envrc use nix EOF direnv allow This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ -
masaeedu created this gist
Jul 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs {}; hie = (import sources.all-hies {}).versions.ghc865; hpkgs = pkgs.haskellPackages; drv = hpkgs.callCabal2nix "questiongraph" ./. {}; in with pkgs; rec { rebase-tree = drv; shell = let pkg' = haskell.lib.addBuildTools rebase-tree [ hpkgs.cabal-install hpkgs.ghcid hpkgs.hoogle hpkgs.stylish-cabal hie ]; in pkg'.env; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ (import ./.).shell