nixos-server/flake.nix

69 lines
2.1 KiB
Nix
Raw Permalink Normal View History

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 = {
2024-06-20 16:39:06 +02:00
nixpkgs.url = "github:NixOs/nixpkgs/nixos-24.05";
2024-05-23 11:21:24 +02:00
nixos-config.url = "git+https://githug.xyz/rachel/nixos-config";
2024-06-21 13:46:23 +02:00
# rachelcafe.url = "git+https://githug.xyz/rachel/rachel.cafe";
2024-05-23 10:59:42 +02:00
};
2024-06-21 13:46:23 +02:00
outputs = inputs@{ self, nixpkgs, nixos-config,
#rachelcafe,
... }:
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-25 15:12:56 +02:00
# 22222 on host is 222 on guest
2024-05-24 11:13:36 +02:00
virt-module = {
virtualisation.vmVariant = {
virtualisation.cores = 4;
virtualisation.memorySize = 4096;
virtualisation.forwardPorts = [
2024-05-25 15:12:56 +02:00
{ from = "host"; host.port = 8080; guest.port = 80; }
{ from = "host"; host.port = 2222; guest.port = 22; }
{ from = "host"; host.port = 22222; guest.port = 222; }
2024-06-20 18:36:45 +02:00
{ from = "host"; host.port = 2223; guest.port = 2222; }
2024-05-24 11:13:36 +02:00
];
};
};
2024-05-31 10:36:14 +02:00
keyboard-module = {
2024-05-23 11:21:24 +02:00
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-06-20 16:39:06 +02:00
state-version = "24.05";
2024-05-23 10:59:42 +02:00
modules = [
nix-config-module
2024-05-23 11:21:24 +02:00
keyboard-module
2024-05-31 10:36:14 +02:00
(import ./host.nix {
2024-05-24 11:13:36 +02:00
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2024-05-31 10:36:14 +02:00
inherit inputs state-version;
2024-05-24 11:13:36 +02:00
})
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
};
};
}