Compare commits
2 commits
8a67b5c85f
...
bea322947a
Author | SHA1 | Date | |
---|---|---|---|
bea322947a | |||
1e53b80eee |
11 changed files with 47 additions and 109 deletions
hosts
modules/users
options
parts/lib
|
@ -1,10 +1,12 @@
|
|||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.modules.meta) username;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
pkgs,
|
||||
username,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.modules.meta) username;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../../modules/home-manager.nix
|
||||
|
|
|
@ -7,10 +7,12 @@ let
|
|||
name = sys.hostname;
|
||||
value = mkSystem ({ inherit withSystem; } // sys);
|
||||
};
|
||||
username = "ny";
|
||||
in
|
||||
{
|
||||
flake.nixosConfigurations = listToAttrs [
|
||||
(mkSystem' {
|
||||
inherit username;
|
||||
hostname = "marr";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [
|
||||
|
@ -20,13 +22,17 @@ in
|
|||
})
|
||||
|
||||
(mkSystem' {
|
||||
inherit username;
|
||||
hostname = "brontes";
|
||||
user = "ny";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [ inputs.agenix.nixosModules.default ];
|
||||
})
|
||||
|
||||
(mkSystem' {
|
||||
inherit username;
|
||||
hostname = "shan";
|
||||
user = "ny";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
|
@ -35,7 +41,9 @@ in
|
|||
})
|
||||
|
||||
(mkSystem' {
|
||||
inherit username;
|
||||
hostname = "raptus";
|
||||
user = "ny";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
|
@ -44,19 +52,13 @@ in
|
|||
})
|
||||
|
||||
(mkSystem' {
|
||||
inherit username;
|
||||
hostname = "nihilus";
|
||||
user = "ny";
|
||||
system = "aarch64-linux";
|
||||
extraModules = [
|
||||
inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
||||
];
|
||||
})
|
||||
|
||||
(mkSystem' {
|
||||
hostname = "dural";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.services.adguardhome;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ cfg.settings.dns.port ];
|
||||
|
||||
services.adguardhome = {
|
||||
enable = true;
|
||||
port = 3000;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
http = {
|
||||
address = "127.0.0.1:${toString cfg.port}";
|
||||
};
|
||||
auth_attempts = 5;
|
||||
block_auth_min = 10;
|
||||
dns = {
|
||||
bind_hosts = [ "0.0.0.0" ];
|
||||
port = 53;
|
||||
upstream_mode = "load_balance";
|
||||
#upstream_dns_file = config.age.secrets.adguard-dns-list.path;
|
||||
fallback_dns = [ "9.9.9.9" ];
|
||||
};
|
||||
clients = {
|
||||
persistent = [
|
||||
{
|
||||
ids = [
|
||||
"100.64.0.1"
|
||||
"192.168.178.20"
|
||||
];
|
||||
name = "brontes";
|
||||
tags = [ "device_pc" ];
|
||||
}
|
||||
{
|
||||
ids = [
|
||||
"100.64.0.2"
|
||||
"192.168.178.53"
|
||||
];
|
||||
name = "oneplus9";
|
||||
tags = [ "device_phone" ];
|
||||
}
|
||||
{
|
||||
ids = [ "100.64.0.5" ];
|
||||
name = "marr";
|
||||
tags = [ "device_laptop" ];
|
||||
}
|
||||
{
|
||||
ids = [ "100.64.0.4" ];
|
||||
name = "shan";
|
||||
tags = [ "device_pc" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./adguard.nix
|
||||
./disko.nix
|
||||
];
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my.disko) mkSwap mkBoot mkRoot;
|
||||
in
|
||||
{
|
||||
disko.devices.disk.builtin = {
|
||||
device = "/dev/sda";
|
||||
type = "disk";
|
||||
imageSize = "16G";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = mkBoot "1G";
|
||||
swap = mkSwap "4G";
|
||||
root = mkRoot "100%" "ext4";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.modules.meta) username;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
username,
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.modules.meta) username;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../../modules/home-manager.nix
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{ username, pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (config.modules.meta) username;
|
||||
in
|
||||
{
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
|
|
|
@ -1,14 +1,28 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types) nullOr str;
|
||||
inherit (lib) mkOption stringLength;
|
||||
inherit (lib.types) str strMatching;
|
||||
|
||||
validateUserName =
|
||||
x:
|
||||
assert (
|
||||
stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"
|
||||
);
|
||||
x;
|
||||
in
|
||||
{
|
||||
options.modules.meta = {
|
||||
hostname = mkOption {
|
||||
default = null;
|
||||
type = nullOr str;
|
||||
type = strMatching "^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
|
||||
default = "";
|
||||
description = "The system's hostname.";
|
||||
};
|
||||
username = mkOption {
|
||||
default = "";
|
||||
type = str;
|
||||
apply = validateUserName;
|
||||
# Should handle multiple users one day? maybe...
|
||||
description = "This system's primary user.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ in
|
|||
{
|
||||
withSystem,
|
||||
hostname,
|
||||
username,
|
||||
extraModules ? [ ],
|
||||
system,
|
||||
}:
|
||||
|
@ -43,13 +44,12 @@ in
|
|||
"${self}/hosts/${hostname}"
|
||||
"${self}/options"
|
||||
"${self}/modules"
|
||||
{ modules.meta.hostname = hostname; }
|
||||
{ modules.meta = { inherit hostname username; }; }
|
||||
] ++ extraModules;
|
||||
specialArgs = {
|
||||
inherit inputs inputs';
|
||||
inherit self self';
|
||||
pubkeys = import ../../options/keys.nix { inherit lib; };
|
||||
username = "ny";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue