nixos-server/flake.nix

69 lines
2.1 KiB
Nix

{
description = "NixOs configuration for my server";
inputs = {
nixpkgs.url = "github:NixOs/nixpkgs/nixos-24.05";
nixos-config.url = "git+https://githug.xyz/rachel/nixos-config";
# rachelcafe.url = "git+https://githug.xyz/rachel/rachel.cafe";
};
outputs = inputs@{ self, nixpkgs, nixos-config,
#rachelcafe,
... }:
let nix-config-module =
{
nix.registry.nixpkgs.flake = nixpkgs;
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
};
# 8080 on host is 80 on guest
# 2222 on host is 22 on guest
# 22222 on host is 222 on guest
virt-module = {
virtualisation.vmVariant = {
virtualisation.cores = 4;
virtualisation.memorySize = 4096;
virtualisation.forwardPorts = [
{ from = "host"; host.port = 8080; guest.port = 80; }
{ from = "host"; host.port = 2222; guest.port = 22; }
{ from = "host"; host.port = 22222; guest.port = 222; }
{ from = "host"; host.port = 2223; guest.port = 2222; }
];
};
};
keyboard-module = {
console = {
useXkbConfig = true;
};
services.xserver = {
xkb = {
layout = "fox";
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = nixos-config.keyboardLayouts.fox;
};
};
};
};
state-version = "24.05";
modules = [
nix-config-module
keyboard-module
(import ./host.nix {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
inherit inputs state-version;
})
];
in {
nixosConfigurations.cafe = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
inherit modules;
};
nixosConfigurations.cafe-virt = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = modules ++ [ virt-module ];
};
};
}