Merge remote-tracking branch 'lass/master'

This commit is contained in:
makefu 2018-09-13 16:41:25 +02:00
commit b830d7476a
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
55 changed files with 65 additions and 755 deletions

View File

@ -13,10 +13,7 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
(attrNames (filterAttrs (_: eq "directory") (readDir (<stockholm> + "/${ns}/1systems"))))
(name: let
config = import (<stockholm> + "/${ns}/1systems/${name}/config.nix");
source = import (<stockholm> + "/${ns}/1systems/${name}/source.nix");
in import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [ config ];
} // {
inherit source;
});
}

View File

@ -1,4 +0,0 @@
import <stockholm/jeschli/source.nix> {
name = "bln";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/jeschli/source.nix> {
name = "bolide";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/jeschli/source.nix> {
name = "brauerei";
secure = true;
}

View File

@ -1,3 +0,0 @@
import <stockholm/jeschli/source.nix> {
name = "enklave";
}

View File

@ -1,4 +0,0 @@
import <stockholm/jeschli/source.nix> {
name = "reagenzglas";
secure = true;
}

View File

@ -1,26 +0,0 @@
with import <stockholm/lib>;
host@{ name, secure ? false, override ? {} }: let
builder = if getEnv "dummy_secrets" == "true"
then "buildbot"
else "jeschli";
_file = <stockholm> + "/jeschli/1systems/${name}/source.nix";
pkgs = import <nixpkgs> {
overlays = map import [
<stockholm/krebs/5pkgs>
<stockholm/submodules/nix-writers/pkgs>
];
};
in
evalSource (toString _file) [
{
nixos-config.symlink = "stockholm/jeschli/1systems/${name}/config.nix";
nixpkgs = (import <stockholm/krebs/source.nix> host).nixpkgs;
secrets.file = getAttr builder {
buildbot = toString <stockholm/jeschli/2configs/tests/dummy-secrets>;
jeschli = "${getEnv "HOME"}/secrets/${name}";
};
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
}
override
]

View File

@ -44,11 +44,6 @@ let
exec >&2
source=${pkgs.writeJSON "source.json" populate-source}
LOGNAME=krebs ${pkgs.populate}/bin/populate --force root@server:22/var/src/ < "$source"
# TODO: make deploy work
#LOGNAME=krebs ${pkgs.stockholm}/bin/deploy \
# --force-populate \
# --source=${./data/test-source.nix} \
# --system=server \
'';
minimalSystem = (import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "hotdog";
}

View File

@ -1,13 +0,0 @@
with import <stockholm/lib>;
let
pkgs = import <nixpkgs> {};
nixpkgs = builtins.fetchTarball {
url = https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
};
in import <stockholm/krebs/source.nix> {
name = "onebutton";
override.nixpkgs = mkForce {
file = toString nixpkgs;
};
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "puyak";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-all-krebs-modules";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-arch";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-centos6";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-centos7";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-failing";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "test-minimal-deploy";
}

View File

@ -1,3 +0,0 @@
import <stockholm/krebs/source.nix> {
name = "wolf";
}

View File

@ -1,47 +1,11 @@
{ config, pkgs, ... }: with import <stockholm/lib>;
{ config, ... }: with import <stockholm/lib>;
let
hostname = config.networking.hostName;
sourceRepos = [
"http://cgit.enklave.r/stockholm"
"http://cgit.gum.r/stockholm"
"http://cgit.hotdog.r/stockholm"
"http://cgit.ni.r/stockholm"
"http://cgit.prism.r/stockholm"
];
# usage: build USER HOST
# This executable is meant to be run with <stockholm> as working directory.
# USER is expected to be a subdirectory of the working directory.
build = pkgs.writeDash "build" ''
set -efu
user=$1
host=$2
result=$(nix-build \
--argstr name "$host" \
--argstr target "$HOME"/stockholm-build \
--attr test \
--no-build-output \
--no-out-link \
--show-trace \
"$user"/krops.nix \
)
exec "$result"
'';
in
{
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = {
enable = true;
virtualHosts.build = {
serverAliases = [ "build.${hostname}.r" ];
serverAliases = [ "build.${config.networking.hostName}.r" ];
locations."/".extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
@ -49,155 +13,16 @@ in
'';
};
};
krebs.buildbot.master = {
slaves = {
testslave = "lasspass";
};
change_source.stockholm = concatMapStrings (repo: ''
cs.append(
changes.GitPoller(
"${repo}",
workdir='stockholm${elemAt(splitString "." repo) 1}', branches=True,
project='stockholm',
pollinterval=10
)
)
'') sourceRepos;
scheduler = {
auto-scheduler = ''
sched.append(
schedulers.SingleBranchScheduler(
change_filter=util.ChangeFilter(branch_re=".*"),
treeStableTimer=60,
name="build-all-branches",
builderNames=[
"hosts",
]
)
)
'';
force-scheduler = ''
sched.append(
schedulers.ForceScheduler(
name="hosts",
builderNames=[
"hosts",
]
)
)
'';
};
builder_pre = ''
# prepare grab_repo step for stockholm
grab_repo = steps.Git(
repourl=util.Property('repository', 'http://cgit.hotdog.r/stockholm'),
mode='full',
submodules=True,
)
'';
builder = {
hosts = ''
from buildbot import interfaces
from buildbot.steps.shell import ShellCommand
class StepToStartMoreSteps(ShellCommand):
def __init__(self, **kwargs):
ShellCommand.__init__(self, **kwargs)
def addBuildSteps(self, steps_factories):
for sf in steps_factories:
step = interfaces.IBuildStepFactory(sf).buildStep()
step.setBuild(self.build)
step.setBuildSlave(self.build.slavebuilder.slave)
step_status = self.build.build_status.addStepWithName(step.name)
step.setStepStatus(step_status)
self.build.steps.append(step)
def start(self):
props = self.build.getProperties()
hosts = json.loads(props.getProperty('hosts_json'))
for host in hosts:
user = hosts[host]['owner']
self.addBuildSteps([steps.ShellCommand(
name=str(host),
env={
"NIX_PATH": "secrets=/var/src/stockholm/null:stockholm=./:/var/src",
"NIX_REMOTE": "daemon",
},
command=[
"${build}", user, host
],
timeout=90001,
workdir='build', # TODO figure out why we need this?
)])
ShellCommand.start(self)
f = util.BuildFactory()
f.addStep(grab_repo)
f.addStep(steps.SetPropertyFromCommand(
env={
"NIX_PATH": "secrets=/var/src/stockholm/null:stockholm=./:/var/src",
"NIX_REMOTE": "daemon",
},
name="get_hosts",
command=["nix-instantiate", "--json", "--strict", "--eval", "-E", """
with import <nixpkgs> {};
let
eval-config = cfg:
import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [
(import cfg)
];
}
;
system = eval-config ./krebs/1systems/hotdog/config.nix; # TODO put a better config here
ci-systems = lib.filterAttrs (_: v: v.ci) system.config.krebs.hosts;
filtered-attrs = lib.mapAttrs ( n: v: {
owner = v.owner.name;
}) ci-systems;
in filtered-attrs
"""],
property="hosts_json"
))
f.addStep(StepToStartMoreSteps(command=["echo"])) # TODO remove dummy command from here
bu.append(
util.BuilderConfig(
name="hosts",
slavenames=slavenames,
factory=f
)
)
'';
};
krebs.ci = {
enable = true;
web.enable = true;
irc = {
enable = true;
nick = "build|${hostname}";
server = "irc.r";
channels = [ "noise" "xxx" ];
allowForce = true;
repos = {
stockholm.urls = [
"http://cgit.enklave.r/stockholm"
"http://cgit.gum.r/stockholm"
"http://cgit.hotdog.r/stockholm"
"http://cgit.ni.r/stockholm"
"http://cgit.prism.r/stockholm"
];
};
extraConfig = ''
c['buildbotURL'] = "http://build.${hostname}.r/"
'';
};
krebs.buildbot.slave = {
enable = true;
masterhost = "localhost";
username = "testslave";
password = "lasspass";
packages = with pkgs; [ gnumake jq nix populate gnutar lzma gzip ];
};
}

View File

@ -49,6 +49,7 @@ with import <stockholm/lib>;
users.mutableUsers = false;
users.extraUsers.root.openssh.authorizedKeys.keys = [
# TODO
config.krebs.users.jeschli-brauerei.pubkey
config.krebs.users.lass.pubkey
config.krebs.users.lass-mors.pubkey
config.krebs.users.makefu.pubkey

View File

@ -141,7 +141,7 @@ let
enable = true;
nick = "build|${hostname}";
server = "irc.r";
channels = [ "noise" ];
channels = [ "xxx" "noise" ];
allowForce = true;
};
extraConfig = ''

View File

@ -160,7 +160,7 @@ rec {
task-list = buildSimpleReaktorPlugin "task-list" {
pattern = "^task-list";
script = pkgs.writeDash "task-list" ''
${pkgs.taskwarrior}/bin/task rc:${taskrcFile} minimal
${pkgs.taskwarrior}/bin/task rc:${taskrcFile} export | ${pkgs.jq}/bin/jq -r '.[] | select(.id != 0) | "\(.id) \(.description)"'
'';
};

View File

@ -1,230 +0,0 @@
{ pkgs }: let
stockholm-dir = ../../../..;
lib = import (stockholm-dir + "/lib");
#
# high level commands
#
cmds.deploy = pkgs.withGetopt {
force-populate = { default = /* sh */ "false"; switch = true; };
quiet = { default = /* sh */ "false"; switch = true; };
source_file = {
default = /* sh */ "$user/1systems/$system/source.nix";
long = "source";
};
system = {};
target.default = /* sh */ "$system";
user.default = /* sh */ "$LOGNAME";
} (opts: pkgs.writeDash "stockholm.deploy" ''
set -efu
. ${init.env}
. ${init.proxy "deploy" opts}
# 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.get-version = pkgs.writeDash "get-version" ''
set -efu
hostname=''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)}
version=git.$(${pkgs.git}/bin/git describe --always --dirty)
case $version in (*-dirty)
version=$version@$hostname
esac
date=$(${pkgs.coreutils}/bin/date +%y.%m)
echo "$date.$version"
'';
cmds.install = pkgs.withGetopt {
force-populate = { default = /* sh */ "false"; switch = true; };
quiet = { default = /* sh */ "false"; switch = true; };
source_file = {
default = /* sh */ "$user/1systems/$system/source.nix";
long = "source";
};
system = {};
target = {};
user.default = /* sh */ "$LOGNAME";
} (opts: pkgs.writeBash "stockholm.install" ''
set -efu
. ${init.env}
if \test "''${using_proxy-}" != true; then
${pkgs.openssh}/bin/ssh \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
"$target_user@$target_host" -p "$target_port" \
env target_path=$(${pkgs.quote}/bin/quote "$target_path") \
sh -s prepare \
< ${stockholm-dir + "/krebs/4lib/infest/prepare.sh"}
# TODO inline prepare.sh?
fi
. ${init.proxy "install" opts}
# these variables get defined by nix-shell (i.e. nix-build) from
# XDG_RUNTIME_DIR and reference the wrong directory (/run/user/0),
# which only exists on / and not at /mnt.
export NIX_BUILD_TOP=/tmp
export TEMPDIR=/tmp
export TEMP=/tmp
export TMPDIR=/tmp
export TMP=/tmp
export XDG_RUNTIME_DIR=/tmp
export NIXOS_CONFIG="$target_path/nixos-config"
cd
exec nixos-install
'');
cmds.test = pkgs.withGetopt {
force-populate = { default = /* sh */ "false"; switch = true; };
quiet = { default = /* sh */ "false"; switch = true; };
source_file = {
default = /* sh */ "$user/1systems/$system/source.nix";
long = "source";
};
system = {};
target = {};
user.default = /* sh */ "$LOGNAME";
} (opts: pkgs.writeDash "stockholm.test" /* sh */ ''
set -efu
export dummy_secrets=true
. ${init.env}
. ${init.proxy "test" opts}
exec ${utils.build} config.system.build.toplevel
'');
#
# low level commands
#
# usage: get-source SOURCE_FILE
cmds.get-source = pkgs.writeDash "stockholm.get-source" ''
set -efu
exec ${pkgs.nix}/bin/nix-instantiate \
--eval \
--json \
--readonly-mode \
--show-trace \
--strict \
"$1"
'';
# usage: parse-target [--default=TARGET] TARGET
# TARGET = [USER@]HOST[:PORT][/PATH]
cmds.parse-target = pkgs.withGetopt {
default_target = {
long = "default";
short = "d";
};
} (opts: pkgs.writeDash "stockholm.parse-target" ''
set -efu
target=$1; shift
for arg; do echo "$0: bad argument: $arg" >&2; done
if \test $# != 0; then exit 2; fi
exec ${pkgs.jq}/bin/jq \
-enr \
--arg default_target "$default_target" \
--arg target "$target" \
-f ${pkgs.writeText "stockholm.parse-target.jq" ''
def parse: match("^(?:([^@]+)@)?([^:/]+)?(?::([0-9]+))?(/.*)?$") | {
user: .captures[0].string,
host: .captures[1].string,
port: .captures[2].string,
path: .captures[3].string,
};
def sanitize: with_entries(select(.value != null));
($default_target | parse) + ($target | parse | sanitize) |
. + { local: (.user == env.LOGNAME and .host == env.HOSTNAME) }
''}
'');
init.env = pkgs.writeText "init.env" /* sh */ ''
export HOSTNAME="$(${pkgs.nettools}/bin/hostname)"
export quiet
export system
export target
export user
default_target=root@$system:22/var/src
export target_object="$(
${cmds.parse-target} "$target" -d "$default_target"
)"
export target_user="$(echo $target_object | ${pkgs.jq}/bin/jq -r .user)"
export target_host="$(echo $target_object | ${pkgs.jq}/bin/jq -r .host)"
export target_port="$(echo $target_object | ${pkgs.jq}/bin/jq -r .port)"
export target_path="$(echo $target_object | ${pkgs.jq}/bin/jq -r .path)"
export target_local="$(echo $target_object | ${pkgs.jq}/bin/jq -r .local)"
'';
init.proxy = command: opts: pkgs.writeText "init.proxy" /* sh */ ''
if \test "''${using_proxy-}" != true; then
source=$(${cmds.get-source} "$source_file")
qualified_target=$target_user@$target_host:$target_port$target_path
if \test "$force_populate" = true; then
echo "$source" | ${pkgs.populate}/bin/populate --force "$qualified_target"
else
echo "$source" | ${pkgs.populate}/bin/populate "$qualified_target"
fi
if \test "$target_local" != true; then
exec ${pkgs.openssh}/bin/ssh \
"$target_user@$target_host" -p "$target_port" \
cd "$target_path/stockholm" \; \
NIX_PATH=$(${pkgs.quote}/bin/quote "$target_path") \
nix-shell --run "$(${pkgs.quote}/bin/quote "
${lib.concatStringsSep " " (lib.mapAttrsToList
(name: opt: /* sh */
"${opt.varname}=\$(${pkgs.quote}/bin/quote ${opt.ref})")
opts
)} \
using_proxy=true \
${lib.shell.escape command} \
$WITHGETOPT_ORIG_ARGS \
")"
fi
fi
'';
utils.build = pkgs.writeDash "utils.build" ''
set -efu
${utils.with-whatsupnix} \
${pkgs.nix}/bin/nix-build \
--no-out-link \
--show-trace \
-E "with import <stockholm>; $1" \
-I "$target_path" \
'';
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
'';
in
pkgs.write "stockholm" (lib.mapAttrs' (name: link:
lib.nameValuePair "/bin/${name}" { inherit link; }
) cmds)

View File

@ -0,0 +1,49 @@
{ openssl, writePython2Bin }:
writePython2Bin "syncthing-device-id" {
flakeIgnore = [
"E226"
"E302"
"E305"
"E501"
"F401"
];
} /* python */ ''
import base64
import hashlib
import subprocess
import sys
B32ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
def luhn_checksum(data, alphabet=B32ALPHABET):
n = len(alphabet)
number = tuple(alphabet.index(i) for i in reversed(data))
result = (sum(number[::2]) +
sum(sum(divmod(i * 2, n)) for i in number[1::2])) % n
return alphabet[-result]
def main(incert):
der_data = subprocess.check_output([
'${openssl}/bin/openssl',
'x509',
'-outform',
'DER',
], stdin=incert)
data_hash = hashlib.sha256(der_data)
b32_hash = base64.b32encode(data_hash.digest()).decode('ascii')
result = b32_hash.upper().rstrip('=')
blocks = [result[pos:pos+13] for pos in range(0, len(result), 13)]
result = '''.join(block + luhn_checksum(block) for block in blocks)
blocks = [result[pos:pos+7] for pos in range(0, len(result), 7)]
print('-'.join(blocks))
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Generate syncthing ID from certificate')
parser.add_argument('incert', type=argparse.FileType('rb'), help='Certificate path')
args = parser.parse_args()
main(**vars(args))
''

View File

@ -18,7 +18,7 @@
stockholm.file = toString ../.;
stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" ''
set -efu
cd $HOME/stockholm
cd ${lib.escapeShellArg krebs-source.stockholm.file}
V=$(${pkgs.coreutils}/bin/date +%y.%m)
if test -d .git; then
V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty)

View File

@ -1,29 +0,0 @@
with import <stockholm/lib>;
host@{ name, secure ? false, override ? {} }: let
builder = if getEnv "dummy_secrets" == "true"
then "buildbot"
else "krebs";
_file = <stockholm> + "/krebs/1systems/${name}/source.nix";
pkgs = import <nixpkgs> {
overlays = map import [
<stockholm/krebs/5pkgs>
<stockholm/submodules/nix-writers/pkgs>
];
};
in
evalSource (toString _file) [
{
nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix";
secrets = getAttr builder {
buildbot.file = toString <stockholm/krebs/0tests/data/secrets>;
krebs.pass = {
dir = "${getEnv "HOME"}/brain";
name = "krebs-secrets/${name}";
};
};
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
nixpkgs = (import ./krops.nix { name = ""; }).krebs-source.nixpkgs;
}
override
]

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "blue";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "cabal";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "daedalus";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "icarus";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "littleT";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "mors";
secure = true;
}

View File

@ -1,4 +0,0 @@
with import <stockholm/lib>;
import <stockholm/lass/source.nix> {
name = "prism";
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "red";
secure = true;
}

View File

@ -1,3 +0,0 @@
import <stockholm/lass/source.nix> {
name = "shodan";
}

View File

@ -1,4 +0,0 @@
import <stockholm/lass/source.nix> {
name = "skynet";
secure = true;
}

View File

@ -1,3 +0,0 @@
import <stockholm/lass/source.nix> {
name = "uriel";
}

View File

@ -1,5 +0,0 @@
with import <stockholm/lib>;
import <stockholm/lass/source.nix> {
name = "xerxes";
secure = true;
}

View File

@ -1,29 +0,0 @@
with import <stockholm/lib>;
host@{ name, secure ? false, override ? {} }: let
builder = if getEnv "dummy_secrets" == "true"
then "buildbot"
else "lass";
_file = <stockholm> + "/lass/1systems/${name}/source.nix";
pkgs = import <nixpkgs> {
overlays = map import [
<stockholm/krebs/5pkgs>
<stockholm/submodules/nix-writers/pkgs>
];
};
in
evalSource (toString _file) [
{
nixos-config.symlink = "stockholm/lass/1systems/${name}/physical.nix";
nixpkgs = (import <stockholm/krebs/source.nix> host).nixpkgs;
secrets = getAttr builder {
buildbot.file = toString <stockholm/lass/2configs/tests/dummy-secrets>;
lass.pass = {
dir = "${getEnv "HOME"}/.password-store";
name = "hosts/${name}";
};
};
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
}
override
]

View File

@ -20,7 +20,6 @@
brain
gen-oath-safe
cdrtools
stockholm
# nix related
nix-repl
nix-index

View File

@ -57,7 +57,7 @@ in
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
stockholm-version.pipe = "${pkgs.coreutils}/bin/echo derp";
}
(mkIf ( musnix ) {
musnix.git = {

View File

@ -1,4 +0,0 @@
import <stockholm/nin/source.nix> {
name = "axon";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/nin/source.nix> {
name = "hiawatha";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/nin/source.nix> {
name = "onondaga";
secure = true;
}

View File

@ -1,23 +0,0 @@
with import <stockholm/lib>;
host@{ name, secure ? false }: let
builder = if getEnv "dummy_secrets" == "true"
then "buildbot"
else "nin";
_file = <stockholm> + "/nin/1systems/${name}/source.nix";
pkgs = import <nixpkgs> {
overlays = map import [
<stockholm/krebs/5pkgs>
<stockholm/submodules/nix-writers/pkgs>
];
};
in
evalSource (toString _file) {
nixos-config.symlink = "stockholm/nin/1systems/${name}/config.nix";
secrets.file = getAttr builder {
buildbot = toString <stockholm/nin/0tests/dummysecrets>;
nin = "/home/nin/secrets/${name}";
};
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
nixpkgs = (import <stockholm/krebs/source.nix> host).nixpkgs;
}

View File

@ -1,38 +0,0 @@
let
lib = import ./lib;
pkgs = import <nixpkgs> {
overlays = [
(import ./krebs/5pkgs)
(import ./submodules/nix-writers/pkgs)
];
};
in pkgs.stdenv.mkDerivation {
name = "stockholm";
shellHook = /* sh */ ''
export NIX_PATH=stockholm=${toString ./.}:nixpkgs=${toString <nixpkgs>}
if test -e /nix/var/nix/daemon-socket/socket; then
export NIX_REMOTE=daemon
fi
export PATH=${lib.makeBinPath [
pkgs.stockholm
]}''${PATH+:$PATH}
eval "$(declare -F | ${pkgs.gnused}/bin/sed s/declare/unset/)"
shopt -u no_empty_cmd_completion
unalias -a
enable -n \
. [ alias bg bind break builtin caller cd command compgen complete \
compopt continue dirs disown eval exec false fc fg getopts hash \
help history jobs kill let local logout mapfile popd printf pushd \
pwd read readarray readonly shift source suspend test times trap \
true typeset ulimit umask unalias wait
exitHandler() {
:
}
PS1='\[\e[38;5;162m\]\w\[\e[0m\] '
'';
}

View File

@ -1,4 +0,0 @@
import <stockholm/tv/source.nix> {
name = "alnus";
override.nixpkgs.git.ref = "d0f0657ca06cc8cb239cb94f430b53bcdf755887";
}

View File

@ -1,3 +0,0 @@
import <stockholm/tv/source.nix> {
name = "mu";
}

View File

@ -1,4 +0,0 @@
import <stockholm/tv/source.nix> {
name = "nomic";
secure = true;
}

View File

@ -1,3 +0,0 @@
import <stockholm/tv/source.nix> {
name = "querel";
}

View File

@ -1,4 +0,0 @@
import <stockholm/tv/source.nix> {
name = "wu";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/tv/source.nix> {
name = "xu";
secure = true;
}

View File

@ -1,4 +0,0 @@
import <stockholm/tv/source.nix> {
name = "zu";
secure = true;
}

View File

@ -1,37 +0,0 @@
with import <stockholm/lib>;
{ name
, dummy_secrets ? getEnv "dummy_secrets" == "true"
, override ? {}
, secure ? false
}@host: let
builder = if dummy_secrets then "buildbot" else "tv";
_file = <stockholm> + "/tv/1systems/${name}/source.nix";
pkgs = import <nixpkgs> {
overlays = map import [
<stockholm/krebs/5pkgs>
<stockholm/submodules/nix-writers/pkgs>
];
};
in
evalSource (toString _file) [
{
nixos-config.symlink = "stockholm/tv/1systems/${name}/config.nix";
nixpkgs.git = {
ref = mkDefault "7cbf6ca1c84dfc917c1a99524e082fb677501844";
url = https://github.com/NixOS/nixpkgs;
};
secrets.file = getAttr builder {
buildbot = toString <stockholm/tv/dummy_secrets>;
tv = "/home/tv/secrets/${name}";
};
stockholm.file = toString <stockholm>;
stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version";
}
(mkIf (builder == "tv") {
secrets-common.file = "/home/tv/secrets/common";
})
(mkIf (builder == "tv" && secure) {
secrets-master.file = "/home/tv/secrets/master";
})
override
]