Skip to content

Instantly share code, notes, and snippets.

@chessai
Last active January 13, 2019 19:13
Show Gist options
  • Save chessai/50592cc2c1dd5066335ffe2d3ef670e0 to your computer and use it in GitHub Desktop.
Save chessai/50592cc2c1dd5066335ffe2d3ef670e0 to your computer and use it in GitHub Desktop.
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ cat default.nix
{ compiler ? "ghc863" }:
with rec {
pkgs = (import ./nix/nixpkgs.nix {
inherit compiler;
});
drv = pkgs.haskellPackages.summoner-cli;
};
drv
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ nix-shell --show-trace
building '/nix/store/kp8hz8fldkawbxbnz56wnh6qf8944cyr-cabal2nix-summoner-cli.drv'...
installing
error: creating directory '/nix/var': Permission denied
error: creating directory '/nix/var': Permission denied
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
cabal2nix: user error (Failed to fetch source. Does this source exist? Source {sourceUrl = "/nix/store/dmvyfysd3q1nk2ryqhg5j14zap7dqsn9-summoner-cli", sourceRevision = "", sourceHash = Guess "", sourceCabalDir = ""})
builder for '/nix/store/kp8hz8fldkawbxbnz56wnh6qf8944cyr-cabal2nix-summoner-cli.drv' failed with exit code 1
error: while evaluating anonymous function at /home/chessai/Development/summoner/summoner-cli/default.nix:1:1, called from /home/chessai/Development/summoner/summoner-cli/shell.nix:1:2:
while evaluating the attribute 'haskellPackages.summoner-cli' at /home/chessai/Development/summoner/summoner-cli/nix/overrides.nix:10:3:
while evaluating 'overrideCabal' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /home/chessai/Development/summoner/summoner-cli/nix/overrides.nix:15:5:
while evaluating 'callCabal2nix' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:195:32, called from /home/chessai/Development/summoner/summoner-cli/nix/overrides.nix:13:27:
while evaluating 'callCabal2nixWithOptions' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:180:66, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:195:38:
while evaluating 'overrideCabal' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:191:10:
while evaluating 'callPackageKeepDeriver' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:156:33, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:191:25:
while evaluating 'overrideCabal' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:157:5:
while evaluating 'callPackage' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:114:22, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:157:20:
while evaluating 'callPackageWithScope' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:74:37, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:114:28:
while evaluating 'makeOverridable' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/lib/customisation.nix:67:24, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:97:8:
while evaluating 'drvScope' at /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/pkgs/development/haskell-modules/make-package-set.nix:87:18, called from /nix/store/sjck5mvcq9ns1y8zpr2m83g8pb31352n-source/lib/customisation.nix:69:12:
build of '/nix/store/kp8hz8fldkawbxbnz56wnh6qf8944cyr-cabal2nix-summoner-cli.drv' failed
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ nix show-derivation /nix/store/kp8hz8fldkawbxbnz56wnh6qf8944cyr-cabal2nix-summoner-cli.drv
{
"/nix/store/kp8hz8fldkawbxbnz56wnh6qf8944cyr-cabal2nix-summoner-cli.drv": {
"outputs": {
"out": {
"path": "/nix/store/vkp30avhdixjamwad0ri6df50jnr6j9q-cabal2nix-summoner-cli"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh",
"/nix/store/dmvyfysd3q1nk2ryqhg5j14zap7dqsn9-summoner-cli"
],
"inputDrvs": {
"/nix/store/549zx7iyxnfd89fwxg2i3prpkmpmb6pz-bash-4.4-p23.drv": [
"out"
],
"/nix/store/7pi05y6ccjcavr7akv40z3jd9sdymyhx-glibc-locales-2.27.drv": [
"out"
],
"/nix/store/cfrlcwabgqc86gjvja3pn0h846b3332b-cabal2nix-2.13.drv": [
"out"
],
"/nix/store/xkmbyn610hfh87xbfl7gahy37x54773i-stdenv-linux.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/gayzik3jx16rpc64czk5cy5s953431s6-bash-4.4-p23/bin/bash",
"args": [
"-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"env": {
"LANG": "en_US.UTF-8",
"LOCALE_ARCHIVE": "/nix/store/rri394g09abd1p98c8gbda8nia1mi2dv-glibc-locales-2.27/lib/locale/locale-archive",
"allowSubstitutes": "",
"buildInputs": "",
"builder": "/nix/store/gayzik3jx16rpc64czk5cy5s953431s6-bash-4.4-p23/bin/bash",
"configureFlags": "",
"depsBuildBuild": "",
"depsBuildBuildPropagated": "",
"depsBuildTarget": "",
"depsBuildTargetPropagated": "",
"depsHostHost": "",
"depsHostHostPropagated": "",
"depsTargetTarget": "",
"depsTargetTargetPropagated": "",
"doCheck": "",
"doInstallCheck": "",
"installPhase": "export HOME=\"$TMP\"\nmkdir -p \"$out\"\ncabal2nix --compiler=ghc-8.6.3 --system=x86_64-linux --sha256= \"/nix/store/dmvyfysd3q1nk2ryqhg5j14zap7dqsn9-summoner-cli\" > \"$out/default.nix\"\n",
"name": "cabal2nix-summoner-cli",
"nativeBuildInputs": "/nix/store/00h686pqic1i3cbqfii729c7vah3skj4-cabal2nix-2.13",
"out": "/nix/store/vkp30avhdixjamwad0ri6df50jnr6j9q-cabal2nix-summoner-cli",
"outputs": "out",
"phases": "installPhase",
"preferLocalBuild": "1",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"stdenv": "/nix/store/hgmpv3ks5nchl0hcgqp1f8x372ya2vms-stdenv-linux",
"strictDeps": "",
"system": "x86_64-linux"
}
}
}
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ cat nix/nixpkgs.nix
{ compiler ? "ghc863" }:
with rec {
fetchNixpkgs = import ./fetchNixpkgs.nix;
nixpkgs = fetchNixpkgs {
owner = "NixOS";
repo = "nixpkgs";
rev = "cecec1f74468766825c2ad32d8388c2ded36225f";
sha256 = "1sq538wy0shbakah27b6n4bl5amzwkzjsds77vdd8rsq0d1nys4w";
};
};
import nixpkgs {
config = {
packageOverrides = super: let self = super.pkgs; in {
haskellPackages = super.haskell.packages.${compiler}.override {
overrides = import ./overrides.nix { pkgs = self; };
};
};
};
overlays = [ ];
}
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ cat nix/overrides.nix
{ pkgs }:
self: super:
with { inherit (pkgs.stdenv) lib; };
with pkgs.haskell.lib;
{
summoner-cli = (
with rec {
summoner-cliSource = pkgs.lib.cleanSource ../.;
summoner-cliBasic = self.callPackage ./summoner-cli.nix {}; # self.callCabal2nix "summoner-cli" summoner-cliSource {};
};
overrideCabal summoner-cliBasic (old: {
})
);
}
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ cat nix/summoner-cli.nix
{ mkDerivation, aeson, ansi-terminal, base, base-noprelude
, bytestring, directory, filepath, generic-deriving, gitrev
, hedgehog, hspec, neat-interpolation, optparse-applicative
, process, relude, stdenv, text, time, tomland
}:
mkDerivation {
pname = "summoner";
version = "1.2.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson ansi-terminal base-noprelude bytestring directory filepath
generic-deriving gitrev neat-interpolation optparse-applicative
process relude text time tomland
];
executableHaskellDepends = [ base ];
testHaskellDepends = [
base-noprelude filepath hedgehog hspec neat-interpolation relude
tomland
];
homepage = "https://github.com/kowainik/summoner";
description = "Tool for scaffolding completely configured production Haskell projects";
license = stdenv.lib.licenses.mpl20;
}
[chessai@chessai-kudu:~/Development/summoner/summoner-cli]$ tree
.
├── app
│   └── Cli.hs
├── CHANGELOG.md
├── default.nix
├── dist
├── LICENSE -> ../LICENSE
├── nix
│   ├── fetchNixpkgs.nix
│   ├── nixpkgs.nix
│   ├── overrides.nix
│   ├── refined.nix
│   └── summoner-cli.nix
├── README.md -> ../README.md
├── release.nix
├── shell.nix
├── src
│   ├── Prelude.hs
│   ├── Summoner
│   │   ├── Ansi.hs
│   │   ├── CLI.hs
│   │   ├── Config.hs
│   │   ├── Decision.hs
│   │   ├── Default.hs
│   │   ├── GhcVer.hs
│   │   ├── License.hs
│   │   ├── Process.hs
│   │   ├── Project.hs
│   │   ├── Question.hs
│   │   ├── Settings.hs
│   │   ├── Source.hs
│   │   ├── Template
│   │   │   ├── Cabal.hs
│   │   │   ├── Doc.hs
│   │   │   ├── GitHub.hs
│   │   │   ├── Haskell.hs
│   │   │   ├── Nix.hs
│   │   │   └── Stack.hs
│   │   ├── Template.hs
│   │   ├── Text.hs
│   │   └── Tree.hs
│   └── Summoner.hs
├── summoner.cabal
└── test
├── golden
│   ├── fullProject
│   │   ├── app
│   │   │   └── Main.hs
│   │   ├── appveyor.yml
│   │   ├── benchmark
│   │   │   └── Main.hs
│   │   ├── CHANGELOG.md
│   │   ├── CONTRIBUTING.md
│   │   ├── fullProject.cabal
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── FullProject.hs
│   │   │   └── Prelude.hs
│   │   ├── stack-8.0.2.yaml
│   │   ├── stack-8.2.2.yaml
│   │   ├── stack-8.4.4.yaml
│   │   ├── stack.yaml
│   │   └── test
│   │   └── Spec.hs
│   └── smallProject
│   ├── app
│   │   └── Main.hs
│   ├── CHANGELOG.md
│   ├── README.md
│   └── smallProject.cabal
├── Prelude.hs
├── Spec.hs
└── Test
├── DecisionSpec.hs
├── Golden.hs
├── QuestionSpec.hs
└── TomlSpec.hs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment