From 5b13f77fe12bbcf2f84f086911fe8deaa9463fa9 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Mon, 3 Feb 2020 10:10:41 +0100 Subject: [PATCH] cleaner nix file --- src/posts/0011-Haskell-Projects/shell.nix | 76 ++++++++++++----------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/src/posts/0011-Haskell-Projects/shell.nix b/src/posts/0011-Haskell-Projects/shell.nix index 42b005b..8c15836 100644 --- a/src/posts/0011-Haskell-Projects/shell.nix +++ b/src/posts/0011-Haskell-Projects/shell.nix @@ -1,40 +1,44 @@ +{ nixpkgs ? import (fetchGit { + name = "nixos-release-19.09"; + url = "https://github.com/NixOS/nixpkgs"; + # obtained via + # git ls-remote https://github.com/nixos/nixpkgs master + ref = "refs/heads/nixpkgs-19.09-darwin"; + rev = "d5291756487d70bc336e33512a9baf9fa1788faf"; +}) { config = { allowBroken = true; }; } }: let - config = { allowBroken = true; }; + inherit (nixpkgs) pkgs; + inherit (pkgs) haskellPackages; + + haskellDeps = ps: with ps; [ + base + protolude + containers + ]; + + hspkgs = haskellPackages; + + # ### how to override package version + # hspkgs = haskellPackages.extend (self: super: { + # summoner = self.callHackage "summoner" "1.4.0.0" {}; + # # summoner-tui = self.callHackage "summoner-tui" "1.4.0.0" {}; + # }); + + ghc = hspkgs.ghcWithPackages haskellDeps; + + nixPackages = [ + ghc + pkgs.gdb + hspkgs.summoner + hspkgs.summoner-tui + haskellPackages.cabal-install + haskellPackages.ghcid + ]; in - { nixpkgs ? import (fetchGit { - name = "nixos-release-19.09"; - url = "https://github.com/NixOS/nixpkgs"; - # obtained via - # git ls-remote https://github.com/nixos/nixpkgs master - ref = "refs/heads/nixpkgs-19.09-darwin"; - rev = "d5291756487d70bc336e33512a9baf9fa1788faf"; - }) { inherit config; } }: - let - inherit (nixpkgs) pkgs; - inherit (pkgs) haskellPackages; - - haskellDeps = ps: with ps; [ - base - protolude - containers - ]; - - ghc = haskellPackages.ghcWithPackages haskellDeps; - - nixPackages = [ - ghc - pkgs.gdb - # haskellPackages.haskell-overridez - haskellPackages.summoner - haskellPackages.summoner-tui - haskellPackages.cabal-install - haskellPackages.ghcid - ]; - in - pkgs.stdenv.mkDerivation { - name = "env"; - buildInputs = nixPackages; - shellHook = '' +pkgs.stdenv.mkDerivation { + name = "env"; + buildInputs = nixPackages; + shellHook = '' export PS1="\n\[[hs:\033[1;32m\]\W\[\033[0m\]]> " ''; - } +}