diff --git a/flake.lock b/flake.lock index 0027b98..857de2e 100644 --- a/flake.lock +++ b/flake.lock @@ -625,22 +625,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1723400035, - "narHash": "sha256-WoKZDlBEdMhP+hjquBAh0BhUJbcH2+U8g2mHOr1mv8I=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a731b45590a5169542990c36ffcde6cebd9a3356", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, "old-ghc-nix": { "flake": false, "locked": { @@ -661,7 +645,10 @@ "root": { "inputs": { "haskellNix": "haskellNix", - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ], "utils": "utils" } }, diff --git a/flake.nix b/flake.nix index cd13d86..63ee5e9 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { haskellNix.url = "github:input-output-hk/haskell.nix"; - nixpkgs.url = "github:NixOS/nixpkgs/?ref=nixos-24.05"; + nixpkgs.follows = "haskellNix/nixpkgs-unstable"; utils.url = "github:numtide/flake-utils"; }; diff --git a/outputs.nix b/outputs.nix index 63614f1..7cad915 100644 --- a/outputs.nix +++ b/outputs.nix @@ -6,25 +6,66 @@ } @ inputs: utils.lib.eachDefaultSystem ( system: let - overlay = self: _: { - hsPkgs = self.haskell-nix.project' rec { - src = ./.; - compiler-nix-name = "ghc910"; - }; - }; + overlays = [ + haskellNix.overlay + (final: prev: { + hakyllProject = final.haskell-nix.project' { + src = ./.; + compiler-nix-name = "ghc910"; + shell.buildInputs = [ + skeleton-web + ]; + shell.tools = { + cabal = "latest"; + hlint = "latest"; + haskell-language-server = "latest"; + }; + }; + }) + ]; pkgs = import nixpkgs { - inherit system; - overlays = [ - haskellNix.overlay - overlay - ]; + inherit overlays system; + inherit (haskellNix) config; + }; + flake = pkgs.hakyllProject.flake {}; + skeleton-web = flake.packages."skeleton-web:exe:site"; + hakyll-skeleton = pkgs.stdenv.mkDerivation { + name = "hakyll-skeleton"; + buildInputs = []; + src = + pkgs.nix-gitignore.gitignoreSourcePure [ + ./.gitignore + ".git" + ".github" + ] + ./.; + + # LANG and LOCALE_ARCHIVE are fixes pulled from the community: + LANG = "en_AU.UTF-8"; + LOCALE_ARCHIVE = + pkgs.lib.optionalString + (pkgs.buildPlatform.libc == "glibc") + "${pkgs.glibcLocales}/lib/locale/locale-archive"; + + buildPhase = '' + ${skeleton-web}/bin/site build --verbose + ''; + + installPhase = '' + mkdir -p "$out/dist" + cp -a dist/. "$out/dist" + ''; }; - flake = pkgs.hsPkgs.flake {}; in { - packages.default = flake.packages."skeleton-web:exe:site"; - apps.default = { - type = "app"; - program = "${flake.packages."skeleton-web:exe:site"}/bin/site"; + packages = { + inherit skeleton-web hakyll-skeleton; + default = hakyll-skeleton; + }; + apps = { + default = utils.lib.mkApp { + drv = skeleton-web; + exePath = "/bin/skeleton-web"; + }; }; # Overwrite devShells being inported from haskell-nix devShells.default = pkgs.callPackage ./shell.nix { diff --git a/shell.nix b/shell.nix index a9dd876..df068b6 100644 --- a/shell.nix +++ b/shell.nix @@ -8,6 +8,7 @@ with pkgs; buildInputs = [ alejandra # The Uncompromising Nix Code Formatter haskell.compiler.ghc910 # The Glasgow Haskell Compiler + haskellPackages.hakyll # A static website compiler library nix # Powerful package manager, makes packaging reliable & reproducible stylish-haskell # A simple Haskell code prettifier tea # Gitea official CLI client diff --git a/skeleton-web.cabal b/skeleton-web.cabal index df5eae9..bbeba42 100644 --- a/skeleton-web.cabal +++ b/skeleton-web.cabal @@ -7,6 +7,6 @@ executable site main-is: site.hs build-depends: base == 4.* , hakyll == 4.16.* - , filepath == 1.4.* + , filepath == 1.5.* ghc-options: -threaded default-language: Haskell2010