concat: RIP

This commit is contained in:
tv 2017-06-20 19:30:14 +02:00
parent 57c6b890f9
commit a9f4ad7586
10 changed files with 164 additions and 159 deletions

View File

@ -1,32 +1,6 @@
pkgs: oldpkgs: pkgs: oldpkgs:
with import <stockholm/lib>; with import <stockholm/lib>;
{ {
# Combine a list of derivations using symlinks. Paths in later derivations
# take precedence over earlier ones.
#
# Example: create wrapper but retain all other files (man pages etc.)
#
# {
# nixpkgs.config.packageOverrides = super: {
# hello = pkgs.concat "hello" [
# super.hello
# (pkgs.writeDashBin "hello" ''
# echo OMG
# echo exec ${super.hello}/bin/hello "$@"
# '')
# ];
# };
# }
#
concat = name: xs: pkgs.runCommand name {} ''
mkdir $out
${flip concatMapStrings xs (x: ''
cp --remove-destination -vrs ${x}/* $out
find $out -type d -exec chmod -v u+rwx {} +
'')}
'';
execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let
in pkgs.writeC name { inherit destination; } /* c */ '' in pkgs.writeC name { inherit destination; } /* c */ ''
#include <unistd.h> #include <unistd.h>

View File

@ -17,7 +17,10 @@ with import <stockholm/lib>;
# my life sucks # my life sucks
nixpkgs.config.packageOverrides = super: { nixpkgs.config.packageOverrides = super: {
irc-announce = super.callPackage <stockholm/krebs/5pkgs/simple/irc-announce> { irc-announce = super.callPackage <stockholm/krebs/5pkgs/simple/irc-announce> {
pkgs = pkgs // { coreutils = pkgs.concat "coreutils-hack" [ pkgs = pkgs // {
coreutils = pkgs.symlinkJoin {
name = "coreutils-hack";
paths = [
pkgs.coreutils pkgs.coreutils
(pkgs.writeDashBin "tee" '' (pkgs.writeDashBin "tee" ''
if test "$1" = /dev/stderr; then if test "$1" = /dev/stderr; then
@ -29,7 +32,9 @@ with import <stockholm/lib>;
${super.coreutils}/bin/tee "$@" ${super.coreutils}/bin/tee "$@"
fi fi
'') '')
];}; ];
};
};
}; };
}; };
boot.kernelParams = [ "copytoram" ]; boot.kernelParams = [ "copytoram" ];

View File

@ -5,7 +5,9 @@ with import <stockholm/lib>;
{ {
security.hideProcessInformation = true; security.hideProcessInformation = true;
nixpkgs.config.packageOverrides = super: { nixpkgs.config.packageOverrides = super: {
htop = pkgs.concat "htop" [ htop = pkgs.symlinkJoin {
name = "htop";
paths = [
super.htop super.htop
(pkgs.writeDashBin "htop" '' (pkgs.writeDashBin "htop" ''
export HTOPRC=${pkgs.writeText "htoprc" '' export HTOPRC=${pkgs.writeText "htoprc" ''
@ -38,4 +40,5 @@ with import <stockholm/lib>;
'') '')
]; ];
}; };
};
} }

View File

@ -113,12 +113,15 @@ let
macro index ~ ,@( 'Toggle sidebar' # toggle the sidebar macro index ~ ,@( 'Toggle sidebar' # toggle the sidebar
''; '';
mutt = pkgs.concat "mutt" [ mutt = pkgs.symlinkJoin {
name = "mutt";
paths = [
pkgs.neomutt pkgs.neomutt
(pkgs.writeDashBin "mutt" '' (pkgs.writeDashBin "mutt" ''
exec ${pkgs.neomutt}/bin/mutt -F ${muttrc} $@ exec ${pkgs.neomutt}/bin/mutt -F ${muttrc} $@
'') '')
]; ];
};
in { in {
environment.systemPackages = [ environment.systemPackages = [

View File

@ -322,7 +322,9 @@ let
in { in {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.concat "mc" [ (pkgs.symlinkJoin {
name = "mc";
paths = [
pkgs.mc pkgs.mc
(pkgs.writeDashBin "mc" '' (pkgs.writeDashBin "mc" ''
export MC_DATADIR=${pkgs.writeOut "mc-ext" { export MC_DATADIR=${pkgs.writeOut "mc-ext" {
@ -332,7 +334,8 @@ in {
export TERM=xterm-256color export TERM=xterm-256color
exec ${pkgs.mc}/bin/mc -S xoria256 "$@" exec ${pkgs.mc}/bin/mc -S xoria256 "$@"
'') '')
]) ];
})
]; ];
} }

View File

@ -7,12 +7,15 @@ let
delete delete
]; ];
mpv = pkgs.concat "mpv" [ mpv = pkgs.symlinkJoin {
name = "mpv";
paths = [
pkgs.mpv pkgs.mpv
(pkgs.writeDashBin "mpv" '' (pkgs.writeDashBin "mpv" ''
exec ${pkgs.mpv}/bin/mpv --no-config --script=${scripts} "$@" exec ${pkgs.mpv}/bin/mpv --no-config --script=${scripts} "$@"
'') '')
]; ];
};
moveToDir = key: dir: pkgs.writeText "move-with-${key}.lua" '' moveToDir = key: dir: pkgs.writeText "move-with-${key}.lua" ''
tmp_dir = "${dir}" tmp_dir = "${dir}"

View File

@ -207,7 +207,9 @@ let
alldirs = attrValues dirs ++ map dirOf (attrValues files); alldirs = attrValues dirs ++ map dirOf (attrValues files);
in unique (sort lessThan alldirs); in unique (sort lessThan alldirs);
vim = pkgs.concat "vim" [ vim = pkgs.symlinkJoin {
name = "vim";
paths = [
pkgs.vim pkgs.vim
(pkgs.writeDashBin "vim" '' (pkgs.writeDashBin "vim" ''
set -efu set -efu
@ -215,6 +217,7 @@ let
exec ${pkgs.vim}/bin/vim "$@" exec ${pkgs.vim}/bin/vim "$@"
'') '')
]; ];
};
hs.vim = pkgs.writeText "hs.vim" '' hs.vim = pkgs.writeText "hs.vim" ''
syn region String start=+\[[[:alnum:]]*|+ end=+|]+ syn region String start=+\[[[:alnum:]]*|+ end=+|]+

View File

@ -32,7 +32,10 @@ with import <stockholm/lib>;
# hack `tee` behavior # hack `tee` behavior
nixpkgs.config.packageOverrides = super: { nixpkgs.config.packageOverrides = super: {
irc-announce = super.callPackage <stockholm/krebs/5pkgs/simple/irc-announce> { irc-announce = super.callPackage <stockholm/krebs/5pkgs/simple/irc-announce> {
pkgs = pkgs // { coreutils = pkgs.concat "coreutils-hack" [ pkgs = pkgs // {
coreutils = pkgs.symlinkJoin {
name = "coreutils-hack";
paths = [
pkgs.coreutils pkgs.coreutils
(pkgs.writeDashBin "tee" '' (pkgs.writeDashBin "tee" ''
if test "$1" = /dev/stderr; then if test "$1" = /dev/stderr; then
@ -44,7 +47,9 @@ with import <stockholm/lib>;
${super.coreutils}/bin/tee "$@" ${super.coreutils}/bin/tee "$@"
fi fi
'') '')
];}; ];
};
};
}; };
}; };
} }

View File

@ -4,7 +4,9 @@ with import <stockholm/lib>;
{ {
nixpkgs.config.packageOverrides = super: { nixpkgs.config.packageOverrides = super: {
htop = pkgs.concat "htop" [ htop = pkgs.symlinkJoin {
name = "htop";
paths = [
super.htop super.htop
(pkgs.writeDashBin "htop" '' (pkgs.writeDashBin "htop" ''
export HTOPRC=${pkgs.writeText "htoprc" '' export HTOPRC=${pkgs.writeText "htoprc" ''
@ -37,4 +39,5 @@ with import <stockholm/lib>;
'') '')
]; ];
}; };
};
} }

View File

@ -297,7 +297,9 @@ let {
alldirs = attrValues dirs ++ map dirOf (attrValues files); alldirs = attrValues dirs ++ map dirOf (attrValues files);
in unique (sort lessThan alldirs); in unique (sort lessThan alldirs);
vim-wrapper = pkgs.concat "vim" [ vim-wrapper = pkgs.symlinkJoin {
name = "vim";
paths = [
pkgs.vim_configurable pkgs.vim_configurable
(pkgs.writeDashBin "vim" '' (pkgs.writeDashBin "vim" ''
set -efu set -efu
@ -309,6 +311,7 @@ let {
exec ${pkgs.vim_configurable}/bin/vim "$@" exec ${pkgs.vim_configurable}/bin/vim "$@"
'') '')
]; ];
};
vimrc = pkgs.writeText "vimrc" '' vimrc = pkgs.writeText "vimrc" ''
set nocompatible set nocompatible