From 9532ab5f9dceb363d6757af23a528c40257772d6 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Tue, 10 Nov 2020 16:07:36 +0100 Subject: [PATCH 1/1] init --- .envrc | 9 ++++++++ default.nix | 50 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 14 ++++++++++++ shell.nix | 1 + sourcephile_web.cabal | 51 +++++++++++++++++++++++++++++++++++++++++++ sourcephile_web.nix | 19 ++++++++++++++++ 6 files changed, 144 insertions(+) create mode 100644 .envrc create mode 100644 default.nix create mode 100644 flake.nix create mode 100644 shell.nix create mode 100644 sourcephile_web.cabal create mode 100644 sourcephile_web.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..06f833c --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +use_flake() { + watch_file flake.nix + watch_file flake.lock + mkdir -p "$(direnv_layout_dir)" + eval "$(nix print-dev-env --option allow-import-from-derivation true -L --profile "$(direnv_layout_dir)/flake-profile" || echo false)" && + nix-store --add-root "shell.root" \ + --indirect --realise "$(direnv_layout_dir)/flake-profile" +} +use flake diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..4802753 --- /dev/null +++ b/default.nix @@ -0,0 +1,50 @@ +{ pkgs ? import {} +, ghc ? null +, withHoogle ? false +}: +let + haskellPackages = + if ghc == null + then pkgs.haskellPackages + else pkgs.haskell.packages.${ghc}; + hs = haskellPackages.extend (with pkgs.haskell.lib; + hself: hsuper: { + #hakyll = unmarkBroken hsuper.hakyll; + hakyll = hself.callHackage "hakyll" "4.13.4.1" {}; + #hakyll-sass = unmarkBroken hsuper.hakyll-sass; + hakyll-sass = hself.callHackage "hakyll-sass" "0.2.4" {}; + # hakyll 4.13.4 requires pandoc 2.10 + pandoc = hself.callHackage "pandoc" "2.10.1" {}; + pandoc-types = hself.callHackage "pandoc-types" "1.21" {}; + skylighting = hself.callHackage "skylighting" "0.8.5" {}; + skylighting-core = hself.callHackage "skylighting-core" "0.8.5" {}; + /* + hakyll = appendConfigureFlags ((hself.callHackage "hakyll" "4.13.4.1" {})) + ["-f-usePandoc" "-f-previewServer" "-f-watchServer"]; + pandoc-sidenote = null; + */ + sourcephile_web = hself.callPackage ./sourcephile_web.nix {}; + } // + packageSourceOverrides { + #sourcephile_web = ./.; + #sourcephile_web = ./sourcephile_web.nix; + } hself hsuper + ); +in hs.sourcephile_web // { + shell = hs.shellFor { + packages = p: [ p.sourcephile_web ]; + nativeBuildInputs = [ + hs.cabal-install + #hs.hpack + #hs.haskell-language-server + #hs.hpc + ]; + buildInputs = [ + #hs.ghcid + #hs.ormolu + #hs.hlint + #pkgs.nixpkgs-fmt + ]; + inherit withHoogle; + }; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..030eef9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,14 @@ +{ +inputs.nixpkgs.url = "flake:nixpkgs"; +inputs.flake-utils.url = "github:numtide/flake-utils"; +outputs = inputs: + inputs.flake-utils.lib.eachDefaultSystem (system: let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in { + defaultPackage = import ./default.nix { inherit pkgs; }; + devShell = (import ./default.nix { + inherit pkgs; + }).shell; + } + ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0d9af5e --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./. {}).shell diff --git a/sourcephile_web.cabal b/sourcephile_web.cabal new file mode 100644 index 0000000..f4d34e4 --- /dev/null +++ b/sourcephile_web.cabal @@ -0,0 +1,51 @@ +name: sourcephile-web +version: 0.0.0.0 +homepage: https://sourcephile.fr +bug-reports: julm+web@sourcephile.fr +author: Julien Moutinho +maintainer: Julien Moutinho +copyright: Julien Moutinho +license: GPL-3 +build-type: Simple +cabal-version: >=1.12 + +source-repository head + type: git + location: git://git.sourcephile.fr/sourcephile-web + +executable site + default-language: Haskell2010 + hs-source-dirs: src + main-is: Main.hs + other-modules: + Paths_sourcephile_web + ghc-options: + -Wall + -Wcompat + -Wincomplete-record-updates + -Wincomplete-uni-patterns + -Wredundant-constraints + -O2 + -threaded + -rtsopts + -with-rtsopts=-N + build-depends: + base >=4.7 && <5 + , blaze-html + , bytestring + , containers + , data-default-class + , directory + , filepath + , hakyll + , hakyll-sass + -- , language-javascript + , pandoc + , pandoc-types + , pretty-terminal + , skylighting + , skylighting-core + , split + , text + , time + -- , xml diff --git a/sourcephile_web.nix b/sourcephile_web.nix new file mode 100644 index 0000000..6b0bb52 --- /dev/null +++ b/sourcephile_web.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, blaze-html, bytestring, containers +, data-default-class, directory, filepath, hakyll, hakyll-sass +, pandoc, pandoc-types, pretty-terminal, skylighting +, skylighting-core, split, stdenv, text, time +}: +mkDerivation { + pname = "sourcephile-web"; + version = "0.0.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base blaze-html bytestring containers data-default-class directory + filepath hakyll hakyll-sass pandoc pandoc-types pretty-terminal + skylighting skylighting-core split text time + ]; + homepage = "https://sourcephile.fr"; + license = stdenv.lib.licenses.gpl3; +} -- 2.42.0