Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got static compilation working again
- Loading branch information
1 parent
9b1a90b
commit 5f53c90
Showing
8 changed files
with
94 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
/tmp | ||
/template/testing.kbd | ||
.stack-work | ||
/bin/ | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let | ||
config = import ./config.nix; | ||
pkgs = import (import ./pinned-nixpkgs.nix) { inherit config; }; | ||
in with pkgs.haskellPackages; callPackage kmonad { doHaddock=false;} | ||
# config = import ./config.nix; | ||
pkgs = import (import ./pinned-nixpkgs.nix) {}; | ||
kmonad = import ./kmonad.nix; | ||
in with pkgs.haskellPackages; callPackage kmonad {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ mkDerivation, base, cereal, lens, megaparsec, mtl | ||
, optparse-applicative, resourcet, rio, stdenv, time, unix | ||
, unliftio | ||
}: | ||
mkDerivation { | ||
pname = "kmonad"; | ||
version = "0.4"; | ||
src = ./..; | ||
isLibrary = true; | ||
isExecutable = true; | ||
libraryHaskellDepends = [ | ||
base cereal lens megaparsec mtl optparse-applicative resourcet rio | ||
time unix unliftio | ||
]; | ||
executableHaskellDepends = [ base ]; | ||
doHaddock = false; | ||
description = "Advanced keyboard remapping utility"; | ||
license = stdenv.lib.licenses.mit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Running using: $(nix-build --no-link -A fullBuildScript) | ||
{ | ||
stack2nix-output-path ? "custom-stack2nix-output.nix", | ||
nixpkgs ? import <nixpkgs> {}, | ||
}: | ||
|
||
let | ||
|
||
# Define basic configuration | ||
cabalPackageName = "kmonad"; | ||
compiler = "ghc865"; | ||
|
||
# Grab the most recent version of `static-haskell-nix` (at time of writing) | ||
static-haskell-nix = nixpkgs.fetchFromGitHub | ||
{ owner = "nh2"; | ||
repo = "static-haskell-nix"; | ||
rev = "dbce18f4808d27f6a51ce31585078b49c86bd2b5"; | ||
sha256 = "084hxnrywsgb73zr41argdkbhkxzm1rqn058pv1l4cp9g1gjr2rr"; | ||
}; | ||
# fetchTarball https://github.com/nh2/static-haskell-nix/archive/d1b20f35ec7d3761e59bd323bbe0cca23b3dfc82.tar.gz; | ||
|
||
# Import the pkgs provided by `static-haskell-nix` | ||
pkgs = import "${static-haskell-nix}/nixpkgs.nix"; | ||
|
||
# Point the script at pwd, using a recent stackage snapshot | ||
stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" { | ||
inherit pkgs; | ||
stack-project-dir = toString ./.; | ||
hackageSnapshot = "2020-05-24T00:00:00Z"; | ||
}; | ||
|
||
# Setup the builder | ||
static-stack2nix-builder = import "${static-haskell-nix}/static-stack2nix-builder/default.nix" { | ||
normalPkgs = pkgs; | ||
inherit cabalPackageName compiler stack2nix-output-path; | ||
# disableOptimization = true; # for compile speed | ||
}; | ||
|
||
# Full invocation, including pinning `nix` version itself. | ||
fullBuildScript = pkgs.writeScript "stack2nix-and-build-script.sh" '' | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
STACK2NIX_OUTPUT_PATH=$(${stack2nix-script}) | ||
export NIX_PATH=nixpkgs=${pkgs.path} | ||
${pkgs.nix}/bin/nix-build --no-link -A static_package --argstr stack2nix-output-path "$STACK2NIX_OUTPUT_PATH" "$@" | ||
''; | ||
|
||
in | ||
{ | ||
static_package = static-stack2nix-builder.static_package; | ||
inherit fullBuildScript; | ||
# For debugging: | ||
# inherit static-stack2nix-builder; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resolver: lts-14.7 | ||
packages: | ||
- . | ||
extra-deps: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
resolver: lts-14.7 | ||
# resolver: lts-16.12 | ||
packages: | ||
- . | ||
extra-deps: |