Statically link binaries
This commit is contained in:
parent
0a505172b4
commit
ad1918aa6f
67
flake.nix
67
flake.nix
@ -2,46 +2,57 @@
|
||||
description = "tricu";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs = {
|
||||
url = "https://github.com/nh2/nixpkgs/archive/ede5282c487a1fd2de64303ba59adad6726f1225.tar.gz";
|
||||
type = "tarball";
|
||||
flake = false;
|
||||
};
|
||||
static-haskell-nix = {
|
||||
url = "github:nh2/static-haskell-nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs = { self, nixpkgs, static-haskell-nix }:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
system = "x86_64-linux";
|
||||
compiler = "ghc948";
|
||||
packageName = "tricu";
|
||||
containerPackageName = "${packageName}-container";
|
||||
|
||||
customGHC = pkgs.haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
|
||||
megaparsec
|
||||
]);
|
||||
overlay = self: super: {
|
||||
haskell = super.haskell // {
|
||||
packages = super.haskell.packages // {
|
||||
${compiler} = super.haskell.packages.${compiler}.override {
|
||||
overrides = final: prev: {
|
||||
${packageName} = prev.callCabal2nix packageName ./. {};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
haskellPackages = pkgs.haskellPackages;
|
||||
overlays = [overlay];
|
||||
|
||||
enableSharedExecutables = false;
|
||||
enableSharedLibraries = false;
|
||||
normalPkgs = import nixpkgs { inherit overlays system; };
|
||||
|
||||
survey = import "${static-haskell-nix}/survey" { inherit compiler normalPkgs; };
|
||||
|
||||
tricuStatic = survey.haskellPackages.${packageName};
|
||||
|
||||
tricu = pkgs.haskell.lib.justStaticExecutables self.packages.${system}.default;
|
||||
in {
|
||||
packages.${system}.default = tricuStatic;
|
||||
|
||||
packages.${packageName} =
|
||||
haskellPackages.callCabal2nix packageName self rec {};
|
||||
|
||||
packages.default = self.packages.${system}.${packageName};
|
||||
defaultPackage = self.packages.${system}.default;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
haskellPackages.cabal-install
|
||||
haskellPackages.ghc-events
|
||||
haskellPackages.ghcid
|
||||
customGHC
|
||||
upx
|
||||
devShells.default = normalPkgs.mkShell {
|
||||
buildInputs = with normalPkgs; [
|
||||
normalPkgs.haskellPackages.cabal-install
|
||||
normalPkgs.haskellPackages.ghc-events
|
||||
normalPkgs.haskellPackages.ghcid
|
||||
normalPkgs.upx
|
||||
];
|
||||
inputsFrom = builtins.attrValues self.packages.${system};
|
||||
};
|
||||
devShell = self.devShells.${system}.default;
|
||||
|
||||
});
|
||||
devShell = self.devShells.${system}.default;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user