Add machine image outputs to flake

This commit is contained in:
Vivian Lim 2022-11-16 08:58:28 -08:00
parent 35cd98f6ec
commit f780f67e6a
4 changed files with 103 additions and 4 deletions

View File

@ -1,8 +1,5 @@
{ ... }: {
imports = [
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
./mastodon.nix
];
boot.cleanTmpDir = true;

View File

@ -1,5 +1,41 @@
{
"nodes": {
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1666812839,
"narHash": "sha256-0nBDgjPU+iDsvz89W+cDEyhnFGSwCJmwDl/gMGqYiU0=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "41f3518bc194389df22a3d198215eae75e6b5ab9",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1668115648,
@ -18,6 +54,7 @@
},
"root": {
"inputs": {
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs"
}
}

View File

@ -3,9 +3,14 @@
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
#nixpkgs.url = "github:ashkitten/nixpkgs/tootcat";
nixpkgs.url = "github:vivlim/nixpkgs/tootcat";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, ... }: {
outputs = { nixpkgs, nixos-generators, ... }: {
colmena = {
meta = {
nixpkgs = import nixpkgs {
@ -18,6 +23,9 @@
imports = [
./configuration.nix
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
./mastodon.nix
];
};
};
@ -25,5 +33,23 @@
devShells."x86_64-linux".default = import ./shell.nix {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
};
droplet = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./configuration.nix
./mastodon-testinstance.nix
];
format = "do";
};
virtualbox = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./configuration.nix
./mastodon-testinstance.nix
];
format = "do";
};
};
}

39
mastodon-testinstance.nix Normal file
View File

@ -0,0 +1,39 @@
{ pkgs, lib, ... }:
let
mastodon = pkgs.mastodon.override {
version = import ./mastodon/version.nix;
srcOverride = pkgs.callPackage ./mastodon/source.nix {};
dependenciesDir = ./mastodon;
yarnSha256 = import ./mastodon/yarn-sha256.nix;
};
in
{
services = {
mastodon = {
enable = true;
package = mastodon;
configureNginx = true;
localDomain = "test.toot.cat";
smtp.fromAddress = "server2022@toot.cat";
extraConfig = {
MAX_TOOT_CHARS = "1000000";
};
};
postgresqlBackup = {
enable = false;
databases = [ "mastodon" ];
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {
acceptTerms = true;
defaults.email = "tc.certbot.2022@wooz.dev";
defaults.server = "https://acme-staging-v02.api.letsencrypt.org/directory"; # letsencrypt staging environment, so we don't hit rate limits
};
}