Compare commits

..

2 Commits

20 changed files with 54 additions and 53 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,5 +24,10 @@
type = lib.types.bool;
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 = {
gnome.gnome-keyring.enable = false;
dbus.enable = true;

View File

@@ -1,7 +1,12 @@
{ lib, config, ... }:
{
lib,
config,
...
}:
let
inherit (config.host) username;
adminHosts = (import ../../utils { inherit lib; }).adminHosts ../../hosts;
in
{
options.ssh = {
@@ -19,6 +24,6 @@ in
keyFile = ../../hosts/${hostname}/ssh_user.pub;
in
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 }:
let
hosts = import ./hosts.nix;
fs = import ./fs.nix { inherit lib; };
hosts = import ./hosts.nix { inherit lib; };
secrets = import ./secrets.nix { inherit lib; };
in
{
dirNames =
path: builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir path));
}
// hosts
// secrets
fs // 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 =
hostDir:
@@ -5,4 +10,10 @@
import (hostDir + "/meta.nix")
else
throw "meta.nix required in ${hostDir}";
adminHosts =
hostsPath:
builtins.filter (host: ((import (hostsPath + "/${host}/host.nix")).host.admin or false)) (
fs.dirNames hostsPath
);
}