From 3c30bf00573a4d5bc4a47cd9178dc7cc113b91a5 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 29 Aug 2018 00:24:34 +0200 Subject: ma krops.nix: init --- makefu/1systems/cake/source.nix | 2 +- makefu/1systems/darth/source.nix | 2 +- makefu/1systems/drop/source.nix | 2 +- makefu/1systems/fileleech/source.nix | 2 +- makefu/1systems/filepimp/source.nix | 2 +- makefu/1systems/full/source.nix | 5 ++ makefu/1systems/gum/source.nix | 2 +- makefu/1systems/iso/source.nix | 2 +- makefu/1systems/kexec/source.nix | 2 +- makefu/1systems/latte/source.nix | 2 +- makefu/1systems/nextgum/source.nix | 2 +- makefu/1systems/omo/source.nix | 2 +- makefu/1systems/pnp/source.nix | 2 +- makefu/1systems/repunit/source.nix | 2 +- makefu/1systems/sdev/source.nix | 2 +- makefu/1systems/shack-autoinstall/source.nix | 3 + makefu/1systems/shoney/source.nix | 2 +- makefu/1systems/studio/source.nix | 2 +- makefu/1systems/tsp/source.nix | 4 +- makefu/1systems/vbob/source.nix | 2 +- makefu/1systems/wbob/source.nix | 2 +- makefu/1systems/wry/source.nix | 2 +- makefu/1systems/x/source.nix | 3 +- makefu/krops.nix | 88 ++++++++++++++++++++++++++++ makefu/nixpkgs.json | 7 +++ makefu/update-channel.sh | 9 +++ 26 files changed, 136 insertions(+), 21 deletions(-) create mode 100644 makefu/1systems/full/source.nix create mode 100644 makefu/1systems/shack-autoinstall/source.nix create mode 100644 makefu/krops.nix create mode 100644 makefu/nixpkgs.json create mode 100755 makefu/update-channel.sh diff --git a/makefu/1systems/cake/source.nix b/makefu/1systems/cake/source.nix index cd97a7c62..22c40039e 100644 --- a/makefu/1systems/cake/source.nix +++ b/makefu/1systems/cake/source.nix @@ -1,4 +1,4 @@ -import { +{ name="cake"; full = true; } diff --git a/makefu/1systems/darth/source.nix b/makefu/1systems/darth/source.nix index b13b6c603..a8d7368ab 100644 --- a/makefu/1systems/darth/source.nix +++ b/makefu/1systems/darth/source.nix @@ -1,3 +1,3 @@ -import { +{ name="darth"; } diff --git a/makefu/1systems/drop/source.nix b/makefu/1systems/drop/source.nix index 45bd6f97e..a6bc834b0 100644 --- a/makefu/1systems/drop/source.nix +++ b/makefu/1systems/drop/source.nix @@ -1,4 +1,4 @@ -import { +{ name="drop"; torrent = true; } diff --git a/makefu/1systems/fileleech/source.nix b/makefu/1systems/fileleech/source.nix index caca1fbcb..b6951a273 100644 --- a/makefu/1systems/fileleech/source.nix +++ b/makefu/1systems/fileleech/source.nix @@ -1,4 +1,4 @@ -import { +{ name = "fileleech"; torrent = true; } diff --git a/makefu/1systems/filepimp/source.nix b/makefu/1systems/filepimp/source.nix index 88c9f4f08..b81a2bf4a 100644 --- a/makefu/1systems/filepimp/source.nix +++ b/makefu/1systems/filepimp/source.nix @@ -1,3 +1,3 @@ -import { +{ name="filepimp"; } diff --git a/makefu/1systems/full/source.nix b/makefu/1systems/full/source.nix new file mode 100644 index 000000000..1e36c6e87 --- /dev/null +++ b/makefu/1systems/full/source.nix @@ -0,0 +1,5 @@ +{ + name="gum"; + torrent = true; + clever_kexec = true; +} diff --git a/makefu/1systems/gum/source.nix b/makefu/1systems/gum/source.nix index e3ca472e4..1e36c6e87 100644 --- a/makefu/1systems/gum/source.nix +++ b/makefu/1systems/gum/source.nix @@ -1,4 +1,4 @@ -import { +{ name="gum"; torrent = true; clever_kexec = true; diff --git a/makefu/1systems/iso/source.nix b/makefu/1systems/iso/source.nix index e200dbfd2..6bef8ada9 100644 --- a/makefu/1systems/iso/source.nix +++ b/makefu/1systems/iso/source.nix @@ -1,3 +1,3 @@ -import { +{ name="iso"; } diff --git a/makefu/1systems/kexec/source.nix b/makefu/1systems/kexec/source.nix index e200dbfd2..6bef8ada9 100644 --- a/makefu/1systems/kexec/source.nix +++ b/makefu/1systems/kexec/source.nix @@ -1,3 +1,3 @@ -import { +{ name="iso"; } diff --git a/makefu/1systems/latte/source.nix b/makefu/1systems/latte/source.nix index d9600909a..ab0a454c0 100644 --- a/makefu/1systems/latte/source.nix +++ b/makefu/1systems/latte/source.nix @@ -1,4 +1,4 @@ -import { +{ name = "latte"; torrent = true; } diff --git a/makefu/1systems/nextgum/source.nix b/makefu/1systems/nextgum/source.nix index 413889c47..6940498f1 100644 --- a/makefu/1systems/nextgum/source.nix +++ b/makefu/1systems/nextgum/source.nix @@ -1,4 +1,4 @@ -import { +{ name="nextgum"; torrent = true; clever_kexec = true; diff --git a/makefu/1systems/omo/source.nix b/makefu/1systems/omo/source.nix index da0d87aad..0d42cc9e2 100644 --- a/makefu/1systems/omo/source.nix +++ b/makefu/1systems/omo/source.nix @@ -1,4 +1,4 @@ -import { +{ name="omo"; torrent = true; } diff --git a/makefu/1systems/pnp/source.nix b/makefu/1systems/pnp/source.nix index 0b630aa3b..02f7d0ab6 100644 --- a/makefu/1systems/pnp/source.nix +++ b/makefu/1systems/pnp/source.nix @@ -1,3 +1,3 @@ -import { +{ name="pnp"; } diff --git a/makefu/1systems/repunit/source.nix b/makefu/1systems/repunit/source.nix index ff361fb55..20d3cd1cb 100644 --- a/makefu/1systems/repunit/source.nix +++ b/makefu/1systems/repunit/source.nix @@ -1,3 +1,3 @@ -import { +{ name="repunit"; } diff --git a/makefu/1systems/sdev/source.nix b/makefu/1systems/sdev/source.nix index 833d9bf73..2e085740a 100644 --- a/makefu/1systems/sdev/source.nix +++ b/makefu/1systems/sdev/source.nix @@ -1,3 +1,3 @@ -import { +{ name="sdev"; } diff --git a/makefu/1systems/shack-autoinstall/source.nix b/makefu/1systems/shack-autoinstall/source.nix new file mode 100644 index 000000000..6bef8ada9 --- /dev/null +++ b/makefu/1systems/shack-autoinstall/source.nix @@ -0,0 +1,3 @@ +{ + name="iso"; +} diff --git a/makefu/1systems/shoney/source.nix b/makefu/1systems/shoney/source.nix index 382474f5e..3616716f9 100644 --- a/makefu/1systems/shoney/source.nix +++ b/makefu/1systems/shoney/source.nix @@ -1,3 +1,3 @@ -import { +{ name="shoney"; } diff --git a/makefu/1systems/studio/source.nix b/makefu/1systems/studio/source.nix index f662653e7..ff88d3557 100644 --- a/makefu/1systems/studio/source.nix +++ b/makefu/1systems/studio/source.nix @@ -1,4 +1,4 @@ -import { +{ name="studio"; musnix = true; } diff --git a/makefu/1systems/tsp/source.nix b/makefu/1systems/tsp/source.nix index 79f6a435d..9abf503e2 100644 --- a/makefu/1systems/tsp/source.nix +++ b/makefu/1systems/tsp/source.nix @@ -1,3 +1,5 @@ -import { +{ name="tsp"; + full = true; + hw = true; } diff --git a/makefu/1systems/vbob/source.nix b/makefu/1systems/vbob/source.nix index 5419215e2..59744faf5 100644 --- a/makefu/1systems/vbob/source.nix +++ b/makefu/1systems/vbob/source.nix @@ -1,4 +1,4 @@ -import { +{ name="vbob"; # musnix = true; } diff --git a/makefu/1systems/wbob/source.nix b/makefu/1systems/wbob/source.nix index b768aa87d..c76f73760 100644 --- a/makefu/1systems/wbob/source.nix +++ b/makefu/1systems/wbob/source.nix @@ -1,4 +1,4 @@ -import { +{ name="wbob"; # musnix = true; } diff --git a/makefu/1systems/wry/source.nix b/makefu/1systems/wry/source.nix index fac3877ee..730300590 100644 --- a/makefu/1systems/wry/source.nix +++ b/makefu/1systems/wry/source.nix @@ -1,3 +1,3 @@ -import { +{ name="wry"; } diff --git a/makefu/1systems/x/source.nix b/makefu/1systems/x/source.nix index ab6429dc1..75af3255b 100644 --- a/makefu/1systems/x/source.nix +++ b/makefu/1systems/x/source.nix @@ -1,9 +1,10 @@ -import { +{ name="x"; full = true; python = true; hw = true; unstable = true; mic92 = true; + clever_kexec = true; # torrent = true; } diff --git a/makefu/krops.nix b/makefu/krops.nix new file mode 100644 index 000000000..5ce430ad2 --- /dev/null +++ b/makefu/krops.nix @@ -0,0 +1,88 @@ +{ config ? config, name }: let + krops = builtins.fetchGit { + url = https://cgit.krebsco.de/krops/; + rev = "4e466eaf05861b47365c5ef46a31a188b70f3615"; + }; + nixpkgs-src = lib.importJSON ./nixpkgs.json; + lib = import "${krops}/lib"; + + # TODO document why pkgs should be used like this + pkgs = import "${krops}/pkgs" {}; + hostSource = { + secure = false; + full = false; + torrent = false; + hw = false; + musnix = false; + python = false; + unstable = false; #unstable channel checked out + mic92 = false; + nms = false; + clever_kexec = false; + } // import (./. + "/1systems/${name}/source.nix"); + source = { test }: lib.evalSource [ + { + # nixos-18.03 @ 2018-08-06 + # + do_sqlite3 ruby: 55a952be5b5 + # + exfat-nofuse bump: ee6a5296a35 + # + uhub/sqlite: 5dd7610401747 + nixpkgs.git = { + ref = nixpkgs-src.rev; + url = nixpkgs-src.url; + }; + nixos-config.symlink = "stockholm/makefu/1systems/${name}/config.nix"; + + stockholm.file = toString ; + secrets = if test then { + file = toString (./. + "/0tests/data/secrets"); + } else { + pass = { + dir = "${lib.getEnv "HOME"}/.secrets-pass"; + inherit name; + }; + }; + } + (lib.mkIf (hostSource.torrent) { + torrent-secrets = if test then { + file = ./. + "/makefu/0tests/data/secrets"; + } else { + pass = { + dir = "${lib.getEnv "HOME"}/.secrets-pass"; + name = "torrent"; + }; + }; + }) + (lib.mkIf ( hostSource.musnix ) { + musnix.git = { + url = https://github.com/musnix/musnix.git; + ref = "master"; # follow the musnix channel, lets see how this works out + }; + }) + (lib.mkIf ( hostSource.hw ) { + nixos-hardware.git = { + url = https://github.com/nixos/nixos-hardware.git; + ref = "30fdd53"; + }; + }) + ]; + +in { + # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy) + deploy = pkgs.krops.writeDeploy "${name}-deploy" { + source = source { test = false; }; + target = "root@${name}/var/src"; + }; + + # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test) + test = pkgs.krops.writeTest "${name}-test" { + source = source { test = true; }; + target = "${lib.getEnv "HOME"}/tmp/${name}-krops-test-src"; + }; + + ci = map (host: + pkgs.krops.writeTest "${host.name}-test" { + source = source { test = true; }; + target = "${lib.getEnv "TMPDIR"}/makefu/${host.name}"; + } + ) (lib.filter (host: lib.getAttr "ci" host && host.owner == "makefu") (lib.attrValues config.krebs.hosts)); +} diff --git a/makefu/nixpkgs.json b/makefu/nixpkgs.json new file mode 100644 index 000000000..f39bb6688 --- /dev/null +++ b/makefu/nixpkgs.json @@ -0,0 +1,7 @@ +{ + "url": "https://github.com/makefu/nixpkgs", + "rev": "8f991294288b27b9dec05cc1e07ec6a360bb39c8", + "date": "2018-08-06T14:29:01+02:00", + "sha256": "0zan8kdjk1pwdzm1rwc3ka87k11j0zmw4mdnj70r6pm38x2fa9n6", + "fetchSubmodules": true +} diff --git a/makefu/update-channel.sh b/makefu/update-channel.sh new file mode 100755 index 000000000..59d3c434f --- /dev/null +++ b/makefu/update-channel.sh @@ -0,0 +1,9 @@ +#!/bin/sh +dir=$(dirname $0) +oldref=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/') +nix-shell -p nix-prefetch-git --run 'nix-prefetch-git \ + --url https://github.com/makefu/nixpkgs \ + --rev refs/heads/master' \ +> $dir/nixpkgs.json +newref=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/') +echo git commit $dir/nixpkgs.json -m "nixpkgs: $oldref -> $newref" -- cgit v1.2.3