flake: init flake support
This commit is contained in:
parent
58889b6c5e
commit
ee72ffbd8c
@ -5,9 +5,9 @@ cabal-version: >= 1.10
|
||||
|
||||
executable site
|
||||
main-is: site.hs
|
||||
build-depends: base == 4.*
|
||||
, hakyll == 4.13.*
|
||||
, filepath >= 1.4
|
||||
build-depends: base
|
||||
, hakyll
|
||||
, filepath
|
||||
, regex-compat
|
||||
ghc-options: -threaded
|
||||
default-language: Haskell2010
|
||||
|
21
default.nix
21
default.nix
@ -1,21 +0,0 @@
|
||||
# Development workflow
|
||||
# - Executing nix-build builds the packages
|
||||
# - Executing nix-shell returns a shell environment containing
|
||||
# 1. Haskell packages needed
|
||||
# 2. Hoogle files for packages
|
||||
# 3. cabal and ghcid installed
|
||||
{ pkgs ? import <unstable> {}
|
||||
}:
|
||||
pkgs.haskellPackages.developPackage {
|
||||
root = ./.;
|
||||
name = "blogng";
|
||||
modifier = drv:
|
||||
# add buildtools such as cabal
|
||||
pkgs.haskell.lib.addBuildTools drv
|
||||
(with pkgs.haskellPackages; [
|
||||
cabal-install
|
||||
ghcid
|
||||
# install hoogle files for packages we use.
|
||||
#(hoogleLocal {packages = drv.propagatedBuildInputs;})
|
||||
]);
|
||||
}
|
60
flake.lock
Normal file
60
flake.lock
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1700037593,
|
||||
"narHash": "sha256-Jy5mdQKTONK5M3pE7aQUFudDOOz+prpwJYAL2HbJsE4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "28189330044e1fe145c55dc9560474121ae21ad9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
55
flake.nix
Normal file
55
flake.nix
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
description = "blogng";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
haskellPackages = pkgs.haskellPackages;
|
||||
|
||||
builder = pkgs.haskellPackages.callCabal2nix "blogng" ./. { };
|
||||
in {
|
||||
|
||||
packages.default = self.packages.${system}.website;
|
||||
defaultPackage = self.packages.${system}.default;
|
||||
|
||||
packages.website = pkgs.stdenv.mkDerivation rec {
|
||||
name = "blog";
|
||||
LANG = "en_US.UTF-8";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
src = ./.;
|
||||
|
||||
# use the haskell package to build the website
|
||||
buildInputs = [ builder ];
|
||||
allowSubstitutes = false;
|
||||
buildPhase = ''
|
||||
mkdir public
|
||||
${builder}/bin/site build
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/
|
||||
cp -R public/* $out/
|
||||
'';
|
||||
dontStrip = true;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
haskellPackages.haskell-language-server # you must build it with your ghc to work
|
||||
ghcid
|
||||
cabal-install
|
||||
];
|
||||
inputsFrom =
|
||||
map (__getAttr "env") (__attrValues self.packages.${system});
|
||||
};
|
||||
devShell = self.devShells.${system}.default;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user