这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "dotfiles/wallpaper"]
path = dotfiles/wallpaper
url = https://github.com/GTrunSec/wallpaper.git
[submodule "channel/nixpkgs"]
[submodule "nixos/channel/nixpkgs"]
path = channel/nixpkgs
url = git@github.com:GTrunSec/nixpkgs.git
[submodule "channel/ghcide-nix"]
[submodule "nixos/channel/ghcide-nix"]
path = channel/ghcide-nix
url = https://github.com/cachix/ghcide-nix.git
1 change: 0 additions & 1 deletion channel/ghcide-nix
Submodule ghcide-nix deleted from f940ec
1 change: 0 additions & 1 deletion channel/nixpkgs
Submodule nixpkgs deleted from 927fcf
2 changes: 1 addition & 1 deletion dotfiles/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function pet-select() {

function jupyter-env() {
cd ~/data/Jupyter-data-science-environment
nix-shell my-default.nix --option build-use-sandbox false --command "jupyter lab --ip $1"
nix-shell my-default.nix --option build-use-sandbox false --command "jupyter lab --ip $1 --app-dir=./jupyterlab"
}

zle -N pet-select
Expand Down
5 changes: 5 additions & 0 deletions nixos/cachix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ config, lib, pkgs, ... }:

{
imports = [ ./ghcide-nix.nix ];
}
12 changes: 12 additions & 0 deletions nixos/cachix/ghcide-nix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

{
nix = {
binaryCaches = [
"https://ghcide-nix.cachix.org"
];
binaryCachePublicKeys = [
"ghcide-nix.cachix.org-1:ibAY5FD+XWLzbLr8fxK6n8fL9zZe7jS+gYeyxyWYK5c="
];
};
}

17 changes: 17 additions & 0 deletions nixos/channel/ghcide-nix/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Build"
on:
pull_request:
push:
jobs:
tests:
strategy:
matrix:
os: [ubuntu-18.04, macos]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v8
- uses: cachix/cachix-action@v5
with:
name: ghcide-nix
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
2 changes: 2 additions & 0 deletions nixos/channel/ghcide-nix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
result
result-*
28 changes: 28 additions & 0 deletions nixos/channel/ghcide-nix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Getting started

## 1. Use Cachix to avoid compilation (optional if you like compiling for 2h)

$ nix-env -iA cachix -f https://cachix.org/api/v1/install
$ cachix use ghcide-nix

## 2. Install ghcide

Currently available for `ghc865`, `ghc864` and `ghc844`:

### On NixOS

```nix
environment.systemPackages = [
(import (builtins.fetchTarball "https://github.com/cachix/ghcide-nix/tarball/master") {}).ghcide-ghc865
];
```

### With Nix

$ nix-env -iA ghcide-ghc865 -f https://github.com/cachix/ghcide-nix/tarball/master

## 3. [Continue by following upstream instructions](https://github.com/digital-asset/ghcide#test-ghcide)

# Updating

./update
5 changes: 5 additions & 0 deletions nixos/channel/ghcide-nix/bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
status = [
"ci/hercules/derivations",
"ci/hercules/evaluation",
]
delete_merged_branches = true
2 changes: 2 additions & 0 deletions nixos/channel/ghcide-nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{ pkgs ? import ./nix {} }:
pkgs.export
20 changes: 20 additions & 0 deletions nixos/channel/ghcide-nix/nix/cabal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/Distribution/Simple/Build/PathsModule.hs b/Distribution/Simple/Build/PathsModule.hs
index f6a203874..2aa406f74 100644
--- a/Distribution/Simple/Build/PathsModule.hs
+++ b/Distribution/Simple/Build/PathsModule.hs
@@ -192,10 +192,14 @@ generate pkg_descr lbi clbi =
bindir = flat_bindir,
libdir = flat_libdir,
dynlibdir = flat_dynlibdir,
- datadir = flat_datadir,
libexecdir = flat_libexecdir,
sysconfdir = flat_sysconfdir
} = absoluteComponentInstallDirs pkg_descr lbi cid NoCopyDest
+
+ InstallDirs {
+ datadir = flat_datadir
+ } = absoluteInstallDirs pkg_descr lbi NoCopyDest
+
InstallDirs {
bindir = flat_bindirrel,
libdir = flat_libdirrel,
17 changes: 17 additions & 0 deletions nixos/channel/ghcide-nix/nix/ci.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let
sources = import ./sources.nix;
inherit (import ./dimension.nix { lib = import (sources.nixpkgs + "/lib"); })
dimension
;

in
dimension "System" {
"x86_64-linux" = {};
"x86_64-darwin" = {};
} (system: {}:

import ../default.nix {
pkgs = import ./default.nix { inherit system; };
}

)
45 changes: 45 additions & 0 deletions nixos/channel/ghcide-nix/nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ sources ? import ./sources.nix
, system ? builtins.currentSystem
}:
let
haskellnix = import sources."haskell.nix";
overlay = _: pkgs:
let
mkPackages = { ghc, stackYaml }:
pkgs.haskell-nix.stackProject {
src = sources.ghcide;
inherit stackYaml;
modules = [({config, ...}: {
ghc.package = ghc;
compiler.version = pkgs.lib.mkForce ghc.version;
reinstallableLibGhc = true;
packages.ghc.flags.ghci = pkgs.lib.mkForce true;
packages.ghci.flags.ghci = pkgs.lib.mkForce true;
# This fixes a performance issue, probably https://gitlab.haskell.org/ghc/ghc/issues/15524
packages.ghcide.configureFlags = [ "--enable-executable-dynamic" ];
packages.haskell-lsp.components.library.doHaddock = pkgs.lib.mkForce false;
packages.ghcide.components.library.doHaddock = pkgs.lib.mkForce false;
})];
};
mkGhcide = args@{...}:
let packages = mkPackages ({ghc = pkgs.haskell-nix.compiler.ghc865; stackYaml = "stack.yaml"; } // args);
in packages.ghcide.components.exes.ghcide // { inherit packages; };
in { export = {
# ghcide-ghc881 = mkHieCore { ghc = pkgs.haskell-nix.compiler.ghc881; stackYaml = "stack88.yaml"; };
ghcide-ghc865 = mkGhcide { ghc = pkgs.haskell-nix.compiler.ghc865; stackYaml = "stack.yaml"; };
ghcide-ghc864 = mkGhcide { ghc = pkgs.haskell-nix.compiler.ghc864; stackYaml = "stack.yaml"; };
ghcide-ghc844 = mkGhcide { ghc = pkgs.haskell-nix.compiler.ghc844; stackYaml = "stack84.yaml"; };
hie-bios = (mkPackages { ghc = pkgs.haskell-nix.compiler.ghc865; stackYaml = "stack.yaml"; }).hie-bios.components.exes.hie-bios;
inherit mkGhcide;
};

devTools = {
inherit (import sources.niv {}) niv;
};
};
in
import sources.nixpkgs {
overlays = haskellnix.overlays ++ [ overlay ];
config = haskellnix.config // {};
inherit system;
}
115 changes: 115 additions & 0 deletions nixos/channel/ghcide-nix/nix/dimension.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{ lib }:
{
/*
dimension: name -> attrs -> function -> attrs
where
function: keyText -> value -> attrsOf package

WARNING: Attribute names must not contain periods (".").
See https://github.com/NixOS/nix/issues/3088

NOTE: The dimension name will be picked up by agent and web ui soon.

Specifies a dimension of the build matrix. For example

dimension "Example" {
withP = { p = true; }
withoutP = { p = false; }
} (key: # either "withP" or "withoutP"
{ p }: # either p = true or p = false
myProject p
)

evaluates roughly to

{
withP = myProject true;
withoutP = myProject false;
}

Use nested calls for multiple dimensions.

Example:

dimension "System" {
"x86_64-linux" = {};
# ...
}: (system: {}:

dimension "Nixpkgs release" (
{
"nixpkgs-19_03".nixpkgs = someSource
} // optionalAttrs (system != "...") {
"nixpkgs-unstable".nixpkgs = someOtherSource
}
) (_key: { nixpkgs }:

myProject system nixpkgs

)
)

evaluates roughly to

{
x86_64-linux.nixpkgs-19_03 = myProject "x86_64-linux" someSource;
x86_64-linux.nixpkgs-unstable = myProject "x86_64-linux" someOtherSource;
...
}

If you need to make references across attributes, you can do so by binding
the result. Wherever you write

dimension "My dimension" {} (key: value: f1 key value)

You can also write

let
myDimension = dimension "My dimension" {} (key: value: f2 key value myDimension)
in
myDimension

This example builds a single test runner to reuse across releases:

let
overlay =
testRunnerPkgs: self: super: {
# ...
};
myProject =
{ nixpkgs,
pkgs ? import nixpkgs { overlays = [ overlay ]; },
testRunnerPkgs ? pkgs
}: pkgs;
in

let
latest = "nixpkgs-19_03";
releases =
dimension "Nixpkgs release"
{
nixpkgs-18_09.nixpkgs = someSource
nixpkgs-19_03.nixpkgs = someOtherSource
}
(_key: { nixpkgs }:

myProject {
inherit nixpkgs;
testRunnerPkgs = releases."${latest}";
}

);
in releases;

*/
dimension = name: attrs: f:
lib.mapAttrs
(k: v:
let o = f k v;
in o // { recurseForDerivations = o.recurseForDerivations or true; }
)
attrs
// { meta.dimension.name = name; };

# TODO: move this file somewhere (a flake?)
}
50 changes: 50 additions & 0 deletions nixos/channel/ghcide-nix/nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"ghcide": {
"branch": "master",
"description": "A library for building Haskell IDE tooling",
"homepage": "",
"owner": "digital-asset",
"repo": "ghcide",
"rev": "c74e9b51f131df446c8e011ae79f3370c683f12b",
"sha256": "19m8jgqqgcarr991adxz5cnd2zixvy14v0ima5950jrd8h73nzcm",
"type": "tarball",
"url": "https://github.com/digital-asset/ghcide/archive/c74e9b51f131df446c8e011ae79f3370c683f12b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"haskell.nix": {
"branch": "master",
"description": "Alternative Haskell Infrastructure for Nixpkgs",
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "642636b47b9bce32d68554e9a935eff120fd95a1",
"sha256": "14vlfvzm5rb8flacs1dngq52cim23jlj4cdk5sn511b6ybx93p06",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/642636b47b9bce32d68554e9a935eff120fd95a1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "5e9671a9a87c240b1c6ce981d04ad23ba4291451",
"sha256": "08j7msxkv452pyxnh0sgn6h9930i5mk9mszba49bj5401gzmfb8a",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/5e9671a9a87c240b1c6ce981d04ad23ba4291451.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "release-20.03",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d149fcaf3b794947eeb3899859a371d10d38f9f",
"sha256": "1fd8c7zaklc1ww4ddayb9s676cf71nj9xgszkq4hr981gkiajnsv",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/2d149fcaf3b794947eeb3899859a371d10d38f9f.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
26 changes: 26 additions & 0 deletions nixos/channel/ghcide-nix/nix/sources.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# A record, from name to path, of the third-party packages
with
{
versions = builtins.fromJSON (builtins.readFile ./sources.json);

# fetchTarball version that is compatible between all the versions of Nix
fetchTarball =
{ url, sha256 }:
if builtins.lessThan builtins.nixVersion "1.12" then
builtins.fetchTarball { inherit url; }
else
builtins.fetchTarball { inherit url sha256; };
};

# NOTE: spec must _not_ have an "outPath" attribute
builtins.mapAttrs (_: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in versions.json should not have an 'outPath' attribute"
else
if builtins.hasAttr "url" spec && builtins.hasAttr "sha256" spec
then
spec //
{ outPath = fetchTarball { inherit (spec) url sha256; } ; }
else spec
) versions
4 changes: 4 additions & 0 deletions nixos/channel/ghcide-nix/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import ./nix {} }:
pkgs.mkShell
{ buildInputs = pkgs.lib.attrValues pkgs.devTools;
}
1 change: 1 addition & 0 deletions nixos/channel/ghcide-nix/update
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nix-shell --run "niv update ghcide"
Loading