Refactor for nixops vpsAdminOS support

This commit is contained in:
Jakub Skokan 2018-08-03 11:57:44 +02:00
parent 830f33f7c4
commit e8b9451988
5 changed files with 34 additions and 75 deletions

View File

@ -1,26 +1,4 @@
let
nixpkgsPath = "/home/aither/workspace/vpsadmin/nixpkgs";
vpsadminosPath = "/home/aither/workspace/vpsadmin/vpsadminos";
in
{
vpsadminos = {configuration, modules ? []}:
let
# this is fed into scopedImport so vpsadminos sees correct <nixpkgs> everywhere
overrides = {
__nixPath = [
{ prefix = "nixpkgs"; path = nixpkgsPath; }
{ prefix = "vpsadminos"; path = vpsadminosPath; }
] ++ builtins.nixPath;
import = fn: scopedImport overrides fn;
scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
builtins = builtins // overrides;
};
in
builtins.scopedImport overrides (vpsadminosPath + "/os/") {
nixpkgs = nixpkgsPath;
system = "x86_64-linux";
extraModules = modules;
inherit configuration;
};
vpsadminosGit = "/home/aither/workspace/vpsadmin/vpsadminos";
nixpkgsVpsFreeGit = "/home/aither/workspace/vpsadmin/nixpkgs";
}

View File

@ -1,40 +1,16 @@
let
pkgs = import <nixpkgs> {};
vpsadminos_spec = builtins.fromJSON (builtins.readFile ./pinned/vpsadminos.json);
nixpkgsVpsFree_spec = builtins.fromJSON (builtins.readFile ./pinned/nixpkgs-vpsfreecz.json);
in
{
vpsadminos_spec = builtins.fromJSON (builtins.readFile ./pinned/vpsadminos.json);
vpsadminosGit = builtins.trace vpsadminos_spec pkgs.fetchgit {
inherit (vpsadminos_spec) url rev sha256;
leaveDotGit = true;
};
nixpkgsVpsFree_spec = builtins.fromJSON (builtins.readFile ./pinned/nixpkgs-vpsfreecz.json);
nixpkgsVpsFreeGit = pkgs.fetchgit {
inherit (nixpkgsVpsFree_spec) url rev sha256;
leaveDotGit = true;
};
nixpkgsVpsFree = import nixpkgsVpsFreeGit {};
vpsadminos = {configuration, modules ? []}:
let
# this is fed into scopedImport so vpsadminos sees correct <nixpkgs> everywhere
overrides = {
__nixPath = [
{ prefix = "nixpkgs"; path = nixpkgsVpsFree.path; }
{ prefix = "vpsadminos"; path = vpsadminosGit; }
] ++ builtins.nixPath;
import = fn: scopedImport overrides fn;
scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
builtins = builtins // overrides;
};
in
builtins.scopedImport overrides (vpsadminosGit + "/os/") {
nixpkgs = nixpkgsVpsFree.path;
system = "x86_64-linux";
extraModules = modules;
inherit configuration;
};
}

View File

@ -6,7 +6,7 @@
./hardware-configuration.nix
];
#deployment.targetHost = "192.168.2.106";
deployment.targetHost = "192.168.2.106";
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
@ -18,11 +18,11 @@
networking.lxcbr = true;
networking.nat = true;
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
time.timeZone = "Europe/Prague";
@ -30,6 +30,7 @@
git
htop
nano
ranger
vim
wget
];
@ -40,5 +41,5 @@
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyWNChi95oRKXtSGdXtbthvXgWXk4y7uqpKVSIfqPq5GzI/S5WmAGe73Tc6o7aBzby09xpmLI/i41+jzQdSfxrGoCFRvpV+2W221jcdWyF/ojXiUciX2dQGS1gsKVcYNjLmqUrN/fNgY5XjuB10VU3nCenmRGGPep1Sx8CYi61lf5Qxb0AF71ylNJ8/rEXjkXad1vi7zTFteEWj3MmOoK1Fau4ykr6o4v2lSRWEvIxY9S+AFwNVqBtCC210ks1XYInaYuPnz0mdRmoOQIATLdBvIyHuWW5y8M9K+aplkLrUBI8abbrLcGze3lRusx4S3w2V4Pvgt9+DtpRM+kyC5gBhUxO8rY7+pBiIWP0WF87Xs5XfUe+nlhnbp23A/rAppvT6NnpvY10bvWTnKbnBlSyGWPUlYLVdqRwshLNSIKr2YByWorzNtnP63rTe5E8gHnpMs3+4f1Rdz0xgSx8kNZ0vAi7w2moFsjwQzc94Uzy52SkYkGgFYpkystXP05GKyB4N0nStoU25KmdX8dsSYGzF0WERy8KWx0tr1Hv/YONWek7IIHDZin5cTyhkbyktenlAyLJ5uj9Oty4MgKPsE3+GrMdczVTBf5ThhSuvyrZo2CqjTSBc6j7mEyEAAHqM6JNVyPRqhDYmtaK0iLTJCAyqnzQyLD9gxEBuTj/o+3rcw== aither@orion"
];
system.nixos.stateVersion = "18.03";
system.stateVersion = "18.03";
}

View File

@ -1,7 +1,7 @@
{
vosa =
{ config, lib, pkgs, ... }:
{
deployment.targetHost = "192.168.2.106";
};
# vosa =
# { config, lib, pkgs, ... }:
# {
# deployment.targetHost = "192.168.2.106";
# };
}

View File

@ -4,18 +4,22 @@ let
in
{
network.description = "testish infrastructure";
vosa =
#{ config, pkgs, lib, ...}:
let
osCfg = (pinned.vpsadminos { configuration = ./machines/vosa/configuration.nix; }).config;
nixopsCfg = {
deployment.targetHost = "192.168.2.106";
environment.checkConfigurationOptions = true;
};
in
osCfg // nixopsCfg;
network.machines = {
vosa = {
spin = "vpsAdminOS";
path = "${pinned.vpsadminosGit}";
nixPath = [
{ prefix = "nixpkgs"; path = "${pinned.nixpkgsVpsFreeGit}"; }
{ prefix = "vpsadminos"; path = "${pinned.vpsadminosGit}"; }
];
};
};
# vosa =
# (pinned.vpsadminos { configuration = ./machines/vosa/configuration.nix; }).config;
vosa =
{ config, pkgs, lib, ... }:
{
imports = [
./machines/vosa/configuration.nix
];
};
}