nix: separate into multiple overlays and expose them from top-level

This commit is contained in:
steveej 2019-12-04 21:08:37 +01:00
parent a96588d9fd
commit e07c5e0fb3
12 changed files with 187 additions and 115 deletions

70
nix/pkgs/default.nix Normal file
View file

@ -0,0 +1,70 @@
{ pkgs }:
let
# one application requires php5
nixpkgsWithPhp5 = pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs-channels";
rev = "846d8f8305192dcc3a63139102698b4ac6b9ef9f";
sha256 = "1qifgc1q2i4g0ivpfjnxp4jl2cc82gfjws08dsllgw7q7kw4b4rb";
};
in rec {
nixpkgs-master = import <nixpkgs-master> {};
linuxPackages_sgx_540rc3 = let
linux_sgx_pkg = { fetchurl, buildLinux, ... } @ args:
buildLinux (args // rec {
version = "5.4.0-rc3";
modDirVersion = version;
src = fetchurl {
url = "https://github.com/jsakkine-intel/linux-sgx/archive/v23.tar.gz";
sha256 = "11rwlwv7s071ia889dk1dgrxprxiwgi7djhg47vi56dj81jgib20";
};
kernelPatches = [];
extraConfig = ''
INTEL_SGX y
'';
extraMeta.branch = "5.4";
} // (args.argsOverride or {}));
linux_sgx = pkgs.callPackage linux_sgx_pkg {};
in
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sgx);
linuxPackages_sgx_latest = linuxPackages_sgx_540rc3;
rdedup = pkgs.callPackages ../pkgs/rdedup {};
busyboxStatic = pkgs.busybox.override {
enableStatic = true;
extraConfig = ''
CONFIG_STATIC y
CONFIG_INSTALL_APPLET_DONT y
CONFIG_INSTALL_APPLET_SYMLINKS n
'';
};
dropbearStatic = pkgs.dropbear.override {
enableStatic = true;
};
php56 = (pkgs.callPackages
"${nixpkgsWithPhp5}/pkgs/development/interpreters/php/default.nix" {})
.php56.overrideAttrs(drv: rec {
# See https://secure.php.net/ChangeLog-5.php
version = "5.6.40";
name = "php-${version}";
sha256 = "005s7w167dypl41wlrf51niryvwy1hfv53zxyyr3lm938v9jbl7z";
src = pkgs.fetchurl {
url = "http://www.php.net/distributions/php-${version}.tar.bz2";
inherit sha256;
};
});
duplicacy = pkgs.callPackage ../pkgs/duplicacy {};
just = pkgs.callPackage ../pkgs/just.nix {};
mfcl3770cdw = pkgs.callPackage ../pkgs/mfcl3770cdw.nix {};
staruml = pkgs.callPackage ../pkgs/staruml.nix { inherit (pkgs.gnome2) GConf; libgcrypt = pkgs.libgcrypt_1_5; };
}

32
nix/pkgs/posh.nix Normal file
View file

@ -0,0 +1,32 @@
# posh makes use of podman to run an encapsulated shell session
{ pkgs, ... }:
{ image, pull ? "always", global_args ? "", run_args ? "" }:
(pkgs.writeScriptBin "posh" ''
#! ${pkgs.bash}/bin/bash
source /etc/profile
test -S "$SSH_AUTH_SOCK" && ssh="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
tty -s && tty="-t" || quiet="-q"
# define these as variables so we can override them at runtime
POSH_IMAGE=${image}
POSH_PULL=${pull}
if [ "$1" == "-c" ]; then
# We've most likely been spawned by sshd and are interested in $2 whitch contains the command string
shift
# TODO parse the beginning of the command for POSH_* overrides
fi
exec ${pkgs.podman}/bin/podman \
${global_args} run --rm -i $tty $ssh -v ~/:/root -w /root --network host --pull=''${POSH_PULL} \
${run_args} ''${POSH_IMAGE} $@
'')
.overrideAttrs(attrs: attrs // {
passthru = {
shellPath = "/bin/posh";
};
})