-
-
Save asheshambasta/1ef9af2b59b09f84ad47ffd6b061291f to your computer and use it in GitHub Desktop.
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
╰─$ nix-build release.nix 1 ↵ | |
error: attribute 'motion-detect-camera' missing, at /home/ashesh/code/homebot/rpi/motion-detect-camera/release.nix:94:26 | |
(use '--show-trace' to show detailed location information) |
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
let | |
# The following lists specify which overrides need to be applied for which | |
# packages. | |
# Create a list per override, and add the names of packages in it as strings | |
# (using quotes). Do not use the derivations, but the package names. | |
# The overrides are applied using `makeOverrides` below. | |
# Disable tests for these packages | |
dontCheckPackages = [ | |
"vinyl" | |
"postgresql-simple" | |
"opaleye-trans" | |
"composite-opaleye" | |
]; | |
# Jailbreak these packages | |
doJailbreakPackages = [ "opaleye-trans" "hpio" ]; | |
# Disable haddocks for these packages | |
dontHaddockPackages = | |
[ "opaleye-trans" "composite-opaleye" ]; | |
# Unmark these packages as broken | |
unmarkBrokenPackages = [ | |
# amazonka is marked as broken (19.09 - 07.01.2020) | |
"amazonka" | |
"amazonka-core" | |
"amazonka-s3" | |
"amazonka-sns" | |
"amazonka-sqs" | |
"amazonka-test" | |
"composite-opaleye" | |
"composite-base" | |
"vinyl" | |
"opaleye-trans" | |
"phone-numbers" | |
"hpio" | |
]; | |
# This function creates overrides | |
makeOverrides = function: names: haskellPackagesNew: haskellPackagesOld: | |
let | |
toPackage = name: { | |
inherit name; | |
value = function haskellPackagesOld.${name}; | |
}; | |
in builtins.listToAttrs (map toPackage names); | |
composeExtensionsList = pkgs.lib.fold pkgs.lib.composeExtensions (_: _: { }); | |
genOverlay = self: super: { | |
motion-detect-camera = | |
self.callCabal2nix "motion-detect-camera" ./. { }; | |
# Call a custom derivation for a dependency | |
# For example: | |
# - use other version than that in nixpkgs | |
# - use a specific git commit | |
# - use a fork | |
postgresql-simple = | |
self.callHackage "postgresql-simple" "0.5.4.0" { }; | |
# TODO: 16.01.2020: opaleye-trans 0.5.1 doesn't show up yet in cabal2nix, so a | |
# manual run is needed | |
# opaleye-trans = haskellPackagesOld.callHackage "opaleye-trans" "0.5.1" {}; | |
opaleye-trans = self.callPackage nix/opaleye-trans.nix { }; | |
# phone-numbers = self.callPackage nix/phone-numbers.nix { | |
# phonenumber = self.libphonenumber; | |
# protobuf = self.protobuf; | |
# }; | |
}; | |
otherOverlay = self: super: | |
(with oldPkgs.haskell.lib; | |
(composeExtensionsList [ | |
(makeOverrides dontCheck dontCheckPackages) | |
(makeOverrides doJailbreak doJailbreakPackages) | |
(makeOverrides dontHaddock dontHaddockPackages) | |
(makeOverrides unmarkBroken unmarkBrokenPackages) | |
]) self super); | |
overlay = self: super: { | |
haskellPackages = super.haskellPackages.override { | |
overrides = | |
(self: super: (genOverlay self super) // (otherOverlay self super)); | |
}; | |
}; | |
# import nixpkgs | |
channel = "nixos-19.09"; | |
pkg-src = builtins.fetchTarball "http://nixos.org/channels/${channel}/nixexprs.tar.xz"; | |
oldPkgs = import pkg-src { }; | |
servantOverlays = (import ./nix/servant2.nix oldPkgs).overlays; | |
pkgs = import pkg-src { overlays = [ overlay ] ++ servantOverlays ; }; | |
in { | |
motion-detect-camera = pkgs.haskellPackages.motion-detect-camera; | |
inherit pkgs; | |
} |
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
pkgs: | |
let | |
servantsrc = pkgs.fetchFromGitHub { | |
owner = "haskell-servant"; | |
repo = "servant"; | |
rev = "9eb57a6119f9c9045dbd49050bed6f1282611d99"; | |
sha256 = "0kqglih3rv12nmkzxvalhfaaafk4b2irvv9x5xmc48i1ns71y23l"; | |
}; | |
servantCookiesrc = pkgs.fetchFromGitHub { | |
owner = "zohl"; | |
repo = "servant-auth-cookie"; | |
rev = "a87aaca613ebc8e4ca213684055d4b1af6f3ca55"; | |
sha256 = "0cv930kv61ffib49dhinks6i64qrsyayk7bx0h444qf366x1jrp7"; | |
}; | |
haskellOverlay = hlib: self: super: { | |
servant = hlib.dontCheck (hlib.doJailbreak (self.callCabal2nix "servant" "${servantsrc}/servant" {})); | |
servant-server = hlib.dontCheck (hlib.doJailbreak (self.callCabal2nix "servant-server" "${servantsrc}/servant-server" {})); | |
servant-auth-cookie = | |
# turn of the build examples flag | |
let noExamples = hlib.disableCabalFlag (hlib.doJailbreak (self.callCabal2nix "servant-auth-cookie" /home/ashesh/code/asheshambasta/servant-auth-cookie { })) "build-examples"; | |
# servant-auth-cookie has strict version bounds, and this causes breakages of all kinds. | |
# ideally this repository should be forked. | |
# the following patch removes all of these bounds, but this now causes compile errors. | |
removeBounds = old: { postPatch = old.postPatch or "" | |
+ '' substituteInPlace servant-auth-cookie.cabal --replace "servant <0.9" "servant -any" | |
substituteInPlace servant-auth-cookie.cabal --replace "bytestring-conversion >=0.3.1 && <0.4" "bytestring-conversion -any" | |
substituteInPlace servant-auth-cookie.cabal --replace "http-api-data ==0.3.*" "http-api-data -any" | |
'' | |
; | |
}; | |
in noExamples.overrideAttrs removeBounds; | |
}; | |
overlays = [ | |
( | |
self: super: { | |
haskellPackages = super.haskellPackages.override { | |
overrides = haskellOverlay self.haskell.lib; | |
}; | |
} | |
) | |
]; | |
in { | |
inherit overlays; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment