From 57de4ede0cef89c04a3728e4f8c97f67ce771eff Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sun, 12 Oct 2025 11:23:58 -0400 Subject: generalize server --- config/git/default.nix | 15 +++++++-- flake.nix | 4 +-- machines/git/configuration.nix | 32 ------------------- machines/git/hardware-configuration.nix | 56 --------------------------------- machines/git/home.nix | 20 ------------ machines/oxo/configuration.nix | 33 +++++++++++++++++++ machines/oxo/git-home.nix | 19 +++++++++++ machines/oxo/hardware-configuration.nix | 56 +++++++++++++++++++++++++++++++++ machines/oxo/home.nix | 37 ++++++++++++++++++++++ modules/compromyse.nix | 1 + modules/git/cgit.nix | 4 ++- modules/git/compromyse.nix | 11 ------- modules/git/git.nix | 9 ------ modules/git/user.nix | 8 +++++ 14 files changed, 172 insertions(+), 133 deletions(-) delete mode 100644 machines/git/configuration.nix delete mode 100644 machines/git/hardware-configuration.nix delete mode 100644 machines/git/home.nix create mode 100644 machines/oxo/configuration.nix create mode 100644 machines/oxo/git-home.nix create mode 100644 machines/oxo/hardware-configuration.nix create mode 100644 machines/oxo/home.nix delete mode 100644 modules/git/compromyse.nix delete mode 100644 modules/git/git.nix create mode 100644 modules/git/user.nix diff --git a/config/git/default.nix b/config/git/default.nix index 838af82..f3f223d 100644 --- a/config/git/default.nix +++ b/config/git/default.nix @@ -6,28 +6,35 @@ userName = "Raghuram Subramani"; userEmail = "raghus2247@gmail.com"; extraConfig = { + init = { defaultBranch = "main"; }; + format = { signoff = true; }; + url = { "git@github.com:" = { insteadOf = [ - "gh:" "github:" ]; }; "git@github.com:compromyse/" = { insteadOf = [ - "cm:" "compromyse:" ]; }; + "git@git.compromyse.xyz:" = { + insteadOf = [ + "oxo:" + ]; + }; + }; "filter \"lfs\"" = { @@ -36,7 +43,11 @@ process = "${pkgs.git-lfs}/bin/git-lfs filter-process --skip"; required = true; }; + push = { autoSetupRemote = true; }; + + safe.directory = "*"; + }; }; } diff --git a/flake.nix b/flake.nix index 4eee65c..b9fa965 100644 --- a/flake.nix +++ b/flake.nix @@ -49,11 +49,11 @@ ]; }; - git = nixpkgs.lib.nixosSystem { + oxo = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ - ./machines/git/configuration.nix + ./machines/oxo/configuration.nix inputs.home-manager.nixosModules.default ]; diff --git a/machines/git/configuration.nix b/machines/git/configuration.nix deleted file mode 100644 index a244c64..0000000 --- a/machines/git/configuration.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, inputs, pkgs, ... }: - -{ - imports = [ - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ] ++ (map (path: ../../modules/${path}) [ - "core/global.nix" - "ssh.nix" - "git/compromyse.nix" - "git/cgit.nix" - "git/git.nix" - ]); - - networking.hostName = "git"; - - boot.loader.grub = { - enable = true; - forceInstall = true; - device = "/dev/sda"; - }; - - programs.fuse.userAllowOther = true; - home-manager = { - extraSpecialArgs = { inherit inputs; }; - useGlobalPkgs = true; - useUserPackages = true; - users = { - "compromyse" = import ./home.nix; - }; - }; -} diff --git a/machines/git/hardware-configuration.nix b/machines/git/hardware-configuration.nix deleted file mode 100644 index b10d174..0000000 --- a/machines/git/hardware-configuration.nix +++ /dev/null @@ -1,56 +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 + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; - fsType = "btrfs"; - options = [ "subvol=boot" ]; - }; - - fileSystems."/home" = - { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; - - fileSystems."/config" = - { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; - fsType = "btrfs"; - options = [ "subvol=config" ]; - }; - - swapDevices = [ ]; - - # 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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/machines/git/home.nix b/machines/git/home.nix deleted file mode 100644 index 723879e..0000000 --- a/machines/git/home.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ inputs, pkgs, ... }: - -{ - home = { - username = "compromyse"; - homeDirectory = "/home/compromyse"; - }; - - home.packages = with pkgs; [ - git-lfs - ]; - - imports = (map (path: ../../config/${path}) [ - "bash.nix" - "git" - "nvim" - ]); - - home.stateVersion = "23.11"; -} diff --git a/machines/oxo/configuration.nix b/machines/oxo/configuration.nix new file mode 100644 index 0000000..ef7a84b --- /dev/null +++ b/machines/oxo/configuration.nix @@ -0,0 +1,33 @@ +{ lib, inputs, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ] ++ (map (path: ../../modules/${path}) [ + "core/global.nix" + "ssh.nix" + "compromyse.nix" + "git/user.nix" + "git/cgit.nix" + ]); + + networking.hostName = "oxo"; + + boot.loader.grub = { + enable = true; + forceInstall = true; + device = "/dev/sda"; + }; + + programs.fuse.userAllowOther = true; + home-manager = { + extraSpecialArgs = { inherit inputs; }; + useGlobalPkgs = true; + useUserPackages = true; + users = { + git = import ./git-home.nix; + compromyse = import ./home.nix + }; + }; +} diff --git a/machines/oxo/git-home.nix b/machines/oxo/git-home.nix new file mode 100644 index 0000000..ce20f9e --- /dev/null +++ b/machines/oxo/git-home.nix @@ -0,0 +1,19 @@ +{ inputs, pkgs, ... }: + +{ + home = { + username = "git"; + homeDirectory = "/home/git"; + }; + + home.packages = with pkgs; [ + git-lfs + ]; + + imports = (map (path: ../../config/${path}) [ + "git" + "nvim" + ]); + + home.stateVersion = "23.11"; +} diff --git a/machines/oxo/hardware-configuration.nix b/machines/oxo/hardware-configuration.nix new file mode 100644 index 0000000..b10d174 --- /dev/null +++ b/machines/oxo/hardware-configuration.nix @@ -0,0 +1,56 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; + fsType = "btrfs"; + options = [ "subvol=boot" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/config" = + { device = "/dev/disk/by-uuid/f321b489-3003-4d4a-8e86-0eee0584e0f6"; + fsType = "btrfs"; + options = [ "subvol=config" ]; + }; + + swapDevices = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/machines/oxo/home.nix b/machines/oxo/home.nix new file mode 100644 index 0000000..8672e15 --- /dev/null +++ b/machines/oxo/home.nix @@ -0,0 +1,37 @@ +{ inputs, pkgs, ... }: + +{ + home = { + username = "compromyse"; + homeDirectory = "/home/compromyse"; + }; + + home.packages = with pkgs; [ + tmux + fzf + fd + ripgrep + + unzip + zip + ]; + + programs = { + direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + bash.enable = true; + }; + + imports = (map (path: ../../config/${path}) [ + "bash.nix" + "dotfiles.nix" + "git" + "nvim" + ]); + + home.stateVersion = "23.11"; +} diff --git a/modules/compromyse.nix b/modules/compromyse.nix index e8484c8..0c4b2a0 100644 --- a/modules/compromyse.nix +++ b/modules/compromyse.nix @@ -4,6 +4,7 @@ users.users.compromyse = { hashedPassword = "$y$j9T$sLByWUVQIl0D6AzHKpVat/$VAsX7YK1NCy2H4XxhVTKdkhWXHuzdMMHq6tC4liH879"; isNormalUser = true; + openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDljZ44cNtYqvpeGuUsMRekkjiyaCLraX7GHp2BJGyhvUnCpVz7I5K6SGQ92vnEdkbQpUEs29Cw5RTYTKDXcn1zyl7fi/jLWVLgV3Apc7dbJvhQOTfxB24D5EuOR+3nZFtR1C89VNiB55ahqoBAxGMxr9GkOaKplruT1u+UOAW7wRwCGWoC7ySuVRnEoquWsv3ZHZhxTgmM6b8wnOk9K/to0JY51fbZ56OXcUKRUNkq4QzVMWEhWEpOuSFeufOewCjUIcMQkWzjG3XiqF7gBGnNqbvPlWOB3iLbAdOGBfkAxFlzTBGzwNEGWV39AMWHA1dRBKeETo5sHACsorpIQ3IHR3uHz3YccqhzOBqERqU419ioLdHSQt7uXS54AvZ7ZAMm/RZBeFdupT2dhfOdmvY/2ZHHEuP55A3GExlthaFR+SPKc1q/MhtX/+hBhtkPH+RMP/WPgPbXBCLVdL/ul/vGk8CGCFeKAVrexmz5q+5xax/gDIKfS3ynoMCrWxoto2U= raghus2247@gmail.com" ]; # openssh.authorizedKeys.keys = []; extraGroups = [ "wheel" "video" "storage" "input" "plugdev" "libvirtd" "docker" "kvm" "lp" ]; }; diff --git a/modules/git/cgit.nix b/modules/git/cgit.nix index cd29b82..56a9b76 100644 --- a/modules/git/cgit.nix +++ b/modules/git/cgit.nix @@ -18,10 +18,12 @@ in { settings = { root-title = "compromyse: CGIT"; root-desc = "Compromyse's Git Repositories"; - root-readme = "README.md"; + + repository-sort = "age"; enable-commit-graph = true; enable-follow-links = true; + section-from-path = true; source-filter = "${cgit}/lib/cgit/filters/syntax-highlighting.py"; about-filter = "${cgit}/lib/cgit/filters/about-formatting.sh"; diff --git a/modules/git/compromyse.nix b/modules/git/compromyse.nix deleted file mode 100644 index 41596d1..0000000 --- a/modules/git/compromyse.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, ... }: - -{ - users.users.compromyse = { - initialPassword = "testing"; - isNormalUser = true; - openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDljZ44cNtYqvpeGuUsMRekkjiyaCLraX7GHp2BJGyhvUnCpVz7I5K6SGQ92vnEdkbQpUEs29Cw5RTYTKDXcn1zyl7fi/jLWVLgV3Apc7dbJvhQOTfxB24D5EuOR+3nZFtR1C89VNiB55ahqoBAxGMxr9GkOaKplruT1u+UOAW7wRwCGWoC7ySuVRnEoquWsv3ZHZhxTgmM6b8wnOk9K/to0JY51fbZ56OXcUKRUNkq4QzVMWEhWEpOuSFeufOewCjUIcMQkWzjG3XiqF7gBGnNqbvPlWOB3iLbAdOGBfkAxFlzTBGzwNEGWV39AMWHA1dRBKeETo5sHACsorpIQ3IHR3uHz3YccqhzOBqERqU419ioLdHSQt7uXS54AvZ7ZAMm/RZBeFdupT2dhfOdmvY/2ZHHEuP55A3GExlthaFR+SPKc1q/MhtX/+hBhtkPH+RMP/WPgPbXBCLVdL/ul/vGk8CGCFeKAVrexmz5q+5xax/gDIKfS3ynoMCrWxoto2U= raghus2247@gmail.com" ]; - extraGroups = [ "wheel" ]; - }; - security.sudo.wheelNeedsPassword = false; -} diff --git a/modules/git/git.nix b/modules/git/git.nix deleted file mode 100644 index 9888dba..0000000 --- a/modules/git/git.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, ... }: - -{ - environment.etc."gitconfig".text = " - [safe] - directory = * - "; -} - diff --git a/modules/git/user.nix b/modules/git/user.nix new file mode 100644 index 0000000..797b452 --- /dev/null +++ b/modules/git/user.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + users.users.git = { + isNormalUser = true; + openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDljZ44cNtYqvpeGuUsMRekkjiyaCLraX7GHp2BJGyhvUnCpVz7I5K6SGQ92vnEdkbQpUEs29Cw5RTYTKDXcn1zyl7fi/jLWVLgV3Apc7dbJvhQOTfxB24D5EuOR+3nZFtR1C89VNiB55ahqoBAxGMxr9GkOaKplruT1u+UOAW7wRwCGWoC7ySuVRnEoquWsv3ZHZhxTgmM6b8wnOk9K/to0JY51fbZ56OXcUKRUNkq4QzVMWEhWEpOuSFeufOewCjUIcMQkWzjG3XiqF7gBGnNqbvPlWOB3iLbAdOGBfkAxFlzTBGzwNEGWV39AMWHA1dRBKeETo5sHACsorpIQ3IHR3uHz3YccqhzOBqERqU419ioLdHSQt7uXS54AvZ7ZAMm/RZBeFdupT2dhfOdmvY/2ZHHEuP55A3GExlthaFR+SPKc1q/MhtX/+hBhtkPH+RMP/WPgPbXBCLVdL/ul/vGk8CGCFeKAVrexmz5q+5xax/gDIKfS3ynoMCrWxoto2U= raghus2247@gmail.com" ]; + }; +} -- cgit v1.2.3