nix: separate into multiple overlays and expose them from top-level #31
13 changed files with 203 additions and 129 deletions
14
default.nix
Normal file
14
default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
# It should return a set of nix derivations
|
||||
# and optionally the special attributes `lib`, `modules` and `overlays`.
|
||||
# It should NOT import <nixpkgs>. Instead, you should take pkgs as an argument.
|
||||
# Having pkgs default to <nixpkgs> is fine though, and it lets you use short
|
||||
# commands such as:
|
||||
# nix-build -A mypackage
|
||||
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
|
||||
{
|
||||
overlays = import ./nix/overlays;
|
||||
pkgs = import ./nix/pkgs { inherit pkgs; };
|
||||
}
|
|
@ -8,9 +8,7 @@ in {
|
|||
# programs.home-manager.enable = true;
|
||||
# programs.home-manager.path = https://github.com/rycee/home-manager/archive/445c0b1482c38172a9f8294ee16a7ca7462388e5.tar.gz;
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(import ../../overlay.nix)
|
||||
];
|
||||
nixpkgs.overlays = builtins.attrValues (import ../../overlays);
|
||||
|
||||
nixpkgs.config = {
|
||||
allowBroken = true;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import ../../../overlay.nix)
|
||||
];
|
||||
nixpkgs.overlays = builtins.attrValues (import ../../../overlays);
|
||||
|
||||
imports = [
|
||||
./boot.nix
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import ../../../overlay.nix)
|
||||
];
|
||||
nixpkgs.overlays = builtins.attrValues (import ../../../overlays);
|
||||
|
||||
imports = [
|
||||
../../modules/ddclient-ovh.nix
|
||||
|
|
105
nix/overlay.nix
105
nix/overlay.nix
|
@ -1,105 +0,0 @@
|
|||
self: super:
|
||||
|
||||
let
|
||||
nixpkgs-master = import <nixpkgs-master> {};
|
||||
|
||||
# one application requires php5
|
||||
nixpkgsWithPhp5 = super.fetchFromGitHub {
|
||||
owner = "nixos";
|
||||
repo = "nixpkgs-channels";
|
||||
rev = "846d8f8305192dcc3a63139102698b4ac6b9ef9f";
|
||||
sha256 = "1qifgc1q2i4g0ivpfjnxp4jl2cc82gfjws08dsllgw7q7kw4b4rb";
|
||||
};
|
||||
|
||||
in {
|
||||
# alacritty = nixpkgs-master.alacritty;
|
||||
alacritty = super.stdenv.mkDerivation {
|
||||
name = "alacritty-custom";
|
||||
buildInputs = [ super.makeWrapper ];
|
||||
phases = "installPhase";
|
||||
installPhase = ''
|
||||
makeWrapper ${nixpkgs-master.alacritty}/bin/alacritty $out/bin/alacritty \
|
||||
--set-default WINIT_HIDPI_FACTOR 1.0
|
||||
'';
|
||||
};
|
||||
|
||||
duplicacy = super.callPackage ./pkgs/duplicacy {};
|
||||
just = super.callPackage ./pkgs/just.nix {};
|
||||
mfcl3770cdw = super.callPackage ./pkgs/mfcl3770cdw.nix {};
|
||||
staruml = super.callPackage ./pkgs/staruml.nix { inherit (super.gnome2) GConf; libgcrypt = super.libgcrypt_1_5; };
|
||||
|
||||
roxterm = super.stdenv.mkDerivation {
|
||||
name = "roxterm-custom";
|
||||
buildInputs = [ super.makeWrapper ];
|
||||
phases = "installPhase";
|
||||
installPhase = ''
|
||||
makeWrapper ${super.roxterm}/bin/roxterm $out/bin/roxterm \
|
||||
--add-flags "--separate"
|
||||
'';
|
||||
};
|
||||
|
||||
busyboxStatic = super.busybox.override {
|
||||
enableStatic = true;
|
||||
extraConfig = ''
|
||||
CONFIG_STATIC y
|
||||
CONFIG_INSTALL_APPLET_DONT y
|
||||
CONFIG_INSTALL_APPLET_SYMLINKS n
|
||||
'';
|
||||
};
|
||||
dropbearStatic = super.dropbear.override {
|
||||
enableStatic = true;
|
||||
};
|
||||
|
||||
php56 = (super.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 = super.fetchurl {
|
||||
url = "http://www.php.net/distributions/php-${version}.tar.bz2";
|
||||
inherit sha256;
|
||||
};
|
||||
});
|
||||
|
||||
rdedup = super.callPackages ./pkgs/rdedup {};
|
||||
|
||||
# TODO: facetimehd is currfently broken (https://github.com/NixOS/nixpkgs/pull/72804)
|
||||
facetimehd-firmware = super.hello;
|
||||
|
||||
qtile = nixpkgs-master.qtile;
|
||||
|
||||
inherit (nixpkgs-master) podman conmon slirp4netns;
|
||||
|
||||
# posh makes use of podman to run an encapsulated shell session
|
||||
posh = { image, pull ? "always", global_args ? "", run_args ? "" }:
|
||||
(super.writeScriptBin "posh" ''
|
||||
#! ${super.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 ${self.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";
|
||||
};
|
||||
});
|
||||
|
||||
}
|
5
nix/overlays/default.nix
Normal file
5
nix/overlays/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
overrides = import ./overrides.nix;
|
||||
pkgs = import ./pkgs.nix;
|
||||
posh = import ./posh.nix;
|
||||
}
|
36
nix/overlays/overrides.nix
Normal file
36
nix/overlays/overrides.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
# This overlay is used for overriding upstream packages.
|
||||
|
||||
self: super:
|
||||
|
||||
let
|
||||
nixpkgs-master = import <nixpkgs-master> { inherit (super) config; };
|
||||
|
||||
in {
|
||||
inherit nixpkgs-master;
|
||||
|
||||
# alacritty = nixpkgs-master.alacritty;
|
||||
alacritty = super.stdenv.mkDerivation {
|
||||
name = "alacritty-custom";
|
||||
buildInputs = [ super.makeWrapper ];
|
||||
phases = "installPhase";
|
||||
installPhase = ''
|
||||
makeWrapper ${self.nixpkgs-master.alacritty}/bin/alacritty $out/bin/alacritty \
|
||||
--set-default WINIT_HIDPI_FACTOR 1.0
|
||||
'';
|
||||
};
|
||||
|
||||
roxterm = super.stdenv.mkDerivation {
|
||||
name = "roxterm-custom";
|
||||
buildInputs = [ super.makeWrapper ];
|
||||
phases = "installPhase";
|
||||
installPhase = ''
|
||||
makeWrapper ${super.roxterm}/bin/roxterm $out/bin/roxterm \
|
||||
--add-flags "--separate"
|
||||
'';
|
||||
};
|
||||
|
||||
# TODO: facetimehd is currfently broken (https://github.com/NixOS/nixpkgs/pull/72804)
|
||||
facetimehd-firmware = super.hello;
|
||||
|
||||
qtile = self.nixpkgs-master.qtile;
|
||||
}
|
18
nix/overlays/pkgs.nix
Normal file
18
nix/overlays/pkgs.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
# This overlay includes all packages defined by the top-level default.nix.
|
||||
# The code is copied from the NUR repository [0].
|
||||
#
|
||||
# [0]: https://github.com/nix-community/nur-packages-template/blob/2610a5b60bd926cea3e6395511da8f0d14c613b9/overlay.nix
|
||||
|
||||
self: super:
|
||||
|
||||
let
|
||||
|
||||
isReserved = n: n == "lib" || n == "overlays" || n == "modules";
|
||||
nameValuePair = n: v: { name = n; value = v; };
|
||||
nurAttrs = import ../pkgs { pkgs = super; };
|
||||
|
||||
in
|
||||
builtins.listToAttrs
|
||||
(map (n: nameValuePair n nurAttrs.${n})
|
||||
(builtins.filter (n: !isReserved n)
|
||||
(builtins.attrNames nurAttrs)))
|
8
nix/overlays/posh.nix
Normal file
8
nix/overlays/posh.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
self: super:
|
||||
|
||||
let
|
||||
nixpkgs-master = import <nixpkgs-master> {};
|
||||
in {
|
||||
inherit (nixpkgs-master) podman conmon slirp4netns;
|
||||
posh = self.callPackage ../pkgs/posh.nix {};
|
||||
}
|
70
nix/pkgs/default.nix
Normal file
70
nix/pkgs/default.nix
Normal 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; };
|
||||
}
|
|
@ -1,24 +1,26 @@
|
|||
{ rustPlatform
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, callPackage
|
||||
, bash
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
name = "just-${version}";
|
||||
version = "849cdcb37fb42feb5e8724ec9fb3b34027e0da4f";
|
||||
let
|
||||
naersk = callPackage (import (fetchFromGitHub {
|
||||
owner = "nmattia";
|
||||
repo = "naersk";
|
||||
rev = "b3b328b088009972e6844f57c97807f6090fa004";
|
||||
sha256 = "152fl2c174zisl2bcky7xspwhc2s8ys2qdv6nvfhqav5x1rbngbp";
|
||||
})) {};
|
||||
|
||||
in
|
||||
naersk.buildPackage rec {
|
||||
version = "5acc112a9749063a554e3626a6055bb88f093468";
|
||||
|
||||
src = builtins.fetchGit {
|
||||
url = "https://github.com/casey/just.git";
|
||||
rev = version;
|
||||
};
|
||||
|
||||
cargoSha256 = "0awfq9fhcin2q6mvv54xw6i6pxhdp9xa1cpx3jmpf3a6h8l6s9wp";
|
||||
|
||||
doDoc = false;
|
||||
doCheck = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Just a command runner ";
|
||||
homepage = https://github.com/casey/just;
|
||||
license = licenses.unlicense;
|
||||
maintainers = [ ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
32
nix/pkgs/posh.nix
Normal file
32
nix/pkgs/posh.nix
Normal 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";
|
||||
};
|
||||
})
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
channels-nixos-stable-path = (builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/7e88992a8c7b2de0bcb89182d8686b27bd93e46a.tar.gz);
|
||||
channels-nixos-stable = import channels-nixos-stable-path { overlays = [ (import ./nix/overlay.nix) ]; };
|
||||
channels-nixos-stable = import channels-nixos-stable-path { overlays = builtins.attrValues (import ./nix/overlays); };
|
||||
|
||||
in
|
||||
with channels-nixos-stable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue