Merge remote-tracking branch 'cd/master'

This commit is contained in:
lassulus 2016-10-13 21:59:56 +02:00
commit 52f5027565
7 changed files with 28 additions and 34 deletions

View file

@ -1,19 +1,12 @@
{ config, lib, ... }: _:
let
lib = import <stockholm/lib>;
in
with builtins;
with lib; with lib;
let out = import <stockholm/lib> // rec { let out = lib // rec {
eq = x: y: x == y;
ne = x: y: x != y;
mod = x: y: x - y * (x / y);
addName = name: set:
set // { inherit name; };
addNames = mapAttrs addName;
guard = spec@{ type, value, ... }: guard = spec@{ type, value, ... }:
assert isOptionType type; assert isOptionType type;
@ -26,12 +19,9 @@ let out = import <stockholm/lib> // rec {
])); ]));
types = import ./types.nix { types = import ./types.nix {
inherit config;
lib = lib // { inherit genid optionalTrace; }; lib = lib // { inherit genid optionalTrace; };
}; };
dir.has-default-nix = path: pathExists (path + "/default.nix");
genid = import ./genid.nix { lib = lib // out; }; genid = import ./genid.nix { lib = lib // out; };
genid_signed = x: ((genid x) + 16777216) / 2; genid_signed = x: ((genid x) + 16777216) / 2;
git = import ./git.nix { lib = lib // out; }; git = import ./git.nix { lib = lib // out; };

View file

@ -1,7 +1,12 @@
{ lib, ... }: { lib, ... }:
with lib;
let let
inherit (lib) addNames escapeShellArg makeSearchPath optionalString; addName = name: set:
set // { inherit name; };
addNames = mapAttrs addName;
commands = addNames { commands = addNames {
git-receive-pack = {}; git-receive-pack = {};

View file

@ -1,14 +1,9 @@
{ config, lib, ... }: { lib, ... }:
with builtins; with builtins;
with lib; with lib;
with types; with types;
let
# Inherited attributes are used in submodules that have their own `config`.
inherit (config.krebs) build users;
in
types // rec { types // rec {
host = submodule ({ config, ... }: { host = submodule ({ config, ... }: {
@ -27,7 +22,6 @@ types // rec {
owner = mkOption { owner = mkOption {
type = user; type = user;
default = users.krebs;
}; };
extraZones = mkOption { extraZones = mkOption {
@ -49,10 +43,6 @@ types // rec {
ssh.pubkey = mkOption { ssh.pubkey = mkOption {
type = nullOr ssh-pubkey; type = nullOr ssh-pubkey;
default = null; default = null;
apply = x:
optionalTrace (x == null && config.owner.name == build.user.name)
"The option `krebs.hosts.${config.name}.ssh.pubkey' is unused."
x;
}; };
ssh.privkey = mkOption { ssh.privkey = mkOption {
type = nullOr ssh-privkey; type = nullOr ssh-privkey;
@ -187,7 +177,6 @@ types // rec {
}; };
owner = mkOption { owner = mkOption {
type = user; type = user;
default = users.root;
}; };
group-name = mkOption { group-name = mkOption {
type = str; type = str;

View file

@ -17,7 +17,7 @@ with config.krebs.lib;
in {} in {}
// import ./builders.nix args // import ./builders.nix args
// mapAttrs (_: flip callPackage {}) // mapAttrs (_: flip callPackage {})
(filterAttrs (_: dir.has-default-nix) (filterAttrs (_: dir: pathExists (dir + "/default.nix"))
(subdirsOf ./.)) (subdirsOf ./.))
// { // {
empty = pkgs.runCommand "empty-1.0.0" {} "mkdir $out"; empty = pkgs.runCommand "empty-1.0.0" {} "mkdir $out";

View file

@ -1,6 +1,10 @@
let let
lib = import <nixpkgs/lib> // builtins // { lib = import <nixpkgs/lib> // builtins // {
shell = import ./shell.nix { inherit lib; }; shell = import ./shell.nix { inherit lib; };
eq = x: y: x == y;
ne = x: y: x != y;
mod = x: y: x - y * (x / y);
}; };
in in

View file

@ -138,6 +138,11 @@ with config.krebs.lib;
fsType = "btrfs"; fsType = "btrfs";
options = ["defaults" "noatime" "ssd" "compress=lzo"]; options = ["defaults" "noatime" "ssd" "compress=lzo"];
}; };
"/bku" = {
device = "/dev/mapper/xuvga-bku";
fsType = "btrfs";
options = ["defaults" "noatime" "ssd" "compress=lzo"];
};
"/home" = { "/home" = {
device = "/dev/mapper/xuvga-home"; device = "/dev/mapper/xuvga-home";
fsType = "btrfs"; fsType = "btrfs";

View file

@ -178,6 +178,11 @@ in
pkgs.writeBashBin "q" '' pkgs.writeBashBin "q" ''
set -eu set -eu
export PATH=/var/empty export PATH=/var/empty
(${q-todo}) || :
if [ "$PWD" != "$HOME" ]; then
(HOME=$PWD; ${q-todo}) || :
fi
echo
${q-cal} ${q-cal}
echo echo
${q-isodate} ${q-isodate}
@ -189,8 +194,4 @@ pkgs.writeBashBin "q" ''
(${q-online}) & (${q-online}) &
(${q-thermal_zone}) & (${q-thermal_zone}) &
wait wait
${q-todo}
if [ "$PWD" != "$HOME" ]; then
(HOME=$PWD; ${q-todo})
fi
'' ''