87 lines
2.8 KiB
Nix
87 lines
2.8 KiB
Nix
{
|
|
description = "Le olde newspaper display";
|
|
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/release-25.05";
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
inputs.gitignore = {
|
|
url = "github:hercules-ci/gitignore.nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
inputs.opium = {
|
|
url = "git+https://git.pbrinkmeier.de/paul/opium?ref=main";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, gitignore, opium }:
|
|
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux" "aarch64-darwin"] (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
inherit (pkgs.haskell.lib) compose;
|
|
|
|
# Include opium in package set
|
|
addOpium = self: super: {
|
|
opium = opium.packages.${system}.opium;
|
|
};
|
|
|
|
# For building the package, we use only the files not ignored by Git as inputs.
|
|
# Also, flake.nix and flake.lock are not included to avoid rebuilds when
|
|
# working on them.
|
|
src = pkgs.lib.cleanSourceWith {
|
|
src = gitignore.lib.gitignoreSource ./.;
|
|
filter = path: type: builtins.elem (builtins.baseNameOf path) [ "flake.nix" "flake.lock" ];
|
|
};
|
|
|
|
yore = pkgs.lib.pipe
|
|
# The basic package
|
|
(pkgs.haskellPackages.developPackage {
|
|
root = ./.;
|
|
overrides = addOpium;
|
|
})
|
|
# And some build configuration.
|
|
# See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers.
|
|
[
|
|
# Remove warp which pulls GHC into the runtime deps for some reason.
|
|
(compose.overrideCabal (drv: {
|
|
postInstall = ''
|
|
remove-references-to -t ${pkgs.haskellPackages.warp} $out/bin/yore
|
|
'';
|
|
}))
|
|
# Return only the bin folder to curb image size
|
|
compose.justStaticExecutables
|
|
];
|
|
in {
|
|
packages = rec {
|
|
docker =
|
|
pkgs.dockerTools.buildImage {
|
|
name = "git.pbrinkmeier.de/paul/yore";
|
|
tag = yore.version;
|
|
config.Cmd = [ "${yore}/bin/yore" ];
|
|
};
|
|
|
|
default = yore;
|
|
|
|
opium_ = opium.packages.${system}.opium;
|
|
};
|
|
|
|
devShells = {
|
|
default =
|
|
(pkgs.haskellPackages.developPackage {
|
|
root = ./.;
|
|
modifier = drv:
|
|
pkgs.haskell.lib.addBuildTools drv [
|
|
pkgs.cabal-install
|
|
pkgs.haskellPackages.implicit-hie
|
|
pkgs.haskellPackages.hoogle
|
|
pkgs.haskell-language-server
|
|
pkgs.fourmolu
|
|
pkgs.postgresql
|
|
pkgs.dbmate
|
|
];
|
|
overrides = addOpium;
|
|
}).env;
|
|
};
|
|
});
|
|
}
|