Skip to content

Commit

Permalink
big refactor, try to add full template.
Browse files Browse the repository at this point in the history
  • Loading branch information
hughjfchen committed Jul 30, 2022
1 parent ad34d1a commit 2eae601
Show file tree
Hide file tree
Showing 281 changed files with 4,127 additions and 5,308 deletions.
2 changes: 1 addition & 1 deletion common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ check_dist_or_OS () {

### guard that the caller of the script must be root or has sudo right
guard_root_or_sudo () {
if [[ $EUID -gt 0 ]] && ! sudo -v >/dev/null 2>&1; then
if [[ $EUID -gt 0 ]] && ! sudo echo >/dev/null 2>&1; then
return 1
else
return 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
let
sources = import ./nix/sources.nix;
# Fetch the latest haskell.nix and import its default.nix
haskellNix = import sources."haskell.nix" { };
haskellNix = import sources."haskell.nix" {};
# haskell.nix provides access to the nixpkgs pins which are used by our CI, hence
# you will be more likely to get cache hits when using these.
# But you can also just use your own, e.g. '<nixpkgs>'
#nixpkgsSrc = if haskellNix.pkgs.stdenv.hostPlatform.isDarwin then sources.nixpkgs-darwin else haskellNix.sources.nixpkgs-2111;
#nixpkgsSrc = if haskellNix.pkgs.stdenv.hostPlatform.isDarwin then sources.nixpkgs-darwin else haskellNix.sources.nixpkgs-{{nixos_release | remove(".")}};
# no need to check platform now
nixpkgsSrc = haskellNix.sources.nixpkgs-2111;
nixpkgsSrc = haskellNix.sources.nixpkgs-{{nixos_release | remove(".")}};
# haskell.nix provides some arguments to be passed to nixpkgs, including some patches
# and also the haskell.nix functionality itself as an overlay.
nixpkgsArgs = haskellNix.nixpkgsArgs;
in { nativePkgs ? import nixpkgsSrc (nixpkgsArgs // {
overlays = nixpkgsArgs.overlays ++ [ (import ./nix/overlay) ];
}), haskellCompiler ? "ghc8107", customModules ? [ ] }:
let
pkgs = nativePkgs;
# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
in rec {
in
{ nativePkgs ? import nixpkgsSrc (nixpkgsArgs // { overlays = nixpkgsArgs.overlays ++ [(import ./nix/overlay)]; })
, haskellCompiler ? "ghc{{ghc_version | remove(".")}}"
, customModules ? []
}:
let pkgs = nativePkgs;
in
# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
rec {
# inherit the pkgs package set so that others importing this function can use it
inherit pkgs;

# nativePkgs.lib.recurseIntoAttrs, just a bit more explicilty.
recurseForDerivations = true;

# java-analyzer-uploader = (pkgs.haskell-nix.project {
# src = pkgs.haskell-nix.haskellLib.cleanGit {
# name = "java-analyzer-uploader";
# src = ./.;
# };
# index-state = pkgs.haskell-nix.internalHackageIndexState;
# compiler-nix-name = haskellCompiler;
# modules = customModules;
# });

# java-analyzer-uploader-exe = java-analyzer-uploader.java-analyzer-uploader.components.exes.java-analyzer-uploader;
# java-analyzer-uploader-test = java-analyzer-uploader.java-analyzer-uploader.components.tests.java-analyzer-uploader-test;

}

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
self: prev: {
# sample pakage override
# xxxx = prev.xxxx.overrideAttrs (oldAttr: rec { buildInputs = prev.xxxx.buildInputs ++ [ self.openssl ]; });
}
self: prev:
with prev.lib;
mapAttrs' (attr: _: {
name = removeSuffix ".nix" attr;
value = import (./. + "/${attr}") self prev;
}) (filterAttrs (attr: _: attr != "default.nix") (builtins.readDir ./.))
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
self: prev:

# override the makeself package to make sure quiet mode is the default
prev.makeself.overrideAttrs (oldAttrs: {
fixupPhase = [ oldAttrs.fixupPhase ] ++ [''
sed -e "s|quiet=\"n\"|quiet=\"y\"|; s|accept=\"n\"|accept=\"y\"|; s|noprogress=\$NOPROGRESS|noprogress=\"y\"|" -i $out/share/makeself-2.4.2/makeself-header.sh
''];
})

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2eae601

Please sign in to comment.