move source config from module system to 1systems/*/source.nix
This commit is contained in:
parent
fc3f5d3d56
commit
7fdc46bb9d
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ export STOCKHOLM_VERSION ?= $(shell \
|
|||||||
system ?= $(HOSTNAME)
|
system ?= $(HOSTNAME)
|
||||||
$(if $(system),,$(error unbound variable: system))
|
$(if $(system),,$(error unbound variable: system))
|
||||||
|
|
||||||
nixos-config ?= $(stockholm)/$(LOGNAME)/1systems/$(system).nix
|
nixos-config ?= $(stockholm)/$(LOGNAME)/1systems/$(system)/config.nix
|
||||||
ifneq ($(words $(wildcard $(nixos-config))),1)
|
ifneq ($(words $(wildcard $(nixos-config))),1)
|
||||||
$(error bad nixos-config: $(nixos-config))
|
$(error bad nixos-config: $(nixos-config))
|
||||||
endif
|
endif
|
||||||
|
@ -14,16 +14,9 @@ with import <stockholm/lib>;
|
|||||||
default = "/nix/var/nix/profiles/system";
|
default = "/nix/var/nix/profiles/system";
|
||||||
};
|
};
|
||||||
|
|
||||||
source = mkOption {
|
|
||||||
type = types.attrsOf types.source;
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO deprecate krebs.build.user
|
# TODO deprecate krebs.build.user
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
type = types.user;
|
type = types.user;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.krebs.build.source.stockholm.file = mkDefault (toString <stockholm>);
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
let
|
let
|
||||||
nixpkgs-lib = import <nixpkgs/lib>;
|
nixpkgs-lib = import <nixpkgs/lib>;
|
||||||
lib = with lib; nixpkgs-lib // builtins // {
|
lib = with lib; nixpkgs-lib // builtins // {
|
||||||
|
|
||||||
|
evalSource = import ./eval-source.nix;
|
||||||
|
|
||||||
git = import ./git.nix { inherit lib; };
|
git = import ./git.nix { inherit lib; };
|
||||||
shell = import ./shell.nix { inherit lib; };
|
shell = import ./shell.nix { inherit lib; };
|
||||||
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
|
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
|
||||||
|
17
lib/eval-source.nix
Normal file
17
lib/eval-source.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
with import <stockholm/lib>;
|
||||||
|
let
|
||||||
|
eval = _file: source: evalModules {
|
||||||
|
modules = singleton {
|
||||||
|
inherit _file;
|
||||||
|
options.source = mkOption {
|
||||||
|
type = types.attrsOf types.source;
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
inherit source;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
# This function's return value can be used as pkgs.populate input.
|
||||||
|
_file: source: (eval _file source).config.source
|
@ -43,9 +43,11 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
init.env = pkgs.writeText "init.env" /* sh */ ''
|
init.env = pkgs.writeText "init.env" /* sh */ ''
|
||||||
config=''${config-$LOGNAME/1systems/$system.nix}
|
config=''${config-$LOGNAME/1systems/$system/config.nix}
|
||||||
|
source=''${source-$LOGNAME/1systems/$system/source.nix}
|
||||||
|
|
||||||
export config
|
export config
|
||||||
|
export source
|
||||||
export system
|
export system
|
||||||
export target
|
export target
|
||||||
|
|
||||||
@ -92,7 +94,7 @@ let
|
|||||||
--show-trace \
|
--show-trace \
|
||||||
--strict \
|
--strict \
|
||||||
-I nixos-config="$config" \
|
-I nixos-config="$config" \
|
||||||
-E 'with import <stockholm>; config.krebs.build.source')
|
"$source")
|
||||||
echo $_source |
|
echo $_source |
|
||||||
${pkgs.populate}/bin/populate \
|
${pkgs.populate}/bin/populate \
|
||||||
"$target_user@$target_host:$target_port$target_path" \
|
"$target_user@$target_host:$target_port$target_path" \
|
||||||
|
@ -4,10 +4,10 @@ with import <stockholm/lib>;
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/x220.nix
|
<stockholm/tv/2configs/hw/x220.nix>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO remove non-hardware stuff from ../2configs/hw/x220.nix
|
# TODO remove non-hardware stuff from ../2configs/hw/x220.nix
|
3
tv/1systems/alnus/source.nix
Normal file
3
tv/1systems/alnus/source.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "alnus";
|
||||||
|
}
|
@ -6,10 +6,10 @@ with import <stockholm/lib>;
|
|||||||
krebs.build.host = config.krebs.hosts.caxi;
|
krebs.build.host = config.krebs.hosts.caxi;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/CAC-Developer-1.nix
|
<stockholm/tv/2configs/hw/CAC-Developer-1.nix>
|
||||||
../2configs/fs/CAC-CentOS-7-64bit.nix
|
<stockholm/tv/2configs/fs/CAC-CentOS-7-64bit.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = let
|
networking = let
|
3
tv/1systems/caxi/source.nix
Normal file
3
tv/1systems/caxi/source.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "caxi";
|
||||||
|
}
|
@ -6,11 +6,11 @@ with import <stockholm/lib>;
|
|||||||
krebs.build.host = config.krebs.hosts.cd;
|
krebs.build.host = config.krebs.hosts.cd;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/CAC-Developer-2.nix
|
<stockholm/tv/2configs/hw/CAC-Developer-2.nix>
|
||||||
../2configs/fs/CAC-CentOS-7-64bit.nix
|
<stockholm/tv/2configs/fs/CAC-CentOS-7-64bit.nix>
|
||||||
../2configs/exim-smarthost.nix
|
<stockholm/tv/2configs/exim-smarthost.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
3
tv/1systems/cd/source.nix
Normal file
3
tv/1systems/cd/source.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "cd";
|
||||||
|
}
|
@ -4,11 +4,11 @@ with import <stockholm/lib>;
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../krebs
|
<stockholm/krebs>
|
||||||
../2configs
|
<stockholm/tv/2configs>
|
||||||
../3modules
|
<stockholm/tv/3modules>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
];
|
];
|
||||||
|
|
||||||
krebs.build.host = config.krebs.hosts.mu;
|
krebs.build.host = config.krebs.hosts.mu;
|
3
tv/1systems/mu/source.nix
Normal file
3
tv/1systems/mu/source.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "mu";
|
||||||
|
}
|
@ -6,16 +6,16 @@ with import <stockholm/lib>;
|
|||||||
krebs.build.host = config.krebs.hosts.nomic;
|
krebs.build.host = config.krebs.hosts.nomic;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/x220.nix
|
<stockholm/tv/2configs/hw/x220.nix>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/gitrepos.nix
|
<stockholm/tv/2configs/gitrepos.nix>
|
||||||
../2configs/im.nix
|
<stockholm/tv/2configs/im.nix>
|
||||||
../2configs/mail-client.nix
|
<stockholm/tv/2configs/mail-client.nix>
|
||||||
../2configs/nginx/public_html.nix
|
<stockholm/tv/2configs/nginx/public_html.nix>
|
||||||
../2configs/pulse.nix
|
<stockholm/tv/2configs/pulse.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
../2configs/xserver
|
<stockholm/tv/2configs/xserver>
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.luks = {
|
boot.initrd.luks = {
|
4
tv/1systems/nomic/source.nix
Normal file
4
tv/1systems/nomic/source.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "nomic";
|
||||||
|
secure = true;
|
||||||
|
}
|
3
tv/1systems/test/source.nix
Normal file
3
tv/1systems/test/source.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "test";
|
||||||
|
}
|
@ -6,17 +6,17 @@ with import <stockholm/lib>;
|
|||||||
krebs.build.host = config.krebs.hosts.wu;
|
krebs.build.host = config.krebs.hosts.wu;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/w110er.nix
|
<stockholm/tv/2configs/hw/w110er.nix>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/gitrepos.nix
|
<stockholm/tv/2configs/gitrepos.nix>
|
||||||
../2configs/im.nix
|
<stockholm/tv/2configs/im.nix>
|
||||||
../2configs/mail-client.nix
|
<stockholm/tv/2configs/mail-client.nix>
|
||||||
../2configs/man.nix
|
<stockholm/tv/2configs/man.nix>
|
||||||
../2configs/nginx/public_html.nix
|
<stockholm/tv/2configs/nginx/public_html.nix>
|
||||||
../2configs/pulse.nix
|
<stockholm/tv/2configs/pulse.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
../2configs/xserver
|
<stockholm/tv/2configs/xserver>
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# root
|
# root
|
4
tv/1systems/wu/source.nix
Normal file
4
tv/1systems/wu/source.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "wu";
|
||||||
|
secure = true;
|
||||||
|
}
|
@ -6,18 +6,18 @@ with import <stockholm/lib>;
|
|||||||
krebs.build.host = config.krebs.hosts.xu;
|
krebs.build.host = config.krebs.hosts.xu;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/x220.nix
|
<stockholm/tv/2configs/hw/x220.nix>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/gitconfig.nix
|
<stockholm/tv/2configs/gitconfig.nix>
|
||||||
../2configs/gitrepos.nix
|
<stockholm/tv/2configs/gitrepos.nix>
|
||||||
../2configs/mail-client.nix
|
<stockholm/tv/2configs/mail-client.nix>
|
||||||
../2configs/man.nix
|
<stockholm/tv/2configs/man.nix>
|
||||||
../2configs/nginx/public_html.nix
|
<stockholm/tv/2configs/nginx/public_html.nix>
|
||||||
../2configs/pulse.nix
|
<stockholm/tv/2configs/pulse.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
../2configs/binary-cache
|
<stockholm/tv/2configs/binary-cache>
|
||||||
../2configs/xserver
|
<stockholm/tv/2configs/xserver>
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
4
tv/1systems/xu/source.nix
Normal file
4
tv/1systems/xu/source.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "xu";
|
||||||
|
secure = true;
|
||||||
|
}
|
@ -12,16 +12,16 @@ with import <stockholm/lib>;
|
|||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
../.
|
<stockholm/tv>
|
||||||
../2configs/hw/x220.nix
|
<stockholm/tv/2configs/hw/x220.nix>
|
||||||
../2configs/exim-retiolum.nix
|
<stockholm/tv/2configs/exim-retiolum.nix>
|
||||||
../2configs/gitrepos.nix
|
<stockholm/tv/2configs/gitrepos.nix>
|
||||||
../2configs/mail-client.nix
|
<stockholm/tv/2configs/mail-client.nix>
|
||||||
../2configs/man.nix
|
<stockholm/tv/2configs/man.nix>
|
||||||
../2configs/nginx/public_html.nix
|
<stockholm/tv/2configs/nginx/public_html.nix>
|
||||||
../2configs/pulse.nix
|
<stockholm/tv/2configs/pulse.nix>
|
||||||
../2configs/retiolum.nix
|
<stockholm/tv/2configs/retiolum.nix>
|
||||||
../2configs/xserver
|
<stockholm/tv/2configs/xserver>
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
4
tv/1systems/zu/source.nix
Normal file
4
tv/1systems/zu/source.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import <stockholm/tv/source.nix> {
|
||||||
|
name = "zu";
|
||||||
|
secure = true;
|
||||||
|
}
|
@ -6,23 +6,7 @@ with import <stockholm/lib>;
|
|||||||
in {
|
in {
|
||||||
krebs.enable = true;
|
krebs.enable = true;
|
||||||
|
|
||||||
krebs.build = {
|
krebs.build.user = config.krebs.users.tv;
|
||||||
user = config.krebs.users.tv;
|
|
||||||
source = let inherit (config.krebs.build) host; in {
|
|
||||||
nixos-config.symlink = "stockholm/tv/1systems/${host.name}.nix";
|
|
||||||
secrets.file = getAttr builder {
|
|
||||||
buildbot = toString <stockholm/tv/dummy_secrets>;
|
|
||||||
tv = "/home/tv/secrets/${host.name}";
|
|
||||||
};
|
|
||||||
secrets-common.file = "/home/tv/secrets/common";
|
|
||||||
nixpkgs.git = {
|
|
||||||
url = https://github.com/NixOS/nixpkgs;
|
|
||||||
ref = "057f89b9344e5341796046f25ae4f269be6d4529"; # nixos-17.03
|
|
||||||
};
|
|
||||||
} // optionalAttrs host.secure {
|
|
||||||
secrets-master.file = "/home/tv/secrets/master";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostName = config.krebs.build.host.name;
|
networking.hostName = config.krebs.build.host.name;
|
||||||
|
|
||||||
|
22
tv/source.nix
Normal file
22
tv/source.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
with import <stockholm/lib>;
|
||||||
|
host@{ name, secure ? false }: let
|
||||||
|
builder = if getEnv "dummy_secrets" == "true"
|
||||||
|
then "buildbot"
|
||||||
|
else "tv";
|
||||||
|
_file = <stockholm> + "/tv/1systems/${name}/source.nix";
|
||||||
|
in
|
||||||
|
evalSource (toString _file) {
|
||||||
|
nixos-config.symlink = "stockholm/tv/1systems/${name}/config.nix";
|
||||||
|
secrets.file = getAttr builder {
|
||||||
|
buildbot = toString <stockholm/tv/dummy_secrets>;
|
||||||
|
tv = "/home/tv/secrets/${name}";
|
||||||
|
};
|
||||||
|
stockholm.file = toString <stockholm>;
|
||||||
|
secrets-common.file = "/home/tv/secrets/common";
|
||||||
|
nixpkgs.git = {
|
||||||
|
url = https://github.com/NixOS/nixpkgs;
|
||||||
|
ref = "1b57bf274ae5c76e91b2b264d8aa8bfcecb72102"; # nixos-17.03
|
||||||
|
};
|
||||||
|
} // optionalAttrs secure {
|
||||||
|
secrets-master.file = "/home/tv/secrets/master";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user