Compare commits

..

2 Commits

Author SHA1 Message Date
felixalb 2382510f16 defiant/gitea: very minor cleanup 2024-06-10 10:46:23 +02:00
felixalb f5a8ace030 defiant: add keycloak 2024-06-10 10:45:59 +02:00
157 changed files with 8808 additions and 7316 deletions
+10 -42
View File
@@ -1,59 +1,27 @@
keys: keys:
- &bw_recovery age146z3h3flw7spy5thznak8k5jh6yd68k9qrrehg8sdcwmyjv3vd7qvahdur - &user_felixalb_old age1n6j9umxfn5ekvmsrqngdhux0y994yh72sd5xdt6sxec86k4dyu9shsgjkw
- &host_burnham age12cgkgx8xac77q0rwakp6zrfrzp45mhk7wj6t3y8s0xurt3k879usnm66ct - &user_felixalb age1nj7ju6f3jfvzw4c0sxywthjmztwp7rwqceun8xw2tlfrt7qymatser4vqf
- &host_challenger age1j43eqpnq5hy6zt3gmdtzdnne2yfvccd832kpt69qavst44leec6sj2l773 - &host_voyager age14jzavfeg47pgnrstea6yzvh3s3a578nj8hkk8g79vxyzpn86gslscp23qu
- &host_defiant age128md9emufxu35kgww3a90sw40vvc60f5xul9n9ndvw4lfnj3ndaqq44u64 - &host_defiant age128md9emufxu35kgww3a90sw40vvc60f5xul9n9ndvw4lfnj3ndaqq44u64
- &host_leonard age1djj3jvt0usurh43t8jsrs74t5pvj54w77vy7qgln9ykckag233eqyth4fl
- &host_morn age14ar8q5454khxxf5ur2nxwk533nzycz2lh3635qwz35wh8yq0jpqskj2ksx
- &user_felixalb_sisko age1phc4fkt25n4wtzg88sg3fhvmy6tv8pguyxp5c9js83ae3z374adsxfpqkl
- &user_felixalb_worf age1nj7ju6f3jfvzw4c0sxywthjmztwp7rwqceun8xw2tlfrt7qymatser4vqf
creation_rules: creation_rules:
# Global secrets # Global secrets
- path_regex: secrets/[^/]+\.yaml$ - path_regex: secrets/[^/]+\.yaml$
key_groups: key_groups:
- age: - age:
- *bw_recovery - *user_felixalb_old
- *user_felixalb_sisko - *user_felixalb
- *user_felixalb_worf
# Host specific secrets # Host specific secrets
- path_regex: secrets/burnham/[^/]+\.yaml$ - path_regex: secrets/voyager/[^/]+\.yaml$
key_groups: key_groups:
- age: - age:
- *host_burnham - *host_voyager
- *bw_recovery - *user_felixalb_old
- *user_felixalb_sisko - *user_felixalb
- *user_felixalb_worf
- path_regex: secrets/challenger/[^/]+\.yaml$
key_groups:
- age:
- *host_challenger
- *bw_recovery
- *user_felixalb_sisko
- *user_felixalb_worf
- path_regex: secrets/defiant/[^/]+\.yaml$ - path_regex: secrets/defiant/[^/]+\.yaml$
key_groups: key_groups:
- age: - age:
- *host_defiant - *host_defiant
- *bw_recovery - *user_felixalb
- *user_felixalb_sisko
- *user_felixalb_worf
- path_regex: secrets/leonard/[^/]+\.yaml$
key_groups:
- age:
- *host_leonard
- *bw_recovery
- *user_felixalb_sisko
- *user_felixalb_worf
- path_regex: secrets/morn/[^/]+\.yaml$
key_groups:
- age:
- *host_morn
- *bw_recovery
- *user_felixalb_sisko
- *user_felixalb_worf
+4 -5
View File
@@ -26,20 +26,19 @@ Other installed packages and tools are described in the config files (like ./hos
## Public / important services ## Public / important services
- Matrix ([source](./hosts/defiant/services/matrix/default.nix)) - Decentralized, encrypted chat - Contact me at @felixalb:feal.no - Matrix ([source](./hosts/defiant/services/matrix/default.nix)) - Decentralized, encrypted chat - Contact me at @felixalb:feal.no
- [Nextcloud](https://cloud.feal.no) ([source](./hosts/challenger/services/nextcloud.nix)) - Personal cloud services and "google replacements", including file hosting, notes, calendar and webmail - [Nextcloud](https://cloud.feal.no) ([source](./hosts/voyager/services/nextcloud.nix)) - Personal cloud services and "google replacements", including file hosting, notes, calendar and webmail
- [Gitea](https://git.feal.no) ([source](./hosts/defiant/services/gitea.nix)) - Software forge / git server - [Gitea](https://git.feal.no) ([source](./hosts/defiant/services/gitea.nix)) - Software forge / git server
- [Hedgedoc](https://md.feal.no) ([source](./hosts/defiant/services/hedgedoc.nix)) - Collaborative markdown notes editor - [Hedgedoc](https://md.feal.no) ([source](./hosts/defiant/services/hedgedoc.nix)) - Collaborative markdown notes editor
- HomeAssistant ([source](./hosts/defiant/services/home-assistant.nix))- Home automation / IOT controller - HomeAssistant ([source](./hosts/defiant/services/home-assistant.nix))- Home automation / IOT controller
- [VaultWarden](https://pw.feal.no) ([source](./hosts/defiant/services/vaultwarden.nix)) - BitWarden Password Manager backend - [VaultWarden](https://pw.feal.no) ([source](./hosts/defiant/services/vaultwarden.nix)) - BitWarden Password Manager backend
- [KeyCloak](https://iam.feal.no) ([source](./hosts/defiant/services/nextcloud.nix)) - Authentication provider, giving SSO with OIDC or SAML - [Kanidm](https://auth.feal.no) ([source](./hosts/voyager/services/kanidm.nix)) - Authentication provider with support for OAuth2/OIDC, LDAPS, SSH, etc.
- [Jellyfin](https://jf.feal.no) ([source](./hosts/challenger/services/jellyfin.nix)) - Local media streaming - [Jellyfin](https://jf.feal.no) ([source](./hosts/voyager/services/jellyfin.nix)) - Local media streaming
## Networking ## Networking
- I use *nginx* as a web server and reverse proxy. The configuration is mostly distributed throughout the services that use it ([example](https://git.feal.no/felixalb/nixos-config/src/commit/3a05681d10a6999f73cbef59c3999742b81947a6/hosts/defiant/services/hedgedoc.nix#L98)). - I use *nginx* as a web server and reverse proxy. The configuration is mostly distributed throughout the services that use it ([example](https://git.feal.no/felixalb/nixos-config/src/commit/3a05681d10a6999f73cbef59c3999742b81947a6/hosts/defiant/services/hedgedoc.nix#L98)).
- A long time ago, I switched from Tailscale(actually [headscale](https://github.com/juanfont/headscale)) to *WireGuard*, configured [here](./hosts/defiant/services/wireguard.nix). - I recently switched from Tailscale(actually [headscale](https://github.com/juanfont/headscale)) to *WireGuard*, configured [here](./hosts/defiant/services/wireguard.nix) and [here](./hosts/burnham/services/wireguard.nix).
- PiHole ([source](./hosts/defiant/services/pihole.nix)) run my internal DNS (\*.home.feal.no) and ad blocking. - PiHole ([source](./hosts/defiant/services/pihole.nix)) run my internal DNS (\*.home.feal.no) and ad blocking.
- A simple custom DynDNS thing is defined [here](./common/domeneshop-dyndns.nix) and used [here](./hosts/defiant/services/dyndns.nix).
## Monitoring ## Monitoring
+16 -18
View File
@@ -5,8 +5,8 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking = { networking = {
domain = lib.mkDefault "home.feal.no"; domain = "home.feal.no";
nameservers = lib.mkDefault [ "192.168.10.175" "192.168.10.1" ]; nameservers = [ "192.168.10.175" "192.168.10.1" "1.1.1.1" ];
useDHCP = lib.mkDefault false; useDHCP = lib.mkDefault false;
}; };
@@ -29,42 +29,40 @@
trusted-users = [ "felixalb" ]; trusted-users = [ "felixalb" ];
builders-use-substitutes = true; builders-use-substitutes = true;
}; };
registry= {
nixpkgs.flake = inputs.nixpkgs;
};
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
}; };
programs.zsh.enable = true; programs.zsh.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
bat
bottom bottom
diffr duf
eza eza
file file
git git
gnugrep gnugrep
gnutar gnutar
htop htop
iotop neofetch
lm_sensors
nix-output-monitor nix-output-monitor
nixfmt
p7zip p7zip
python3 python3
ripgrep ripgrep
rsync rsync
screen screen
unzip unzip
usbutils
vim
wget wget
zip zip
] ++ lib.optionals (pkgs.stdenv.isLinux) [
dmidecode
lm_sensors
pciutils
]; ];
services.openssh = { services.openssh = {
enable = true; enable = true;
openFirewall = lib.mkDefault true;
settings = { settings = {
PermitRootLogin = "no"; PermitRootLogin = "no";
PasswordAuthentication = false; PasswordAuthentication = false;
@@ -78,7 +76,7 @@
''; '';
}; };
programs.mosh.enable = true; networking.firewall.allowedTCPPorts = [ 22 ];
users.users.felixalb = { users.users.felixalb = {
isNormalUser = true; isNormalUser = true;
@@ -86,12 +84,12 @@
"wheel" "wheel"
"docker" "docker"
]; ];
uid = lib.mkDefault 1000; uid = 1000;
openssh.authorizedKeys.keys = lib.mkDefault [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTXSL0w7OUcz1LzEt1T3I3K5RgyNV+MYz0x/1RbpDHQ felixalb@worf"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTXSL0w7OUcz1LzEt1T3I3K5RgyNV+MYz0x/1RbpDHQ felixalb@worf"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFiPHhj0YbklJnJNcxD0IlzPxLTGfv095H5zyS/1Wb64 felixalb@edison.home.feal.no"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5M7hYl3saBNMAo6sczgfUvASEJWFHuERB7xvf4gxst nix-builder-worf" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5M7hYl3saBNMAo6sczgfUvASEJWFHuERB7xvf4gxst nix-builder-worf"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJky33ynjqyWP+hh24gFCMFIEqe3CjIIowGM9jiPbT79 felixalb@sisko.home.feal.no"
]; ];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
-15
View File
@@ -1,15 +0,0 @@
{ config, pkgs, lib, ... }:
{
system.autoUpgrade = {
enable = true;
flake = "git+https://git.feal.no/felixalb/nixos-config.git";
flags = [
# Override nixpkgs (only). Notably does not include home-manager, sops or other utility/application flake inputs.
"--refresh"
"--override-input" "nixpkgs" "github:NixOS/nixpkgs/nixos-26.05-small"
"--override-input" "nixpkgs-unstable" "github:nixos/nixpkgs/nixos-unstable"
"--no-write-lock-file"
];
};
}
-45
View File
@@ -1,45 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.domeneshop-dyndns;
in {
options.services.domeneshop-dyndns = {
enable = lib.mkEnableOption "Domeneshop DynDNS";
domain = lib.mkOption {
type = lib.types.str;
description = "Domain name to configure";
};
netrcFile = lib.mkOption {
type = lib.types.path;
description = "Path to the file that contains `machine api.domeneshop.no login <DDNS_TOKEN> password <DDNS_SECRET>` from https://domene.shop/admin?view=api";
};
startAt = lib.mkOption {
type = lib.types.str;
default = "*:0/10"; # Every 10 minutes
description = "Systemd onCalendar expression for when to run the timer";
};
};
config = lib.mkIf cfg.enable {
systemd.services.domeneshop-dyndns = {
serviceConfig.LoadCredential = "netrc:${cfg.netrcFile}";
startAt = cfg.startAt;
script = ''
DNSNAME="${cfg.domain}"
NEW_IP="$(${lib.getExe pkgs.curl} --silent https://ipinfo.io/ip)"
OLD_IP="$(${lib.getExe pkgs.getent} hosts "$DNSNAME" | ${lib.getExe pkgs.gawk} '{ print $1 }')"
if [[ "$NEW_IP" != "$OLD_IP" ]]; then
echo "Old IP ($OLD_IP) does not match new IP ($NEW_IP), updating..."
${lib.getExe pkgs.curl} --silent --netrc-file "$CREDENTIALS_DIRECTORY/netrc" "https://api.domeneshop.no/v0/dyndns/update?hostname=$DNSNAME&myip=$NEW_IP"
else
echo "Old IP ($OLD_IP) matches new IP ($NEW_IP), exiting..."
fi
'';
};
};
}
+36 -1
View File
@@ -17,6 +17,41 @@ in {
''; '';
}; };
# TODO: Configure fluent-bit or rsyslog services.promtail = {
enable = true;
configuration = {
server = {
http_listen_port = 28183;
grpc_listen_port = 0;
};
clients = [
{
url = "http://${metricsHost}:3100/loki/api/v1/push";
}
];
scrape_configs = [
{
job_name = "systemd-journal";
journal = {
max_age = "12h";
labels = {
job = "systemd-journal";
host = config.networking.hostName;
};
};
relabel_configs = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "unit";
}
{
source_labels = [ "__journal_priority_keyword" ];
target_label = "level";
}
];
}
];
};
};
} }
-44
View File
@@ -1,44 +0,0 @@
# Credit https://git.pvv.ntnu.no/oysteikt 2026
{
openssh,
fetchurl,
lib
}:
openssh.overrideAttrs (prev: rec {
# Old crypto was removed in v10.0
version = "9.9p2";
src = fetchurl {
url = "mirror://openbsd/OpenSSH/portable/openssh-${version}.tar.gz";
hash = "sha256-karbYD4IzChe3fll4RmdAlhfqU2ZTWyuW0Hhch4hVnM=";
};
configureFlags = prev.configureFlags ++ [
"--enable-dsa-keys"
];
# Broken patches, meant for 10.3p :p
patches = lib.filter (x: !(lib.any (suf: lib.hasSuffix suf (baseNameOf x)) [
"dont_create_privsep_path.patch"
"pkcs11-fix-pinentry.patch"
"pkcs11-tests-allow-module-path.patch"
"ssh-agent-tests-increase-timeout.patch"
])) prev.patches;
# We actually needed the `dont_create_privsep_path` one :3
postPatch = prev.postPatch + ''
substituteInPlace Makefile.in \
--replace-fail '$(MKDIR_P) -m 0755 $(DESTDIR)$(PRIVSEP_PATH)' '''
'';
# Tihi
doInstallCheck = false;
postFixup = ''
rm -rf $out/libexec $out/etc
rm $out/bin/ssh-* $out/bin/sshd $out/bin/sftp
cd $out/bin
for filename in *; do mv {,old}"$filename"; done;
'';
})
-81
View File
@@ -1,81 +0,0 @@
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
dpkg,
cups,
gtkmm3,
icu74,
krb5,
makeWrapper,
openssl,
pango,
python312,
xcb-util-cursor,
xorg,
}:
let
packageId = "scrt_ubuntu2464_deb_963";
in stdenv.mkDerivation rec {
pname = "securecrt";
version = "9.6.3";
src = fetchurl {
url = "https://www.vandyke.com/cgi-bin/download_1.php";
name = "${pname}-${version}.deb";
curlOpts = "-X POST --data 'pid=${packageId}&export_check=accept&country=no&su";
sha256 = "sha256-PsFuxJ7H0rJCWWi+rvzrlRUJlp9R4MG14d883/kl9Lo=";
};
unpackCmd = "dpkg -x $curSrc source";
nativeBuildInputs = [
dpkg
autoPatchelfHook
];
buildInputs = [
cups
gtkmm3
icu74
krb5
makeWrapper
openssl
pango
python312
xcb-util-cursor
xorg.xcbutilkeysyms
xorg.xcbutilwm
];
dontConfigure = true;
dontBuild = true;
dontWrapQTApps = true;
installPhase = ''
runhook preInstall
mkdir -p "$out"
cp -R usr/* "$out/"
wrapProgram "$out/bin/SecureCRT" --set QT_QPA_PLATFORM_PLUGIN_PATH "$out/lib/scrt/plugins/platforms"
runhook postInstall
'';
meta = with lib; {
homepage = "https://www.vandyke.com/products/securecrt/unix.html";
description = "Terminal emulator for computing professionals, with advanced session management";
license = {
free = false;
fullName = "Unknown / Custom";
};
platforms = with lib.platforms; linux ++ darwin ++ windows;
broken = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64);
};
mainProgram = "SecureCRT";
}
-38
View File
@@ -1,38 +0,0 @@
[
{ # Worf
publicKey = "4buTx2yGpQMvCw6q+COySRHiS4acf1F09WryiDNQ428=";
allowedIPs = [
"10.100.0.4/32"
];
}
{ # Phone
publicKey = "axFXtcTYtW6m1FT9Czn9DRvG+b05D7j+0yRMjn/FJEk=";
allowedIPs = [
"10.100.0.5/32"
];
}
{ # Riker
publicKey = "r715vpgH1H0zvN+Z5wcNKcOo5e6UM3fBfh9BZwTBjmA=";
allowedIPs = [
"10.100.0.6/32"
];
}
{ # fa-t14-2025
publicKey = "UPpUVWQqOKT65MFym1sFDTstNmuynDYE4LOOtbWqEng=";
allowedIPs = [
"10.100.0.7/32"
];
}
{ # Turtle
publicKey = "mDzAtRPv+O5TDHa9DGodF/KKuFXRBYwSqfPyeWfdfRI=";
allowedIPs = [
"10.100.0.8/32"
];
}
{ # Amalies phone
publicKey = "Iqoq00e5rUNygmjOKmSPzvDTzvUdpxkpwVrD6UJXG2w=";
allowedIPs = [
"10.100.0.9/32"
];
}
]
Generated
+109 -175
View File
@@ -1,28 +1,13 @@
{ {
"nodes": { "nodes": {
"extra-config": {
"locked": {
"lastModified": 1775160379,
"narHash": "sha256-xrY3E3RTHP/c8MRKtciVbpXrgPCEnSQeNK4dCF53i9E=",
"ref": "refs/heads/main",
"rev": "66b4e90b64ecfacc1fff901f3197388f70bc53c8",
"revCount": 15,
"type": "git",
"url": "file:///home/felixalb/nix-extra-config"
},
"original": {
"type": "git",
"url": "file:///home/felixalb/nix-extra-config"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1747046372, "lastModified": 1673956053,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -31,6 +16,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -38,36 +41,35 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1782704057, "lastModified": 1716736833,
"narHash": "sha256-G1I1gd32F7mp9LAe1DaZ4ZL7NX5gyiKwdCMwro1Vrck=", "narHash": "sha256-rNObca6dm7Qs524O4st8VJH6pZ/Xe1gxl+Rx6mcWYo0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "868d0a692de703c2de98fab61968e4e310b7c28e", "rev": "a631666f5ec18271e86a5cde998cba68c33d9ac6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-26.05", "ref": "release-24.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"matrix-synapse-next": { "matrix-synapse-next": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1765214213, "lastModified": 1717234745,
"narHash": "sha256-WSk8CTdIDFFP5VMJj9beve19nPMMdTsWnkCHVXqO/3E=", "narHash": "sha256-MFyKRdw4WQD6V3vRGbP6MYbtJhZp712zwzjW6YiOBYM=",
"owner": "dali99", "owner": "dali99",
"repo": "nixos-matrix-modules", "repo": "nixos-matrix-modules",
"rev": "82959f612ffd523a49c92f84358a9980a851747b", "rev": "d7dc42c9bbb155c5e4aa2f0985d0df75ce978456",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "dali99", "owner": "dali99",
"ref": "v0.6.0",
"repo": "nixos-matrix-modules", "repo": "nixos-matrix-modules",
"type": "github" "type": "github"
} }
@@ -75,20 +77,20 @@
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs-darwin" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1779036909, "lastModified": 1710717205,
"narHash": "sha256-zXcwYQGCT6pzinK+1dBB2ekTVtfxGZAapb3Evdcu4fY=", "narHash": "sha256-Wf3gHh5uV6W1TV/A8X8QJf99a5ypDSugY4sNtdJDe0A=",
"owner": "nix-darwin", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "56c666e108467d87d13508936aade6d567f2a501", "rev": "bcc8afd06e237df060c85bad6af7128e05fd61a3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-darwin", "owner": "lnl7",
"ref": "nix-darwin-26.05", "ref": "master",
"repo": "nix-darwin", "repo": "nix-darwin",
"type": "github" "type": "github"
} }
@@ -96,17 +98,15 @@
"nix-minecraft": { "nix-minecraft": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"nixpkgs": [ "flake-utils": "flake-utils",
"nixpkgs" "nixpkgs": "nixpkgs_2"
],
"systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1780113881, "lastModified": 1710638386,
"narHash": "sha256-AMOOt682Odr4GZwCwZ08/Q/21/Sh3DxfmOAoiQbTKhk=", "narHash": "sha256-8etSpxJaCYBWTViHqQRR6o76WfDX2CuD1o2UQXQrwao=",
"owner": "Infinidoge", "owner": "Infinidoge",
"repo": "nix-minecraft", "repo": "nix-minecraft",
"rev": "d9bd57f218cda7d6aac4b52546240da0df76a1f9", "rev": "8f292bc64336ac9559d33c9a074a214d783a4c8e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -117,164 +117,92 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1783014552, "lastModified": 1706098335,
"narHash": "sha256-htsCMj3F1QHmBHcadpwxA+mVcgTCvPXOZLg1M82/zdM=", "narHash": "sha256-r3dWjT8P9/Ah5m5ul4WqIWD8muj5F+/gbCdjiNVBKmU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5863b64722a3967028f5ad22f79875b52ce82007", "rev": "a77ab169a83a4175169d78684ddd2e54486ac651",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"type": "indirect"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1710628718,
"narHash": "sha256-y+l3eH53UlENaYa1lmnCBHusZb1kxBEFd2/c7lDsGpw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6dc11d9859d6a18ab0c5e5829a5b8e4810658de3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-26.05-small", "ref": "release-23.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-2211": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1658083977, "lastModified": 1698318101,
"narHash": "sha256-yqLXI+viN5+Vx5YpG9gNapKL3/+P6Pkprc36xNdyqSU=", "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=",
"type": "tarball", "owner": "nixos",
"url": "https://github.com/NixOS/nixpkgs/archive/34bfa9403e42eece93d1a3740e9d8a02fceafbca.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/34bfa9403e42eece93d1a3740e9d8a02fceafbca.tar.gz"
}
},
"nixpkgs-darwin": {
"locked": {
"lastModified": 1782971832,
"narHash": "sha256-/g/OtRDpNSGuQuIAP2bZL2Dlvsvxna7fAaKFAXkpsxw=",
"owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a88cc24d9d9e9a89614298fe908aba6d289654d3", "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixpkgs-26.05-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1782723713,
"narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"pwndbg": { "nixpkgs_3": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"pyproject-build-systems": "pyproject-build-systems",
"pyproject-nix": "pyproject-nix",
"uv2nix": "uv2nix"
},
"locked": { "locked": {
"lastModified": 1783022620, "lastModified": 1717144377,
"narHash": "sha256-iPkF6wgjM5P1wUMngNV+0BEUJHs7OmcL3Phi2AaIUIs=", "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
"owner": "pwndbg", "owner": "NixOS",
"repo": "pwndbg", "repo": "nixpkgs",
"rev": "91d23aa950c48b9bbd59375b9a3af2cc365b05c4", "rev": "805a384895c696f802a9bf5bf4720f37385df547",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "pwndbg", "owner": "NixOS",
"repo": "pwndbg", "ref": "nixos-24.05",
"type": "github" "repo": "nixpkgs",
}
},
"pyproject-build-systems": {
"inputs": {
"nixpkgs": [
"pwndbg",
"nixpkgs"
],
"pyproject-nix": [
"pwndbg",
"pyproject-nix"
],
"uv2nix": [
"pwndbg",
"uv2nix"
]
},
"locked": {
"lastModified": 1763662255,
"narHash": "sha256-4bocaOyLa3AfiS8KrWjZQYu+IAta05u3gYZzZ6zXbT0=",
"owner": "pyproject-nix",
"repo": "build-system-pkgs",
"rev": "042904167604c681a090c07eb6967b4dd4dae88c",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "build-system-pkgs",
"type": "github"
}
},
"pyproject-nix": {
"inputs": {
"nixpkgs": [
"pwndbg",
"nixpkgs"
]
},
"locked": {
"lastModified": 1769936401,
"narHash": "sha256-kwCOegKLZJM9v/e/7cqwg1p/YjjTAukKPqmxKnAZRgA=",
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"rev": "b0d513eeeebed6d45b4f2e874f9afba2021f7812",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"extra-config": "extra-config",
"home-manager": "home-manager", "home-manager": "home-manager",
"matrix-synapse-next": "matrix-synapse-next", "matrix-synapse-next": "matrix-synapse-next",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nix-minecraft": "nix-minecraft", "nix-minecraft": "nix-minecraft",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_3",
"nixpkgs-2211": "nixpkgs-2211", "sops-nix": "sops-nix",
"nixpkgs-darwin": "nixpkgs-darwin", "unstable": "unstable",
"nixpkgs-unstable": "nixpkgs-unstable", "voyager-addons": "voyager-addons"
"pwndbg": "pwndbg",
"sops-nix": "sops-nix"
} }
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ],
"nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1777944972, "lastModified": 1710644594,
"narHash": "sha256-VfGRo1qTBKOe3s2gOv8LSoA6Fk19PvBlwQ1ECN0Evn8=", "narHash": "sha256-RquCuzxfy4Nr8DPbdp3D/AsbYep21JgQzG8aMH9jJ4A=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "c591bf665727040c6cc5cb409079acb22dcce33c", "rev": "83b68a0e8c94b72cdd0a6e547a14ca7eb1c03616",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -298,30 +226,36 @@
"type": "github" "type": "github"
} }
}, },
"uv2nix": { "unstable": {
"inputs": {
"nixpkgs": [
"pwndbg",
"nixpkgs"
],
"pyproject-nix": [
"pwndbg",
"pyproject-nix"
]
},
"locked": { "locked": {
"lastModified": 1769957392, "lastModified": 1716948383,
"narHash": "sha256-6PkqwwYf5K2CHi2V+faI/9pqjfz/HxUkI/MVid6hlOY=", "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"owner": "pyproject-nix", "owner": "NixOS",
"repo": "uv2nix", "repo": "nixpkgs",
"rev": "d18bc50ae1c3d4be9c41c2d94ea765524400af75", "rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "pyproject-nix", "owner": "NixOS",
"repo": "uv2nix", "ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
},
"voyager-addons": {
"locked": {
"lastModified": 1717176924,
"narHash": "sha256-pYq/v0RNwHshSZf2OeH3P6Aa4/zHGDAJq7Z2Ah9i700=",
"ref": "refs/heads/main",
"rev": "15f32cc6b828c56cb6a954de0096b81f291100d9",
"revCount": 8,
"type": "git",
"url": "file:///home/felixalb/voyager-addons"
},
"original": {
"type": "git",
"url": "file:///home/felixalb/voyager-addons"
}
} }
}, },
"root": "root", "root": "root",
+90 -73
View File
@@ -2,29 +2,20 @@
description = "Felixalb System flake"; description = "Felixalb System flake";
inputs = { inputs = {
# Nixpkgs and friends nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05-small"; # Remember to update ./common/auto-upgrade.nix unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-26.05-darwin";
nixpkgs-2211.url = "https://github.com/NixOS/nixpkgs/archive/34bfa9403e42eece93d1a3740e9d8a02fceafbca.tar.gz"; # old nixpgks for e.g. remmina
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-26.05"; nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-26.05"; home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Other inputs matrix-synapse-next.url = "github:dali99/nixos-matrix-modules/v0.6.0";
extra-config.url = "git+file:///home/felixalb/nix-extra-config";
matrix-synapse-next.url = "github:dali99/nixos-matrix-modules"; # TODO: Lock to release
matrix-synapse-next.inputs.nixpkgs.follows = "nixpkgs";
nix-minecraft.url = "github:Infinidoge/nix-minecraft"; nix-minecraft.url = "github:Infinidoge/nix-minecraft";
nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
pwndbg.url = "github:pwndbg/pwndbg"; # voyager-addons.url = "git+ssh://git@git.feal.no:2222/felixalb/voyager-addons.git";
pwndbg.inputs.nixpkgs.follows = "nixpkgs"; voyager-addons.url = "git+file:///home/felixalb/voyager-addons";
sops-nix.url = "github:Mic92/sops-nix"; sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.inputs.nixpkgs.follows = "nixpkgs";
@@ -32,106 +23,132 @@
outputs = { outputs = {
self self
, extra-config
, home-manager , home-manager
, matrix-synapse-next , matrix-synapse-next
, nix-darwin
, nix-minecraft , nix-minecraft
, nix-darwin
, nixpkgs , nixpkgs
, nixpkgs-2211
, nixpkgs-darwin
, nixpkgs-unstable
, pwndbg
, sops-nix , sops-nix
, unstable
, voyager-addons
, ... }@inputs: , ... }@inputs:
let let
pkgs-overlay = final: prev: { pkgs-overlay = final: prev: {
unstable = import nixpkgs-unstable { unstable = unstable.legacyPackages.${prev.system};
system = prev.system;
config.allowUnfree = true; python311 = prev.python311.override {
packageOverrides = self: super: {
# k5test is broken on darwin, as of 24.05
gssapi = super.gssapi.overrideAttrs (old: {
doInstallCheck = false;
});
};
}; };
nixpkgs-2211 = import nixpkgs-2211 {
system = prev.system;
config.allowUnfree = true;
};
pwndbg = pwndbg.packages."${prev.system}".default;
securecrt = prev.callPackage ./common/securecrt.nix { };
oldssh = prev.callPackage ./common/oldssh.nix { };
}; };
in in
{ {
nixosConfigurations = let nixosConfigurations = {
normalSys = name: hostConfig: nixpkgs.lib.nixosSystem { voyager = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; # TODO - Handle system = "x86_64-linux";
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
modules = [ modules = [
({ config, pkgs, ... }: { # Overlays-module makes "pkgs.unstable" available in configuration.nix
# Make "pkgs.unstable" etc. available ({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
nixpkgs.overlays = [ pkgs-overlay ] ++ hostConfig.overlays or [ ];
})
./hosts/${name}/configuration.nix ./hosts/voyager/configuration.nix
voyager-addons.nixosModules.default
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager { home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users = { home-manager.users."felixalb" = import ./hosts/voyager/home.nix;
"felixalb" = import ./hosts/${name}/home.nix;
} // hostConfig.home-manager-users or { };
} }
] ++ hostConfig.modules or [ ];
};
in {
# Media / storage server
challenger = normalSys "challenger" {
modules = [
extra-config.nixosModules.default
]; ];
}; };
defiant = nixpkgs.lib.nixosSystem {
# General application server system = "x86_64-linux";
defiant = normalSys "defiant" { specialArgs = {
inherit inputs;
};
modules = [ modules = [
./common/domeneshop-dyndns.nix # Overlays-module makes "pkgs.unstable" available in configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
./hosts/defiant/configuration.nix
sops-nix.nixosModules.sops
matrix-synapse-next.nixosModules.default matrix-synapse-next.nixosModules.default
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."felixalb" = import ./hosts/defiant/home.nix;
}
]; ];
}; };
edison = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
# Overlays-module makes "pkgs.unstable" available in configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
# Work laptop ./hosts/edison/configuration.nix
fa-t14-2025 = normalSys "fa-t14-2025" { }; sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."felixalb" = import ./hosts/edison/home.nix;
}
];
};
burnham = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
# Overlays-module makes "pkgs.unstable" available in configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
# Web host ./hosts/burnham/configuration.nix
leonard = normalSys "leonard" { }; sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager {
# General application server home-manager.useGlobalPkgs = true;
morn = normalSys "morn" { }; home-manager.useUserPackages = true;
home-manager.users."felixalb" = import ./hosts/burnham/home.nix;
# Home desktop }
sisko = normalSys "sisko" { }; ];
};
redshirt = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
./hosts/redshirt/configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
sops-nix.nixosModules.sops
];
};
}; };
# Daily driver macbook
darwinConfigurations.worf = nix-darwin.lib.darwinSystem { darwinConfigurations.worf = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin"; system = "aarch64-darwin";
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
modules = [ modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
./hosts/worf/configuration.nix ./hosts/worf/configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = [ pkgs-overlay ]; })
home-manager.darwinModules.home-manager { home-manager.darwinModules.home-manager {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users."felixalb" = import ./hosts/worf/home.nix; home-manager.users."felixalb" = import ./hosts/worf/home.nix;
} }
# sops-nix.nixosModules.sops
]; ];
}; };
+2 -30
View File
@@ -19,7 +19,7 @@
decorations = "none"; # full/none/transparent/buttonless decorations = "none"; # full/none/transparent/buttonless
# Transparency: # Transparency:
opacity = lib.mkDefault 0.95; # opacity = 0.95;
}; };
scrolling = { scrolling = {
@@ -50,34 +50,7 @@
colors = { colors = {
draw_bold_text_with_bright_colors = true; draw_bold_text_with_bright_colors = true;
# # Tomorrow Night Bright
# # gruvbox_material_medium_dark
# primary = {
# background = "0x282828";
# foreground = "0xd4be98";
# };
# normal = {
# black = "0x3c3836";
# red = "0xea6962";
# green = "0xa9b665";
# yellow = "0xd8a657";
# blue = "0x7daea3";
# magenta = "0xd3869b";
# cyan = "0x89b482";
# white = "0xd4be98";
# };
# bright = {
# black = "0x3c3836";
# red = "0xea6962";
# green = "0xa9b665";
# yellow = "0xd8a657";
# blue = "0x7daea3";
# magenta = "0xd3869b";
# cyan = "0x89b482";
# white = "0xd4be98";
# };
# # # Tomorrow Night Bright
# primary = { # primary = {
# background = "0x141414"; # background = "0x141414";
# foreground = "0xeaeaea"; # foreground = "0xeaeaea";
@@ -110,7 +83,6 @@
# white = "0xffffff"; # white = "0xffffff";
# }; # };
# Nord: # Nord:
primary = { primary = {
background = "0x2e3440"; background = "0x2e3440";
-43
View File
@@ -1,43 +0,0 @@
{ pkgs, lib, ... }:
{
imports = [
./../alacritty.nix
];
home = {
packages = with pkgs; [
papers
kitty
pavucontrol
# Window Manager Extras
bibata-cursors
hyprcursor
hypridle
hyprlock
hyprpaper
hyprshot
nautilus
networkmanager
swaynotificationcenter
waybar
wl-clipboard
];
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
};
programs = {
alacritty = {
enable = true;
settings.window.opacity = 0.92;
};
firefox.enable = true;
wofi.enable = true;
};
home.stateVersion = "24.11";
}
+9 -36
View File
@@ -1,37 +1,25 @@
{ pkgs, lib, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
./neovim.nix ./neovim.nix
./zsh.nix ./zsh.nix
]; ];
home = { home.packages = with pkgs; [
packages = with pkgs; [ bottom
bat unstable.ncdu
bottom neofetch
# ncdu ];
pwgen
sshfs
sshuttle
];
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
};
programs.nix-index = { programs.nix-index = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
}; };
programs.fzf.enable = true;
programs.git = { programs.git = {
enable = true; enable = true;
settings = { extraConfig = {
pull.rebase = true; pull.rebase = true;
push.autoSetupRemote = true; push.autoSetupRemote = true;
color.ui = "auto"; color.ui = "auto";
@@ -40,30 +28,15 @@
user = { user = {
name = "Felix Albrigtsen"; name = "Felix Albrigtsen";
email = lib.mkDefault "felix@albrigtsen.it"; email = "felix@albrigtsen.it";
};
safe = {
directory = "/config";
}; };
}; };
ignores = [ ignores = [
"*.swp"
"*~" "*~"
"*.swp"
".DS_Store" ".DS_Store"
".gdb_history"
".vscode" ".vscode"
]; ];
}; };
programs.tmux = {
enable = true;
sensibleOnTop = true;
baseIndex = 1;
clock24 = true;
keyMode = "vi";
mouse = true;
terminal = "screen-256color";
};
} }
-47
View File
@@ -1,47 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.wayland.windowManager.hyprland;
in
{
imports = [
./hypridle.nix
./hyprland.nix
./hyprlock.nix
./hyprpaper.nix
./keybinds.nix
];
config = lib.mkIf cfg.enable {
systemd.user.sessionVariables = {
NIXOS_OZONE_WL = "1";
WLR_NO_HARDWARE_CURSORS = "1";
WLR_RENDERER_ALLOW_SOFTWARE = "1";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
};
home.packages = with pkgs; [
bibata-cursors
swaynotificationcenter
wl-clipboard
];
home.pointerCursor = {
name = "Bibata-Modern-Ice";
package = pkgs.bibata-cursors;
size = 24;
gtk.enable = true;
x11 = {
enable = true;
defaultCursor = true;
};
};
};
}
-45
View File
@@ -1,45 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
services.hypridle = {
enable = true;
settings = {
general = {
ignore_dbus_inhibit = false;
lock_cmd = "pidof hyprlock || ${config.programs.hyprlock.package}/bin/hyprlock";
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
after_sleep_cmd = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
};
listener = [
{
timeout = 8 * 60;
on-timeout = "${pkgs.libnotify}/bin/notify-send \"You are idle!\"";
}
{
timeout = 10 * 60;
on-timeout = "${config.programs.hyprlock.package}/bin/hyprlock";
}
{
timeout = 15 * 60;
on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
}
];
};
};
# TODO - Remove?
systemd.user.services.hypridle = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
}
-180
View File
@@ -1,180 +0,0 @@
{
lib,
config,
osConfig,
...
}:
{
wayland.windowManager.hyprland = {
systemd.enable = false; # Required for UWSM
systemd.enableXdgAutostart = false;
configType = "lua";
settings =
let
wpDir = "${config.home.homeDirectory}/Pictures/wallpapers";
in
{
on._args = [
"hyprland.start"
(lib.generators.mkLuaInline (
''
function()
''
+
lib.concatMapStringsSep "\n" (cmd: ''hl.exec_cmd("${cmd}")'') (
[
"swaync"
"hyprswitch init --size-factor 5 &"
"wl-paste --type text --watch cliphist store #Stores only text data"
"wl-paste --type image --watch cliphist store #Stores only image data"
]
++ (
{
# TODO: the hyprpaper hm-module still generates the old config format, use ipc temporarily
"sisko" = [
"hyprctl hyprpaper wallpaper 'DP-1, ${wpDir}/Ultrawide_Stray_City.png'"
"hyprctl hyprpaper wallpaper 'DP-2, ${wpDir}/cyberpunk-gas-station-1.jpg'"
];
"fa-t14-2025" = [
"hyprctl hyprpaper wallpaper ', ${wpDir}/mktv-wallpaper-01.png'"
];
}
."${osConfig.networking.hostName}"
)
)
+ ''
end
''
))
];
monitor = [
# Sisko
{
output = "desc:Philips Consumer Electronics Company 49M2C8900 AU42525000628";
mode = "highres@highrr";
position = "0x0";
scale = "1";
supports_hdr = 1;
}
{
output = "desc:LG Electronics LG ULTRAWIDE 407NTABCV312";
mode = "highres@highrr";
position = "600x-1440";
scale = "1";
supports_hdr = 1;
}
# fa-t14-2025
{
output = "desc:Lenovo Group Limited 0x403D";
mode = "highres@highrr";
position = "0x0";
scale = "1";
supports_hdr = 1;
}
{
output = "desc:Samsung Electric Company LS32D70xE HK2XC00156";
mode = "3840x2160@30.00";
position = "-3840x0";
scale = "1";
}
{
output = "desc:Samsung Electric Company C24F390 H4ZM501656";
mode = "1920x1080@60.00";
position = "-5760x0";
scale = "1";
}
# Other
{
output = "";
mode = "preferred";
position = "auto";
scale = "auto";
}
];
config = {
general = {
gaps_in = 8;
gaps_out = 12;
border_size = 1;
"col.active_border" = {
colors = [
"rgba(33ccffee)"
"rgba(00ff99ee)"
];
angle = 45;
};
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "dwindle";
};
decoration = {
rounding = 8;
active_opacity = 1.0;
inactive_opacity = 1.0;
shadow = {
enabled = true;
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
blur = {
enabled = true;
size = 3;
passes = 1;
vibrancy = 0.1696;
};
};
animations.enabled = false; # TODO
dwindle = {
preserve_split = true;
};
master = {
new_status = "master";
};
binds = {
movefocus_cycles_fullscreen = 1;
};
misc = {
force_default_wallpaper = 0;
disable_hyprland_logo = true;
};
input = {
kb_layout = lib.mkDefault "us";
kb_variant = lib.mkDefault "intl";
kb_model = "";
kb_options = "ctrl:nocaps";
kb_rules = "";
follow_mouse = 1;
sensitivity = 0;
touchpad = {
natural_scroll = false;
};
};
};
};
};
}
-47
View File
@@ -1,47 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
programs.hyprlock = {
enable = true;
settings = {
general = {
hide_cursor = true;
no_fade_in = false;
};
background = [
{
path = "screenshot";
blur_passes = 3;
blur_size = 8;
}
];
input-field = [
{
size = "200, 50";
position = "0, -80";
monitor = "";
dots_center = true;
fade_on_empty = false;
font_color = "rgb(202, 211, 245)";
inner_color = "rgb(91, 96, 120)";
outer_color = "rgb(24, 25, 38)";
outline_thickness = 5;
placeholder_text = "Password...";
shadow_passes = 2;
}
];
};
};
};
}
-17
View File
@@ -1,17 +0,0 @@
{ config, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
services.hyprpaper = {
enable = true;
settings.ipc = true;
};
systemd.user.services.hyprpaper = {
Unit.After = lib.mkForce "graphical-session.target";
Service.Slice = "session.slice";
};
};
}
-291
View File
@@ -1,291 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.wayland.windowManager.hyprland;
in
{
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.settings =
let
exe = lib.getExe;
terminalCommand = "alacritty";
resizeAmount = toString 10;
in
{
mod._var = "SUPER";
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
bind =
let
lua = lib.generators.mkLuaInline;
mod = key: args: {
_args = [
(lua "mod .. \" + ${key}\"")
]
++ args;
};
in
[
# Layout actions
(mod "U" [
(lua "hl.dsp.layout(\"togglesplit\")")
])
(mod "Y" [
(lua "hl.dsp.window.float({ action = \"toggle\" })")
])
(mod "T" [
(lua "hl.dsp.window.fullscreen({ action = \"toggle\", mode = \"maximized\" })")
])
(mod "C" [
(lua "hl.dsp.exec_cmd(\"hyprctl reload\")")
])
# Left click drag
(mod "mouse:272" [
(lua "hl.dsp.window.drag()")
(lua "{ mouse = true }")
])
# Right click drag
(mod "mouse:273" [
(lua "hl.dsp.window.resize()")
(lua "{ mouse = true }")
])
# Scroll through workspaces on this monitor
(mod "mouse_up" [
(lua "hl.dsp.focus({ workspace = \"r+1\" })")
])
(mod "mouse_down" [
(lua "hl.dsp.focus({ workspace = \"r-1\" })")
])
# Window actions
(mod "W" [
(lua "hl.dsp.window.close()")
])
(mod "SHIFT + W" [
(lua "hl.dsp.window.kill()")
])
# Application launches
(mod "RETURN" [
(lua "hl.dsp.exec_cmd(\"${terminalCommand}\")")
])
(mod "SPACE" [
(lua "hl.dsp.exec_cmd(\"rofi -show drun\")")
])
(mod "A" [
(lua "hl.dsp.exec_cmd(\"${exe pkgs.pavucontrol}\")")
])
(mod "B" [
(lua "hl.dsp.exec_cmd(\"rofi-rbw\")")
])
(mod "N" [
(lua "hl.dsp.exec_cmd(\"swaync-client -t -sw\")")
])
(mod "P" [
(lua "hl.dsp.exec_cmd(\"${terminalCommand} -e python3\")")
])
(mod "V" [
(lua "hl.dsp.exec_cmd(\"rofi -modi clipboard:${pkgs.cliphist}/bin/cliphist-rofi-img -show clipboard\")")
])
# Focus workspace
(mod "1" [ (lua "hl.dsp.focus({ workspace = 1 })") ])
(mod "2" [ (lua "hl.dsp.focus({ workspace = 2 })") ])
(mod "3" [ (lua "hl.dsp.focus({ workspace = 3 })") ])
(mod "4" [ (lua "hl.dsp.focus({ workspace = 4 })") ])
(mod "5" [ (lua "hl.dsp.focus({ workspace = 5 })") ])
(mod "6" [ (lua "hl.dsp.focus({ workspace = 6 })") ])
(mod "7" [ (lua "hl.dsp.focus({ workspace = 7 })") ])
(mod "8" [ (lua "hl.dsp.focus({ workspace = 8 })") ])
(mod "9" [ (lua "hl.dsp.focus({ workspace = 9 })") ])
# Move window to workspace
(mod "SHIFT + 1" [ (lua "hl.dsp.window.move({ workspace = 1 })") ])
(mod "SHIFT + 2" [ (lua "hl.dsp.window.move({ workspace = 2 })") ])
(mod "SHIFT + 3" [ (lua "hl.dsp.window.move({ workspace = 3 })") ])
(mod "SHIFT + 4" [ (lua "hl.dsp.window.move({ workspace = 4 })") ])
(mod "SHIFT + 5" [ (lua "hl.dsp.window.move({ workspace = 5 })") ])
(mod "SHIFT + 6" [ (lua "hl.dsp.window.move({ workspace = 6 })") ])
(mod "SHIFT + 7" [ (lua "hl.dsp.window.move({ workspace = 7 })") ])
(mod "SHIFT + 8" [ (lua "hl.dsp.window.move({ workspace = 8 })") ])
(mod "SHIFT + 9" [ (lua "hl.dsp.window.move({ workspace = 9 })") ])
# Focus window
(mod "LEFT" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
(mod "RIGHT" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
(mod "UP" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
(mod "DOWN" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
(mod "H" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
(mod "L" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
(mod "K" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
(mod "J" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
# Move window
(mod "SHIFT + LEFT" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
(mod "SHIFT + RIGHT" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
(mod "SHIFT + UP" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
(mod "SHIFT + DOWN" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
(mod "SHIFT + H" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
(mod "SHIFT + L" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
(mod "SHIFT + K" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
(mod "SHIFT + J" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
# Resize window
(mod "CONTROL + LEFT" [
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + RIGHT" [
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + UP" [
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + DOWN" [
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + H" [
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + L" [
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + K" [
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
(lua "{ repeating = true }")
])
(mod "CONTROL + J" [
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
(lua "{ repeating = true }")
])
# TODO - replace with hyprlock?
(mod "F1" [ (lua "hl.dsp.exec_cmd(\"${pkgs.systemd}/bin/loginctl lock-session\")") ])
# Screenshots
{
_args = [
(lua "\"PRINT\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m output --clipboard-only\")")
];
}
{
_args = [
(lua "\"CTRL + PRINT\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m region --clipboard-only\")")
];
}
{
_args = [
(lua "\"CTRL + SHIFT + PRINT\"")
(lua "hl.dsp.exec_cmd(\"HYPRSHOT_DIR=/home/felixalb/Pictures/screenshots ${exe pkgs.hyprshot} -m region \")")
];
}
# Media controls
{
_args = [
(lua "\"XF86AudioPlay\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
(lua "{ locked = true }")
];
}
{
_args = [
(lua "\"XF86AudioPause\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
(lua "{ locked = true }")
];
}
{
_args = [
(lua "\"XF86AudioPrev\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} previous\")")
(lua "{ locked = true }")
];
}
{
_args = [
(lua "\"XF86AudioNext\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} next\")")
(lua "{ locked = true }")
];
}
{
_args = [
(lua "\"XF86AudioMute\"")
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\")")
(lua "{ locked = true, repeating = true }")
];
}
{
_args = [
(lua "\"XF86AudioMicMute\"")
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle\")")
(lua "{ locked = true, repeating = true }")
];
}
{
_args = [
(lua "\"XF86AudioLowerVolume\"")
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-\")")
(lua "{ locked = true, repeating = true }")
];
}
{
_args = [
(lua "\"XF86AudioRaiseVolume\"")
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+\")")
(lua "{ locked = true, repeating = true }")
];
}
# Laptop controls
{
_args = [
(lua "\"XF86MonBrightnessUp\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%+\")")
(lua "{ locked = true, repeating = true }")
];
}
{
_args = [
(lua "\"XF86MonBrightnessDown\"")
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%-\")")
(lua "{ locked = true, repeating = true }")
];
}
];
};
};
}
+6 -40
View File
@@ -21,22 +21,20 @@ in {
telescope-nvim telescope-nvim
nvim-lspconfig nvim-lspconfig
copilot-vim
nvim-treesitter nvim-treesitter
coc-css coc-css
coc-go
coc-html coc-html
coc-json coc-json
coc-nvim coc-nvim
coc-pyright
vim-nix vim-nix
vim-puppet
go-nvim
]; ];
withNodeJs = true; withNodeJs = true;
withPython3 = true;
withRuby = false;
extraConfig = '' extraConfig = ''
let mapleader = ',' let mapleader = ','
@@ -53,7 +51,7 @@ in {
" Integrate status with lightline " Integrate status with lightline
let g:lightline = { let g:lightline = {
\ 'active': { \ 'active': {
\ 'left': [[ 'mode', 'paste', 'filename', 'readonly', 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]] \ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
\ } \ }
\ } \ }
@@ -100,16 +98,11 @@ in {
" Nerdtree-settings " Nerdtree-settings
" Toggle nerdtree on Ctrl+t " Toggle nerdtree on Ctrl+t
nmap <silent> <C-t> :NERDTreeToggle<CR> nmap <silent> <C-t> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p " Unselect nerdtree window
" Close vim is Nerdtree is the only buffer left " Close vim is Nerdtree is the only buffer left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if empty($AERC_ACCOUNT) && empty($MOZ_APP_LAUNCHER)
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p " Unselect nerdtree window
endif
autocmd Filetype go setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
" List and switch buffers on Ctrl+k " List and switch buffers on Ctrl+k
" nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space> " nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
nnoremap <silent> <C-k> !echo "Did you mean C-a?"<CR> nnoremap <silent> <C-k> !echo "Did you mean C-a?"<CR>
@@ -123,39 +116,12 @@ in {
nnoremap <C-s> <cmd>Telescope find_files<cr> nnoremap <C-s> <cmd>Telescope find_files<cr>
nnoremap <C-g> <cmd>Telescope live_grep<cr> nnoremap <C-g> <cmd>Telescope live_grep<cr>
" Don't darken the background
autocmd VimEnter * highlight normal ctermbg=NONE guibg=NONE
" Show trailing whitespace " Show trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/ match ExtraWhitespace /\s\+$/
" Show non-ascii characters (except norwegian æøå)
highlight nonascii ctermbg=214 guibg=#FFA500 " orange
function! HighlightNonAscii()
" delete the old match if it exists
let s:matchid = get(s:, 'matchid', -1)
if s:matchid != -1
try
call matchdelete(s:matchid)
catch /E803/
" matchid does not exist, pass
endtry
endif
" Skip popups like telescope
if &buftype ==# ""
let s:matchid = matchadd('nonascii', '[^\x00-\x7FæøåÆØÅ]', 100)
else
let s:matchid = -1
endif
endfunction
autocmd BufEnter * call HighlightNonAscii()
" Disable search highlights " Disable search highlights
map <Leader><Space> :noh<CR> map <Leader><Space> :noh<CR>
" Start with Coc disabled
" autocmd VimEnter * CocDisable
''; '';
}; };
-264
View File
@@ -1,264 +0,0 @@
{ config, lib, ... }:
let
cfg = config.programs.waybar;
cfgs = cfg.settings.mainBar;
in
{
programs.waybar = {
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 26;
modules-left = [ "hyprland/workspaces" ];
modules-center = [ "hyprland/window" ];
modules-right = [
"tray"
"network"
"pulseaudio"
"battery"
"clock#date"
"clock"
];
"hyprland/workspaces" = {
persistent-workspaces = {
"*" = 8;
};
};
"hyprland/window" = {
"format" = "{initialTitle}";
};
tray = {
spacing = 10;
};
clock = {
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = " {:%H:%M:%S}";
"format-alt" = " {:%Y-%m-%d}";
interval = 1;
};
"clock#date" = {
format = " {:%d.%m.%Y}";
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
"battery" = {
"states" = {
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-charging" = " {capacity}%";
"format-plugged" = " {capacity}%";
"format-icons" = [
""
""
""
""
""
];
"on-click" = "ags -t quicksettings";
};
"pulseaudio" = {
"format" = "{icon} {volume}% {format_source}";
"format-bluetooth" = " {icon} {volume}% {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
"format-source" = "";
"format-source-muted" = "";
"format-icons" = {
"default" = [
""
""
""
];
};
"on-click" = "pavucontrol";
};
"network" = {
"format-wifi" = " {essid}";
"format-ethernet" = "{bandwidthDownBytes} {bandwidthUpBytes}";
"interval" = 3;
"format-linked" = "{ifname} (No IP) ";
"format" = "";
"format-disconnected" = "";
"on-click" = "alacritty -e nmtui";
"tooltip-format" = " {bandwidthUpBits} {bandwidthDownBits}\n{ifname}\n{ipaddr}/{cidr}\n";
"tooltip-format-wifi" =
" {essid} {frequency}MHz\nStrength: {signaldBm}dBm ({signalStrength}%)\nIP: {ipaddr}/{cidr}\n {bandwidthUpBits} {bandwidthDownBits}";
"min-length" = 10;
"max-length" = 17;
};
};
};
style =
let
c = config.colors.defaultColorSet;
in
''
/*
*
* Catppuccin Mocha palette
* Maintainer: rubyowo
*
*/
@define-color background #1e1e2e;
@define-color foreground #cdd6f4;
@define-color mantle #181825;
@define-color crust #11111b;
@define-color subtext0 #a6adc8;
@define-color subtext1 #bac2de;
@define-color surface0 #313244;
@define-color surface1 #45475a;
@define-color surface2 #585b70;
@define-color overlay0 #6c7086;
@define-color overlay1 #7f849c;
@define-color overlay2 #9399b2;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color sapphire #74c7ec;
@define-color sky #89dceb;
@define-color teal #94e2d5;
@define-color green #a6e3a1;
@define-color yellow #f9e2af;
@define-color peach #fab387;
@define-color maroon #eba0ac;
@define-color red #f38ba8;
@define-color mauve #cba6f7;
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;
* {
font-family: "Hack Nerd Font";
font-size: 14px;
min-height: 0;
font-weight: normal;
}
window#waybar {
background: transparent;
background-color: @background;
color: @foreground;
transition-property: background-color;
transition-duration: 0.1s;
}
#window {
margin: 2;
padding-left: 8;
padding-right: 8;
}
button {
box-shadow: inset 0 -3px transparent;
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
border-top: 2px solid @hover;
}
#workspaces button {
padding: 0 4px;
color: gray;
font-weight: 300;
}
#workspaces button.empty {
color: #404040;
font-weight: 100;
}
#workspaces button.active {
background-color: rgba(0, 0, 0, 0.3);
color: white;
border-top: 2px solid @blue;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#pulseaudio,
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#wireplumber,
#tray,
#mode,
#scratchpad {
margin-left: 4px;
margin-right: 4px;
padding-left: 4px;
padding-right: 4px;
}
#clock {
color: @maroon;
border-bottom: 2px solid @maroon;
}
#clock.date {
color: @mauve;
border-bottom: 2px solid @mauve;
}
#pulseaudio {
color: @blue;
border-bottom: 2px solid @blue;
}
#network {
color: @yellow;
border-bottom: 2px solid @yellow;
}
#idle_inhibitor {
margin-right: 12px;
color: #7cb342;
}
#idle_inhibitor.activated {
color: @red;
}
#battery.charging,
#battery.plugged {
color: @green;
border-bottom: 2px solid @green;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left>widget:first-child>#workspaces {
margin-left: 0;
}
'';
};
systemd.user.services.waybar = lib.mkIf (cfg.enable && cfg.systemd.enable) {
Service.Environment = [
"DISPLAY=:0"
];
};
}
+12 -20
View File
@@ -2,7 +2,6 @@
programs = { programs = {
zsh = { zsh = {
enable = true; enable = true;
history.extended = true;
prezto = { prezto = {
enable = true; enable = true;
@@ -22,7 +21,6 @@
"terminal" "terminal"
"editor" "editor"
"history" "history"
"history-substring-search"
# "directory" # "directory"
"spectrum" "spectrum"
# "utility" # "utility"
@@ -30,39 +28,33 @@
"git" "git"
"autosuggestions" "autosuggestions"
"syntax-highlighting" "syntax-highlighting"
"history-substring-search"
"prompt" "prompt"
]; ];
}; };
initContent = '' initExtra = ''
# Autocomplete ../ # Autocomplete ../
zstyle ':completion:*' special-dirs true zstyle ':completion:*' special-dirs true
export PATH="$HOME/.config/emacs/bin:$HOME/.cargo/bin:$PATH" export PATH="$HOME/.config/emacs/bin:$PATH"
unalias "gs" unalias "gs"
if [ -f ~/.config/zsh-extras ]; then
source ~/.config/zsh-extras
fi
''; '';
shellAliases = { shellAliases = {
c = "z";
em = "emacsclient -c";
emnw = "emacsclient -nw";
grep = "grep --color=auto";
l = "exa -l"; l = "exa -l";
ls = "ls --color=auto"; c = "z";
nd = "nix develop --command zsh"; tree = "exa --tree --icons";
s = "nix-shell --run zsh"; s = "nix-shell --run zsh";
sp = "nix-shell --run zsh -p"; sp = "nix-shell --run zsh -p";
spu = "nix-shell -I nixpkgs=channel:nixos-unstable --run zsh -p"; spu = "nix-shell -I nixpkgs=channel:nixos-unstable --run zsh -p";
tree = "exa --tree --icons"; nd = "nix develop --command zsh";
em = "emacsclient -c";
"git clone git clone" = "git clone"; emnw = "emacsclient -nw";
gcm = "git commit -m";
gpl = "git pull";
gps = "git push";
gst = "git status -sb"; gst = "git status -sb";
gcm = "git commit -m";
gps = "git push";
gpl = "git pull";
"git clone git clone" = "git clone";
}; };
}; };
+39
View File
@@ -0,0 +1,39 @@
{ config, pkgs, lib, ... }:
{
imports =
[
../../base.nix
../../common/metrics-exporters.nix
./hardware-configuration.nix
# Infrastructure
./services/wireguard.nix
# Other
./services/thelounge.nix
./services/nginx.nix
];
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
networking = {
hostName = "burnham";
defaultGateway = "192.168.11.1";
interfaces.ens18.ipv4 = {
addresses = [
{ address = "192.168.11.109"; prefixLength = 24; }
];
};
hostId = "8e24f235";
};
# sops.defaultSopsFile = ../../secrets/burnham/burnham.yaml;
environment.variables = { EDITOR = "vim"; };
system.stateVersion = "23.11";
}
@@ -1,6 +1,3 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
@@ -14,27 +11,20 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/93307186-cbc3-4748-859f-0013a1e36def"; { device = "/dev/disk/by-uuid/31ff6d37-52d6-43c3-a214-5d38a6c38b0e";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = swapDevices =
{ device = "/dev/disk/by-uuid/FFCD-993A"; [ { device = "/dev/disk/by-uuid/cce59ee7-7c83-4165-a9b0-f950cd2e3273"; }
fsType = "vfat"; ];
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ {
device = "/swapfile";
size = 4*1024;
} ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
# networking.useDHCP = lib.mkDefault true; #networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true; # networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
@@ -8,5 +8,5 @@
zsh.shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config"; zsh.shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config";
}; };
home.stateVersion = "24.05"; home.stateVersion = "23.05";
} }
+56
View File
@@ -0,0 +1,56 @@
{ config, pkgs, lib, ... }:
let
cfg = config.networking.wireguard.interfaces."wg0";
in {
networking = {
nat = {
enable = true;
externalInterface = "ens18";
internalInterfaces = [ "wg0" ];
};
firewall.allowedUDPPorts = [ cfg.listenPort ];
wireguard.interfaces."wg0" = {
ips = [ "10.100.0.2/24" ];
listenPort = 51820;
privateKeyFile = "/etc/wireguard/burnham.private";
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -d 192.168.11.0/24 -o eth0 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -d 192.168.11.0/24 -o eth0 -j MASQUERADE
'';
peers = [
{ # Defiant
publicKey = "8/711GhmN9+NcduHF4JPkfoZPE0qsDLuwhABcPyjNxI=";
persistentKeepalive = 120;
allowedIPs = [
"10.100.0.1/32"
"192.168.10.0/24"
];
endpoint = "site3.feal.no:51902";
}
{ # Worf
publicKey = "kW8SyzCh2tw8GzZV6bPn+IQVNUoUhseNfEm3rHnR1So=";
allowedIPs = [
"10.100.0.4/32"
];
}
{ # Phone
publicKey = "axFXtcTYtW6m1FT9Czn9DRvG+b05D7j+0yRMjn/FJEk=";
allowedIPs = [
"10.100.0.5/32"
];
}
{ # Riker
publicKey = "r715vpgH1H0zvN+Z5wcNKcOo5e6UM3fBfh9BZwTBjmA=";
allowedIPs = [
"10.100.0.6/32"
];
}
];
};
};
}
-37
View File
@@ -1,37 +0,0 @@
{ config, pkgs, lib, ... }:
let
cmdChownManga = pkgs.writeScriptBin "chownManga" ''
#!${pkgs.stdenv.shell}
chown -R amalieem:komga /tank/media/komga/Amalie
chmod -R 750 /tank/media/komga/Amalie
'';
in {
users.users."amalieem" = {
isNormalUser = true;
home = "/home/amalieem";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID7e+BAoXIFmTeeBYAVImQAcyx6SCoYCErA7h16OGL70 amalieem@wentworth"
];
packages = with pkgs; [
cmdChownManga
mangal
rsync
];
};
security.sudo = {
enable = true;
extraRules = [{
commands = [
{
command = "${lib.getExe cmdChownManga}";
options = [ "NOPASSWD" ];
}
];
users = [ "amalieem" ];
}];
};
}
-80
View File
@@ -1,80 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.restic.backups = let
localJob = name: paths: {
inherit paths;
repository = "/mnt/feal-syn1/backup/challenger/${name}";
passwordFile = config.sops.secrets."restic/${name}".path;
initialize = true;
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 3"
"--keep-yearly 10"
];
};
cloudJob = name: paths: {
inherit paths;
# "rsyncnet" connection details specified in /root/.ssh/config
repository = "sftp://rsyncnet/restic/challenger/${name}";
passwordFile = config.sops.secrets."restic/${name}".path;
initialize = true;
pruneOpts = [
# rsync.net keeps daily snapshots
"--keep-weekly 4"
"--keep-monthly 36"
];
};
in {
# Calibre metadata and config
calibre = localJob "calibre" [
"/var/lib/calibre-web"
"/var/lib/calibre-server"
];
# Other system backups (NB: Large!)
hostBackups = localJob "hostBackups" [
"/tank/backup"
] // {
pruneOpts = [ "--keep-monthly 12" ];
};
media = localJob "media" [
"/tank/media/books"
"/tank/media/komga"
"/tank/media/music"
];
media-remote = cloudJob "media" [
"/tank/media/books"
"/tank/media/komga"
"/tank/media/music"
] // {
pruneOpts = [ "--keep-monthly 12" ];
};
# Nextcloud config and data
nextcloud = localJob "nextcloud" [ "/tank/nextcloud" ];
nextcloud-remote = cloudJob "nextcloud" [ "/tank/nextcloud" ];
# Postgresql databases
postgres = (localJob "postgres" [ "/var/backup/postgres" ]) // {
timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup
};
postgres-remote = (cloudJob "postgres" [ "/var/backup/postgres" ]) // {
timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup
};
# TODO: timemachine
};
sops.secrets."restic/calibre" = { };
sops.secrets."restic/hostBackups" = { };
sops.secrets."restic/media" = { };
sops.secrets."restic/nextcloud" = { };
sops.secrets."restic/postgres" = { };
environment.systemPackages = with pkgs; [
restic
];
}
-76
View File
@@ -1,76 +0,0 @@
{ config, pkgs, lib, ... }:
{
imports =
[
./hardware-configuration.nix
../../base.nix
../../common/metrics-exporters.nix
./amalieem.nix
./backup.nix
# ./exports.nix
./filesystems.nix
# ./services/archivebox.nix
./services/audiobookshelf.nix
./services/calibre.nix
./services/frigate.nix
./services/jellyfin.nix
./services/komga.nix
./services/nextcloud.nix
./services/nginx.nix
./services/postgres.nix
./services/timemachine.nix
];
networking = {
hostName = "challenger";
bridges.br0.interfaces = [ "ens18" ];
interfaces.br0.useDHCP = false;
interfaces.br0.ipv4.addresses = [
{ address = "192.168.10.161"; prefixLength = 24; }
];
hostId = "828ab735";
defaultGateway = "192.168.10.1";
};
sops.defaultSopsFile = ../../secrets/challenger/challenger.yaml;
environment.variables = { EDITOR = "vim"; };
environment.systemPackages = with pkgs; [
zfs
];
virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker";
security.polkit.enable = true; # Required for nextcloud
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"nvidia-kernel-modules"
"nvidia-settings"
"nvidia-x11"
];
hardware.nvidia = {
modesetting.enable = true;
open = false;
# https://github.com/sircam-html/nixos-conf/blob/main/guides/nvidia-nixos-guide.md
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "580.142";
sha256_64bit = "sha256-IJFfzz/+icNVDPk7YKBKKFRTFQ2S4kaOGRGkNiBEdWM=";
sha256_aarch64 = "sha256-0000000000000000000000000000000000000000000=";
openSha256 = "sha256-0000000000000000000000000000000000000000000=";
settingsSha256 = "sha256-BnrIlj5AvXTfqg/qcBt2OS9bTDDZd3uhf5jqOtTMTQM=";
persistencedSha256 = "sha256-0000000000000000000000000000000000000000000=";
};
};
hardware.graphics.enable = true;
services.xserver.videoDrivers = ["nvidia"];
system.stateVersion = "24.05";
}
-22
View File
@@ -1,22 +0,0 @@
{ config, pkgs, lib, ... }:
{
fileSystems = {
"/export/riker-backup" = {
device = "/tank/backup/riker";
options = [ "bind" ];
fsType = "none";
};
};
# Enable nfs4 only
# services.nfs.server = {
# enable = true;
# exports = ''
# /export 192.168.10.67(rw,fsid=0,no_subtree_check)
# /export/riker-backup 192.168.10.67(rw,nohide,no_subtree_check,no_root_squash)
# '';
# };
# networking.firewall.allowedTCPPorts = [ 111 2049 20048 ];
# networking.firewall.allowedUDPPorts = [ 111 20048];
}
-49
View File
@@ -1,49 +0,0 @@
{ config, pkgs, lib, ... }:
{
# Boot drives are defined in ./hardware-configuration.nix
environment.systemPackages = with pkgs; [ cifs-utils ];
# Local zfs
boot = {
zfs = {
extraPools = [ "tank" ];
requestEncryptionCredentials = false;
forceImportRoot = false;
};
supportedFilesystems = [ "zfs" ];
};
services.zfs.autoScrub = {
enable = true;
interval = "Wed *-*-8..14 00:00:00";
};
fileSystems = {
"/mnt/feal-syn1/backup" = {
# device = "feal-syn1.home.feal.no:/volume2/backup";
device = "192.168.10.162:/volume2/backup";
fsType = "nfs";
options = [
"defaults"
"noatime"
"rw"
"nfsvers=3"
"x-systemd.automount"
"noauto"
];
};
"/mnt/feal-syn2/backup" = {
# device = "feal-syn1.home.feal.no:/volume2/backup";
device = "192.168.11.163:/volume1/challenger";
fsType = "nfs";
options = [
"defaults"
"noatime"
"rw"
"nfsvers=3"
"x-systemd.automount"
"noauto"
];
};
};
}
-35
View File
@@ -1,35 +0,0 @@
{ config, lib, ... }:
let
host = "127.0.1.2";
port = "5009";
uid = 911;
gid = 911;
in {
users.users.archivebox = {
inherit uid;
group = "archivebox";
isSystemUser = true;
useDefaultShell = true;
description = "ArchiveBox web archiving tool";
};
users.groups.archivebox = {
inherit gid;
};
# ArchiveBox - Open source self-hosted web archiving.
virtualisation.oci-containers.containers.archivebox = {
image = "archivebox/archivebox:0.8.5rc50";
ports = [ "${host}:${port}:8000" ];
volumes = [
"/tank/archivebox:/data"
];
};
services.nginx.virtualHosts."archivebox.home.feal.no" = {
locations."/" = {
proxyPass = "http://${host}:${port}";
};
};
}
@@ -1,60 +0,0 @@
{ config, lib, pkgs, ... }:
let
domain = "audiobooks.home.feal.no";
host = "127.0.1.2";
port = 5016;
in {
fileSystems = {
"/var/lib/audiobookshelf" = {
device = "/tank/media/audiobookshelf/config";
depends = [ "/tank/media/audiobookshelf" ];
fsType = "none";
options = [ "bind" ];
};
};
services.audiobookshelf = {
enable = true;
dataDir = "audiobookshelf";
inherit host port;
};
systemd.services.audiobookshelf = {
requires = [ "var-lib-audiobookshelf.mount" ];
serviceConfig = {
# Better safe than sorry :)
CapabilityBoundingSet = "";
LockPersonality = true;
NoNewPrivileges = true;
PrivateDevices = true;
PrivateMounts = true;
PrivateTmp = true;
PrivateUsers = true;
ProtectClock = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProtectSystem = "strict";
ReadWritePaths = [
"/var/lib/audiobookshelf"
"/tank/media/audiobookshelf"
];
RemoveIPC = true;
RestrictSUIDSGID = true;
UMask = "0007";
RestrictAddressFamilies = [ "AF_UNIX AF_INET AF_INET6" ];
SystemCallArchitectures = "native";
};
};
services.nginx.virtualHosts.${domain} = {
locations."/" = {
proxyPass = "http://${host}:${toString port}";
proxyWebsockets = true;
};
};
}
-50
View File
@@ -1,50 +0,0 @@
{ config, lib, pkgs, ... }:
{
fileSystems = {
"/var/lib/frigate" = {
device = "/tank/nvr/frigate";
depends = [ "/tank/nvr/frigate" ];
options = [ "bind" ];
fsType = "none";
};
};
services.frigate = {
enable = true;
hostname = "frigate.home.feal.no";
vaapiDriver = "nvidia";
checkConfig = false;
settings = {
# auth.reset_admin_password = true;
motion.enabled = true;
record.enabled = true;
# snapshots.enabled = true;
# detect = {
# enabled = true;
# fps = 5;
# };
cameras = {
driveway = {
ffmpeg.inputs = [
{
path = "rtsp://admin:placeholder@192.168.10.40/streaming/channels/101";
roles = [
"detect"
"record"
];
}
];
};
};
};
};
systemd.services.frigate.serviceConfig = {
# Allow GPU use
PrivateDevices = false;
# Allow cpuinfo
ProcSubset = "all";
};
}
-154
View File
@@ -1,154 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.nextcloud;
hostName = "cloud.feal.no";
in {
services.nextcloud = {
enable = true;
package = pkgs.nextcloud33;
inherit hostName;
home = "/tank/nextcloud";
https = true;
webfinger = true;
config = {
dbtype = "pgsql";
dbuser = "nextcloud";
dbhost = "/run/postgresql";
dbname = "nextcloud";
adminuser = "ncadmin";
adminpassFile = config.sops.secrets."nextcloud/adminpass".path;
};
settings = {
default_phone_region = "NO";
log_type = "file";
overwriteprotocol = "https";
trusted_proxies = [ "192.168.10.175" ]; # defiant
# Docs: https://github.com/pulsejet/nextcloud-oidc-login
oidc_login_auto_redirect = true;
oidc_login_button_text = "Log in with KeyCloak";
oidc_login_client_id = "nextcloud";
oidc_login_client_secret = "dont_put_secrets_here_use_secretFile";
oidc_login_code_challenge_method = "S256";
oidc_login_end_session_redirect' = true;
oidc_login_logout_url = "https://cloud.feal.no/apps/oidc_login/oidc";
oidc_login_provider_url = "https://iam.feal.no/realms/feal.no";
oidc_login_redir_fallback = true;
oidc_login_attributes = {
id = "preferred_username";
mail = "email";
name = "name";
login_filter = "nextcloud-roles";
};
oidc_login_filter_allowed_values = [ "nextcloud-user" ];
oidc_login_disable_registration = false;
"memories.exiftool" = pkgs.writeShellScript "exiftool-perl" ''
${lib.getExe pkgs.perl} ${cfg.home}/store-apps/memories/bin-ext/exiftool/exiftool "$@"
'';
"memories.exiftool_no_local" = false;
"memories.vod.disable" = false;
"memories.vod.ffmpeg" = "${lib.getExe pkgs.ffmpeg-headless}";
"memories.vod.ffprobe" = "${pkgs.ffmpeg-headless}/bin/ffprobe";
preview_ffmpeg_path = "${pkgs.ffmpeg-headless}/bin/ffmpeg";
};
secretFile = config.sops.secrets."nextcloud/secretsjson".path;
phpOptions = {
"opcache.interned_strings_buffer" = "16";
"upload_max_filesize" = lib.mkForce "8G";
"post_max_size" = lib.mkForce "8G";
"memory_limit" = lib.mkForce "8G";
};
poolSettings = {
"pm" = "ondemand";
"pm.max_children" = 32;
"pm.process_idle_timeout" = "10s";
"pm.max_requests" = 500;
};
};
environment.systemPackages = [
cfg.occ # "occ CMD" in the docs -> "sudo -u nextcloud nextcloud-occ CMD"
pkgs.nodejs # For Recognize; Put /run/current-system/sw/bin/node in the "node_binary" field in the web UI -> Memories
];
sops.secrets."nextcloud/adminpass" = {
mode = "0440";
owner = "nextcloud";
group = "nextcloud";
restartUnits = [ "phpfpm-nextcloud.service" ];
};
sops.secrets."nextcloud/secretsjson" = {
mode = "0440";
owner = "nextcloud";
group = "nextcloud";
restartUnits = [ "phpfpm-nextcloud.service" ];
};
services.postgresql = {
ensureDatabases = [ "nextcloud" ];
ensureUsers = [ {
name = "nextcloud";
ensureDBOwnership = true;
} ];
};
systemd.services.nextcloud-cron = {
path = with pkgs; [
exiftool
ffmpeg-headless
];
};
systemd.services."nextcloud-setup" = {
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
};
systemd.services."phpfpm-nextcloud" = {
requires = [ "tank-nextcloud.mount" ];
path = with pkgs; [
# perl
# perlPackages.ImageExifTool
exiftool
ffmpeg-headless
];
serviceConfig = {
PrivateDevices = lib.mkForce false;
WorkingDirectory = "/tank/nextcloud";
NoNewPrivileges = true;
PrivateMounts = true;
PrivateTmp = true;
ProtectClock = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ReadWritePaths = [ "/tank/nextcloud" "/run/phpfpm" "/run/systemd" ];
ReadOnlyPaths = [ "/run/secrets" "/nix/store" ];
InaccessiblePaths = [ "/tank/media" "/tank/backup" ];
RemoveIPC = true;
RestrictSUIDSGID = true;
UMask = "0007";
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
CapabilityBoundingSet = "~CAP_FSETID ~CAP_SETFCAP ~CAP_SETUID ~CAP_SETGID ~CAP_SETPCAP ~CAP_NET_ADMIN ~CAP_SYS_ADMIN ~CAP_SYS_PTRACE ";
};
};
# Notes:
# - Install Memories and Recognize from the app store
# - They might need to be forced on with "nextcloud-occ app:enable memories", etc.
# - Run "nextcloud-occ maintenance:repair" to fix broken paths
# - Download ai models and maps with the commands given in the ui
# - libtensorflow doesn't work properly through node, but recognize still works(?)
}
+57 -45
View File
@@ -1,50 +1,62 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
services.restic.backups = let services.borgbackup.jobs =
localJob = name: paths: { let
inherit paths; borgJob = name: {
repository = "/mnt/feal-syn1/backup/defiant/${name}"; environment.BORG_RSH = "ssh -i /root/.ssh/fealsyn1";
passwordFile = config.sops.secrets."restic/${name}".path; environment.BORG_REMOTE_PATH = "/usr/local/bin/borg";
initialize = true; repo = "ssh://backup@feal-syn1.home.feal.no/volume2/backup/borg/defiant/${name}";
pruneOpts = [ compression = "auto,zstd";
"--keep-daily 3" };
"--keep-weekly 4" in {
"--keep-monthly 3" postgresDaily = borgJob "postgres::daily" // {
]; paths = "/data/backup/postgresql";
}; startAt = "*-*-* 05:15:00"; # 2 hours after postgresqlBackup
cloudJob = name: paths: { extraInitArgs = "--storage-quota 10G";
inherit paths; encryption = {
# "rsyncnet" connection details specified in /root/.ssh/config mode = "repokey-blake2";
repository = "sftp://rsyncnet/restic/defiant/${name}"; passCommand = "cat ${config.sops.secrets."borg/postgres".path}";
passwordFile = config.sops.secrets."restic/${name}".path; };
initialize = true; };
pruneOpts = [
# rsync.net keeps daily snapshots postgresWeekly = borgJob "postgres::weekly" // {
"--keep-weekly 4" paths = "/data/backup/postgresql";
"--keep-monthly 36" startAt = "Mon *-*-* 05:15:00"; # 2 hours after postgresqlBackup
]; extraInitArgs = "--storage-quota 10G";
}; encryption = {
in { mode = "repokey-blake2";
postgres = (localJob "postgres" [ "/tank/backup/postgresql" ]) // { passCommand = "cat ${config.sops.secrets."borg/postgres".path}";
timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup };
}; };
postgres-remote = (cloudJob "postgres" [ "/tank/backup/postgresql" ]) // {
timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup gitea = borgJob "gitea::weekly" // {
paths = "/tank/services/gitea";
startAt = "Mon *-*-* 05:15:00";
extraInitArgs = "--storage-quota 20G";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg/gitea".path}";
};
};
minecraft = borgJob "minecraft::weekly" // {
paths = "/var/lib/minecraft-wack";
startAt = "weekly";
extraInitArgs = "--storage-quota 20G";
encryption.mode = "none";
preHook = ''
${pkgs.mcrcon}/bin/mcrcon -p wack "say Starting Backup" "save-off" "save-all"
'';
postHook = ''
${pkgs.mcrcon}/bin/mcrcon -p wack "save-all" "say Completed Backup" "save-on" "save-all"
'';
};
}; };
gitea = (localJob "gitea" [ "/tank/services/gitea" ]); # TODO: Matrix (keys,media,db), home-assistant, pihole, vaultwarden
gitea-remote = (cloudJob "gitea" [ "/tank/services/gitea" ]); sops.secrets."borg/postgres" = { };
sops.secrets."borg/gitea" = { };
matrix-synapse = (localJob "matrix-synapse" [ "/var/lib/matrix-synapse" ]);
matrix-synapse-remote = (cloudJob "matrix-synapse" [ "/var/lib/matrix-synapse" ]);
vaultwarden = (localJob "vaultwarden" [ "/var/lib/bitwarden_rs" ]);
vaultwarden-remote = (cloudJob "vaultwarden" [ "/var/lib/bitwarden_rs" ]);
};
# TODO: home-assistant, pihole
sops.secrets."restic/postgres" = { };
sops.secrets."restic/gitea" = { };
sops.secrets."restic/matrix-synapse" = { };
sops.secrets."restic/vaultwarden" = { };
} }
+12 -5
View File
@@ -5,29 +5,26 @@
[ [
../../base.nix ../../base.nix
../../common/metrics-exporters.nix ../../common/metrics-exporters.nix
./filesystems.nix
./hardware-configuration.nix ./hardware-configuration.nix
# Infrastructure # Infrastructure
./backup.nix ./backup.nix
./libvirt.nix ./libvirt.nix
./services/dyndns.nix
./services/nginx.nix ./services/nginx.nix
./services/pihole.nix ./services/pihole.nix
./services/postgresql.nix ./services/postgresql.nix
./services/wireguard.nix ./services/wireguard.nix
# Services # Services
./services/flame.nix
./services/gitea.nix ./services/gitea.nix
./services/hedgedoc.nix ./services/hedgedoc.nix
./services/home-assistant.nix ./services/home-assistant.nix
./services/keycloak.nix ./services/keycloak.nix
./services/matrix ./services/matrix
./services/microbin.nix ./services/microbin.nix
# ./services/minecraft/home.nix # ./services/minecraft.nix
./services/monitoring ./services/monitoring
# ./services/rtl-tcp.nix
# ./services/searx.nix
./services/vaultwarden.nix ./services/vaultwarden.nix
]; ];
@@ -45,6 +42,16 @@
sops.defaultSopsFile = ../../secrets/defiant/defiant.yaml; sops.defaultSopsFile = ../../secrets/defiant/defiant.yaml;
environment.variables = { EDITOR = "vim"; }; environment.variables = { EDITOR = "vim"; };
environment.systemPackages = with pkgs; [
zfs
];
boot = {
zfs.extraPools = [ "tank" ];
supportedFilesystems = [ "zfs" ];
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
};
services.prometheus.exporters.zfs.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker"; virtualisation.oci-containers.backend = "docker";
-34
View File
@@ -1,34 +0,0 @@
{ config, pkgs, lib, ... }:
{
# Boot drives are defined in ./hardware-configuration.nix
boot = {
zfs = {
extraPools = [ "tank" ];
forceImportRoot = false;
};
supportedFilesystems = [ "zfs" ];
};
services.prometheus.exporters.zfs.enable = true;
environment.systemPackages = with pkgs; [
cifs-utils
zfs
];
fileSystems = {
"/mnt/feal-syn1/backup" = {
device = "192.168.10.162:/volume2/backup";
fsType = "nfs";
options = [
"defaults"
"noatime"
"rw"
"nfsvers=3"
"x-systemd.automount"
"noauto"
];
};
};
}
-1
View File
@@ -11,7 +11,6 @@
fileSystems."/var/lib/libvirt/images" = { fileSystems."/var/lib/libvirt/images" = {
device = "/tank/iso"; device = "/tank/iso";
options = [ "bind" ]; options = [ "bind" ];
fsType = "none";
}; };
# On a gui-enabled machine, connect with: # On a gui-enabled machine, connect with:
-11
View File
@@ -1,11 +0,0 @@
{ config, pkgs, lib, ... }:
{
sops.secrets."domeneshop/netrc" = { };
services.domeneshop-dyndns = {
enable = true;
domain = "site2.feal.no";
netrcFile = config.sops.secrets."domeneshop/netrc".path;
};
}
+22
View File
@@ -0,0 +1,22 @@
{ config, pkgs, lib, ... }:
let
domain = "flame.home.feal.no";
host = "127.0.1.2";
port = "5005";
in {
# Flame - Homelab dashboard/linktree
virtualisation.oci-containers.containers = {
flame = {
image = "pawelmalak/flame";
ports = [ "${host}:${port}:5005" ];
volumes = [
"/var/lib/flame/data:/app/data/"
];
};
};
services.nginx.virtualHosts."${domain}" = {
locations."/".proxyPass = "http://${host}:${port}";
};
}
+13 -14
View File
@@ -4,7 +4,7 @@ let
domain = "md.feal.no"; domain = "md.feal.no";
port = 3300; port = 3300;
host = "127.0.1.2"; host = "127.0.1.2";
authServerUrl = "https://iam.feal.no"; authServerUrl = "https://auth.feal.no";
in { in {
# Contains CMD_SESSION_SECRET and CMD_OAUTH2_CLIENT_SECRET # Contains CMD_SESSION_SECRET and CMD_OAUTH2_CLIENT_SECRET
sops.secrets."hedgedoc/env" = { sops.secrets."hedgedoc/env" = {
@@ -21,8 +21,9 @@ in {
allowFreeURL = true; allowFreeURL = true;
allowAnonymous = false; allowAnonymous = false;
allowAnonymousEdits = true; allowAnonymousEdits = true; # Allow anonymous edits with the "freely" permission
# dbURL = "postgres://hedgedoc@localhost/hedgedoc";
db = { db = {
username = "hedgedoc"; username = "hedgedoc";
database = "hedgedoc"; database = "hedgedoc";
@@ -31,23 +32,20 @@ in {
}; };
email = false; email = false;
oauth2 = let oauth2 = {
oidc = "${authServerUrl}/realms/feal.no/protocol/openid-connect"; baseURL = "${authServerUrl}/oauth2";
in { tokenURL = "${authServerUrl}/oauth2/token";
providerName = "Keycloak"; authorizationURL = "${authServerUrl}/ui/oauth2";
authorizationURL = "${oidc}/auth"; userProfileURL = "${authServerUrl}/oauth2/openid/hedgedoc/userinfo";
baseURL = "${authServerUrl}";
tokenURL = "${oidc}/token";
userProfileURL = "${oidc}/userinfo";
clientID = "hedgedoc"; clientID = "hedgedoc";
clientSecret = "$CMD_OAUTH2_CLIENT_SECRET"; clientSecret = "$CMD_OAUTH2_CLIENT_SECRET";
scope = "openid email profile"; scope = "openid email profile";
userProfileDisplayNameAttr = "name"; userProfileUsernameAttr = "name";
userProfileEmailAttr = "email"; userProfileEmailAttr = "email";
userProfileUsernameAttr = "preferred_username"; userProfileDisplayNameAttr = "displayname";
rolesClaim = "hedgedoc-roles";
accessRole = "hedgedoc-user"; providerName = "KaniDM";
}; };
}; };
}; };
@@ -55,6 +53,7 @@ in {
systemd.services.hedgedoc = { systemd.services.hedgedoc = {
requires = [ requires = [
"postgresql.service" "postgresql.service"
# "kanidm.service"
]; ];
serviceConfig = let serviceConfig = let
workDir = "/var/lib/hedgedoc"; workDir = "/var/lib/hedgedoc";
+1 -2
View File
@@ -8,10 +8,9 @@ in {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
homeassistant = { homeassistant = {
image = "ghcr.io/home-assistant/home-assistant:2025.5.3"; image = "ghcr.io/home-assistant/home-assistant:2024.1";
extraOptions = [ extraOptions = [
"--network=host" "--network=host"
"--device=/dev/ttyUSB0" # Sonoff Zigbee 3.0 USB
]; ];
volumes = [ volumes = [
"/tank/services/homeassistant/config:/config" "/tank/services/homeassistant/config:/config"
+7 -7
View File
@@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.services.keycloak.settings; cfg = config.services.keycloak.settings;
hostname = "iam.feal.no";
in { in {
environment.noXlibs = false;
sops.secrets."keycloak/postgres" = { }; sops.secrets."keycloak/postgres" = { };
services.keycloak = { services.keycloak = {
@@ -17,17 +17,17 @@ in {
settings = { settings = {
cache = "local"; cache = "local";
hostname = "https://${hostname}"; hostname = "iam.feal.no";
hostname-backchannel-dynamic = false; hostname-strict-backchannel = true;
http-enabled = true; http-enable = true;
http-host = "127.0.1.2"; http-host = "127.0.1.2";
http-port = 5060; http-port = 5060;
proxy-headers = "xforwarded"; proxy = "edge";
}; };
}; };
# The main reverse proxy is defined in ./nginx.nix # The main reverse proxy is defined in ./nginx.nix
services.nginx.virtualHosts.${hostname} = { services.nginx.virtualHosts.${cfg.hostname} = {
locations."= /".return = "302 ${cfg.hostname}/realms/feal.no/account"; locations."= /".return = "302 https://${cfg.hostname}/realms/master/account";
}; };
} }
+2 -29
View File
@@ -6,12 +6,6 @@
group = "matrix-synapse"; group = "matrix-synapse";
}; };
sops.secrets."matrix/synapse/oidcsecret" = {
restartUnits = [ "matrix-synapse.service" ];
owner = "matrix-synapse";
group = "matrix-synapse";
};
services.matrix-synapse-next = { services.matrix-synapse-next = {
enable = true; enable = true;
enableNginx = true; enableNginx = true;
@@ -75,34 +69,13 @@
tls_certificate_path = "/etc/ssl-snakeoil/matrix_feal_no.crt"; tls_certificate_path = "/etc/ssl-snakeoil/matrix_feal_no.crt";
tls_private_key_path = "/etc/ssl-snakeoil/matrix_feal_no.key"; tls_private_key_path = "/etc/ssl-snakeoil/matrix_feal_no.key";
enableSlidingSync = true;
oidc_providers = [
{
idp_id = "keycloak";
idp_name = "Keycloak";
issuer = "https://iam.feal.no/realms/feal.no";
client_id = "matrix-synapse";
client_secret_path = config.sops.secrets."matrix/synapse/oidcsecret".path;
user_mapping_provider.config = {
localpart_template = "{{ user.preferred_username }}";
display_name_template = "{{ user.name }}";
};
attribute_requirements = [{
attribute = "matrix-roles";
value = "matrix-user";
}];
backchannel_logout_enabled = true;
enable_registration = false;
}
];
}; };
}; };
services.redis.servers."".enable = true;
services.postgresqlBackup.databases = [ "matrix-synapse" ]; services.postgresqlBackup.databases = [ "matrix-synapse" ];
services.redis.servers."".enable = true;
services.nginx.virtualHosts."matrix.feal.no" = { services.nginx.virtualHosts."matrix.feal.no" = {
listen = [ listen = [
{ addr = "192.168.10.175"; port = 43443; ssl = true; } { addr = "192.168.10.175"; port = 43443; ssl = true; }
-50
View File
@@ -1,50 +0,0 @@
{ config, pkgs, lib, inputs, ... }:
{
imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
services.minecraft-servers = {
enable = true;
eula = true;
openFirewall = true;
dataDir = "/var/lib/minecraft-server";
servers.home = {
enable = true;
jvmOpts = "-Xms4G -Xmx4G";
package = pkgs.fabricServers.fabric-1_21_4;
serverProperties = {
motd = "Home <3";
difficulty = "easy";
view-distance = 16;
simulation-distance = 16;
enable-command-block = true;
enable-rcon = true;
online-mode = false;
"rcon.password" = "wack";
};
symlinks = {
mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues {
FabricAPI = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/8FAH9fuR/fabric-api-0.114.2%2B1.21.4.jar";
sha256 = "sha256-nL1bcAaMW0tRCpfW0prd3mce14ZNcl7pAUabVXAQfWs=";
};
Lithium = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/zVOQw7YU/lithium-fabric-0.14.6%2Bmc1.21.4.jar";
sha256 = "sha256-iF4hy+3XVJP7Fv6R2dsrYq6Ct0MQJLX4/4Yh5WEJm90=";
};
});
};
};
};
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"minecraft-server"
];
networking.firewall.allowedUDPPorts = [ 24454 ];
}
File diff suppressed because it is too large Load Diff
+10 -9
View File
@@ -9,15 +9,10 @@ in {
# TODO: Migrate sqlite to postgres # TODO: Migrate sqlite to postgres
settings = { settings.server = {
server = { domain = "grafana.home.feal.no";
domain = "grafana.home.feal.no"; http_port = 2342;
http_port = 2342; http_addr = "127.0.0.1";
http_addr = "127.0.0.1";
};
security = {
secret_key = "SW2YcwTIb9zpOOhoPsMm"; # TODO - Rotate
};
}; };
provision = { provision = {
@@ -49,6 +44,12 @@ in {
url = "https://grafana.com/api/dashboards/14284/revisions/9/download"; url = "https://grafana.com/api/dashboards/14284/revisions/9/download";
options.path = dashboards/synology-nas-details.json; options.path = dashboards/synology-nas-details.json;
} }
{
name = "OpenWRT";
type = "file";
url = "https://grafana.com/api/dashboards/11147/revisions/1/download";
options.path = dashboards/openwrt.json;
}
]; ];
}; };
}; };
@@ -17,16 +17,23 @@ in {
static_configs = [ static_configs = [
{ {
targets = [ targets = [
"challenger.home.feal.no:9100" "voyager.home.feal.no:9100"
"constellation.home.feal.no:9100" "sulu.home.feal.no:9100"
"mccoy.home.feal.no:9100"
"dlink-feal.home.feal.no:9100"
"edison.home.feal.no:9100"
"defiant.home.feal.no:9100" "defiant.home.feal.no:9100"
"leonard.home.feal.no:9100" "scotty.home.feal.no:9100"
"morn.home.feal.no:9100"
"sisko.home.feal.no:9100"
]; ];
} }
]; ];
} }
{
job_name = "openwrt";
static_configs = [
{ targets = ["dlink-feal.home.feal.no:9100"]; }
];
}
{ {
job_name = "snmp"; job_name = "snmp";
static_configs = [{ static_configs = [{
File diff suppressed because it is too large Load Diff
@@ -1,13 +1,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# TODO - Fix. Broken in 26.05 services.prometheus.exporters.snmp = {
# services.prometheus.exporters.snmp = { enable = true;
# enable = true; configurationPath = "/tank/services/metrics/prometheus/snmp.yml";
# configurationPath = ./snmp-exporter-conf.yml; # snmp.yml = https://github.com/prometheus/snmp_exporter/blob/main/snmp.yml + https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf
# # snmp.yml is built from };
# # https://github.com/prometheus/snmp_exporter/blob/main/snmp.yml
# # and
# # https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf
# };
} }
+7 -50
View File
@@ -31,15 +31,6 @@ in {
defaults.email = "felix@albrigtsen.it"; defaults.email = "felix@albrigtsen.it";
}; };
# security.acme.certs."domainname" = {
# dnsProvider = "domeneshop";
# environmentFile = config.sops.secrets."domeneshop/acme".path;
# webroot = null;
# };
sops.secrets."domeneshop/acme" = {
group = "nginx";
};
# Publicly exposed services: # Publicly exposed services:
services.nginx.virtualHosts = let services.nginx.virtualHosts = let
@@ -63,51 +54,17 @@ in {
''; '';
} // overrides; } // overrides;
in { in {
"cloud.feal.no" = publicProxy "" { "auth.feal.no" = publicProxy "" {
listen = [
{ addr = "192.168.10.175"; port = 43443; ssl = true; }
{ addr = "192.168.10.175"; port = 43080; ssl = false; }
# Note: cloud.feal.no is overriden in the local DNS, to allow use through Wireguard VPN
{ addr = "192.168.10.175"; port = 443; ssl = true; }
{ addr = "192.168.10.175"; port = 80; ssl = false; }
];
locations."/" = { locations."/" = {
proxyPass = "http://challenger.home.feal.no"; proxyPass = "https://voyager.home.feal.no:8300";
extraConfig = '' extraConfig = ''
client_max_body_size 8G; proxy_ssl_verify off;
''; '';
}; };
extraConfig = ''
# Direct local traffic and NAT Hairpin
allow 192.168.10.0/24;
# Wireguard
allow 10.100.0.0/24;
# AS16185
allow 82.146.64.0/19;
allow 217.31.96.0/20;
allow 185.166.44.0/22;
# NTNU
allow 129.241.0.0/16;
deny all;
'';
}; };
"cloud.feal.no" = publicProxy "http://voyager.home.feal.no" {};
"amalie.mansaker.no" = publicProxy "http://leonard.home.feal.no/" { }; "git.feal.no" = publicProxy "http://unix:${gitea.server.HTTP_ADDR}" {};
"feal.no" = publicProxy "http://leonard.home.feal.no/" { serverAliases = [ "www.feal.no" ]; }; "jf.feal.no" = publicProxy "http://jellyfin.home.feal.no/" {};
"git.feal.no" = publicProxy "http://unix:${gitea.server.HTTP_ADDR}" { default = true; }; "iam.feal.no" = publicProxy "http://${keycloak.http-host}:${toString keycloak.http-port}" {};
"iam.feal.no" = publicProxy "http://${keycloak.http-host}:${toString keycloak.http-port}" { };
"jf.feal.no" = publicProxy "http://jellyfin.home.feal.no/" { };
"kinealbrigtsen.no" = publicProxy "http://leonard.home.feal.no/" { serverAliases = [ "www.kinealbrigtsen.no" ]; };
"wiki.wackattack.eu" = publicProxy "http://leonard.home.feal.no/" { };
};
security.acme.certs."cloud.feal.no" = {
dnsProvider = "domeneshop";
environmentFile = config.sops.secrets."domeneshop/acme".path;
webroot = null;
}; };
} }
+1 -1
View File
@@ -4,7 +4,7 @@ let
dnsHost = "192.168.10.175"; dnsHost = "192.168.10.175";
webuiListen = "127.0.1.2:5053"; webuiListen = "127.0.1.2:5053";
in { in {
# Pihole - Ad-blocking DNS recursor and authoritative DNS/DHCP # Flame - Homelab dashboard/linktree
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
pihole = { pihole = {
image = "pihole/pihole"; image = "pihole/pihole";
+2 -9
View File
@@ -2,24 +2,17 @@
{ {
services.postgresql = { services.postgresql = {
enable = true; enable = true;
enableTCPIP = true; enableTCPIP = false;
authentication = ''
host all all 172.16.0.0/12 md5
'';
}; };
services.postgresqlBackup = { services.postgresqlBackup = {
enable = true; enable = true;
location = "/tank/backup/postgresql"; location = "/data/backup/postgresql/";
startAt = "*-*-* 03:15:00"; startAt = "*-*-* 03:15:00";
# Each service is registered in its own configuration file # Each service is registered in its own configuration file
databases = [ ]; databases = [ ];
}; };
# Docker containers on this host can reach postgres
networking.firewall.extraCommands = "iptables -A INPUT -p tcp --destination-port 5432 -s 172.16.0.0/12 -j ACCEPT";
environment.systemPackages = [ config.services.postgresql.package ]; environment.systemPackages = [ config.services.postgresql.package ];
} }
-14
View File
@@ -1,14 +0,0 @@
{ config, pkgs, lib, ... }:
let
port = 1457;
in {
hardware.rtl-sdr.enable = true;
systemd.services.rtl-tcp = {
script = "${pkgs.rtl-sdr}/bin/rtl_tcp -a 0.0.0.0 -p ${toString port} -s 2000000 -T";
serviceConfig = {
Group = "plugdev";
};
};
networking.firewall.allowedTCPPorts = [ port ];
}
-39
View File
@@ -1,39 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.searx;
domain = "search.home.feal.no";
in {
services.searx = {
enable = true;
environmentFile = config.sops.secrets."searx/envfile".path;
settings = {
server = {
secret_key = "@SEARX_SECRET_KEY@";
base_url = "http://${domain}";
};
};
runInUwsgi = true;
uwsgiConfig = {
socket = "/run/searx/searx.sock";
chmod-socket = "660";
};
redisCreateLocally = true;
};
sops.secrets."searx/envfile" = {
owner = "searx";
group = "searx";
};
users.groups."searx".members = [ "nginx" ];
services.nginx.virtualHosts."${domain}" = {
locations."/".extraConfig = ''
include ${config.services.nginx.package}/conf/uwsgi_params;
uwsgi_pass unix:${cfg.uwsgiConfig.socket};
'';
};
}
+4 -8
View File
@@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.services.vaultwarden; cfg = config.services.vaultwarden;
domain = "pw.home.feal.no"; domain = "pw.feal.no";
address = "127.0.1.2"; address = "127.0.1.2";
port = 3011; port = 3011;
wsPort = 3012; wsPort = 3012;
@@ -43,17 +43,13 @@ in {
services.postgresqlBackup.databases = [ "vaultwarden" ]; services.postgresqlBackup.databases = [ "vaultwarden" ];
security.acme.certs."pw.home.feal.no" = {
dnsProvider = "domeneshop";
environmentFile = config.sops.secrets."domeneshop/acme".path;
webroot = null;
};
services.nginx.virtualHosts."${domain}" = { services.nginx.virtualHosts."${domain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
listen = [ listen = [
{ addr = "192.168.10.175"; port = 443; ssl = true; } { addr = "192.168.10.175"; port = 43443; ssl = true; }
{ addr = "192.168.10.175"; port = 80; ssl = false; } { addr = "192.168.10.175"; port = 43080; ssl = false; }
]; ];
extraConfig = '' extraConfig = ''
+37 -3
View File
@@ -16,13 +16,47 @@ in {
privateKeyFile = "/etc/wireguard/defiant.private"; privateKeyFile = "/etc/wireguard/defiant.private";
postSetup = '' postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -d 192.168.10.0/24 -o enp3s0 -j MASQUERADE ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -d 192.168.10.0/24 -o eth0 -j MASQUERADE
''; '';
postShutdown = '' postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -d 192.168.10.0/24 -o enp3s0 -j MASQUERADE ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -d 192.168.10.0/24 -o eth0 -j MASQUERADE
''; '';
peers = (import ../../../common/wireguard-peers.nix); peers = [
{ # Burnham
publicKey = "JcfyrMoZmnbibVLaIKuGSARAX2alFv4kwLbJaLBNbzo=";
persistentKeepalive = 60;
allowedIPs = [
"10.100.0.2/32"
"192.168.11.0/24"
];
endpoint = "site2.feal.no:51902";
}
{ # Sulu
publicKey = "j6YVekgGS4nhL5zUiOTeK2BVQkYGlTQaiUpwcqQyfRk=";
allowedIPs = [
"10.100.0.3/32"
];
}
{ # Worf
publicKey = "kW8SyzCh2tw8GzZV6bPn+IQVNUoUhseNfEm3rHnR1So=";
allowedIPs = [
"10.100.0.4/32"
];
}
{ # Phone
publicKey = "axFXtcTYtW6m1FT9Czn9DRvG+b05D7j+0yRMjn/FJEk=";
allowedIPs = [
"10.100.0.5/32"
];
}
{ # Riker
publicKey = "r715vpgH1H0zvN+Z5wcNKcOo5e6UM3fBfh9BZwTBjmA=";
allowedIPs = [
"10.100.0.6/32"
];
}
];
}; };
}; };
} }
+55
View File
@@ -0,0 +1,55 @@
{ config, pkgs, lib, ... }:
{
imports =
[
../../base.nix
../../common/metrics-exporters.nix
./hardware-configuration.nix
./desktop
];
virtualisation.docker.enable = true;
systemd.coredump.enable = true;
networking = {
hostName = "edison";
defaultGateway = "192.168.10.1";
interfaces.enp4s0.useDHCP = false;
interfaces.enp4s0.ipv4.addresses = [
{ address = "192.168.10.170"; prefixLength = 24; }
];
hostId = "8e84b281";
};
console.keyMap = "us";
# sops.defaultSopsFile = ../../secrets/edison/edison.yaml;
environment.variables = { EDITOR = "vim"; };
environment.systemPackages = with pkgs; [
discord
gimp
gparted
openvpn
pavucontrol
unstable.element-desktop
unstable.hydrus
];
programs.steam.enable = true;
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"discord"
"nvidia-x11"
"nvidia-settings"
"steam"
"steam-original"
"steam-run"
];
system.stateVersion = "23.05";
}
+91
View File
@@ -0,0 +1,91 @@
{ config, pkgs, lib, ... }:
{
imports = [
./remote.nix
./gnome.nix
./xfce.nix
];
services.xserver = {
enable = true;
displayManager.gdm = {
enable = true;
wayland = true;
};
videoDrivers = [ "nvidia" ];
xkbOptions = "ctrl:nocaps";
layout = "no,us";
xkbVariant = "intl";
};
#hardware.nvidia.modesetting.enable = true; # TODO: Fix this. Steam crashes, and textures/fonts unload when suspended.
hardware.keyboard.zsa.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.systemPackages = with pkgs; [
xclip
];
hardware.opengl.enable = true;
# Audio
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
hardware.pulseaudio.enable = false;
# Fonts
fonts = {
fontDir.enable = true;
packages = with pkgs; [
noto-fonts
noto-fonts-emoji
noto-fonts-cjk-sans
font-awesome
fira-code
hack-font
(nerdfonts.override {
fonts = [
"Hack"
];
})
];
};
# Dark mode
home-manager.users.felixalb = {
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome.gnome-themes-extra;
};
};
};
qt = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";
};
# Misc:
xdg.portal = {
enable = true;
wlr.enable = true;
};
location.provider = "geoclue2";
security.polkit.enable = true;
services.flatpak.enable = true;
services.redshift.enable = true;
users.users."felixalb".packages = [ pkgs.flatpak ];
}
+10
View File
@@ -0,0 +1,10 @@
{ config, pkgs, lib, ... }:
{
services.xserver.desktopManager.gnome.enable = true;
environment.systemPackages = with pkgs; [
gnomeExtensions.appindicator
gnome.adwaita-icon-theme
];
services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
programs.dconf.enable = true;
}
+12
View File
@@ -0,0 +1,12 @@
{ config, pkgs, lib, ... }:
{
# Microsoft-style Remote Desktop:
services.xrdp = {
enable = true;
defaultWindowManager = "xfce4-session"; # Avoid fancy animations, no hyprland/GNOME!
openFirewall = true;
};
# X window forwarding with `ssh -Y`
services.openssh.settings.X11Forwarding = true;
}
+10
View File
@@ -0,0 +1,10 @@
{ config, pkgs, lib, ... }:
{
services.xserver = {
desktopManager.xfce.enable = true;
};
environment.systemPackages = with pkgs; [
xfce.xfce4-pulseaudio-plugin
];
}
+52
View File
@@ -0,0 +1,52 @@
{ config, pkgs, lib, ... }:
{
programs.neomutt = {
enable = true;
sidebar = {
enable = true;
width = 30;
};
sort = "reverse-threads";
vimKeys = true;
checkStatsInterval = 60;
};
programs.mbsync.enable = true;
programs.notmuch = {
enable = true;
hooks = {
preNew = "mbsync --all";
};
};
# programs.msmtp.enable = true;
accounts.email = {
accounts.felix-albrigtsen-it = rec {
address = "felix@albrigtsen.it";
userName = address;
primary = true;
realName = "Felix Albrigtsen";
signature = {
text = ''
Med vennlig hilsen
${realName}
'';
showSignature = "append";
};
imap.host = "imap.migadu.com";
smtp.host = "smtp.migadu.com";
passwordCommand = "cat ~/.secrets/email/migadu"; # yolo / TODO
mbsync = {
enable = true;
create = "maildir"; # Create subfolders locally
# expugne = "both";
};
msmtp.enable = true;
notmuch.enable = true;
neomutt.enable = true;
};
};
}
+46
View File
@@ -0,0 +1,46 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/14b254e1-d94f-4b9b-a910-7fcf7e33af46";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/A197-7913";
fsType = "vfat";
};
fileSystems."/data" =
{ device = "/dev/disk/by-uuid/ebbdf34e-adec-4df3-bbed-20d80455f3f7";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/d56040a0-3009-4899-95fa-1b82e60e32e4"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault false;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+30
View File
@@ -0,0 +1,30 @@
{ pkgs, lib, ... }:
{
home.packages = with pkgs; [
nix-index
unstable.snicat
python3
] ++ (with python3Packages; [
beautifulsoup4
numpy
pillow
pwntools
pycryptodome
requests
]);
imports = [
./../../home/base.nix
./email.nix
];
programs = {
zsh.shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config";
alacritty.enable = true;
firefox.enable = true;
rofi.enable = true;
};
home.stateVersion = "23.05";
}
-66
View File
@@ -1,66 +0,0 @@
{
config,
pkgs,
lib,
...
}:
{
imports = [
../../base.nix
./hardware-configuration.nix
./desktop.nix
];
networking = {
networkmanager.enable = true;
wireguard.enable = true;
tempAddresses = "disabled";
hostName = "fa-t14-2025";
nameservers = [ "9.9.9.9" ];
domain = "it.hime.no";
hostId = "f458d6aa";
search = [
"mktv.no"
"mktv.local"
];
};
services.openssh.openFirewall = false;
environment.systemPackages = with pkgs; [
inetutils
wireguard-tools
];
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
};
users.users.felixalb = {
uid = 1000;
openssh.authorizedKeys.keys = [ ];
extraGroups = [ "networkmanager" ];
};
console.keyMap = "no";
nixpkgs.config = {
allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"microsoft-edge"
"securecrt"
"securefx"
];
};
system.stateVersion = "25.05";
}
-58
View File
@@ -1,58 +0,0 @@
{
config,
pkgs,
lib,
...
}:
{
hardware.graphics.enable = true;
services.xserver = {
enable = true;
xkb = {
options = "ctrl:nocaps";
layout = "no";
};
};
services.displayManager.ly.enable = true;
services.gnome.gnome-keyring.enable = true;
programs.hyprland = {
# See configuration (through home-manager) in home/hypr
enable = true;
withUWSM = true;
xwayland.enable = true;
};
# Audio
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
# Fonts
fonts = {
fontDir.enable = true;
packages = with pkgs; [
noto-fonts
noto-fonts-color-emoji
noto-fonts-cjk-sans
font-awesome
fira-code
hack-font
nerd-fonts.hack
];
};
# Misc:
xdg.portal = {
enable = true;
wlr.enable = true;
};
location.provider = "geoclue2";
security.polkit.enable = true;
services.dbus.packages = [ pkgs.gcr ];
services.openssh.settings.X11Forwarding = true;
programs.nm-applet.enable = true;
}
@@ -1,53 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "resume_offset=3037184" "mem_sleep_default=deep" ];
boot.resumeDevice = "/dev/disk/by-uuid/75dd0e39-9411-48c9-822d-bf3c897d0f61";
powerManagement.enable = true;
services.power-profiles-daemon.enable = true;
services.logind.settings.Login = {
HandleLidSwitch = "suspend-then-hibernate";
HandleLidSwitchDocked = "ignore";
HandlwPowerKey = "suspend-then-hibernate";
HandlePowerKeyLongPress = "poweroff";
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/75dd0e39-9411-48c9-822d-bf3c897d0f61";
fsType = "ext4";
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/3ecaedab-415c-4cce-a3a9-9f3782acb682";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/0800-59D9";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [
{
device = "/var/lib/swapfile";
size = 32*1024;
}
];
networking.useDHCP = lib.mkDefault false;
# networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
-113
View File
@@ -1,113 +0,0 @@
{ pkgs, lib, ... }:
let
emailAddress = "felix.albrigtsen@mktv.no";
in
{
imports = [
./../../home/base.nix
./../../home/alacritty.nix
./../../home/waybar.nix
./../../home/hypr
];
home.packages = with pkgs; [
bc
catimg
chromium
dig
element-desktop
gnumeric
hunspellDicts.en_US
hunspellDicts.nb_NO
iperf3
jq
libreoffice
microsoft-edge
mpv
nixpkgs-2211.remmina
oauth2ms
oldssh
openssl
openvpn
pavucontrol
pwgen
traceroute
virt-manager
w3m
# Window Manager Extras
brightnessctl
cliphist
nautilus
rofi-rbw-wayland
swaynotificationcenter
wl-clipboard
(python312.withPackages (
ps: with ps; [
numpy
pycryptodome
requests
]
))
];
wayland.windowManager.hyprland = {
enable = true;
# Override settings from home/hypr/hyprland.nix
settings.config.input = {
kb_layout = "no";
kb_variant = "";
};
};
programs = {
aerc = {
enable = true;
package = pkgs.aerc;
};
firefox = {
enable = true;
configPath = ".mozilla/firefox"; # Old default before 26.05
};
git.settings.user.email = emailAddress;
rbw = {
enable = true;
settings = {
base_url = "https://vault.mktv.no";
email = emailAddress;
pinentry = pkgs.pinentry-rofi;
lock_timeout = 60 * 60 * 8;
};
};
rofi = {
enable = true;
# theme = "iggy";
theme = "Arc-Dark";
};
waybar.enable = true;
zsh = {
shellAliases = {
"kssh" = "ssh -t controlnode ssh";
"ossh" =
"oldssh -oHostKeyAlgorithms=+ssh-dss -oCiphers=+aes256-cbc -oKexAlgorithms=+diffie-hellman-group14-sha1";
"rebuild" = "sudo nixos-rebuild switch --flake /config";
};
prezto.pmodules = [ "ssh" ];
};
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
};
};
home.stateVersion = "25.05";
}
-43
View File
@@ -1,43 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.restic.backups = let
localJob = name: paths: {
inherit paths;
repository = "/mnt/feal-syn1/backup/leonard/${name}"; # TODO - Mount first
passwordFile = config.sops.secrets."restic/${name}".path;
initialize = true;
pruneOpts = [
"--keep-daily 3"
"--keep-weekly 4"
"--keep-monthly 3"
];
};
cloudJob = name: paths: {
inherit paths;
# "rsyncnet" connection details specified in /root/.ssh/config
extraOptions = [ "rclone.program=\"ssh rsyncnet\"" ];
# repository = "rclone::/${name}";
repository = "rclone:";
passwordFile = config.sops.secrets."restic/${name}".path;
initialize = true;
pruneOpts = [
# rsync.net keeps daily snapshots
"--keep-weekly 4"
"--keep-monthly 36"
];
};
in {
# TODO - local NAS backups
mysql-remote = (cloudJob "postgres" [ "/var/backup/mysql" ]) // {
timerConfig.OnCalendar = "01:30"; # 1h after mysqlBackup
};
# WIP
# postgres-remote = (cloudJob "postgres" [ "/tank/backup/postgresql" ]) // {
# timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup
# };
};
sops.secrets."restic/mysql" = { };
sops.secrets."restic/postgres" = { };
}
-55
View File
@@ -1,55 +0,0 @@
{ config, pkgs, lib, ... }:
{
imports =
[
../../base.nix
../../common/metrics-exporters.nix
../../common/auto-upgrade.nix
./hardware-configuration.nix
./backup.nix
./services/mysql.nix
./services/nginx.nix
./services/postgresql.nix
./services/wiki-wackattack-eu.nix
./services/www-feal-no
./services/www-kinealbrigtsen-no.nix
./services/www-amalie-mansaker-no
];
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
networking = {
hostName = "leonard";
defaultGateway = "192.168.10.1";
interfaces.ens18.ipv4 = {
addresses = [
{ address = "192.168.10.207"; prefixLength = 24; }
];
};
hostId = "b99c12d1";
# Prepend the following output rules to disallow talking to other devices on LAN
firewall.extraCommands = lib.strings.concatLines ([
"iptables -F OUTPUT"
] ++ (map (addr: "iptables -A OUTPUT -p udp --dport 53 -d ${addr} -j nixos-fw-accept") config.networking.nameservers) ++ [ # Exception for DNS
"iptables -A OUTPUT -p tcp --dport 3100 -d 192.168.10.175 -j nixos-fw-accept" # Exception for loki logging
"iptables -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"
"iptables -A OUTPUT -d 192.168.10.0/24 -j nixos-fw-refuse"
"iptables -A OUTPUT -d 192.168.11.0/24 -j nixos-fw-refuse"
]);
};
sops.defaultSopsFile = ../../secrets/leonard/leonard.yaml;
environment.variables = { EDITOR = "vim"; };
system.stateVersion = "25.05";
}
-27
View File
@@ -1,27 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/4a70c1d5-9d72-4581-8f75-733b91c10669";
fsType = "ext4";
};
swapDevices = [ {
device = "/swapfile";
size = 4*1024;
} ];
networking.useDHCP = lib.mkDefault false;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-13
View File
@@ -1,13 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.mysql = {
enable = true;
package = pkgs.mariadb;
};
services.mysqlBackup = {
enable = true;
calendar = "00:30:00";
};
}
-20
View File
@@ -1,20 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.postgresql = {
enable = true;
enableTCPIP = false;
authentication = pkgs.lib.mkOverride 10 ''
#type database DBuser auth-method
local all all trust
'';
};
services.postgresqlBackup = {
enable = true;
location = "/backup/postgresql/";
startAt = "*-*-* 03:15:00";
backupAll = true;
};
environment.systemPackages = [ config.services.postgresql.package ];
}
@@ -1,38 +0,0 @@
{ config, ... }:
let
bindIP = "127.0.1.2";
port = 5051;
cfg = config.services.wiki-js;
in {
# sops.secrets."wikijs/envfile" = {
# restartUnits = [ "wiki-js.service" ];
# };
services.wiki-js = {
enable = true;
# environmentFile = config.sops.secrets."wikijs/envfile".path;
settings = {
inherit bindIP port;
db = {
type = "postgres";
host = "/run/postgresql";
db = "wiki-js";
user = "wiki-js";
};
};
};
services.postgresql = {
ensureDatabases = [ "wiki-js" ];
ensureUsers = [{
name = "wiki-js";
ensureDBOwnership = true;
}];
};
services.nginx.virtualHosts."wiki.wackattack.eu" = {
locations."/" = {
proxyPass = "http://${bindIP}:${toString port}";
};
};
}
@@ -1,11 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.nginx.virtualHosts."amalie.mansaker.no" = let
siteContent = pkgs.callPackage ./site.nix { };
in {
locations = {
"/".root = siteContent;
};
};
}
@@ -1,26 +0,0 @@
{ stdenv, fetchgit, hugo }:
stdenv.mkDerivation {
name = "www-amalie-mansaker-no";
src = fetchgit {
url = "https://git.feal.no/amalieem/amalie.mansaker.no.git";
fetchSubmodules = true;
rev = "f5ff8133b9d31de0de7386be8831de0d0fab6f95";
hash = "sha256-fld2f9PW1vwnals6kUerXzqGP/anMs7abstaYfaXO4Q=";
};
nativeBuildInputs = [ hugo ];
buildPhase = ''
cp -r $src/* .
${hugo}/bin/hugo
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r public/* $out/
runHook postInstall
'';
}
@@ -1,26 +0,0 @@
{ config, pkgs, lib, ... }:
{
services.nginx.virtualHosts."feal.no" = {
default = true;
serverAliases = [
"www.feal.no"
];
locations = {
# TODO: Reinstate actual website
"/".return = "302 https://git.feal.no/";
"^~ /.well-known/" = {
alias = (toString ./well-known) + "/";
};
"/cc/" = {
alias = "${pkgs.cyberchef}/share/cyberchef/";
index = "index.html";
};
"= /cc".return = "302 /cc/";
};
};
}
@@ -1,5 +0,0 @@
{
"m.homeserver": {
"base_url": "https://matrix.feal.no:443"
}
}
@@ -1 +0,0 @@
{"m.server": "matrix.feal.no:443"}
@@ -1,98 +0,0 @@
{ config, pkgs, lib, ... }:
{
users.users.www-kinealbrigtsen-no = {
isSystemUser = true;
group = "www-kinealbrigtsen-no";
};
users.groups.www-kinealbrigtsen-no = { };
services.mysql.ensureDatabases = [
"www_kinealbrigtsen_no"
];
services.mysql.ensureUsers = [
{
name = "www-kinealbrigtsen-no";
ensurePermissions = {
# "www_kinealbrigtsen_no.*" = "ALL PRIVILEGES"; # For upgrades and special procedures
"www_kinealbrigtsen_no.*" = "SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX";
};
}
];
services.mysqlBackup.databases = [
"www_kinealbrigtsen_no"
];
services.phpfpm.pools.www-kinealbrigtsen-no = {
user = "www-kinealbrigtsen-no";
group = "www-kinealbrigtsen-no";
phpOptions = lib.generators.toKeyValue {} {
upload_max_filesize = "1000M";
post_max_size = "1000M";
memory_limit = "1000M";
};
settings = {
"listen.owner" = config.services.nginx.user;
"listen.group" = config.services.nginx.group;
"pm" = "dynamic";
"pm.max_children" = 32;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 2;
"pm.max_spare_servers" = 4;
"pm.process_idle_timeout" = "10s";
"pm.max_requests" = 1000;
};
};
services.nginx.virtualHosts."kinealbrigtsen.no" = {
serverAliases = [ "www.kinealbrigtsen.no" ];
root = "/var/www/www-kinealbrigtsen-no";
locations = {
"/".extraConfig = ''
try_files $uri $uri/ /index.php?$args;
'';
"~ \\.php$".extraConfig = ''
include ${config.services.nginx.package}/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:${config.services.phpfpm.pools.www-kinealbrigtsen-no.socket};
'';
"~ /\\.ht".extraConfig = ''
deny all;
'';
"/favicon.ico".extraConfig = ''
log_not_found off;
access_log off;
'';
"/robots.txt".extraConfig = ''
allow all;
log_not_found off;
access_log off;
'';
"~* \\.(js|css|png|jpg|jpeg|gif|ico)$".extraConfig = ''
expires max;
log_not_found off;
'';
};
extraConfig = ''
index index.php index.html;
set_real_ip_from 192.168.11.0/24;
real_ip_header X-Forwarded-For;
add_header 'Referrer-Policy' 'origin-when-cross-origin';
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
'';
};
# TODO:
# - Configure a mailer so wp_mail() works
# - Enable periodic backups
}
-35
View File
@@ -1,35 +0,0 @@
{ config, pkgs, lib, ... }:
{
imports =
[
../../base.nix
../../common/metrics-exporters.nix
../../common/auto-upgrade.nix
./hardware-configuration.nix
./services/nginx.nix
./services/glance
./services/miniflux.nix
./services/thelounge.nix
];
networking = {
hostName = "morn";
defaultGateway = "192.168.10.1";
interfaces.ens18.ipv4 = {
addresses = [
{ address = "192.168.10.203"; prefixLength = 24; }
];
};
hostId = "89b7722d";
};
sops.defaultSopsFile = ../../secrets/morn/morn.yaml;
environment.variables = { EDITOR = "vim"; };
system.stateVersion = "24.11";
}
-12
View File
@@ -1,12 +0,0 @@
{ pkgs, lib, ... }:
{
imports = [
./../../home/base.nix
];
programs = {
zsh.shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config";
};
home.stateVersion = "24.11";
}
-15
View File
@@ -1,15 +0,0 @@
{ config, values, ... }:
{
services.glance = {
enable = true;
settings = import ./settings.nix;
};
services.nginx.virtualHosts."glance.home.feal.no" = let
inherit (config.services.glance.settings.server) host port;
in {
locations."/" = {
proxyPass = "http://${host}:${toString port}";
};
};
}
-83
View File
@@ -1,83 +0,0 @@
{ config, ... }:
{
server = {
port = 5001;
host = "127.0.1.2";
};
pages =
let
fullCol = widgets: {
size = "full";
inherit widgets;
};
in
[
{
name = "Home";
columns = [
(fullCol [
{
type = "search";
search-engine = "http://search.home.feal.no/search?q={QUERY}";
}
{
type = "weather";
units = "metric";
location = "Trondheim, Norway";
}
])
(fullCol [
{
type = "hacker-news";
limit = 20;
collapse-after = 5;
}
{
type = "monitor";
cache = "5m";
sites =
let
site = title: url: { inherit title url; };
in
[
(site "Jellyfin" "http://jellyfin.home.feal.no")
(site "Gitea" "https://git.feal.no")
(site "VaultWarden" "https://pw.feal.no")
];
}
])
];
}
{
name = "News";
columns =
let
feed = title: url: { inherit title url; };
rss = title: feeds: {
type = "rss";
inherit title feeds;
};
in
[
(fullCol [
(rss "Norway" [
(feed "NRK" "https://www.nrk.no/toppsaker.rss")
(feed "Bygdeposten" "https://www.bygdeposten.no/service/rss")
(feed "Nidaros" "https://www.nidaros.no/service/rss")
])
])
(fullCol [
(rss "NTNU" [
(feed "OmegaV" "https://omegav.no/newsrss")
(feed "PVV" "https://www.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&days=7&limit=50&action=feedrecentchanges&feedformat=atom")
(feed "IT-Varsel" "https://varsel.it.ntnu.no/subscribe/rss/")
])
])
];
}
];
}
-23
View File
@@ -1,23 +0,0 @@
{ config, pkgs, lib, ... }:
let
domain = "rss.home.feal.no";
listen_addr = "127.0.1.2:5051";
in {
sops.secrets."miniflux/env" = { };
services.miniflux = {
enable = true;
adminCredentialsFile = config.sops.secrets."miniflux/env".path;
config = {
CREATE_ADMIN = true;
LISTEN_ADDR = listen_addr;
BASE_URL = "http://${domain}";
};
};
services.nginx.virtualHosts."${domain}" = {
locations."/".proxyPass = "http://${listen_addr}";
};
}
-19
View File
@@ -1,19 +0,0 @@
{ config, values, ... }:
{
services.nginx = {
enable = true;
enableReload = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {
acceptTerms = true;
defaults.email = "felix@albrigtsen.it";
};
}
+73
View File
@@ -0,0 +1,73 @@
{ config, pkgs, ... }:
{
imports =
[
../../base.nix
./hardware-configuration.nix
];
networking.hostName = "redshirt";
networking.networkmanager.enable = true;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
windowManager = {
qtile.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
libinput.enable = true;
};
# The NixOS module enables critical components needed to run Hyprland properly, such as: polkit, xdg-desktop-portal-hyprland, graphics drivers, fonts, dconf, xwayland, and adding a proper Desktop Entry to your Display Manager.
#programs.hyprland = {
# enable = true;
# package = pkgs.unstable.hyprland;
#};
services.xserver.displayManager = {
lightdm.enable = true;
#defaultSession = "hyprland";
};
# Configure keymap in X11
services.xserver.layout = "no";
fonts.fonts = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; })
];
sound.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
users.users.felixalb = {
extraGroups = [ "networkmanager" ];
};
environment.systemPackages = with pkgs; [
zsh
neovim
git
ripgrep
rsync
cifs-utils
];
documentation.man.generateCaches = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
system.stateVersion = "22.11";
}
+41
View File
@@ -0,0 +1,41 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/0d709ab3-0d10-46eb-9e4f-10a320af703e";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/6EE9-1C06";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/2067bbb4-b4fa-4326-9f58-4018857058a7"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
-133
View File
@@ -1,133 +0,0 @@
{ config, pkgs, lib, ... }:
{
imports = [
../../base.nix
../../common/metrics-exporters.nix
./hardware-configuration.nix
];
# Networking
networking = {
hostName = "sisko";
# networkmanager.enable = true;
defaultGateway = "192.168.10.1";
interfaces.enp14s0 = {
ipv4 = {
addresses = [
{ address = "192.168.10.172"; prefixLength = 24; }
];
};
wakeOnLan.enable = true;
};
hostId = "b716d781";
};
hardware.bluetooth.enable = true;
# Video
hardware.graphics = {
enable = true;
enable32Bit = true;
};
hardware.amdgpu.opencl.enable = true;
# Audio
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
# Other hardware / devices
hardware.rtl-sdr.enable = true;
users.users.felixalb.extraGroups = [
"dialout"
"libvirtd"
"networkmanager"
"plugdev"
];
# Desktop
programs.hyprland = {
# See configuration (through home-manager) in home/hypr
enable = true;
withUWSM = true;
};
services.displayManager.ly.enable = true;
services.xserver.enable = true;
services.xserver.desktopManager.xfce.enable = true;
fonts = {
fontDir.enable = true;
packages = with pkgs; [
fira-code
font-awesome
hack-font
nerd-fonts.hack
noto-fonts
noto-fonts-cjk-sans
noto-fonts-color-emoji
];
};
# Programs
# TODO - Move to Home-Manager
programs = {
alvr = {
enable = true;
openFirewall = true;
};
firefox = {
enable = true;
nativeMessagingHosts.packages = with pkgs; [ tridactyl-native ];
};
gamemode.enable = true;
steam = {
enable = true;
remotePlay.openFirewall = true;
};
virt-manager.enable = true;
};
environment.variables = {
SSH_AUTH_SOCK = "/run/user/${toString config.users.users.felixalb.uid}/keyring/ssh";
EDITOR = "vim";
};
# Virtualization
virtualisation = {
libvirtd.enable = true;
spiceUSBRedirection.enable = true;
};
environment.systemPackages = with pkgs; [
virtiofsd
];
virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker";
# Nix / meta
nixpkgs.config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"discord"
"spotify"
"steam"
"steam-unwrapped"
];
permittedInsecurePackages = [
"openssl-1.1.1w"
];
rocmSupport = true;
};
sops.defaultSopsFile = ../../secrets/sisko/sisko.yaml;
services.fwupd.enable = true;
system.stateVersion = "24.11";
}
-55
View File
@@ -1,55 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.extraModprobeConfig = "options bluetooth disable_ertm=1"; # Xbox controller
hardware.xpadneo.enable = true;
boot.kernel.sysctl = {
"vm.max_map_count" = 16777216;
# "fs.file-max" = 524288;
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/60a70caf-ca37-488d-8c2a-98a7e9b67d84";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/60a70caf-ca37-488d-8c2a-98a7e9b67d84";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/60a70caf-ca37-488d-8c2a-98a7e9b67d84";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/12CE-A600";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ {
device = "/swapfile";
size = 64*1024;
} ];
networking.useDHCP = lib.mkDefault false;
# networking.interfaces.enp14s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp15s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
-172
View File
@@ -1,172 +0,0 @@
{ pkgs, lib, config, ... }:
{
imports = [
./../../home/base.nix
./../../home/alacritty.nix
./../../home/hypr/default.nix
./../../home/waybar.nix
];
wayland.windowManager.hyprland.enable = true;
home.packages = with pkgs; [
# GUI Applications
cantata
chromium
discord
easyeffects
element-desktop
emacs-gtk
feishin
gqrx
kitty
libreoffice
lutris
mpv
mumble
orca-slicer
papers
pavucontrol
picard
pkgsRocm.hashcat
prismlauncher
restic
runelite
spotify
swayimg
thunderbird
tor-browser
bolt-launcher
exiftool
ghidra
pwndbg
snicat
# Window Manager Extras
cliphist
nautilus
networkmanager
rofi-rbw-wayland
# Misc tools
abcde
bc
catimg
dante
dig
go
hunspellDicts.en_US
hunspellDicts.nb_NO
jq
nixpkgs-2211.remmina
ollama-rocm
openssl
playerctl
pwgen
restic
rocmPackages.clang
traceroute
w3m
(python313.withPackages (ps: with ps; [
numpy
pycryptodome
requests
]))
];
programs = {
aerc = {
enable = true;
package = pkgs.aerc;
};
alacritty = {
enable = true;
settings.window.opacity = 0.92;
};
ncmpcpp.enable = true;
rbw = {
enable = true;
settings = {
base_url = "https://pw.home.feal.no";
email = "felix@albrigtsen.it";
pinentry = pkgs.pinentry-gnome3;
};
};
rofi = {
enable = true;
theme = "iggy";
};
waybar.enable = true;
zsh = {
shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config";
prezto.pmodules = [ "ssh" ];
};
};
services = {
gnome-keyring.enable = true;
mpd = let
home = config.home.homeDirectory;
in {
enable = true;
musicDirectory = "${home}/mnt/music";
dataDir = "${home}/Music/mpd/data";
playlistDirectory = "${home}/Music/mpd/playlists";
extraConfig = ''
audio_output {
type "pipewire"
name "PipewireOut1"
}
'';
};
};
# Dark mode
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
gtk4.theme = config.gtk.theme;
};
qt = {
enable = true;
platformTheme.name = "adwaita";
style.name = "adwaita-dark";
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
"inode/directory" = "org.gnome.Nautilus.desktop";
"application/pdf" = "org.gnome.Papers.desktop";
} // builtins.listToAttrs (
builtins.map
( imgType: { name = "image/${imgType}"; value = "swayimg.desktop"; } )
[ "apng" "bmp" "gif" "heic" "heif" "jpeg" "png" "svg" "svg+xml" "tiff" ]
);
};
home.stateVersion = "24.11";
}
+47
View File
@@ -0,0 +1,47 @@
{ config, pkgs, lib, ... }:
{
services.borgbackup.jobs =
let
borgJob = name: {
environment.BORG_RSH = "ssh -i /root/.ssh/fealsyn1";
environment.BORG_REMOTE_PATH = "/usr/local/bin/borg";
repo = "ssh://backup@feal-syn1.home.feal.no/volume2/backup/borg/voyager/${name}";
compression = "auto,zstd";
};
in {
postgresDaily = borgJob "postgres::daily" // {
paths = "/var/backup/postgres";
startAt = "*-*-* 05:15:00"; # 2 hours after postgresqlBackup
extraInitArgs = "--storage-quota 10G";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg/postgres".path}";
};
};
postgresWeekly = borgJob "postgres::weekly" // {
paths = "/var/backup/postgres";
startAt = "Mon *-*-* 05:15:00"; # 2 hours after postgresqlBackup
extraInitArgs = "--storage-quota 10G";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg/postgres".path}";
};
};
transmission = borgJob "transmission::weekly" // {
paths = "/var/lib/transmission";
startAt = "weekly";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg/transmission".path}";
};
};
# TODO: kanidm, timemachine, calibre(?), nextcloud
};
sops.secrets."borg/postgres" = { };
sops.secrets."borg/transmission" = { };
}
+58
View File
@@ -0,0 +1,58 @@
{ config, pkgs, ... }:
{
imports =
[
../../base.nix
../../common/metrics-exporters.nix
./hardware-configuration.nix
./backup.nix
./exports.nix
./filesystems.nix
./services/calibre.nix
./services/fancontrol.nix
./services/jellyfin.nix
./services/kanidm.nix
./services/komga.nix
./services/nextcloud.nix
./services/nginx
./services/podgrab.nix
./services/postgres.nix
./services/snappymail.nix
./services/timemachine.nix
];
networking = {
hostName = "voyager";
bridges.br0.interfaces = [ "eno1" ];
interfaces.br0.useDHCP = false;
interfaces.br0.ipv4.addresses = [
{ address = "192.168.10.165"; prefixLength = 24; }
];
hostId = "8e84b235";
defaultGateway = "192.168.10.1";
};
sops.defaultSopsFile = ../../secrets/voyager/voyager.yaml;
environment.variables = { EDITOR = "vim"; };
environment.systemPackages = with pkgs; [
zfs
];
virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker";
users.users."amalieem" = {
isNormalUser = true;
home = "/home/amalieem";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID7e+BAoXIFmTeeBYAVImQAcyx6SCoYCErA7h16OGL70 amalieem@wentworth"
];
};
system.stateVersion = "22.11";
}
+27
View File
@@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }:
{
fileSystems = {
"/export/riker-backup" = {
device = "/tank/backup/riker";
options = [ "bind" ];
};
"/export/defiant-backup" = {
device = "/tank/backup/defiant";
options = [ "bind" ];
};
};
# Enable nfs4 only
services.nfs.server = {
enable = true;
exports = ''
/export 192.168.10.4(rw,fsid=0,no_subtree_check) 192.168.10.5(rw,fsid=0,no_subtree_check) 192.168.10.2(rw,fsid=0,no_subtree_check) 192.168.10.175(rw,fsid=0,no_subtree_check)
/export/riker-backup 192.168.10.2(rw,nohide,no_subtree_check,no_root_squash)
/export/doyle-backup 192.168.10.2(rw,nohide,no_subtree_check,no_root_squash)
/export/defiant-backup 192.168.10.175(rw,nohide,no_subtree_check,async,no_root_squash)
'';
};
networking.firewall.allowedTCPPorts = [ 111 2049 20048 ];
networking.firewall.allowedUDPPorts = [ 111 20048];
}

Some files were not shown because too many files have changed in this diff Show More