Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Workflows #17

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: NixOS Package Building

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-stregsystemet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1

- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-23.11

- name: build-stregsystemet
run: nix build -f ./pkgs/stregsystemet
2 changes: 2 additions & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{lib, ...}: {
imports = [
./stregsystemet.nix
./nginx.nix
./fikien.nix
];

options = {
Expand Down
11 changes: 11 additions & 0 deletions modules/fikien.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let
portmap = import ./portmap.nix {};
in {
services.dokuwiki.sites."${portmap.domain}" = {
enable = true;
settings = {
title = "test wiki";
useacl = true;
};
};
}
36 changes: 36 additions & 0 deletions modules/nginx.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{pkgs, ...}: let
portmap = import ./portmap.nix {};

defaultListen = [{ port = 80; addr = "${portmap.domain}"; }];

in {
services.nginx = {
enable = true;
virtualHosts = {
# Fikien
"${portmap.domain}" = {
listen = defaultListen;
};
# Stregsystemet
"stregsystem.${portmap.domain}" = {
listen = defaultListen;

locations."/" = {
proxyPass = "http://localhost:${portmap.ports.stregsystemet}/";
};
};
# it will only run on localhost, its for debugging
"routing.localhost" = {
listen = [{ port = 80; addr = "localhost"; }];
locations."/".index = "${pkgs.writeText "index.html" ''
<div style="text-align: center;">
<h3>F-Klubben | Routing</h3>
<a href="http://${portmap.domain}/">Fikien</a><br>
<a href="http://stregsystem.${portmap.domain}/">Stregsystemet</a>
</div>
''}";
root = "/.";
};
};
};
}
9 changes: 9 additions & 0 deletions modules/portmap.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{}: {
domain = "fklub.dk";
#domain = "localhost"; # Comment the line above an uncomment this to run locally

ports = {
stregsystemet = "8080";
};
}

1 change: 1 addition & 0 deletions system/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
imports = [
./programs.nix
./users.nix

./nginx.nix
./fikien.nix

Expand Down
11 changes: 11 additions & 0 deletions system/graphical.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
services.xserver = {
enable = true;
displayManager.sddm.enable = true;
desktopManager.xfce.enable = true;
layout = "dk";

};

programs.firefox.enable = true;
}
6 changes: 5 additions & 1 deletion system/users.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ ... }:
{pkgs, ... }:

let
users = {};
Expand All @@ -18,5 +18,9 @@ in {
description = "Thomas";
extraGroups = [ "wheel" ];
hashedPassword = "$6$rounds=2000000$htFKKf65jcKCw09Z$JNmYnL5lIBZP6dvqYXUmj0vzzaiRteXOwlJzkcYcRCYdT5Zt8TVJWvtT4w4Q8suBneVOLEjxsMIf0yEY4BDrz1";
packages = with pkgs; [
lynx
vim
];
};
}