diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4821a96 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/modules/default.nix b/modules/default.nix index 284fc4e..4192d10 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,6 +1,8 @@ {lib, ...}: { imports = [ ./stregsystemet.nix + ./nginx.nix + ./fikien.nix ]; options = { diff --git a/modules/fikien.nix b/modules/fikien.nix new file mode 100644 index 0000000..36f4929 --- /dev/null +++ b/modules/fikien.nix @@ -0,0 +1,11 @@ +let + portmap = import ./portmap.nix {}; +in { + services.dokuwiki.sites."${portmap.domain}" = { + enable = true; + settings = { + title = "test wiki"; + useacl = true; + }; + }; +} diff --git a/modules/nginx.nix b/modules/nginx.nix new file mode 100644 index 0000000..b2d5cd1 --- /dev/null +++ b/modules/nginx.nix @@ -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" '' +
+ ''}"; + root = "/."; + }; + }; + }; +} diff --git a/modules/portmap.nix b/modules/portmap.nix new file mode 100644 index 0000000..9af5f9e --- /dev/null +++ b/modules/portmap.nix @@ -0,0 +1,9 @@ +{}: { + domain = "fklub.dk"; + #domain = "localhost"; # Comment the line above an uncomment this to run locally + + ports = { + stregsystemet = "8080"; + }; +} + diff --git a/system/configuration.nix b/system/configuration.nix index 9d51a09..5c9d934 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -5,6 +5,7 @@ imports = [ ./programs.nix ./users.nix + ./nginx.nix ./fikien.nix diff --git a/system/graphical.nix b/system/graphical.nix new file mode 100644 index 0000000..3a426f7 --- /dev/null +++ b/system/graphical.nix @@ -0,0 +1,11 @@ +{ + services.xserver = { + enable = true; + displayManager.sddm.enable = true; + desktopManager.xfce.enable = true; + layout = "dk"; + + }; + + programs.firefox.enable = true; +} diff --git a/system/users.nix b/system/users.nix index 211179b..15ecadc 100644 --- a/system/users.nix +++ b/system/users.nix @@ -1,4 +1,4 @@ -{ ... }: +{pkgs, ... }: let users = {}; @@ -18,5 +18,9 @@ in { description = "Thomas"; extraGroups = [ "wheel" ]; hashedPassword = "$6$rounds=2000000$htFKKf65jcKCw09Z$JNmYnL5lIBZP6dvqYXUmj0vzzaiRteXOwlJzkcYcRCYdT5Zt8TVJWvtT4w4Q8suBneVOLEjxsMIf0yEY4BDrz1"; + packages = with pkgs; [ + lynx + vim + ]; }; }