Merge remote-tracking branch 'ni/master'
This commit is contained in:
commit
1a5d6a75b0
@ -24,6 +24,7 @@ let
|
||||
./go.nix
|
||||
./hidden-ssh.nix
|
||||
./htgen.nix
|
||||
./iana-etc.nix
|
||||
./iptables.nix
|
||||
./kapacitor.nix
|
||||
./monit.nix
|
||||
|
55
krebs/3modules/iana-etc.nix
Normal file
55
krebs/3modules/iana-etc.nix
Normal file
@ -0,0 +1,55 @@
|
||||
with import <stockholm/lib>;
|
||||
{ config, pkgs, ... }: {
|
||||
|
||||
options.krebs.iana-etc.services = mkOption {
|
||||
default = {};
|
||||
type = types.attrsOf (types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
port = mkOption {
|
||||
default = config._module.args.name;
|
||||
type = types.addCheck types.str (test "[1-9][0-9]*");
|
||||
};
|
||||
} // genAttrs ["tcp" "udp"] (protocol: mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
}));
|
||||
};
|
||||
|
||||
config.environment.etc = mkIf (config.krebs.iana-etc.services != {}) {
|
||||
services.source = mkForce (pkgs.runCommand "krebs-iana-etc" {} ''
|
||||
exec < ${pkgs.iana_etc}/etc/services
|
||||
exec > $out
|
||||
awk -F '[ /]+' '
|
||||
BEGIN {
|
||||
port=0
|
||||
}
|
||||
${concatMapStringsSep "\n" (entry: ''
|
||||
$2 == ${entry.port} {
|
||||
port=$2
|
||||
next
|
||||
}
|
||||
port == ${entry.port} {
|
||||
${concatMapStringsSep "\n"
|
||||
(proto: let
|
||||
s = "${entry.${proto}.name} ${entry.port}/${proto}";
|
||||
in
|
||||
"print ${toJSON s}")
|
||||
(filter (proto: entry.${proto} != null) ["tcp" "udp"])}
|
||||
port=0
|
||||
}
|
||||
'') (attrValues config.krebs.iana-etc.services)}
|
||||
{
|
||||
print $0
|
||||
}
|
||||
'
|
||||
'');
|
||||
};
|
||||
|
||||
}
|
17
krebs/5pkgs/simple/git-preview.nix
Normal file
17
krebs/5pkgs/simple/git-preview.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ coreutils, git, writeDashBin }:
|
||||
|
||||
writeDashBin "git-preview" ''
|
||||
set -efu
|
||||
head_commit=$(${git}/bin/git log -1 --format=%H)
|
||||
merge_commit=$1; shift
|
||||
merge_message='Merge for git-preview'
|
||||
preview_dir=$(${coreutils}/bin/mktemp --tmpdir -d git-preview.XXXXXXXX)
|
||||
preview_branch=$(${coreutils}/bin/basename "$preview_dir")
|
||||
${git}/bin/git worktree add -b "$preview_branch" "$preview_dir" >/dev/null
|
||||
${git}/bin/git -C "$preview_dir" checkout "$head_commit"
|
||||
${git}/bin/git -C "$preview_dir" merge -m "$merge_message" "$merge_commit"
|
||||
${git}/bin/git -C "$preview_dir" diff "$head_commit.." "$@" &
|
||||
${git}/bin/git branch -fd "$preview_branch"
|
||||
${coreutils}/bin/rm -fR "$preview_dir"
|
||||
wait
|
||||
''
|
@ -10,7 +10,7 @@ in
|
||||
nixos-config.symlink = "stockholm/mv/1systems/${name}/config.nix";
|
||||
nixpkgs.git = {
|
||||
# nixos-17.03
|
||||
ref = mkDefault "56da88a298a6f549701a10bb12072804a1ebfbd5";
|
||||
ref = mkDefault "3d04a557b72aa0987d9bf079e1445280b6bfd907";
|
||||
url = https://github.com/NixOS/nixpkgs;
|
||||
};
|
||||
secrets.file = getAttr builder {
|
||||
|
17
shell.nix
17
shell.nix
@ -22,7 +22,12 @@ let
|
||||
. ${init.env}
|
||||
. ${init.proxy opts}
|
||||
|
||||
exec ${utils.deploy}
|
||||
# Use system's nixos-rebuild, which is not self-contained
|
||||
export PATH=/run/current-system/sw/bin
|
||||
exec ${utils.with-whatsupnix} \
|
||||
nixos-rebuild switch \
|
||||
--show-trace \
|
||||
-I "$target_path"
|
||||
'');
|
||||
|
||||
cmds.install = pkgs.withGetopt {
|
||||
@ -205,16 +210,6 @@ let
|
||||
-I "$target_path" \
|
||||
'';
|
||||
|
||||
utils.deploy = pkgs.writeDash "utils.deploy" ''
|
||||
set -efu
|
||||
# Use system's nixos-rebuild, which is not self-contained
|
||||
export PATH=/run/current-system/sw/bin
|
||||
${utils.with-whatsupnix} \
|
||||
nixos-rebuild switch \
|
||||
--show-trace \
|
||||
-I "$target_path"
|
||||
'';
|
||||
|
||||
utils.with-whatsupnix = pkgs.writeDash "utils.with-whatsupnix" ''
|
||||
set -efu
|
||||
if \test "$quiet" = true; then
|
||||
|
@ -1,5 +1,3 @@
|
||||
_:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./charybdis
|
||||
|
Loading…
Reference in New Issue
Block a user