initial commit

This commit is contained in:
Rachel Lambda Samuelsson 2024-05-23 10:59:42 +02:00
commit 30a084c793
4 changed files with 140 additions and 0 deletions

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1716361217,
"narHash": "sha256-mzZDr00WUiUXVm1ujBVv6A0qRd8okaITyUp4ezYRgc4=",
"owner": "NixOs",
"repo": "nixpkgs",
"rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f",
"type": "github"
},
"original": {
"owner": "NixOs",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View File

@ -0,0 +1,23 @@
{
description = "My various NixOs configurations";
inputs = {
nixpkgs.url = "github:NixOs/nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs, ... }:
let nix-config-module =
{
nix.registry.nixpkgs.flake = nixpkgs;
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
};
in {
nixosConfigurations.cafe = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nix-config-module
./host.nix
];
};
};
}

28
guests/gitea.nix Normal file
View File

@ -0,0 +1,28 @@
{ config, pkgs, ... }:
{
services.gitea = {
enable = true;
appName = "My awesome Gitea server"; # Give the site a name
database = {
type = "sqlite3";
};
settings.server = {
DOMAIN = "localhost";
ROOT_URL = "http://localhost/";
HTTP_PORT = 3001;
};
};
# [CONTAINER]
boot.isContainer = true;
# [NETWORK]
networking.hostName = "gitea";
networking.useDHCP = false;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 3001 ];
networking.firewall.allowedUDPPorts = [ ];
system.stateVersion = "23.11";
}

62
host.nix Normal file
View File

@ -0,0 +1,62 @@
{ pkgs, ... }:
let gitea = {
host = "10.10.0.1";
local = "10.10.0.2";
};
in
{
# [CONTAINERS]
containers.gitea = {
autoStart = true;
ephemeral = true;
privateNetwork = true;
hostAddress = gitea.host;
localAddress = gitea.local;
config = ./gitea.nix;
};
# [NGINX]
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"localhost" = {
locations."/".proxyPass = "http://${gitea.local}:3001";
};
};
};
# [NETWORK]
networking.firewall.allowedTCPPorts = [ 80 ];
networking.firewall.allowedUDPPorts = [ ];
# VM test user
users.users.test.isSystemUser = true ;
users.users.test.initialPassword = "test";
users.users.test.group = "test";
users.groups.test = {};
console = {
useXkbConfig = true;
};
services.xserver = {
xkb = {
layout = "fox,sus";
options = "ctrl:nocaps";
extraLayouts.sus = {
description = "Swedish US";
languages = [ "se" ];
symbolsFile = ../shared/sus.xkb;
};
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = ../shared/fox.xkb;
};
};
};
system.stateVersion = "23.11";
}