feature(nix): finalise flake

This commit is contained in:
Fiscal Velvet Poet 2024-10-28 22:03:05 +10:00
parent 683ac23f27
commit 834b3ec421
Signed by: fiscalvelvetpoet
GPG key ID: D8EBFD58B023BD47
5 changed files with 64 additions and 35 deletions

View file

@ -625,22 +625,6 @@
"type": "github" "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": { "old-ghc-nix": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -661,7 +645,10 @@
"root": { "root": {
"inputs": { "inputs": {
"haskellNix": "haskellNix", "haskellNix": "haskellNix",
"nixpkgs": "nixpkgs_2", "nixpkgs": [
"haskellNix",
"nixpkgs-unstable"
],
"utils": "utils" "utils": "utils"
} }
}, },

View file

@ -3,7 +3,7 @@
inputs = { inputs = {
haskellNix.url = "github:input-output-hk/haskell.nix"; 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"; utils.url = "github:numtide/flake-utils";
}; };

View file

@ -6,25 +6,66 @@
} @ inputs: } @ inputs:
utils.lib.eachDefaultSystem ( utils.lib.eachDefaultSystem (
system: let system: let
overlay = self: _: { overlays = [
hsPkgs = self.haskell-nix.project' rec { haskellNix.overlay
src = ./.; (final: prev: {
compiler-nix-name = "ghc910"; 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 { pkgs = import nixpkgs {
inherit system; inherit overlays system;
overlays = [ inherit (haskellNix) config;
haskellNix.overlay };
overlay 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 { in {
packages.default = flake.packages."skeleton-web:exe:site"; packages = {
apps.default = { inherit skeleton-web hakyll-skeleton;
type = "app"; default = hakyll-skeleton;
program = "${flake.packages."skeleton-web:exe:site"}/bin/site"; };
apps = {
default = utils.lib.mkApp {
drv = skeleton-web;
exePath = "/bin/skeleton-web";
};
}; };
# Overwrite devShells being inported from haskell-nix # Overwrite devShells being inported from haskell-nix
devShells.default = pkgs.callPackage ./shell.nix { devShells.default = pkgs.callPackage ./shell.nix {

View file

@ -8,6 +8,7 @@ with pkgs;
buildInputs = [ buildInputs = [
alejandra # The Uncompromising Nix Code Formatter alejandra # The Uncompromising Nix Code Formatter
haskell.compiler.ghc910 # The Glasgow Haskell Compiler haskell.compiler.ghc910 # The Glasgow Haskell Compiler
haskellPackages.hakyll # A static website compiler library
nix # Powerful package manager, makes packaging reliable & reproducible nix # Powerful package manager, makes packaging reliable & reproducible
stylish-haskell # A simple Haskell code prettifier stylish-haskell # A simple Haskell code prettifier
tea # Gitea official CLI client tea # Gitea official CLI client

View file

@ -7,6 +7,6 @@ executable site
main-is: site.hs main-is: site.hs
build-depends: base == 4.* build-depends: base == 4.*
, hakyll == 4.16.* , hakyll == 4.16.*
, filepath == 1.4.* , filepath == 1.5.*
ghc-options: -threaded ghc-options: -threaded
default-language: Haskell2010 default-language: Haskell2010