Skip to content

Instantly share code, notes, and snippets.

@bdmorin
Created June 10, 2024 03:03
Show Gist options
  • Save bdmorin/ada3dd9be5da83bc96bfdf0362d44ee5 to your computer and use it in GitHub Desktop.
Save bdmorin/ada3dd9be5da83bc96bfdf0362d44ee5 to your computer and use it in GitHub Desktop.
{
description = "Colmena nixflake demo";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena";
};
outputs = { self, nixpkgs, flake-utils, colmena }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in
{
devShell = pkgs.mkShell {
buildInputs = [ colmena.packages.${system}.colmena ];
};
packages.default = pkgs.mkShell {
buildInputs = [ pkgs.nginx ];
};
nixosConfigurations.exampleHost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ config, pkgs, ... }: {
imports = [ colmena.nixosModules.colmena ];
networking.hostName = "exampleHost";
services.nginx = {
enable = true;
virtualHosts."example.com" = {
root = "/var/www/example";
locations."/" = {
extraConfig = ''
try_files $uri $uri/ =404;
'';
};
};
};
users.users.example = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAr..." ];
};
system.stateVersion = "21.05";
})
];
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment