diff --git a/nixos/machines/bragi/configuration.nix b/nixos/machines/bragi/configuration.nix new file mode 100644 index 0000000..6c63736 --- /dev/null +++ b/nixos/machines/bragi/configuration.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./hardware-configuration.nix + ../../roles + ../../roles/hardware.nix + ./network.nix + ]; + + # System configuration here + networking.hostName = "bragi"; + system.stateVersion = "23.11"; +} diff --git a/nixos/machines/bragi/hardware-configuration.nix b/nixos/machines/bragi/hardware-configuration.nix new file mode 100644 index 0000000..13a0333 --- /dev/null +++ b/nixos/machines/bragi/hardware-configuration.nix @@ -0,0 +1,30 @@ +{lib, ...}: { + imports = []; + + fileSystems."/" = { + device = "gha-root"; + fsType = "tmpfs"; + options = ["size=1G" "mode=755"]; + }; + fileSystems."/persist" = { + device = "/dev/disk/by-uuid/"; #TODO + fsType = "btrfs"; + options = ["subvol=persist"]; + neededForBoot = true; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/"; #TODO + fsType = "ext4"; + }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/"; #TODO + fsType = "btrfs"; + options = ["subvol=nix"]; + }; + + swapDevices = [{device = "/dev/disk/by-uuid/";}]; #TODO + + nix.settings.max-jobs = lib.mkDefault 4; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/machines/bragi/network.nix b/nixos/machines/bragi/network.nix new file mode 100644 index 0000000..88b395a --- /dev/null +++ b/nixos/machines/bragi/network.nix @@ -0,0 +1,16 @@ +# We sohuld put that config somewhere in roles and give it a parameter or something, +# everyone gets the same nameserver and the same prefixLength and address vs defaultGateway alsways +# depend on the same thing +{ + imports = []; + networking = { + interfaces.enp4s0f1.ipv4.addresses = [ + { + address = "192.168.1.11"; + prefixLength = 24; + } + ]; + defaultGateway = "192.168.1.137"; + nameservers = ["130.83.2.22" "130.83.56.60" "130.83.22.60" "130.82.22.63"]; + }; +} diff --git a/nixos/machines/ghatanothoa/configuration.nix b/nixos/machines/ghatanothoa/configuration.nix index 3b4faa5..207e37f 100644 --- a/nixos/machines/ghatanothoa/configuration.nix +++ b/nixos/machines/ghatanothoa/configuration.nix @@ -3,6 +3,7 @@ ./hardware-configuration.nix ../../modules/jitsi.nix ../../roles + ../../roles/vm.nix ./network.nix ]; diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index 60284a7..2936ac3 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -1,16 +1,15 @@ { pkgs, lib, - modulesPath, ... }: { imports = [ ./admins.nix ./nix_keys.nix ./prometheusNodeExporter.nix - (modulesPath + "/virtualisation/xen-domU.nix") ../modules/impermanence.nix ]; + nix = { extraOptions = '' experimental-features = nix-command flakes diff --git a/nixos/roles/hardware.nix b/nixos/roles/hardware.nix new file mode 100644 index 0000000..ac55bcc --- /dev/null +++ b/nixos/roles/hardware.nix @@ -0,0 +1,5 @@ +{ + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/nixos/roles/vm.nix b/nixos/roles/vm.nix new file mode 100644 index 0000000..45a995e --- /dev/null +++ b/nixos/roles/vm.nix @@ -0,0 +1,8 @@ +{ + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/virtualisation/xen-domU.nix") + ]; +}