forked from hswaw/hscloud
cluster/nix: integrate with readtree
This unifies nixpkgs with the one defined in //default.nix and makes it possible to use readTree to build the provisioners: nix-build -A cluster.nix.provision result/bin/provision Change-Id: I68dd70b9c8869c7c0b59f5007981eac03667b862
This commit is contained in:
parent
2df7685b46
commit
4842705406
3 changed files with 17 additions and 32 deletions
|
@ -207,8 +207,8 @@ def nodestrap(args, nocerts=False):
|
|||
ca_admitomatic.make_cert('admitomatic-webhook', ou='Admitomatic Webhook', hosts=['admitomatic.admitomatic.svc'])
|
||||
|
||||
subprocess.check_call(["nix", "run",
|
||||
"-f", os.path.join(local_root, "cluster/nix/default.nix"),
|
||||
"provision",
|
||||
"-f", local_root,
|
||||
"cluster.nix.provision",
|
||||
"-c", "provision-{}".format(fqdn.split('.')[0])])
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
let
|
||||
# Tracking nixos-unstable as of 2021-01-31.
|
||||
nixpkgsCommit = "44ad80ab1036c5cc83ada4bfa451dac9939f2a10";
|
||||
nixpkgsSrc = fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";
|
||||
sha256 = "1b61nzvy0d46cspy07szkc0rggacxiqg9v1py27pkqpj7rvawfsk";
|
||||
};
|
||||
pkgs = import nixpkgsSrc;
|
||||
cfg = {
|
||||
overlays = [
|
||||
(import ./provision.nix)
|
||||
];
|
||||
};
|
||||
|
||||
in pkgs cfg
|
|
@ -1,10 +1,12 @@
|
|||
self: super:
|
||||
{ hscloud, pkgs, ... }:
|
||||
|
||||
with builtins;
|
||||
|
||||
let
|
||||
machines = (import ./defs-machines.nix);
|
||||
configurations = builtins.listToAttrs (map (machine: {
|
||||
name = machine.fqdn;
|
||||
value = super.nixos ({ config, pkgs, ... }: {
|
||||
value = pkgs.nixos ({ config, pkgs, ... }: {
|
||||
networking.hostName = machine.name;
|
||||
imports = [
|
||||
./modules/base.nix
|
||||
|
@ -32,18 +34,16 @@ let
|
|||
fi
|
||||
'';
|
||||
|
||||
machineProvisioners = builtins.listToAttrs (map (machine: {
|
||||
name = "provision-${machine.name}";
|
||||
value = super.writeScriptBin "provision-${machine.name}" (scriptForMachine machine);
|
||||
}) machines);
|
||||
provisioners = (map (machine:
|
||||
pkgs.writeScriptBin "provision-${machine.name}" (scriptForMachine machine)
|
||||
) machines);
|
||||
|
||||
provision = pkgs.writeScriptBin "provision" (
|
||||
''
|
||||
echo "Available provisioniers:"
|
||||
'' + (concatStringsSep "\n" (map (machine: "echo ' provision-${machine.name}'") machines)));
|
||||
in
|
||||
{
|
||||
provision = ({
|
||||
provision = super.writeScriptBin "provision"
|
||||
(
|
||||
''
|
||||
echo "Available provisioniers:"
|
||||
'' + (builtins.concatStringsSep "\n" (map (machine: "echo ' provision-${machine.name}'") machines))
|
||||
);
|
||||
}) // machineProvisioners;
|
||||
pkgs.symlinkJoin {
|
||||
name = "provision";
|
||||
paths = [ provision ] ++ provisioners;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue