Merge remote-tracking branch 'ni/master' into HEAD
This commit is contained in:
commit
2bf77c0cc0
|
@ -1,15 +1,20 @@
|
||||||
with import <stockholm/lib>;
|
with import <stockholm/lib>;
|
||||||
|
let
|
||||||
|
overrides = self: super:
|
||||||
|
listToAttrs
|
||||||
|
(map
|
||||||
|
(name: nameValuePair (removeSuffix ".nix" name)
|
||||||
|
(self.callPackage (./. + "/${name}") {}))
|
||||||
|
(filter
|
||||||
|
(name: name != "default.nix" && !hasPrefix "." name)
|
||||||
|
(attrNames (readDir ./.))));
|
||||||
|
in
|
||||||
self: super:
|
self: super:
|
||||||
{
|
{
|
||||||
|
haskell.packages = mapAttrs (_: pkgs: pkgs.override {
|
||||||
|
inherit overrides;
|
||||||
|
}) super.haskell.packages;
|
||||||
haskellPackages = super.haskellPackages.override {
|
haskellPackages = super.haskellPackages.override {
|
||||||
overrides = self: super:
|
inherit overrides;
|
||||||
listToAttrs
|
|
||||||
(map
|
|
||||||
(name: nameValuePair (removeSuffix ".nix" name)
|
|
||||||
(self.callPackage (./. + "/${name}") {}))
|
|
||||||
(filter
|
|
||||||
(name: name != "default.nix" && !hasPrefix "." name)
|
|
||||||
(attrNames (readDir ./.))));
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = http://cgit.ni.krebsco.de/dic;
|
url = http://cgit.ni.krebsco.de/dic;
|
||||||
rev = "refs/tags/v1.0.1";
|
rev = "refs/tags/v1.0.2";
|
||||||
sha256 = "1686mba1z4m7vq70w26qpl00z1cz286c9bya9ql36g6w2pbcs8d3";
|
sha256 = "133x2z3dr5synckdvgnyc9fa7jdca43vj0973v148i13x4dqgr36";
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = [
|
phases = [
|
||||||
|
|
61
shell.nix
61
shell.nix
|
@ -6,13 +6,18 @@ let
|
||||||
# high level commands
|
# high level commands
|
||||||
#
|
#
|
||||||
|
|
||||||
# usage: deploy [--force-populate] [--user=USER]
|
# usage: deploy
|
||||||
# --system=SYSTEM [--target=TARGET]
|
# [--force-populate]
|
||||||
|
# [--quiet]
|
||||||
|
# --system=SYSTEM
|
||||||
|
# [--target=TARGET]
|
||||||
|
# [--user=USER]
|
||||||
cmds.deploy = pkgs.writeDash "cmds.deploy" ''
|
cmds.deploy = pkgs.writeDash "cmds.deploy" ''
|
||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
command=deploy
|
command=deploy
|
||||||
. ${init.args}
|
. ${init.args}
|
||||||
|
\test -n "''${quiet-}" || quiet=false
|
||||||
\test -n "''${target-}" || target=$system
|
\test -n "''${target-}" || target=$system
|
||||||
\test -n "''${user-}" || user=$LOGNAME
|
\test -n "''${user-}" || user=$LOGNAME
|
||||||
. ${init.env}
|
. ${init.env}
|
||||||
|
@ -21,13 +26,18 @@ let
|
||||||
exec ${utils.deploy}
|
exec ${utils.deploy}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# usage: install [--force-populate] [--user=USER]
|
# usage: install
|
||||||
# --system=SYSTEM --target=TARGET
|
# [--force-populate]
|
||||||
|
# [--quiet]
|
||||||
|
# --system=SYSTEM
|
||||||
|
# --target=TARGET
|
||||||
|
# [--user=USER]
|
||||||
cmds.install = pkgs.writeBash "cmds.install" ''
|
cmds.install = pkgs.writeBash "cmds.install" ''
|
||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
command=install
|
command=install
|
||||||
. ${init.args}
|
. ${init.args}
|
||||||
|
\test -n "''${quiet-}" || quiet=false
|
||||||
\test -n "''${user-}" || user=$LOGNAME
|
\test -n "''${user-}" || user=$LOGNAME
|
||||||
. ${init.env}
|
. ${init.env}
|
||||||
|
|
||||||
|
@ -63,8 +73,12 @@ let
|
||||||
exec nixos-install
|
exec nixos-install
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# usage: test [--force-populate] [--user=USER]
|
# usage: test
|
||||||
# --system=SYSTEM --target=TARGET
|
# [--force-populate]
|
||||||
|
# [--quiet]
|
||||||
|
# --system=SYSTEM
|
||||||
|
# --target=TARGET
|
||||||
|
# [--user=USER]
|
||||||
cmds.test = pkgs.writeDash "cmds.test" /* sh */ ''
|
cmds.test = pkgs.writeDash "cmds.test" /* sh */ ''
|
||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
|
@ -72,6 +86,7 @@ let
|
||||||
|
|
||||||
command=test
|
command=test
|
||||||
. ${init.args}
|
. ${init.args}
|
||||||
|
\test -n "''${quiet-}" || quiet=false
|
||||||
\test -n "''${user-}" || user=$LOGNAME
|
\test -n "''${user-}" || user=$LOGNAME
|
||||||
. ${init.env}
|
. ${init.env}
|
||||||
. ${init.proxy}
|
. ${init.proxy}
|
||||||
|
@ -144,14 +159,15 @@ let
|
||||||
|
|
||||||
init.args = pkgs.writeText "init.args" /* sh */ ''
|
init.args = pkgs.writeText "init.args" /* sh */ ''
|
||||||
args=$(${pkgs.utillinux}/bin/getopt -n "$command" -s sh \
|
args=$(${pkgs.utillinux}/bin/getopt -n "$command" -s sh \
|
||||||
-o s:t:u: \
|
-o Qs:t:u: \
|
||||||
-l force-populate,system:,target:,user: \
|
-l force-populate,quiet,system:,target:,user: \
|
||||||
-- "$@")
|
-- "$@")
|
||||||
if \test $? != 0; then exit 1; fi
|
if \test $? != 0; then exit 1; fi
|
||||||
eval set -- "$args"
|
eval set -- "$args"
|
||||||
force_populate=false;
|
force_populate=false
|
||||||
while :; do case $1 in
|
while :; do case $1 in
|
||||||
--force-populate) force_populate=true; shift;;
|
--force-populate) force_populate=true; shift;;
|
||||||
|
-Q|--quiet) quiet=true; shift;;
|
||||||
-s|--system) system=$2; shift 2;;
|
-s|--system) system=$2; shift 2;;
|
||||||
-t|--target) target=$2; shift 2;;
|
-t|--target) target=$2; shift 2;;
|
||||||
-u|--user) user=$2; shift 2;;
|
-u|--user) user=$2; shift 2;;
|
||||||
|
@ -162,6 +178,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
init.env = pkgs.writeText "init.env" /* sh */ ''
|
init.env = pkgs.writeText "init.env" /* sh */ ''
|
||||||
|
export quiet
|
||||||
export system
|
export system
|
||||||
export target
|
export target
|
||||||
export user
|
export user
|
||||||
|
@ -182,7 +199,7 @@ let
|
||||||
source_file=$user/1systems/$system/source.nix
|
source_file=$user/1systems/$system/source.nix
|
||||||
source=$(get-source "$source_file")
|
source=$(get-source "$source_file")
|
||||||
qualified_target=$target_user@$target_host:$target_port$target_path
|
qualified_target=$target_user@$target_host:$target_port$target_path
|
||||||
if test "$force_populate" = true; then
|
if \test "$force_populate" = true; then
|
||||||
echo "$source" | populate --force "$qualified_target"
|
echo "$source" | populate --force "$qualified_target"
|
||||||
else
|
else
|
||||||
echo "$source" | populate "$qualified_target"
|
echo "$source" | populate "$qualified_target"
|
||||||
|
@ -195,6 +212,7 @@ let
|
||||||
NIX_PATH=$(quote "$target_path") \
|
NIX_PATH=$(quote "$target_path") \
|
||||||
STOCKHOLM_VERSION=$(quote "$STOCKHOLM_VERSION") \
|
STOCKHOLM_VERSION=$(quote "$STOCKHOLM_VERSION") \
|
||||||
nix-shell --run "$(quote "
|
nix-shell --run "$(quote "
|
||||||
|
quiet=$(quote "$quiet") \
|
||||||
system=$(quote "$system") \
|
system=$(quote "$system") \
|
||||||
target=$(quote "$target") \
|
target=$(quote "$target") \
|
||||||
using_proxy=true \
|
using_proxy=true \
|
||||||
|
@ -206,24 +224,31 @@ let
|
||||||
|
|
||||||
utils.build = pkgs.writeDash "utils.build" ''
|
utils.build = pkgs.writeDash "utils.build" ''
|
||||||
set -efu
|
set -efu
|
||||||
|
${utils.with-whatsupnix} \
|
||||||
${pkgs.nix}/bin/nix-build \
|
${pkgs.nix}/bin/nix-build \
|
||||||
-Q \
|
|
||||||
--no-out-link \
|
--no-out-link \
|
||||||
--show-trace \
|
--show-trace \
|
||||||
-E "with import <stockholm>; $1" \
|
-E "with import <stockholm>; $1" \
|
||||||
-I "$target_path" \
|
-I "$target_path" \
|
||||||
2>&1 |
|
|
||||||
${pkgs.whatsupnix}/bin/whatsupnix
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
utils.deploy = pkgs.writeDash "utils.deploy" ''
|
utils.deploy = pkgs.writeDash "utils.deploy" ''
|
||||||
set -efu
|
set -efu
|
||||||
PATH=/run/current-system/sw/bin nixos-rebuild switch \
|
# Use system's nixos-rebuild, which is not self-contained
|
||||||
-Q \
|
export PATH=/run/current-system/sw/bin
|
||||||
|
${utils.with-whatsupnix} \
|
||||||
|
nixos-rebuild switch \
|
||||||
--show-trace \
|
--show-trace \
|
||||||
-I "$target_path" \
|
-I "$target_path"
|
||||||
2>&1 |
|
'';
|
||||||
${pkgs.whatsupnix}/bin/whatsupnix
|
|
||||||
|
utils.with-whatsupnix = pkgs.writeDash "utils.with-whatsupnix" ''
|
||||||
|
set -efu
|
||||||
|
if \test "$quiet" = true; then
|
||||||
|
"$@" -Q 2>&1 | ${pkgs.whatsupnix}/bin/whatsupnix
|
||||||
|
else
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shell.get-version = pkgs.writeDash "shell.get-version" ''
|
shell.get-version = pkgs.writeDash "shell.get-version" ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user