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 ? []}: vpsadminosGit = "/home/aither/workspace/vpsadmin/vpsadminos";
let nixpkgsVpsFreeGit = "/home/aither/workspace/vpsadmin/nixpkgs";
# 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;
};
} }

View File

@ -1,40 +1,16 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
vpsadminos_spec = builtins.fromJSON (builtins.readFile ./pinned/vpsadminos.json);
nixpkgsVpsFree_spec = builtins.fromJSON (builtins.readFile ./pinned/nixpkgs-vpsfreecz.json);
in in
{ {
vpsadminos_spec = builtins.fromJSON (builtins.readFile ./pinned/vpsadminos.json);
vpsadminosGit = builtins.trace vpsadminos_spec pkgs.fetchgit { vpsadminosGit = builtins.trace vpsadminos_spec pkgs.fetchgit {
inherit (vpsadminos_spec) url rev sha256; inherit (vpsadminos_spec) url rev sha256;
leaveDotGit = true; leaveDotGit = true;
}; };
nixpkgsVpsFree_spec = builtins.fromJSON (builtins.readFile ./pinned/nixpkgs-vpsfreecz.json);
nixpkgsVpsFreeGit = pkgs.fetchgit { nixpkgsVpsFreeGit = pkgs.fetchgit {
inherit (nixpkgsVpsFree_spec) url rev sha256; inherit (nixpkgsVpsFree_spec) url rev sha256;
leaveDotGit = true; 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 ./hardware-configuration.nix
]; ];
#deployment.targetHost = "192.168.2.106"; deployment.targetHost = "192.168.2.106";
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.version = 2; boot.loader.grub.version = 2;
@ -18,11 +18,11 @@
networking.lxcbr = true; networking.lxcbr = true;
networking.nat = true; networking.nat = true;
i18n = { # i18n = {
consoleFont = "Lat2-Terminus16"; # consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us"; # consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8"; # defaultLocale = "en_US.UTF-8";
}; # };
time.timeZone = "Europe/Prague"; time.timeZone = "Europe/Prague";
@ -30,6 +30,7 @@
git git
htop htop
nano nano
ranger
vim vim
wget wget
]; ];
@ -40,5 +41,5 @@
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyWNChi95oRKXtSGdXtbthvXgWXk4y7uqpKVSIfqPq5GzI/S5WmAGe73Tc6o7aBzby09xpmLI/i41+jzQdSfxrGoCFRvpV+2W221jcdWyF/ojXiUciX2dQGS1gsKVcYNjLmqUrN/fNgY5XjuB10VU3nCenmRGGPep1Sx8CYi61lf5Qxb0AF71ylNJ8/rEXjkXad1vi7zTFte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HDZin5cTyhkbyktenlAyLJ5uj9Oty4MgKPsE3+GrMdczVTBf5ThhSuvyrZo2CqjTSBc6j7mEyEAAHqM6JNVyPRqhDYmtaK0iLTJCAyqnzQyLD9gxEBuTj/o+3rcw== aither@orion"
]; ];
system.nixos.stateVersion = "18.03"; system.stateVersion = "18.03";
} }

View File

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

View File

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