feature(nix): finalise flake
This commit is contained in:
parent
683ac23f27
commit
834b3ec421
21
flake.lock
21
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"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
|
||||
|
|
73
outputs.nix
73
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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue