Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHCID, Gitignore.nix and Nix-thunk #1037

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
, reflex-platform-func ? import ./dep/reflex-platform
, useGHC810 ? true # false if one wants to use ghc 8.6.5
}:
, ...
}@args:
let
reflex-platform = getReflexPlatform { inherit system; };
inherit (reflex-platform) hackGet nixpkgs;
Expand All @@ -25,7 +26,7 @@ let
];

haskellOverlays = [
(import ./haskell-overlays/misc-deps.nix { inherit hackGet; __useNewerCompiler = useGHC810; })
(import ./haskell-overlays/misc-deps.nix { inherit hackGet system; inherit args; __useNewerCompiler = useGHC810; })
pkgs.obeliskExecutableConfig.haskellOverlay
(import ./haskell-overlays/obelisk.nix)
(import ./haskell-overlays/tighten-ob-exes.nix)
Expand Down
7 changes: 1 addition & 6 deletions dep/ghcid/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import ((import <nixpkgs> {}).fetchFromGitHub (
let json = builtins.fromJSON (builtins.readFile ./github.json);
in { inherit (json) owner repo rev sha256;
private = json.private or false;
}
))
import (import ./thunk.nix)
5 changes: 3 additions & 2 deletions dep/ghcid/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"owner": "ndmitchell",
"repo": "ghcid",
"branch": "master",
"rev": "f572318f32b1617f6054248e5888af68222f8e50",
"sha256": "1icg3r70lg2kmd9gdc024ih1n9nrja98yav74z9nvykqygvv5w0n"
"private": false,
"rev": "e2852979aa644c8fed92d46ab529d2c6c1c62b59",
"sha256": "0bsjbb6n7ssg411k2xj4f881v392hvb7xln99bq1r3vkg14mqqsd"
}
12 changes: 12 additions & 0 deletions dep/ghcid/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz";
sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr";
}) {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
8 changes: 1 addition & 7 deletions dep/gitignore.nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import <nixpkgs> {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))
import (import ./thunk.nix)
4 changes: 2 additions & 2 deletions dep/gitignore.nix/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "gitignore.nix",
"branch": "master",
"private": false,
"rev": "7415c4feb127845553943a3856cbc5cb967ee5e0",
"sha256": "1zd1ylgkndbb5szji32ivfhwh04mr1sbgrnvbrqpmfb67g2g3r9i"
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"sha256": "07vg2i9va38zbld9abs9lzqblz193vc5wvqd6h7amkmwf66ljcgh"
}
12 changes: 12 additions & 0 deletions dep/gitignore.nix/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz";
sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr";
}) {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
4 changes: 2 additions & 2 deletions dep/nix-thunk/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "nix-thunk",
"branch": "master",
"private": false,
"rev": "2b65d2cbf83e77a90b4103418d037ba5b0b32e77",
"sha256": "07pr014iifyy1xaiqamkx78xfszr67g8kzysmzgzms0a4470k1i9"
"rev": "bef3163ab930f5ffbbca9635b858da761b4dcbfb",
"sha256": "0mcrrx3ka3b1n0lccnkm4wn1vwkmnjy1sh2lbj6dr310hf462sdd"
}
9 changes: 6 additions & 3 deletions haskell-overlays/misc-deps.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ hackGet, __useNewerCompiler ? false }:
{ hackGet, args, __useNewerCompiler ? false, system ? builtins.currentSystem }:

# Fix misc upstream packages
self: super:
Expand Down Expand Up @@ -66,7 +66,7 @@ rec {
nix-derivation = haskellLib.doJailbreak super.nix-derivation;
algebraic-graphs = haskellLib.doJailbreak super.algebraic-graphs;
snap = haskellLib.doJailbreak super.snap;
ghcid = self.callCabal2nix "ghcid" (hackGet ../dep/ghcid) { };
ghcid = haskellLib.doJailbreak (self.callCabal2nix "ghcid" (hackGet ../dep/ghcid) { });

snap-core = self.callHackage "snap-core" "1.0.5.0" {};
snap-server = haskellLib.doJailbreak super.snap-server;
Expand All @@ -86,7 +86,10 @@ rec {
modern-uri = haskellLib.doJailbreak super.modern-uri;
monad-logger = self.callHackage "monad-logger" "0.3.36" { };
neat-interpolation = haskellLib.doJailbreak super.neat-interpolation;
nix-thunk = (import ../dep/nix-thunk { }).makeRunnableNixThunk (haskellLib.doJailbreak (self.callCabal2nix "nix-thunk" (hackGet ../dep/nix-thunk) { }));
nix-thunk = (import ../dep/nix-thunk
({ } // pkgs.lib.optionalAttrs (args ? thunkpkgs) {
pkgs = args.thunkpkgs;
})).makeRunnableNixThunk (haskellLib.doJailbreak (self.callCabal2nix "nix-thunk" (hackGet ../dep/nix-thunk) { }));
cli-extras = haskellLib.doJailbreak (self.callCabal2nix "cli-extras" (hackGet ../dep/cli-extras) { });
cli-git = haskellLib.doJailbreak (haskellLib.overrideCabal (self.callCabal2nix "cli-git" (hackGet ../dep/cli-git) { }) {
librarySystemDepends = with pkgs; [
Expand Down
9 changes: 6 additions & 3 deletions lib/command/src/Obelisk/Command/Deploy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
{- ORMOLU_DISABLE -}
{-|
Description:
Implementation of the CLI deploy commands. Deployment is done by intializing
Expand Down Expand Up @@ -53,6 +54,7 @@ import Obelisk.Command.Project
import Obelisk.Command.Utils

import "nix-thunk" Nix.Thunk
import "nix-thunk" Nix.Thunk.Internal
import Cli.Extras

-- | Options passed to the `init` verb
Expand Down Expand Up @@ -178,7 +180,8 @@ deployPush deployPath builders = do
checkGitCleanStatus srcPath True >>= \case
True -> wrapNixThunkError $ packThunk (ThunkPackConfig False (ThunkConfig Nothing)) srcPath
False -> failWith $ T.pack $ "ob deploy push: ensure " <> srcPath <> " has no pending changes and latest is pushed upstream."
Left err -> failWith $ "ob deploy push: couldn't read src thunk: " <> T.pack (show err)
Left err -> failWith $ "ob deploy push: couldn't read src thunk: " <> prettyReadThunkError err

let version = show . _thunkRev_commit $ _thunkPtr_rev thunkPtr
let moduleFile = deployPath </> "module.nix"
moduleFileExists <- liftIO $ doesFileExist moduleFile
Expand Down