GithubHelp home page GithubHelp logo

homepage-nix's Introduction

Homepage

There are lots of these, but this one is mine.

Goals, generate all of the static content with rust or nix.

What is this?

An overly-complicated way to generate a single-page website with an overly simple rust backend provided on a docker image that is built with nix.

The front end is a mixture of tailwind and very vanilla javascript all stored in the /static directory.

Install on NixOS with Flakes

  inputs.homepage-nix.url = "github:etossell/homepage-nix";
{ homepage-nix, system, ... }:
{
  imports = [
    homepage-nix.nixosModules.${system}.default;
  ];
  services.homepage-nix = {
    enable = true;
    port = 8080;
    staticDir = "/path/to/your/static";
  };
}

Use it with Docker

The docker image is available on docker-hub as etossell/homepage-nix.

You can build the image from source with nix-build docker.nix and then load it into docker with docker load < result.

Pull it from docker-hub with docker pull etossell/homepage-nix:latest.

Run it with docker run -p 5000:5000 -v ./<path/to/your/static>:/static etossell/homepage-nix:latest.

Why?

I wanted to reduce the memory usage on all of my personal sites, and I wanted to learn more about rust and nix.

The result is a very very small memory footprint (~2-4MB) for my mostly idle sites. The docker image itself is only ~55.3MB.

⚠️ Packages in nixpkgs are not typically built to reduce size on disk. Take careful consideration using pkgs.<nixpkgs-name-here>.

Directory Tree

src/ main.rs static/ index.html

Nix Flake Show

git+file:///home/eriim/repos/nix/homepage-nix
├───devShells
│   ├───aarch64-darwin
│   │   └───default: development environment 'nix-shell'
│   ├───aarch64-linux
│   │   └───default: development environment 'nix-shell'
│   ├───x86_64-darwin
│   │   └───default: development environment 'nix-shell'
│   └───x86_64-linux
│       └───default: development environment 'nix-shell'
├───formatter
│   ├───aarch64-darwin: package 'nixpkgs-fmt-1.3.0'
│   ├───aarch64-linux: package 'nixpkgs-fmt-1.3.0'
│   ├───x86_64-darwin: package 'nixpkgs-fmt-1.3.0'
│   └───x86_64-linux: package 'nixpkgs-fmt-1.3.0'
├───nixosModules
│   ├───aarch64-darwin: NixOS module
│   ├───aarch64-linux: NixOS module
│   ├───x86_64-darwin: NixOS module
│   └───x86_64-linux: NixOS module
└───packages
    ├───aarch64-darwin
    │   └───default: package 'homepage-nix-0.2.0'
    ├───aarch64-linux
    │   └───default: package 'homepage-nix-0.2.0'
    ├───x86_64-darwin
    │   └───default: package 'homepage-nix-0.2.0'
    └───x86_64-linux
        └───default: package 'homepage-nix-0.2.0'

homepage-nix's People

Contributors

erictossell avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.