Created
December 10, 2025 02:32
-
-
Save kesor/f396dce261a87dd80d13dc35c17ec79f to your computer and use it in GitHub Desktop.
Silverbullet NixOS module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| flake.modules.nixos.services-silverbullet = | |
| { | |
| config, | |
| lib, | |
| pkgs, | |
| ... | |
| }: | |
| let | |
| cfg = config.features.services.silverbullet; | |
| in | |
| { | |
| options.features.services.silverbullet = { | |
| enable = lib.mkEnableOption "Enable SilverBullet note-taking service"; | |
| port = lib.mkOption { | |
| type = lib.types.port; | |
| default = 63000; | |
| description = "Port to run SilverBullet on (localhost only)"; | |
| }; | |
| dataDir = lib.mkOption { | |
| type = lib.types.str; | |
| default = "/var/lib/silverbullet"; | |
| description = "Directory to store SilverBullet data"; | |
| }; | |
| }; | |
| config = lib.mkIf cfg.enable { | |
| services.silverbullet = { | |
| enable = true; | |
| package = pkgs.callPackage ./package.nix { }; | |
| listenPort = cfg.port; | |
| listenAddress = "127.0.0.1"; | |
| spaceDir = cfg.dataDir; | |
| }; | |
| }; | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { pkgs }: | |
| pkgs.silverbullet.overrideAttrs (old: rec { | |
| version = "2.3.0"; | |
| src = pkgs.fetchzip { | |
| url = "https://github.com/silverbulletmd/silverbullet/releases/download/${version}/silverbullet-server-linux-x86_64.zip"; | |
| hash = "sha256-IGks7vmJd/xuJzqhogR5aLVM6eUUe6bACe5VuAWJOWA="; | |
| stripRoot = false; | |
| }; | |
| nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.autoPatchelfHook ]; | |
| buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.stdenv.cc.cc.lib ]; | |
| installPhase = '' | |
| runHook preInstall | |
| mkdir -p $out/bin | |
| cp $src/silverbullet $out/bin/ | |
| runHook postInstall | |
| ''; | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment