{ description = "My knowledge"; nixConfig = { extra-substituters = "https://srid.cachix.org"; extra-trusted-public-keys = "srid.cachix.org-1:3clnql5gjbJNEvhA/WQp7nrZlBptwpXnUk6JAv8aB2M="; }; inputs = { emanote.url = "github:srid/emanote"; nixpkgs.follows = "emanote/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, emanote, flake-utils, nixpkgs, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; in rec { apps.deploy = flake-utils.lib.mkApp { name = "deploy"; drv = pkgs.writeScriptBin "deploy" '' #!${pkgs.runtimeShell} rsync -arP ${packages.default}/public as:/srv/knowledge.beyermatthi.as/ ''; }; apps.serve = flake-utils.lib.mkApp { name = "serve"; drv = pkgs.writeScriptBin "serve" '' #!${pkgs.runtimeShell} PORT=8008 ${emanote.packages."${system}".default}/bin/emanote ''; }; packages.default = pkgs.stdenv.mkDerivation { name = "knowledge"; src = let nixFilter = path: _type: !pkgs.lib.hasSuffix ".nix" path; extraFiles = path: _type: !(builtins.any (n: pkgs.lib.hasSuffix n path) [ ".github" ".sh" ]); filterPath = path: type: builtins.all (f: f path type) [ nixFilter extraFiles pkgs.lib.cleanSourceFilter ]; in pkgs.lib.cleanSourceWith { src = ./.; filter = filterPath; }; buildPhase = '' mkdir -p $out/public/ ${emanote.packages."${system}".default}/bin/emanote --allow-broken-links gen $out/public/ ''; installPhase = ''true''; }; devShells.default = pkgs.mkShell { buildInputs = [ pkgs.nixpkgs-fmt emanote.packages."${system}".default ]; }; }); }