From 2c1dc0899c5a5cdd3e164f2c9508255fec6979f8 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 28 Sep 2022 22:01:17 +1000 Subject: [PATCH] make bonfire actually build waiting on upstream to merge my pr before we can deploy it --- flake.lock | 74 ++++++++++++++++++++++----------------------- flake.nix | 43 +++++++++++++++++++++++++- overlay/default.nix | 2 +- pkgs/default.nix | 2 +- 4 files changed, 81 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index 1856103..891aee0 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,41 @@ { "nodes": { + "bonfire": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1664356228, + "narHash": "sha256-YLmsR/OSf7q0t3/7gAPI0Uf9sS9JQSWF7trmrtsDPOo=", + "owner": "bonfire-networks", + "repo": "bonfire-app", + "rev": "9533e672724198fcad61ba4d7f7e92649cb4a655", + "type": "github" + }, + "original": { + "owner": "bonfire-networks", + "repo": "bonfire-app", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1656928814, + "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "hardware": { "locked": { "lastModified": 1659356074, @@ -15,27 +51,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": "utils" - }, - "locked": { - "lastModified": 1659484873, - "narHash": "sha256-6VoPiGyDdjBHOJ3IpS24lY1lrDiOHeuEefOFI0qz3WE=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "d8d9ff0b2df77defa10375c6665b51f0251c34d6", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1659522808, @@ -54,25 +69,10 @@ }, "root": { "inputs": { + "bonfire": "bonfire", "hardware": "hardware", - "home-manager": "home-manager", "nixpkgs": "nixpkgs" } - }, - "utils": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index cf71aa4..7480813 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,6 @@ ); nixosConfigurations = { - # FIXME replace with your hostname sincerity = nixpkgs.lib.nixosSystem { pkgs = legacyPackages.x86_64-linux; specialArgs = { inherit inputs; }; # Pass flake inputs to our config @@ -64,6 +63,48 @@ bonfire.nixosModules.bonfire ]; }; + test = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./nixos/configuration.nix + bonfire.nixosModules.bonfire + ({ pkgs, ... }: { + boot.isContainer = true; + networking.firewall.allowedTCPPorts = [ 80 ]; + services.nginx = { + enable = true; + virtualHosts."bonfire.lan".locations."/".proxyPass = "http://localhost:4000"; + }; + services.bonfire = { + # you will need to expose bonfire with a reverse proxy, for example caddy + port = 4000; + package = pkgs.elixirBonfire; + dbName = "bonfire"; + # the environment should contain a minimum of + # SECRET_KEY_BASE + # SIGNING_SALT + # ENCRYPTION_SALT + # RELEASE_COOKIE + # have a look into nix/module.nix for more details + # the way to deploy secrets is beyond this readme, but I would recommend agenix + environmentFile = "/run/secrets/bonfireEnv"; + dbSocketDir = "/var/run/postgresql"; + }; + + # this is uniquely for database backup purposes + # replace myBackupUserName with the user name that will do the backups + # if you want to do backups differently, feel free to remove this part of the config + # services.postgresql = { + # enable = true; + # ensureDatabases = [ "bonfire" ]; + # ensureUsers = [{ + # name = "bonfire"; + # ensurePermissions = { "DATABASE bonfire" = "ALL PRIVILEGES"; }; + # }]; + # }; + }) + ]; + }; }; }; } diff --git a/overlay/default.nix b/overlay/default.nix index 00a02f2..932ef29 100644 --- a/overlay/default.nix +++ b/overlay/default.nix @@ -2,7 +2,7 @@ { inputs, ... }: let # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs { pkgs = final; }; + additions = final: _prev: import ../pkgs { pkgs = final; inputs = inputs; }; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/pkgs/default.nix b/pkgs/default.nix index faa4f03..244ae74 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,5 +2,5 @@ # These are similar to nixpkgs packages { inputs, pkgs }: { # example = pkgs.callPackage ./example { }; - elixirBonfire = bonfire.defaultPackage.x86_64-linux; + elixirBonfire = inputs.bonfire.defaultPackage.x86_64-linux; }