summaryrefslogtreecommitdiff
path: root/modules/xnet/default.nix
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2025-04-02 22:11:38 -0400
committerKleidi Bujari <mail@4kb.net>2025-04-02 22:11:38 -0400
commitc950f338c5720a132552863a35d1c7924df3d3a6 (patch)
treec3134c42e1618c255ca8e9e0698f90b0ae8b3563 /modules/xnet/default.nix
parentb619ff9dd42eaa62569c8297142f0e4c719d40d2 (diff)
parent09c2b6de63a6ff35348fcb2c2eb57b974f0a8a52 (diff)
downloaddepot-c950f338c5720a132552863a35d1c7924df3d3a6.tar.gz
depot-c950f338c5720a132552863a35d1c7924df3d3a6.tar.bz2
depot-c950f338c5720a132552863a35d1c7924df3d3a6.zip
Merge remote-tracking branch 'origin/copy-blueprint'
Diffstat (limited to 'modules/xnet/default.nix')
-rw-r--r--modules/xnet/default.nix114
1 files changed, 114 insertions, 0 deletions
diff --git a/modules/xnet/default.nix b/modules/xnet/default.nix
new file mode 100644
index 0000000..9d224cf
--- /dev/null
+++ b/modules/xnet/default.nix
@@ -0,0 +1,114 @@
+{ pkgs, lib, config, ... }:
+let
+ inherit (builtins)
+ fetchurl
+ filter
+ readFile
+ ;
+
+ inherit (lib)
+ mkDefault
+ mkOption
+ types
+ splitString
+ ;
+
+ gitKeys = fetchurl {
+ url = "https://github.com/kbujari.keys";
+ sha256 = "1kskbiyqvjz1wsmcrgh9v0iryf33y70zk503z0m96wmzdjllmc94";
+ };
+
+in
+{
+ imports = [
+ ./disk.nix
+ ./nginx.nix
+ ./persist.nix
+ ./net
+ ./desktop
+ ./gitserver
+ ./monitoring
+ ];
+
+ options.xnet = {
+ pubKeys = mkOption {
+ type = types.listOf types.str;
+ default = filter (s: s != "")
+ (splitString "\n" (readFile gitKeys));
+ };
+ };
+
+ config = {
+ i18n.defaultLocale = mkDefault "en_US.UTF-8";
+ time.timeZone = mkDefault "America/Toronto";
+
+ boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
+
+ nix = {
+ settings = {
+ auto-optimise-store = true;
+ experimental-features = [ "nix-command" "flakes" ];
+ warn-dirty = false;
+
+ # timeout fast from binary cache
+ connect-timeout = 5;
+ };
+ gc = {
+ automatic = true;
+ options = mkDefault "--delete-older-than 30d";
+ };
+ };
+
+ documentation = {
+ doc.enable = mkDefault false;
+ info.enable = mkDefault false;
+ };
+
+ users.mutableUsers = false;
+ users.users.root = {
+ openssh.authorizedKeys.keys = config.xnet.pubKeys;
+ initialPassword = "hello";
+ };
+
+ security.sudo = {
+ execWheelOnly = true;
+ extraConfig = "Defaults lecture = never";
+ };
+
+ nixpkgs.config.allowUnfree = true;
+
+ programs.ssh = {
+ knownHosts = {
+ "github.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
+ "gitlab.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf";
+ "git.sr.ht".publicKey = " ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMZvRd4EtM7R+IHVMWmDkVU3VLQTSwQDSAvW0t2Tkj60";
+ "pascal.ee.ryerson.ca".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmWInQNT6EoU1NtUYzTs5jtpfbO/m6yvCckOiEGjvDc";
+ };
+ extraConfig = ''
+ Host github
+ HostName github.com
+ User git
+ PreferredAuthentications publickey
+
+ Host ee
+ HostName pascal.ee.ryerson.ca
+ User kbujari
+ '';
+ };
+
+ programs.git = {
+ enable = true;
+ config = {
+ init.defaultBranch = "master";
+ fetch.prune = true;
+ core.excludesFile = pkgs.writeText "gitignore" ''
+ # dev shell caching
+ .direnv/
+ .envrc
+ '';
+ push.default = "upstream";
+ push.autoSetupRemote = true;
+ };
+ };
+ };
+}