From 7ed5bdf15fc92c3a51c7e4c8fedf20f97033bcf9 Mon Sep 17 00:00:00 2001 From: Shahab Dogar Date: Sun, 2 Nov 2025 08:29:18 +0500 Subject: [PATCH] chore: formatter --- flake.lock | 78 ++++++++-------- flake.nix | 4 +- home/shahab/aamil-1.nix | 27 ++++++ home/shahab/aamil-2.nix | 27 ++++++ home/shahab/aamil-3.nix | 27 ++++++ home/shahab/common/core/default.nix | 31 ------- .../common/{core => optional}/direnv.nix | 0 .../common/{core => optional}/fonts.nix | 0 .../common/{core => optional}/ghostty.nix | 0 home/shahab/common/{core => optional}/git.nix | 9 +- .../common/{core => optional}/kitty.nix | 0 home/shahab/common/optional/misc-packages.nix | 18 ++++ home/shahab/common/optional/zsh.nix | 16 +++- home/shahab/rihla.nix | 5 + hosts/common/core/default.nix | 3 +- hosts/common/disks/aamil.nix | 44 +++++++++ hosts/common/optional/services/k3s.nix | 14 +++ hosts/common/optional/services/openiscsi.nix | 8 ++ hosts/common/users/primary/default.nix | 2 +- hosts/nixos/aamil-1/default.nix | 92 +++++++++++++++++++ .../nixos/aamil-1/hardware-configuration.nix | 31 +++++++ hosts/nixos/aamil-2/default.nix | 92 +++++++++++++++++++ .../nixos/aamil-2/hardware-configuration.nix | 31 +++++++ hosts/nixos/aamil-3/default.nix | 92 +++++++++++++++++++ .../nixos/aamil-3/hardware-configuration.nix | 31 +++++++ hosts/nixos/rihla/hardware-configuration.nix | 2 +- secret.key | 1 + 27 files changed, 604 insertions(+), 81 deletions(-) create mode 100644 home/shahab/aamil-1.nix create mode 100644 home/shahab/aamil-2.nix create mode 100644 home/shahab/aamil-3.nix rename home/shahab/common/{core => optional}/direnv.nix (100%) rename home/shahab/common/{core => optional}/fonts.nix (100%) rename home/shahab/common/{core => optional}/ghostty.nix (100%) rename home/shahab/common/{core => optional}/git.nix (74%) rename home/shahab/common/{core => optional}/kitty.nix (100%) create mode 100644 hosts/common/disks/aamil.nix create mode 100644 hosts/common/optional/services/k3s.nix create mode 100644 hosts/common/optional/services/openiscsi.nix create mode 100644 hosts/nixos/aamil-1/default.nix create mode 100644 hosts/nixos/aamil-1/hardware-configuration.nix create mode 100644 hosts/nixos/aamil-2/default.nix create mode 100644 hosts/nixos/aamil-2/hardware-configuration.nix create mode 100644 hosts/nixos/aamil-3/default.nix create mode 100644 hosts/nixos/aamil-3/hardware-configuration.nix create mode 100644 secret.key diff --git a/flake.lock b/flake.lock index a8473bc..6efcf7b 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1759499898, - "narHash": "sha256-UNzYHLWfkSzLHDep5Ckb5tXc0fdxwPIrT+MY4kpQttM=", + "lastModified": 1760101617, + "narHash": "sha256-8jf/3ZCi+B7zYpIyV04+3wm72BD7Z801IlOzsOACR7I=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "655e067f96fd44b3f5685e17f566b0e4d535d798", + "rev": "1826a9923881320306231b1c2090379ebf9fa4f8", "type": "github" }, "original": { @@ -55,11 +55,11 @@ ] }, "locked": { - "lastModified": 1758287904, - "narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=", + "lastModified": 1761899396, + "narHash": "sha256-XOpKBp6HLzzMCbzW50TEuXN35zN5WGQREC7n34DcNMM=", "owner": "nix-community", "repo": "disko", - "rev": "67ff9807dd148e704baadbd4fd783b54282ca627", + "rev": "6f4cf5abbe318e4cd1e879506f6eeafd83f7b998", "type": "github" }, "original": { @@ -172,11 +172,11 @@ ] }, "locked": { - "lastModified": 1759550472, - "narHash": "sha256-JLM3D6RbnGmXR8x+3WNac9neklAxA1JtZHZscwukFYw=", + "lastModified": 1761878381, + "narHash": "sha256-lCRaipHgszaFZ1Cs8fdGJguVycCisBAf2HEFgip5+xU=", "owner": "nix-community", "repo": "home-manager", - "rev": "817ace497b72b38da0c08728a683b7febaccf9cf", + "rev": "4ac96eb21c101a3e5b77ba105febc5641a8959aa", "type": "github" }, "original": { @@ -230,11 +230,11 @@ ] }, "locked": { - "lastModified": 1759490292, - "narHash": "sha256-T6iWzDOXp8Wv0KQOCTHpBcmAOdHJ6zc/l9xaztW6Ivc=", + "lastModified": 1760445448, + "narHash": "sha256-fXGjL6dw31FPFRrmIemzGiNSlfvEJTJNsmadZi+qNhI=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "9431db625cd9bb66ac55525479dce694101d6d7a", + "rev": "50fb9f069219f338a11cf0bcccb9e58357d67757", "type": "github" }, "original": { @@ -259,11 +259,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1759530922, - "narHash": "sha256-9NgZKpibALekGTPDc2O8lP8vFealQSZkXe+L+S7MMZU=", + "lastModified": 1761869718, + "narHash": "sha256-jLfwwlPGpnGRAtVDyoGj9FgH2D9hWwyEu0yHkflG2EI=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "76d998743ac10e712238c1016db4d8e8d16f1049", + "rev": "8e9add2afda58d233a75e4c5ce8503b24fa59ceb", "type": "github" }, "original": { @@ -284,11 +284,11 @@ ] }, "locked": { - "lastModified": 1749046714, - "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=", + "lastModified": 1759610243, + "narHash": "sha256-+KEVnKBe8wz+a6dTLq8YDcF3UrhQElwsYJaVaHXJtoI=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330", + "rev": "bd153e76f751f150a09328dbdeb5e4fab9d23622", "type": "github" }, "original": { @@ -406,11 +406,11 @@ ] }, "locked": { - "lastModified": 1759490926, - "narHash": "sha256-7IbZGJ5qAAfZsGhBHIsP8MBsfuFYS0hsxYHVkkeDG5Q=", + "lastModified": 1759619523, + "narHash": "sha256-r1ed7AR2ZEb2U8gy321/Xcp1ho2tzn+gG1te/Wxsj1A=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "94cce794344538c4d865e38682684ec2bbdb2ef3", + "rev": "3df7bde01efb3a3e8e678d1155f2aa3f19e177ef", "type": "github" }, "original": { @@ -490,11 +490,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1759261527, - "narHash": "sha256-wPd5oGvBBpUEzMF0kWnXge0WITNsITx/aGI9qLHgJ4g=", + "lastModified": 1761933221, + "narHash": "sha256-rNHeoG3ZrA94jczyLSjxCtu67YYPYIlXXr0uhG3wNxM=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "e087756cf4abbe1a34f3544c480fc1034d68742f", + "rev": "7467f155fcba189eb088a7601f44fbef7688669b", "type": "github" }, "original": { @@ -505,11 +505,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1759381078, - "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", + "lastModified": 1761114652, + "narHash": "sha256-f/QCJM/YhrV/lavyCVz8iU3rlZun6d+dAiC3H+CDle4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", + "rev": "01f116e4df6a15f4ccdffb1bcd41096869fb385c", "type": "github" }, "original": { @@ -537,11 +537,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1759381078, - "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", + "lastModified": 1761672384, + "narHash": "sha256-o9KF3DJL7g7iYMZq9SWgfS1BFlNbsm6xplRjVlOCkXI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", + "rev": "08dacfca559e1d7da38f3cf05f1f45ee9bfd213c", "type": "github" }, "original": { @@ -561,11 +561,11 @@ ] }, "locked": { - "lastModified": 1758108966, - "narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=", + "lastModified": 1760663237, + "narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b", + "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", "type": "github" }, "original": { @@ -641,11 +641,11 @@ ] }, "locked": { - "lastModified": 1759188042, - "narHash": "sha256-f9QC2KKiNReZDG2yyKAtDZh0rSK2Xp1wkPzKbHeQVRU=", + "lastModified": 1760998189, + "narHash": "sha256-ee2e1/AeGL5X8oy/HXsZQvZnae6XfEVdstGopKucYLY=", "owner": "Mic92", "repo": "sops-nix", - "rev": "9fcfabe085281dd793589bdc770a2e577a3caa5d", + "rev": "5a7d18b5c55642df5c432aadb757140edfeb70b3", "type": "github" }, "original": { @@ -697,11 +697,11 @@ ] }, "locked": { - "lastModified": 1755354946, - "narHash": "sha256-zdov5f/GcoLQc9qYIS1dUTqtJMeDqmBmo59PAxze6e4=", + "lastModified": 1760713634, + "narHash": "sha256-5HXelmz2x/uO26lvW7MudnadbAfoBnve4tRBiDVLtOM=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "a10726d6a8d0ef1a0c645378f983b6278c42eaa0", + "rev": "753bbbdf6a052994da94062e5b753288cef28dfb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7fe6f9c..0649253 100644 --- a/flake.nix +++ b/flake.nix @@ -63,11 +63,11 @@ in { nixosConfigurations = mkHostConfigs (readHosts "nixos"); - devShell.x86_64-linux = let + devShells.x86_64-linux.default = let pkgs = nixpkgs.legacyPackages.x86_64-linux; in pkgs.mkShell { - buildInputs = with pkgs; [nil lua-language-server]; + buildInputs = with pkgs; [nil lua-language-server kubernetes-helm kubectl]; }; }; } diff --git a/home/shahab/aamil-1.nix b/home/shahab/aamil-1.nix new file mode 100644 index 0000000..dff5b70 --- /dev/null +++ b/home/shahab/aamil-1.nix @@ -0,0 +1,27 @@ +{lib, ...}: { + imports = lib.flatten [ + # + # ========== Required Configs ========== + # + ./common/core + + # + # ========== Host-specific Optional Configs ========== + # + (map (config: "${builtins.toString ./.}/common/optional/${config}.nix") [ + "btop" + "nvim" + "starship" + "tmux" + "zsh" + ]) + ]; + + home = { + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + stateVersion = "25.05"; + sessionVariables = { + EDITOR = "nvim"; + }; + }; +} diff --git a/home/shahab/aamil-2.nix b/home/shahab/aamil-2.nix new file mode 100644 index 0000000..dff5b70 --- /dev/null +++ b/home/shahab/aamil-2.nix @@ -0,0 +1,27 @@ +{lib, ...}: { + imports = lib.flatten [ + # + # ========== Required Configs ========== + # + ./common/core + + # + # ========== Host-specific Optional Configs ========== + # + (map (config: "${builtins.toString ./.}/common/optional/${config}.nix") [ + "btop" + "nvim" + "starship" + "tmux" + "zsh" + ]) + ]; + + home = { + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + stateVersion = "25.05"; + sessionVariables = { + EDITOR = "nvim"; + }; + }; +} diff --git a/home/shahab/aamil-3.nix b/home/shahab/aamil-3.nix new file mode 100644 index 0000000..dff5b70 --- /dev/null +++ b/home/shahab/aamil-3.nix @@ -0,0 +1,27 @@ +{lib, ...}: { + imports = lib.flatten [ + # + # ========== Required Configs ========== + # + ./common/core + + # + # ========== Host-specific Optional Configs ========== + # + (map (config: "${builtins.toString ./.}/common/optional/${config}.nix") [ + "btop" + "nvim" + "starship" + "tmux" + "zsh" + ]) + ]; + + home = { + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + stateVersion = "25.05"; + sessionVariables = { + EDITOR = "nvim"; + }; + }; +} diff --git a/home/shahab/common/core/default.nix b/home/shahab/common/core/default.nix index 2406b7e..7979ad3 100644 --- a/home/shahab/common/core/default.nix +++ b/home/shahab/common/core/default.nix @@ -7,11 +7,6 @@ }: { imports = lib.flatten [ (map lib.custom.relativeToRoot ["modules/common" "modules/home-manager"]) - - ./kitty.nix - ./direnv.nix - ./git.nix - ./fonts.nix ]; inherit hostSpec; @@ -27,32 +22,6 @@ VISUAL = "nvim"; EDITOR = "nvim"; }; - - packages = with pkgs; [ - nh - btop - eza - ripgrep - rm-improved - dust - zoxide - xcp - unzip - tmux - gcc - zig - gparted - gnupg - dig - bash - kdePackages.dolphin - font-awesome - tree - wl-clipboard-rs - brightnessctl - age - nerd-fonts.jetbrains-mono - ]; }; nix = { diff --git a/home/shahab/common/core/direnv.nix b/home/shahab/common/optional/direnv.nix similarity index 100% rename from home/shahab/common/core/direnv.nix rename to home/shahab/common/optional/direnv.nix diff --git a/home/shahab/common/core/fonts.nix b/home/shahab/common/optional/fonts.nix similarity index 100% rename from home/shahab/common/core/fonts.nix rename to home/shahab/common/optional/fonts.nix diff --git a/home/shahab/common/core/ghostty.nix b/home/shahab/common/optional/ghostty.nix similarity index 100% rename from home/shahab/common/core/ghostty.nix rename to home/shahab/common/optional/ghostty.nix diff --git a/home/shahab/common/core/git.nix b/home/shahab/common/optional/git.nix similarity index 74% rename from home/shahab/common/core/git.nix rename to home/shahab/common/optional/git.nix index 49b2ea0..3b5d6ef 100644 --- a/home/shahab/common/core/git.nix +++ b/home/shahab/common/optional/git.nix @@ -5,13 +5,14 @@ ... }: { programs.git = { - package = pkgs.gitAndTools.gitFull; enable = true; - userName = config.hostSpec.userFullName; - userEmail = config.hostSpec.email.user; lfs.enable = true; - extraConfig = { + settings = { + user = { + name = config.hostSpec.userFullName; + email = config.hostSpec.email.user; + }; gpg = {format = "ssh";}; "gpg \"ssh\"" = { program = "${lib.getExe' pkgs._1password-gui "op-ssh-sign"}"; diff --git a/home/shahab/common/core/kitty.nix b/home/shahab/common/optional/kitty.nix similarity index 100% rename from home/shahab/common/core/kitty.nix rename to home/shahab/common/optional/kitty.nix diff --git a/home/shahab/common/optional/misc-packages.nix b/home/shahab/common/optional/misc-packages.nix index 41332ba..7f00f08 100644 --- a/home/shahab/common/optional/misc-packages.nix +++ b/home/shahab/common/optional/misc-packages.nix @@ -1,5 +1,23 @@ {pkgs, ...}: { home.packages = with pkgs; [ + uv + btop + zoxide + unzip + tmux + gcc + zig + gparted + gnupg + dig + bash + kdePackages.dolphin + font-awesome + tree + wl-clipboard-rs + brightnessctl + age + nerd-fonts.jetbrains-mono lazygit gh dbeaver-bin diff --git a/home/shahab/common/optional/zsh.nix b/home/shahab/common/optional/zsh.nix index 10cc76d..63011ec 100644 --- a/home/shahab/common/optional/zsh.nix +++ b/home/shahab/common/optional/zsh.nix @@ -1,4 +1,18 @@ -{config, ...}: { +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs; [ + eza + ripgrep + rm-improved + dust + xcp + nh + zoxide + ]; + programs.zsh = { enable = true; enableCompletion = true; diff --git a/home/shahab/rihla.nix b/home/shahab/rihla.nix index 08bed9e..a667d68 100644 --- a/home/shahab/rihla.nix +++ b/home/shahab/rihla.nix @@ -10,8 +10,13 @@ # (map (config: "${builtins.toString ./.}/common/optional/${config}.nix") [ "btop" + "direnv" "firefox" + "fonts" + "ghostty" + "git" "hyprland" + "kitty" "misc-packages" "nvim" "ssh" diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index a66e419..c14e6f8 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -20,7 +20,6 @@ handle = "shahab96"; email = {user = "shahab@dogar.dev";}; userFullName = "Shahab Dogar"; - domain = "rihla"; networking.ports.tcp.ssh = 22; }; @@ -56,7 +55,7 @@ warn-dirty = false; trusted-users = ["@wheel"]; - substituters = ["https://hyprland.cachix.org"]; + substituters = ["https://hyprland.cachix.org" "https://nix.dogar.dev"]; trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; diff --git a/hosts/common/disks/aamil.nix b/hosts/common/disks/aamil.nix new file mode 100644 index 0000000..adbb9cc --- /dev/null +++ b/hosts/common/disks/aamil.nix @@ -0,0 +1,44 @@ +{ + disko.devices = { + disk = { + vdb = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "128M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + luks = { + size = "100%"; + content = { + name = "crypted"; + type = "luks"; + passwordFile = "/tmp/secret.key"; + settings = { + allowDiscards = true; + crypttabExtraOpts = ["fido2-device=auto" "token-timeout=10"]; + }; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/common/optional/services/k3s.nix b/hosts/common/optional/services/k3s.nix new file mode 100644 index 0000000..a8c945d --- /dev/null +++ b/hosts/common/optional/services/k3s.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + k3s + cifs-utils + nfs-utils + ]; + + services.k3s = { + enable = true; + role = "agent"; + token = "K10aad4485a9e2a872775c6560ab812ac1a05d2dc4c86f189fdf56e5fdc673dcc10::server:G7zhbpu7iSUYvM2e"; + serverAddr = "https://rashid:6443"; + }; +} diff --git a/hosts/common/optional/services/openiscsi.nix b/hosts/common/optional/services/openiscsi.nix new file mode 100644 index 0000000..9178f9b --- /dev/null +++ b/hosts/common/optional/services/openiscsi.nix @@ -0,0 +1,8 @@ +{config, ...}: let + hostName = config.hostSpec.hostName; +in { + services.openiscsi = { + enable = true; + name = "iqn.2016-04.com.open-iscsi:${hostName}"; + }; +} diff --git a/hosts/common/users/primary/default.nix b/hosts/common/users/primary/default.nix index 879c09a..249c5d6 100644 --- a/hosts/common/users/primary/default.nix +++ b/hosts/common/users/primary/default.nix @@ -19,7 +19,7 @@ in { home = hostSpec.home; isNormalUser = true; hashedPassword = "$y$j9T$pvjyL7hL5x2VBarGNTnMl1$mLA2UsWTbfp8Hgp/ug5l8224thi..Mo8.p7ME.tDZ.4"; - extraGroups = ["networkmanager" "wheel" "input" "libvirtd"]; + extraGroups = ["networkmanager" "wheel" "input" "libvirtd" "docker"]; # Read all keys in ./keys and add them to authorizedKeys. openssh.authorizedKeys.keys = diff --git a/hosts/nixos/aamil-1/default.nix b/hosts/nixos/aamil-1/default.nix new file mode 100644 index 0000000..cb91810 --- /dev/null +++ b/hosts/nixos/aamil-1/default.nix @@ -0,0 +1,92 @@ +{ + inputs, + pkgs, + lib, + ... +}: let + hostName = "aamil-1"; +in { + imports = lib.flatten [ + # + # ========= Hardware ========= + # + ./hardware-configuration.nix + + # + # ========= Disk Layout ========= + # + inputs.disko.nixosModules.disko + (lib.custom.relativeToRoot "hosts/common/disks/aamil.nix") + + # + # ========= Required Configs ========= + # + (map lib.custom.relativeToRoot ["hosts/common/core"]) + + # + # ========= Services ========= + # + (map + (s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [ + "k3s" + "openiscsi" + "openssh" + ]) + ]; + + # + # ========= Host specification ========= + # + hostSpec = { + hostName = hostName; + }; + + networking = { + hostName = hostName; + networkmanager.enable = true; + enableIPv6 = false; + firewall.enable = false; + }; + + nix = { + settings = { + require-sigs = false; + experimental-features = ["nix-command" "flakes"]; + }; + }; + + # Set your time zone. + time.timeZone = "Asia/Karachi"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # Fixes for longhorn + systemd.tmpfiles.rules = [ + "L+ /usr/local/bin - - - - /run/current-system/sw/bin/" + ]; + virtualisation.docker.logDriver = "json-file"; + + security.sudo.extraRules = [ + { + users = ["shahab"]; + commands = [ + { + command = "ALL"; + options = ["NOPASSWD"]; + } + ]; + } + ]; + + environment.systemPackages = with pkgs; [ + neovim + git + ]; + + system.stateVersion = "25.05"; +} diff --git a/hosts/nixos/aamil-1/hardware-configuration.nix b/hosts/nixos/aamil-1/hardware-configuration.nix new file mode 100644 index 0000000..10c62a0 --- /dev/null +++ b/hosts/nixos/aamil-1/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + + boot = { + loader = { + # Use the systemd-boot EFI boot loader. + systemd-boot = { + enable = true; + configurationLimit = 1; + }; + efi.canTouchEfiVariables = true; + }; + initrd = { + availableKernelModules = ["ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod"]; + kernelModules = []; + }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nixos/aamil-2/default.nix b/hosts/nixos/aamil-2/default.nix new file mode 100644 index 0000000..7a1a510 --- /dev/null +++ b/hosts/nixos/aamil-2/default.nix @@ -0,0 +1,92 @@ +{ + inputs, + pkgs, + lib, + ... +}: let + hostName = "aamil-2"; +in { + imports = lib.flatten [ + # + # ========= Hardware ========= + # + ./hardware-configuration.nix + + # + # ========= Disk Layout ========= + # + inputs.disko.nixosModules.disko + (lib.custom.relativeToRoot "hosts/common/disks/aamil.nix") + + # + # ========= Required Configs ========= + # + (map lib.custom.relativeToRoot ["hosts/common/core"]) + + # + # ========= Services ========= + # + (map + (s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [ + "k3s" + "openiscsi" + "openssh" + ]) + ]; + + # + # ========= Host specification ========= + # + hostSpec = { + hostName = hostName; + }; + + networking = { + hostName = hostName; + networkmanager.enable = true; + enableIPv6 = false; + firewall.enable = false; + }; + + nix = { + settings = { + require-sigs = false; + experimental-features = ["nix-command" "flakes"]; + }; + }; + + # Set your time zone. + time.timeZone = "Asia/Karachi"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # Fixes for longhorn + systemd.tmpfiles.rules = [ + "L+ /usr/local/bin - - - - /run/current-system/sw/bin/" + ]; + virtualisation.docker.logDriver = "json-file"; + + security.sudo.extraRules = [ + { + users = ["shahab"]; + commands = [ + { + command = "ALL"; + options = ["NOPASSWD"]; + } + ]; + } + ]; + + environment.systemPackages = with pkgs; [ + neovim + git + ]; + + system.stateVersion = "25.05"; +} diff --git a/hosts/nixos/aamil-2/hardware-configuration.nix b/hosts/nixos/aamil-2/hardware-configuration.nix new file mode 100644 index 0000000..78f756d --- /dev/null +++ b/hosts/nixos/aamil-2/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + + boot = { + loader = { + # Use the systemd-boot EFI boot loader. + systemd-boot = { + enable = true; + configurationLimit = config.hostSpec.bootHistoryLimit; + }; + efi.canTouchEfiVariables = true; + }; + initrd = { + availableKernelModules = ["nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod"]; + kernelModules = []; + }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nixos/aamil-3/default.nix b/hosts/nixos/aamil-3/default.nix new file mode 100644 index 0000000..0a9d985 --- /dev/null +++ b/hosts/nixos/aamil-3/default.nix @@ -0,0 +1,92 @@ +{ + inputs, + pkgs, + lib, + ... +}: let + hostName = "aamil-3"; +in { + imports = lib.flatten [ + # + # ========= Hardware ========= + # + ./hardware-configuration.nix + + # + # ========= Disk Layout ========= + # + inputs.disko.nixosModules.disko + (lib.custom.relativeToRoot "hosts/common/disks/aamil.nix") + + # + # ========= Required Configs ========= + # + (map lib.custom.relativeToRoot ["hosts/common/core"]) + + # + # ========= Services ========= + # + (map + (s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [ + "k3s" + "openiscsi" + "openssh" + ]) + ]; + + # + # ========= Host specification ========= + # + hostSpec = { + hostName = hostName; + }; + + networking = { + hostName = hostName; + networkmanager.enable = true; + enableIPv6 = false; + firewall.enable = false; + }; + + nix = { + settings = { + require-sigs = false; + experimental-features = ["nix-command" "flakes"]; + }; + }; + + # Set your time zone. + time.timeZone = "Asia/Karachi"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # Fixes for longhorn + systemd.tmpfiles.rules = [ + "L+ /usr/local/bin - - - - /run/current-system/sw/bin/" + ]; + virtualisation.docker.logDriver = "json-file"; + + security.sudo.extraRules = [ + { + users = ["shahab"]; + commands = [ + { + command = "ALL"; + options = ["NOPASSWD"]; + } + ]; + } + ]; + + environment.systemPackages = with pkgs; [ + neovim + git + ]; + + system.stateVersion = "25.05"; +} diff --git a/hosts/nixos/aamil-3/hardware-configuration.nix b/hosts/nixos/aamil-3/hardware-configuration.nix new file mode 100644 index 0000000..78f756d --- /dev/null +++ b/hosts/nixos/aamil-3/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + + boot = { + loader = { + # Use the systemd-boot EFI boot loader. + systemd-boot = { + enable = true; + configurationLimit = config.hostSpec.bootHistoryLimit; + }; + efi.canTouchEfiVariables = true; + }; + initrd = { + availableKernelModules = ["nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod"]; + kernelModules = []; + }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nixos/rihla/hardware-configuration.nix b/hosts/nixos/rihla/hardware-configuration.nix index 7515487..de2e76d 100644 --- a/hosts/nixos/rihla/hardware-configuration.nix +++ b/hosts/nixos/rihla/hardware-configuration.nix @@ -2,7 +2,6 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { - pkgs, config, lib, modulesPath, @@ -26,6 +25,7 @@ kernelModules = ["kvm-amd"]; extraModulePackages = []; + binfmt.emulatedSystems = ["aarch64-linux"]; # Add other target architectures as needed }; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/secret.key b/secret.key new file mode 100644 index 0000000..901a802 --- /dev/null +++ b/secret.key @@ -0,0 +1 @@ +kernel-hacker!