-
-
Notifications
You must be signed in to change notification settings - Fork 44
feat(nix): adding flake.nix for Nix support #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
outofrange
wants to merge
13
commits into
perber:main
Choose a base branch
from
outofrange:feat/nix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d71274c
feat(nix): adding flake.nix
outofrange 4e98565
fix(nix): fixing develop shell
outofrange 3f48f52
docs(nix): adding nix run to readme
outofrange 8f61186
fix(nix): revert removal of self argument
outofrange ca3859d
chore(nix): change character
outofrange 068873c
chore(nix): adding install section for leafwiki
outofrange 36e0701
chore(nix): adding vscode extension recommendation for nix
outofrange 4e7c0cc
feat(direnv): adding direnv with nix support
outofrange 3873f71
chore(direnv): adding direnv extension recommendation for vscode
outofrange 135bbf4
fix(nix): fixing ui dist copy
outofrange 18ef67d
feat(nix): adding nixos and homemanager modules and refactored flake.…
outofrange 49f4068
chore(nix): reformatting
outofrange 75d4353
chore(nix): moved disableAuth option to example section
outofrange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| { | ||
| description = "LeafWiki - a fast wiki for people who think in folders, not feeds"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
|
|
||
| outputs = { self, nixpkgs, flake-utils }: | ||
| flake-utils.lib.eachDefaultSystem (system: | ||
| let | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
|
|
||
| version = "0.0.0"; | ||
|
|
||
| # Build the Vite/React frontend | ||
| ui = pkgs.buildNpmPackage { | ||
| pname = "leafwiki-ui"; | ||
| inherit version; | ||
| src = ./ui/leafwiki-ui; | ||
|
|
||
| npmDepsHash = "sha256-gYL+VczQNEISjvNEtsfjFMFJ0tvfYgqeERlUcHdzAsY="; | ||
|
|
||
| env.VITE_API_URL = "/"; | ||
|
|
||
| installPhase = '' | ||
| runHook preInstall | ||
| cp -r dist $out | ||
| runHook postInstall | ||
| ''; | ||
| }; | ||
|
|
||
| # Build the Go backend, embedding the compiled frontend | ||
| leafwiki = pkgs.buildGoModule { | ||
| pname = "leafwiki"; | ||
| inherit version; | ||
| src = ./.; | ||
|
|
||
| vendorHash = "sha256-/5K4BfYCFeNCJ/Sfd1eV7GO3LMx7pEe5yst7el+TfaY="; | ||
|
|
||
| # Copy frontend dist into the expected location before the Go build | ||
| preBuild = '' | ||
| mkdir -p internal/http/dist | ||
| cp -r ${ui}/. internal/http/dist/ | ||
| ''; | ||
|
|
||
| ldflags = [ | ||
| "-s" | ||
| "-w" | ||
| "-X github.com/perber/wiki/internal/http.EmbedFrontend=true" | ||
| "-X github.com/perber/wiki/internal/http.Environment=production" | ||
| ]; | ||
|
|
||
| # Only build the main binary; e2e-proxy is a separate Go module | ||
| subPackages = [ "cmd/leafwiki" ]; | ||
|
|
||
| # modernc.org/sqlite is pure Go – no C compiler needed | ||
| env.CGO_ENABLED = "0"; | ||
| }; | ||
| in | ||
| { | ||
| packages = { | ||
| default = leafwiki; | ||
| inherit leafwiki ui; | ||
| }; | ||
|
|
||
| apps = { | ||
| default = flake-utils.lib.mkApp { drv = leafwiki; }; | ||
| leafwiki = flake-utils.lib.mkApp { drv = leafwiki; }; | ||
| }; | ||
|
|
||
| devShells.default = pkgs.mkShell { | ||
| packages = with pkgs; [ | ||
| # Go toolchain | ||
| go | ||
| gopls | ||
| gotools | ||
| golangci-lint | ||
| # Node / frontend | ||
| nodejs | ||
| typescript-language-server | ||
| # Utilities | ||
| git | ||
| gnumake | ||
| ]; | ||
| }; | ||
| }); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.