2024-05-23 10:59:42 +02:00
|
|
|
{
|
2024-05-23 11:21:24 +02:00
|
|
|
description = "NixOs configuration for my server";
|
2024-05-23 10:59:42 +02:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOs/nixpkgs/nixos-23.11";
|
2024-05-23 11:21:24 +02:00
|
|
|
nixos-config.url = "git+https://githug.xyz/rachel/nixos-config";
|
2024-05-23 10:59:42 +02:00
|
|
|
};
|
|
|
|
|
2024-05-23 11:21:24 +02:00
|
|
|
outputs = { self, nixpkgs, nixos-config, ... }:
|
2024-05-23 10:59:42 +02:00
|
|
|
let nix-config-module =
|
|
|
|
{
|
|
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
|
|
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
|
|
|
};
|
2024-05-24 22:30:04 +02:00
|
|
|
# 8080 on host is 80 on guest
|
|
|
|
# 2222 on host is 22 on guest
|
2024-05-24 11:13:36 +02:00
|
|
|
virt-module = {
|
|
|
|
virtualisation.vmVariant = {
|
|
|
|
virtualisation.cores = 4;
|
|
|
|
virtualisation.memorySize = 4096;
|
|
|
|
virtualisation.forwardPorts = [
|
|
|
|
{ from = "host"; host.port = 8080; guest.port = 80; }
|
2024-05-24 22:30:04 +02:00
|
|
|
{ from = "host"; host.port = 2222; guest.port = 22; }
|
2024-05-24 11:13:36 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2024-05-23 11:21:24 +02:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-05-24 11:13:36 +02:00
|
|
|
state-version = "23.11";
|
2024-05-23 10:59:42 +02:00
|
|
|
modules = [
|
|
|
|
nix-config-module
|
2024-05-23 11:21:24 +02:00
|
|
|
keyboard-module
|
2024-05-24 11:13:36 +02:00
|
|
|
(import ./host.nix state-version {
|
|
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
|
|
})
|
2024-05-23 10:59:42 +02:00
|
|
|
];
|
2024-05-24 11:13:36 +02:00
|
|
|
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 ];
|
2024-05-23 10:59:42 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|