From 4fd8fb6e6f6778903358e565c29514482790b9bc Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Mon, 1 Apr 2024 22:06:44 +0200 Subject: [PATCH] Made a new machine: Solis. It is the Latin word for sun, as it is my personal server. --- flake.nix | 8 ++- home-manager/{home.nix => apps.nix} | 7 +-- home-manager/server-apps.nix | 54 +++++++++++++++++ machines/luna/configuration.nix | 2 +- machines/solis/configuration.nix | 73 +++++++++++++++++++++++ machines/solis/hardware-configuration.nix | 34 +++++++++++ machines/terra/configuration.nix | 2 +- 7 files changed, 172 insertions(+), 8 deletions(-) rename home-manager/{home.nix => apps.nix} (88%) create mode 100644 home-manager/server-apps.nix create mode 100644 machines/solis/configuration.nix create mode 100644 machines/solis/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index b850f14..d1409ff 100644 --- a/flake.nix +++ b/flake.nix @@ -1,4 +1,4 @@ -{ +r{ description = "Your new nix config"; inputs = { @@ -71,6 +71,12 @@ ./machines/terra/configuration.nix ]; }; + solis = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./machines/solis/configuration.nix + ]; + }; }; }; } diff --git a/home-manager/home.nix b/home-manager/apps.nix similarity index 88% rename from home-manager/home.nix rename to home-manager/apps.nix index 97faf45..0041dfb 100644 --- a/home-manager/home.nix +++ b/home-manager/apps.nix @@ -52,15 +52,12 @@ programs.home-manager.enable = true; programs.git = { enable = true; - userName = "KoenDR06"; userEmail = - "koen.de.ruiter@hotmail.com"; + userName = "KoenDR06"; + userEmail = "koen.de.ruiter@hotmail.com"; }; programs.firefox.enable = true; programs.gh.enable = true; programs.zsh = { - shellAliases = { - update = "sudo nixos-rebuild switch --flake .#laptop-koen"; - }; oh-my-zsh = { enable = true; plugins = [ "git" ]; diff --git a/home-manager/server-apps.nix b/home-manager/server-apps.nix new file mode 100644 index 0000000..8fbc6e9 --- /dev/null +++ b/home-manager/server-apps.nix @@ -0,0 +1,54 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + imports = []; + + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + ]; + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + }; + }; + + home = { + username = "horseman"; + homeDirectory = "/home/horseman"; + }; + + # Enable programs + home.packages = with pkgs; [ + htop + zoxide + ]; + + programs.home-manager.enable = true; + programs.git = { + enable = true; + userName = "KoenDR06"; + userEmail = "koen.de.ruiter@hotmail.com"; + }; + programs.gh.enable = true; + programs.zsh = { + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + theme = "agnoster"; + }; + }; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.05"; +} diff --git a/machines/luna/configuration.nix b/machines/luna/configuration.nix index 960f5b2..1f2d278 100644 --- a/machines/luna/configuration.nix +++ b/machines/luna/configuration.nix @@ -31,7 +31,7 @@ extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration - horseman = import ../../home-manager/home.nix; + horseman = import ../../home-manager/apps.nix; }; }; diff --git a/machines/solis/configuration.nix b/machines/solis/configuration.nix new file mode 100644 index 0000000..2773e85 --- /dev/null +++ b/machines/solis/configuration.nix @@ -0,0 +1,73 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ./hardware-configuration.nix + ]; + + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + users = { + horseman = import ../../home-manager/home.nix; + }; + }; + + nixpkgs = { + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + ]; + config = { + allowUnfree = true; + }; + }; + + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + networking.hostName = "solis"; + boot.loader.systemd-boot.enable = true; + + users.users = { + horseman = { + initialPassword = "1234"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + extraGroups = ["wheel"]; + }; + }; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.11"; +} diff --git a/machines/solis/hardware-configuration.nix b/machines/solis/hardware-configuration.nix new file mode 100644 index 0000000..02593b1 --- /dev/null +++ b/machines/solis/hardware-configuration.nix @@ -0,0 +1,34 @@ +# 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 = [ "ahci" "ohci_pci" "ehci_pci" "pata_atiixp" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/74211087-d087-49d5-bc58-eb49748a51f0"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/bfe8c490-e8d7-438e-b95b-5bc5743bb23b"; } + ]; + + # 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.enp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/terra/configuration.nix b/machines/terra/configuration.nix index 6a1e0cc..2073d7b 100644 --- a/machines/terra/configuration.nix +++ b/machines/terra/configuration.nix @@ -74,7 +74,7 @@ extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration - horseman = import ../../home-manager/home.nix; + horseman = import ../../home-manager/apps.nix; }; };