Compare commits

..

2 Commits

20 changed files with 54 additions and 53 deletions

View File

@@ -76,7 +76,10 @@
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
modules = [ modules = [
./hosts/${host} ./hosts/${host}
{ nixpkgs.hostPlatform = (myUtils.hostMeta ./hosts/${host}).system; } {
nixpkgs.hostPlatform = (myUtils.hostMeta ./hosts/${host}).system;
host.name = host;
}
]; ];
specialArgs = { specialArgs = {
inherit inherit

View File

@@ -51,9 +51,7 @@ in
../../modules/yubikey ../../modules/yubikey
]; ];
home-manager.users.${config.host.username} = import ../../home/hosts/andromache; home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
ssh.authorizedHosts = [ "astyanax" ];
secrets.nixSigningKey.enable = true; secrets.nixSigningKey.enable = true;

View File

@@ -1,7 +1,7 @@
{ {
host = { host = {
username = "h"; username = "h";
name = "andromache";
highRam = true; highRam = true;
admin = true;
}; };
} }

View File

@@ -47,9 +47,7 @@ in
../../modules/yubikey ../../modules/yubikey
]; ];
home-manager.users.${config.host.username} = import ../../home/hosts/astyanax; home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
ssh.authorizedHosts = [ "andromache" ];
secrets.nixSigningKey.enable = true; secrets.nixSigningKey.enable = true;

View File

@@ -1,7 +1,7 @@
{ {
host = { host = {
username = "h"; username = "h";
name = "astyanax";
highRam = true; highRam = true;
admin = true;
}; };
} }

View File

@@ -11,13 +11,6 @@
../../modules/ssh ../../modules/ssh
]; ];
ssh = {
authorizedHosts = [
"andromache"
"astyanax"
];
};
boot = { boot = {
kernelParams = [ kernelParams = [
"console=ttyS1,115200n8" "console=ttyS1,115200n8"

View File

@@ -1,6 +1,5 @@
{ {
host = { host = {
username = "h"; username = "h";
name = "eetion-02";
}; };
} }

View File

@@ -15,13 +15,6 @@
tailscale.enable = true; tailscale.enable = true;
ssh = {
authorizedHosts = [
"andromache"
"astyanax"
];
};
boot.loader = { boot.loader = {
grub.enable = false; grub.enable = false;
generic-extlinux-compatible.enable = true; generic-extlinux-compatible.enable = true;

View File

@@ -1,6 +1,5 @@
{ {
host = { host = {
username = "h"; username = "h";
name = "eetion";
}; };
} }

View File

@@ -18,13 +18,6 @@
]; ];
networking.hostName = config.host.name; networking.hostName = config.host.name;
ssh = {
authorizedHosts = [
"andromache"
"astyanax"
];
};
docker.enable = true; docker.enable = true;
fileSystems."/" = { fileSystems."/" = {

View File

@@ -1,6 +1,5 @@
{ {
host = { host = {
username = "username"; username = "username";
name = "hecuba";
}; };
} }

View File

@@ -1,6 +1,5 @@
{ {
host = { host = {
username = "h"; username = "h";
name = "vm";
}; };
} }

View File

@@ -21,11 +21,6 @@ in
name = "orange-pi"; name = "orange-pi";
}; };
ssh.authorizedHosts = [
"andromache"
"astyanax"
];
nix.settings.experimental-features = [ nix.settings.experimental-features = [
"nix-command" "nix-command"
"flakes" "flakes"

View File

@@ -21,11 +21,6 @@ in
name = "raspberry-pi"; name = "raspberry-pi";
}; };
ssh.authorizedHosts = [
"andromache"
"astyanax"
];
boot.kernelParams = [ boot.kernelParams = [
"console=ttyS1,115200n8" "console=ttyS1,115200n8"
]; ];

View File

@@ -24,5 +24,10 @@
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
}; };
admin = lib.mkOption {
type = lib.types.bool;
default = false;
};
}; };
} }

View File

@@ -37,6 +37,20 @@ in
]; ];
}; };
# error:
# Failed assertions:
# - h profile: xdg.portal: since you installed Home Manager via its NixOS module and
# 'home-manager.useUserPackages' is enabled, you need to add
#
# environment.pathsToLink = [ `/share/applications` `/share/xdg-desktop-portal` ];
#
# to your NixOS configuration so that the portal definitions and DE
# provided configurations get linked.
environment.pathsToLink = [
"/share/applications"
"/share/xdg-desktop-portal"
];
services = { services = {
gnome.gnome-keyring.enable = false; gnome.gnome-keyring.enable = false;
dbus.enable = true; dbus.enable = true;

View File

@@ -1,7 +1,12 @@
{ lib, config, ... }: {
lib,
config,
...
}:
let let
inherit (config.host) username; inherit (config.host) username;
adminHosts = (import ../../utils { inherit lib; }).adminHosts ../../hosts;
in in
{ {
options.ssh = { options.ssh = {
@@ -19,6 +24,6 @@ in
keyFile = ../../hosts/${hostname}/ssh_user.pub; keyFile = ../../hosts/${hostname}/ssh_user.pub;
in in
lib.optionals (builtins.pathExists keyFile) (lib.splitString "\n" (builtins.readFile keyFile)) lib.optionals (builtins.pathExists keyFile) (lib.splitString "\n" (builtins.readFile keyFile))
) config.ssh.authorizedHosts ) ((builtins.filter (h: h != config.host.name) adminHosts) ++ config.ssh.authorizedHosts)
); );
} }

View File

@@ -1,12 +1,8 @@
{ lib }: { lib }:
let let
hosts = import ./hosts.nix; fs = import ./fs.nix { inherit lib; };
hosts = import ./hosts.nix { inherit lib; };
secrets = import ./secrets.nix { inherit lib; }; secrets = import ./secrets.nix { inherit lib; };
in in
{ fs // hosts // secrets
dirNames =
path: builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir path));
}
// hosts
// secrets

6
utils/fs.nix Normal file
View File

@@ -0,0 +1,6 @@
{ lib }:
{
dirNames =
path: builtins.attrNames (lib.filterAttrs (_: t: t == "directory") (builtins.readDir path));
}

View File

@@ -1,3 +1,8 @@
{ lib }:
let
fs = import ./fs.nix { inherit lib; };
in
{ {
hostMeta = hostMeta =
hostDir: hostDir:
@@ -5,4 +10,10 @@
import (hostDir + "/meta.nix") import (hostDir + "/meta.nix")
else else
throw "meta.nix required in ${hostDir}"; throw "meta.nix required in ${hostDir}";
adminHosts =
hostsPath:
builtins.filter (host: ((import (hostsPath + "/${host}/host.nix")).host.admin or false)) (
fs.dirNames hostsPath
);
} }