Work in progress further refactoring.

This commit is contained in:
kat witch 2021-03-03 04:01:28 +00:00
parent 556a302df9
commit 20b4bafa85
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
20 changed files with 42 additions and 39 deletions

View file

@ -3,7 +3,7 @@
To provision a new host:
* add that host to the SSH config in programs.ssh
* create a config for that host that contains a meta.deploy.ssh.host
* create a config for that host that contains a deploy.ssh.host
* run `./nyx install <hostname>`.
To rebuild a host:

View file

@ -1,7 +1,10 @@
{ config, lib, pkgs, sources, ... }:
{
imports = [../users (sources.home-manager + "/nixos") ];
imports = [
../users
(sources.home-manager + "/nixos")
];
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
boot.loader.grub.configurationLimit = 8;

View file

@ -23,8 +23,8 @@
./matrix.nix
];
meta.deploy.profiles = [ ];
meta.deploy.ssh.host = "athame.kittywit.ch";
deploy.profiles = [ ];
deploy.ssh.host = "athame.kittywit.ch";
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;

View file

@ -6,8 +6,8 @@
#./wireguard.nix
];
meta.deploy.profiles = [ ];
meta.deploy.ssh.host = "boline.kittywit.ch";
deploy.profiles = [ ];
deploy.ssh.host = "boline.kittywit.ch";
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;

View file

@ -9,8 +9,8 @@
./torrenting.nix
];
meta.deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
meta.deploy.ssh.host = "192.168.1.135";
deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
deploy.ssh.host = "192.168.1.135";
# libvirtd is used for our virtual machine
virtualisation.libvirtd = {

View file

@ -3,8 +3,8 @@
{
imports = [ ./hardware.nix ../../services/zfs.nix ];
meta.deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
meta.deploy.ssh.host = "192.168.1.92";
deploy.profiles = [ "desktop" "development" "sway" "gaming" "network" ];
deploy.ssh.host = "192.168.1.92";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

View file

@ -1,7 +1,9 @@
{ pkgs, config, ... }:
{
imports = [ ./kat ];
imports = [
./kat
];
users.users.root = {
openssh.authorizedKeys.keys = with pkgs.lib;

View file

@ -1,7 +1,8 @@
{ config, pkgs, ... }:
{ config, pkgs, sources, ... }:
{
imports = [
../../../modules/home
./ssh.nix
./desktop.nix
./sound.nix
@ -26,11 +27,13 @@
home-manager.useGlobalPkgs = true;
home-manager.users.kat = {
imports = [ ./modules ];
programs.fish = {
enable = true;
shellAliases = { nixdirfmt = "fd --color=never .nix | xargs nixfmt"; };
shellAliases = {
nixdirfmt = "fd --color=never .nix | xargs nixfmt";
tmne = "tmux new -s";
tmat = "tmux attach -t";
};
plugins = [{
name = "bass";
src = pkgs.fetchFromGitHub {

View file

@ -4,7 +4,7 @@ let sources = import ../../../nix/sources.nix;
in {
imports = [ ./firefox ];
config = lib.mkIf (lib.elem "desktop" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
nixpkgs.config = {
mumble.speechdSupport = true;
pulseaudio = true;

View file

@ -5,7 +5,7 @@
programs.fish = {
enable = true;
interactiveShellInit = ''
${if (lib.elem "desktop" config.meta.deploy.groups) then
${if (lib.elem "desktop" config.deploy.groups) then
"export SSH_AUTH_SOCK=(gpgconf --list-dirs agent-ssh-socket)"
else
""}

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf (lib.elem "gaming" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "gaming" config.deploy.profiles) {
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
hardware.pulseaudio.support32Bit = true;

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, witch, ... }:
{
config = lib.mkIf (lib.elem "desktop" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
home-manager.users.kat = {
programs.kitty = {

View file

@ -1,3 +0,0 @@
{ ... }:
let sources = import ../../../../nix/sources.nix;
in { imports = [ (sources.tf-nix + "/modules/home/secrets.nix") ]; }

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: {
config = lib.mkIf (lib.elem "network" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "network" config.deploy.profiles) {
networking = {
networkmanager.enable = true;
resolvconf.useLocalResolver = true;

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
{
config = lib.mkIf (lib.elem "desktop" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "desktop" config.deploy.profiles) {
sound.extraConfig = ''
defaults.pcm.rate_converter "speexrate_best"
'';

View file

@ -3,7 +3,7 @@
let
secrets = import ../../../secrets.nix;
in {
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "sway" config.deploy.profiles) {
fonts.fonts = with pkgs; [
font-awesome

View file

@ -3,7 +3,7 @@
let
secrets = import ../../../../secrets.nix;
in {
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
config = lib.mkIf (lib.elem "sway" config.deploy.profiles) {
home-manager.users.kat = {
programs.waybar = {
enable = true;

View file

@ -21,8 +21,6 @@ rec {
imports = [
(import (hostsDir + "/${hostName}/configuration.nix"))
(import (privateHostsDir + "/${hostName}/configuration.nix"))
# urgh, yes, we still need to manually import the deploy module for now
# at least if i want to keep my thing reusable.
../modules/nixos/deploy
] ++ commonImports;
networking = {
@ -47,10 +45,10 @@ rec {
);
profileNames = unique (concatLists
(mapAttrsToList (name: host: host.config.meta.deploy.profiles) hosts));
(mapAttrsToList (name: host: host.config.deploy.profiles) hosts));
profiles = listToAttrs (map (profileName:
nameValuePair profileName
(filter (host: elem profileName host.config.meta.deploy.profiles)
(filter (host: elem profileName host.config.deploy.profiles)
(attrValues hosts))) profileNames);
}

View file

@ -1,9 +1,9 @@
{ sources, ... }:
{
home-manager.users = {
imports = [
(sources.tf-nix + "/modules/home/secrets.nix")
];
{
home-manager.users.kat = {
imports = [
(sources.tf-nix + "/modules/home/secrets.nix")
];
};
}
}

View file

@ -3,7 +3,7 @@
with lib;
let
cfg = config.meta.deploy;
cfg = config.deploy;
secretsScript = concatMapStrings (file: ''
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "mkdir -p ${toString file.out.dir}
cat > ${file.path}
@ -14,7 +14,7 @@ let
'') (attrValues config.secrets.files);
in {
options = {
meta.deploy = {
deploy = {
enable = mkOption {
type = types.bool;
default = true;
@ -39,7 +39,7 @@ in {
};
config = mkIf cfg.enable {
meta.deploy.profiles = [ "all" ];
deploy.profiles = [ "all" ];
system.build.deployScript =
pkgs.writeScript "deploy-${config.networking.hostName}" ''