Compare commits
12 Commits
a0f14a888e
...
34f9f3d180
| Author | SHA1 | Date | |
|---|---|---|---|
| 34f9f3d180 | |||
| ffe5a7665a | |||
| 999a48526d | |||
| 75e642c6cf | |||
| 8e589775a2 | |||
| a1ee523642 | |||
| 3b2c0d88ff | |||
| 947dc6fbd5 | |||
| 8f2f6b45a1 | |||
| c4b9a4ee6b | |||
| beff889a18 | |||
| 7fa9ec19c4 |
46
flake.nix
46
flake.nix
@ -33,43 +33,41 @@
|
|||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
homeManagerConfFor = config: {...}: {
|
homeManagerConfFor = config: { ... }: {
|
||||||
#nixpkgs.overlays = [ nur.overlay ];
|
#nixpkgs.overlays = [ nur.overlay ];
|
||||||
imports = [config];
|
imports = [ config ];
|
||||||
};
|
};
|
||||||
jacobHome = homeManagerConfFor ./home/jacob.nix;
|
jacobHome = homeManagerConfFor ./home/jacob.nix;
|
||||||
jacobHomeMod = {
|
jacobHomeMod = {
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.users.jacob = jacobHome;
|
home-manager.users.jacob = jacobHome;
|
||||||
};
|
};
|
||||||
in rec {
|
mkNixosSystem = extraModules: nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
# see https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
jacobHomeMod
|
||||||
|
sops-nix.nixosModules.sops
|
||||||
|
] ++ extraModules;
|
||||||
|
};
|
||||||
|
in {
|
||||||
homeManagerConfigurations = {
|
homeManagerConfigurations = {
|
||||||
jacob = jacobHome;
|
jacob = jacobHome;
|
||||||
};
|
};
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
# Thinkpad T470 laptop
|
# Thinkpad T470 laptop
|
||||||
buck = nixpkgs.lib.nixosSystem {
|
buck = mkNixosSystem [
|
||||||
inherit system;
|
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
|
||||||
modules = [
|
./machines/buck/configuration.nix
|
||||||
nixos-hardware.nixosModules.lenovo-thinkpad-t470s
|
];
|
||||||
./machines/buck/configuration.nix
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
jacobHomeMod
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
};
|
|
||||||
# ThinkCentre M700 mini-pc (server)
|
# ThinkCentre M700 mini-pc (server)
|
||||||
pedro = nixpkgs.lib.nixosSystem {
|
pedro = mkNixosSystem [
|
||||||
inherit system;
|
nixos-hardware.nixosModules.common-pc-hdd
|
||||||
modules = [
|
nixos-hardware.nixosModules.common-cpu-intel-cpu-only
|
||||||
nixos-hardware.nixosModules.common-pc-hdd
|
./machines/pedro/configuration.nix
|
||||||
nixos-hardware.nixosModules.common-cpu-intel-cpu-only
|
];
|
||||||
./machines/pedro/configuration.nix
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
jacobHomeMod
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# Edit this configuration file to define what should be installed on
|
# Edit this configuration file to define what should be installed on
|
||||||
# your system. Help is available in the configuration.nix(5) man page
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
|
{ config, pkgs, inputs, sops, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
@ -12,6 +15,12 @@
|
|||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# This lets us pin the nixpkgs registry by default to the nixpkgs used to build this system.
|
||||||
|
# Doing this means we are less likely to require the 30+MB download when
|
||||||
|
# running commands like nix search or nix run
|
||||||
|
# See: https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
|
||||||
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
# This will add secrets.yml to the nix store
|
# This will add secrets.yml to the nix store
|
||||||
# You can avoid this by adding a string to the full path instead, i.e.
|
# You can avoid this by adding a string to the full path instead, i.e.
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page and in the NixOS manual (accessible by running ‘nixos-help’).
|
# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
{
|
|
||||||
config,
|
{ config, pkgs, inputs, options, sops, ... }:
|
||||||
pkgs,
|
|
||||||
options,
|
{ imports =
|
||||||
sops,
|
[ # Include the results of the hardware scan.
|
||||||
...
|
./hardware-configuration-zfs.nix
|
||||||
}: {
|
];
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
# This lets us pin the nixpkgs registry by default to the nixpkgs used to build this system.
|
||||||
./hardware-configuration-zfs.nix
|
# Doing this means we are less likely to require the 30+MB download when
|
||||||
];
|
# running commands like nix search or nix run
|
||||||
|
# See: https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
|
||||||
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
# This will add secrets.yml to the nix store
|
# This will add secrets.yml to the nix store
|
||||||
@ -66,6 +68,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
firewall = import ./firewall.nix;
|
||||||
|
timeServers = [ "192.168.88.1" ] ++ options.networking.timeServers.default;
|
||||||
|
=======
|
||||||
firewall = {
|
firewall = {
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
8384
|
8384
|
||||||
@ -102,6 +108,7 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
timeServers = ["192.168.88.1"] ++ options.networking.timeServers.default;
|
timeServers = ["192.168.88.1"] ++ options.networking.timeServers.default;
|
||||||
|
>>>>>>> 337a41901fccf4591c5315525a74e6e52d33589c
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware.video.hidpi.enable = false;
|
hardware.video.hidpi.enable = false;
|
||||||
@ -112,10 +119,13 @@
|
|||||||
#package = pkgs.pulseaudioFull;
|
#package = pkgs.pulseaudioFull;
|
||||||
#};
|
#};
|
||||||
hardware.bluetooth.enable = false;
|
hardware.bluetooth.enable = false;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
services.blueman.enable = false;
|
services.blueman.enable = false;
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
services.printing.enable = false;
|
services.printing.enable = false;
|
||||||
|
>>>>>>> 337a41901fccf4591c5315525a74e6e52d33589c
|
||||||
|
|
||||||
# Enable sound.
|
# Enable sound.
|
||||||
sound.enable = false;
|
sound.enable = false;
|
||||||
@ -153,6 +163,7 @@
|
|||||||
virtualisation.oci-containers.containers = let
|
virtualisation.oci-containers.containers = let
|
||||||
serverIP = "192.168.88.21";
|
serverIP = "192.168.88.21";
|
||||||
in {
|
in {
|
||||||
|
home-assistant = import ./home-assistant.nix serverIP;
|
||||||
pihole = import ./pihole.nix serverIP;
|
pihole = import ./pihole.nix serverIP;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -160,6 +171,16 @@
|
|||||||
services = {
|
services = {
|
||||||
chrony.enable = true;
|
chrony.enable = true;
|
||||||
|
|
||||||
|
fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
maxretry = 5;
|
||||||
|
ignoreIP = [
|
||||||
|
"127.0.0.0/8" # localhost
|
||||||
|
"192.168.0.0/16" # LAN
|
||||||
|
"160.91.241.229" # lucky
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
gitea = import ./gitea.nix;
|
gitea = import ./gitea.nix;
|
||||||
|
|
||||||
nginx = import ./nginx.nix;
|
nginx = import ./nginx.nix;
|
||||||
@ -167,10 +188,6 @@
|
|||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
|
|
||||||
paperless = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
pipewire = {
|
pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
alsa.enable = true;
|
alsa.enable = true;
|
||||||
@ -184,6 +201,8 @@
|
|||||||
#media-session.enable = true;
|
#media-session.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
syncthing = import ./syncthing.nix;
|
||||||
|
|
||||||
unifi = {
|
unifi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
@ -192,9 +211,11 @@
|
|||||||
|
|
||||||
vaultwarden = {
|
vaultwarden = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = { # https://github.com/dani-garcia/vaultwarden/blob/1.25.2/.env.template
|
||||||
domain = "http://pedro:8081";
|
DOMAIN = "https://vault.jhink.org";
|
||||||
signupsAllowed = true;
|
ROCKET_ADDRESS = "0.0.0.0";
|
||||||
|
ROCKET_PORT = 8222;
|
||||||
|
SIGNUPS_ALLOWED = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
19
machines/pedro/firewall.nix
Normal file
19
machines/pedro/firewall.nix
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
allowedTCPPorts = [
|
||||||
|
8384 22000 # syncthing
|
||||||
|
8080 8443 6789 8880 8843 27117 # unifi controller: https://help.ui.com/hc/en-us/articles/218506997-UniFi-Network-Required-Ports-Reference
|
||||||
|
53 8088 # pihole
|
||||||
|
#8123 # home-assistant
|
||||||
|
#3000 # gitea
|
||||||
|
#8081 # vaultwarden
|
||||||
|
80 443 # reverse proxy
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
22000 21027 # syncthing
|
||||||
|
3478 5514 10001 1900 123 # unifi
|
||||||
|
53 # pihole
|
||||||
|
];
|
||||||
|
allowedUDPPortRanges = [
|
||||||
|
{ from = 5656; to = 5699; } # unifi
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -32,75 +32,81 @@
|
|||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" =
|
||||||
device = "rpool/nixos/nix";
|
{ device = "rpool/nixos/nix";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/etc" = {
|
fileSystems."/etc" =
|
||||||
device = "rpool/nixos/etc";
|
{ device = "rpool/nixos/etc";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var" = {
|
fileSystems."/var" =
|
||||||
device = "rpool/nixos/var";
|
{ device = "rpool/nixos/var";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/lib" = {
|
fileSystems."/var/lib" =
|
||||||
device = "rpool/nixos/var/lib";
|
{ device = "rpool/nixos/var/lib";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/log" = {
|
fileSystems."/var/log" =
|
||||||
device = "rpool/nixos/var/log";
|
{ device = "rpool/nixos/var/log";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/spool" = {
|
fileSystems."/var/spool" =
|
||||||
device = "rpool/nixos/var/spool";
|
{ device = "rpool/nixos/var/spool";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/serverdata/pihole" = {
|
|
||||||
device = "rpool/serverdata/pihole";
|
|
||||||
fsType = "zfs";
|
|
||||||
options = ["zfsutil"];
|
|
||||||
};
|
|
||||||
fileSystems."/serverdata/gitea" = {
|
|
||||||
device = "rpool/serverdata/gitea";
|
|
||||||
fsType = "zfs";
|
|
||||||
options = ["zfsutil"];
|
|
||||||
};
|
|
||||||
fileSystems."/serverdata/home-assistant" = {
|
|
||||||
device = "rpool/serverdata/home-assistant";
|
|
||||||
fsType = "zfs";
|
|
||||||
options = ["zfsutil"];
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/home" = {
|
fileSystems."/serverdata/gitea" =
|
||||||
device = "rpool/userdata/home";
|
{ device = "rpool/serverdata/gitea";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
fileSystems."/serverdata/home-assistant" =
|
||||||
|
{ device = "rpool/serverdata/home-assistant";
|
||||||
|
fsType = "zfs";
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
fileSystems."/serverdata/pihole" =
|
||||||
|
{ device = "rpool/serverdata/pihole";
|
||||||
|
fsType = "zfs";
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
fileSystems."/serverdata/syncthing" =
|
||||||
|
{ device = "rpool/serverdata/syncthing";
|
||||||
|
fsType = "zfs";
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
fileSystems."/root" = {
|
fileSystems."/home" =
|
||||||
device = "rpool/userdata/home/root";
|
{ device = "rpool/userdata/home";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/home/jacob" = {
|
fileSystems."/root" =
|
||||||
device = "rpool/userdata/home/jacob";
|
{ device = "rpool/userdata/home/root";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
options = ["zfsutil"];
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems."/home/jacob" =
|
||||||
|
{ device = "rpool/userdata/home/jacob";
|
||||||
|
fsType = "zfs";
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
swapDevices = [
|
swapDevices = [
|
||||||
{
|
{
|
||||||
|
|||||||
17
machines/pedro/home-assistant.nix
Normal file
17
machines/pedro/home-assistant.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
serverIP :
|
||||||
|
{
|
||||||
|
image = "ghcr.io/home-assistant/home-assistant:2022.8.5";
|
||||||
|
#ports = [
|
||||||
|
#"8123:8123"
|
||||||
|
#];
|
||||||
|
volumes = [
|
||||||
|
"/etc/localtime:/etc/localtime:ro"
|
||||||
|
"/serverdata/home-assistant:/config"
|
||||||
|
];
|
||||||
|
extraOptions = [
|
||||||
|
"--privileged"
|
||||||
|
"--network=host"
|
||||||
|
#"--device /dev/ttyUSB0"
|
||||||
|
#"--device /dev/ttyUSB1"
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -9,14 +9,13 @@
|
|||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
'';
|
'';
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://[::1]:${toString ip}";
|
proxyPass = "http://127.0.0.1:${toString ip}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
"home.jhink.org" = simpleProxy 8123;
|
"home.jhink.org" = simpleProxy 8123;
|
||||||
"git.jhink.org" = simpleProxy 3000;
|
"git.jhink.org" = simpleProxy 3000;
|
||||||
"paperless.jhink.org" = simpleProxy 8000;
|
"vault.jhink.org" = simpleProxy 8222;
|
||||||
#"vault.jhink.org" = simpleProxy 8081;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ serverIP: {
|
|||||||
"/run/secrets/pihole:/run/secrets/pihole"
|
"/run/secrets/pihole:/run/secrets/pihole"
|
||||||
];
|
];
|
||||||
extraOptions = [
|
extraOptions = [
|
||||||
|
"--cap-add=NET_ADMIN"
|
||||||
"--no-hosts" # do not populate internal /etc/hosts with container host's
|
"--no-hosts" # do not populate internal /etc/hosts with container host's
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
9
machines/pedro/syncthing.nix
Normal file
9
machines/pedro/syncthing.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
dataDir = "/serverdata/syncthing/";
|
||||||
|
user = "jacob";
|
||||||
|
group = "users";
|
||||||
|
#openDefaultPorts = true;
|
||||||
|
configDir = "/serverdata/syncthing/.config/syncthing";
|
||||||
|
guiAddress = "192.168.88.0:8234"; # for headless
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user