diff --git a/flake.nix b/flake.nix index 2bbe76d..541ef9f 100644 --- a/flake.nix +++ b/flake.nix @@ -17,19 +17,6 @@ }: let system = "x86_64-linux"; - mkHost = hostname: { - imports = [ - ./hosts/${hostname}/configuration.nix - ./modules/common - (import "${home-manager}/nixos") - ]; - - deployment = { - targetUser = "root"; - targetHost = hostname; - allowLocalDeployment = true; - }; - }; in { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; @@ -41,7 +28,30 @@ }; }; - bengal = mkHost "bengal"; + bengal = { name, nodes, pkgs, ... }: { + imports = [ + ./hosts/${name}/configuration.nix + ./modules/common + (import "${home-manager}/nixos") + ]; + + deployment = { + targetUser = "sammy"; + allowLocalDeployment = true; + }; + }; + + maine-coon = { name, nodes, pkgs, ... }: { + imports = [ + ./hosts/${name}/configuration.nix + ./modules/common + (import "${home-manager}/nixos") + ]; + deployment = { + targetHost = "maine-coon"; + allowLocalDeployment = true; + }; + }; }; nixosConfigurations.test = nixpkgs.lib.nixosSystem { inherit system; diff --git a/hosts/maine-coon/configuration.nix b/hosts/maine-coon/configuration.nix new file mode 100644 index 0000000..8c54f39 --- /dev/null +++ b/hosts/maine-coon/configuration.nix @@ -0,0 +1,50 @@ +{ + config, + pkgs, + lib, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + networking.hostName = "maine-coon"; + + boot.loader.grub.device = "/dev/nvme0n1"; + + networking.useDHCP = false; + networking.interfaces."enp0s31f6".ipv4.addresses = [ + { + address = "159.69.71.253"; + prefixLength = 26; + } + ]; + networking.interfaces."enp0s31f6".ipv6.addresses = [ + { + address = "2a01:4f8:231:16dc::1"; + prefixLength = 64; + } + ]; + networking.defaultGateway = "159.69.71.193"; + networking.defaultGateway6 = { + address = "fe80::1"; + interface = "enp0s31f6"; + }; + networking.nameservers = ["8.8.8.8"]; + + # Initial empty root password for easy login: + services.openssh.permitRootLogin = lib.mkForce "prohibit-password"; + + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" + ]; + + services.openssh.enable = true; + + # This value determines the NixOS release with which your system is to be + # compatible, in order to avoid breaking some software such as database + # servers. You should change this only after NixOS release notes say you + # should. + system.stateVersion = "24.05"; # Did you read the comment? +} diff --git a/hosts/maine-coon/hardware-configuration.nix b/hosts/maine-coon/hardware-configuration.nix new file mode 100644 index 0000000..a880a00 --- /dev/null +++ b/hosts/maine-coon/hardware-configuration.nix @@ -0,0 +1,27 @@ +# 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, + ... +}: { + + boot.initrd.availableKernelModules = ["ahci" "nvme"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/nvme0n1p2"; + fsType = "btrfs"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/69ed72d0-20c2-440e-a036-7de658766ee0"; + fsType = "ext2"; + }; + + swapDevices = []; +} diff --git a/hosts/test-vm/configuration.nix b/hosts/test-vm/configuration.nix index 5bbc5f8..ce36a78 100644 --- a/hosts/test-vm/configuration.nix +++ b/hosts/test-vm/configuration.nix @@ -1,5 +1,9 @@ -{ config, lib, pkgs, ... }: { - +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../../modules/common ../../modules/graphical @@ -9,12 +13,12 @@ users.users.admin = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; password = "admin"; group = "admin"; }; - users.groups.admin = { }; + users.groups.admin = {}; virtualisation.vmVariant = { # following configuration is added only when building VM with build-vm @@ -30,7 +34,7 @@ settings.PasswordAuthentication = lib.mkForce true; }; - networking.firewall.allowedTCPPorts = [ 22 ]; + networking.firewall.allowedTCPPorts = [22]; environment.systemPackages = with pkgs; [ htop ]; diff --git a/modules/common/default.nix b/modules/common/default.nix index 13156f2..67b1f1e 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,12 +1,11 @@ -{ lib -, config -, pkgs -, ... -}: -let - cfg = config.cherrykitten.common; -in { + lib, + config, + pkgs, + ... +}: let + cfg = config.cherrykitten.common; +in { imports = [ ../users ./security.nix @@ -23,7 +22,7 @@ in }; config = { - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; time.timeZone = "Europe/Berlin"; @@ -44,10 +43,10 @@ in nerdfonts ]; fontconfig = { - defaultFonts.emoji = [ "Noto Emoji" ]; - defaultFonts.serif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font" ]; - defaultFonts.sansSerif = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font" ]; - defaultFonts.monospace = [ "Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" ]; + defaultFonts.emoji = ["Noto Emoji"]; + defaultFonts.serif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font"]; + defaultFonts.sansSerif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font"]; + defaultFonts.monospace = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font"]; }; }; diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index fba13a1..9a63ffc 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -1,12 +1,11 @@ -{ pkgs -, config -, lib -, ... -}: -let - cfg = config.cherrykitten.graphical; -in { + pkgs, + config, + lib, + ... +}: let + cfg = config.cherrykitten.graphical; +in { options.cherrykitten.graphical = { enable = lib.mkEnableOption (lib.mdDoc "graphical stuffs"); };