summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-07-21 15:21:02 +0300
committerKyren223 <Kyren223@proton.me>2025-07-21 15:21:02 +0300
commit7d5ce5721b250658a86af69b22e2f02ad443f431 (patch)
treeec274da8bd82061d96f963e8ea7cadf5a1f968c6 /flake.nix
parent49484cf734848e68b6508ee10aab7dd307bd0ca4 (diff)
Added a flake.nix (not ready)
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix122
1 files changed, 122 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..b2edfea
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,122 @@
+{
+ description = "Localias is a tool for developers to securely manage local aliases for development servers.";
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+
+ flake-utils.url = "github:numtide/flake-utils";
+
+ flake-compat.url = "github:edolstra/flake-compat";
+ flake-compat.flake = false;
+
+ nix-filter.url = "github:numtide/nix-filter";
+ };
+
+ outputs = { self, ... }@inputs:
+ inputs.flake-utils.lib.eachDefaultSystem (system:
+ let
+ overlays = [ ];
+ pkgs = import inputs.nixpkgs {
+ inherit system overlays;
+ };
+ lib = pkgs.lib;
+ version = (builtins.readFile ./VERSION); # TODO: have version?
+ commit = if (builtins.hasAttr "rev" self) then (builtins.substring 0 7 self.rev) else "unknown";
+ in
+ rec {
+ packages = rec {
+ eko = pkgs.buildGoModule {
+ pname = "eko";
+ version = version;
+ # vendorHash = pkgs.lib.fakeHash;
+ vendorHash = "sha256-t8Crwi8dPWOTiCbyCfgOCYJboC7pC1G/wyUsFfcVVkQ="; # TODO: change?
+ src =
+ let
+ # Set this to `true` in order to show all of the source files
+ # that will be included in the module build.
+ debug-tracing = false;
+ source-files = inputs.nix-filter.lib.filter {
+ root = ./.;
+ };
+ in
+ (
+ if (debug-tracing) then
+ pkgs.lib.sources.trace source-files
+ else
+ source-files
+ );
+ # Any extra packages required to build the binaries should go here.
+ buildInputs = [ ];
+ ldflags = [
+ "-X github.com/kyren223/eko/cmd/client/shared.Version=${version}" # TODO: change the version thing
+ "-X github.com/kyren223/eko/cmd/client/shared.Commit=${commit}" # TODO: change the commit thing
+ ];
+ modRoot = "./.";
+ subPackages = [ "cmd/client" ];
+ doCheck = false;
+ };
+ default = eko;
+ };
+
+ apps = rec {
+ eko = {
+ type = "app";
+ program = "${packages.eko}/bin/eko";
+ };
+ default = eko;
+ };
+
+ # TODO: make my own devshell?
+ # devShells = rec {
+ # default = pkgs.mkShell {
+ # packages = with pkgs;
+ # [
+ # # golang
+ # go
+ # delve
+ # go-outline
+ # golangci-lint
+ # gopkgs
+ # gopls
+ # gotools
+ # # nix
+ # nixpkgs-fmt
+ # # other tools
+ # just
+ # cobra-cli
+ # ];
+ #
+ # shellHook = ''
+ # # The path to this repository
+ # shell_nix="''${IN_LORRI_SHELL:-$(pwd)/shell.nix}"
+ # workspace_root=$(dirname "$shell_nix")
+ # export WORKSPACE_ROOT="$workspace_root"
+ #
+ # # We put the $GOPATH/$GOCACHE/$GOENV in $TOOLCHAIN_ROOT,
+ # # and ensure that the GOPATH's bin dir is on our PATH so tools
+ # # can be installed with `go install`.
+ # #
+ # # Any tools installed explicitly with `go install` will take precedence
+ # # over versions installed by Nix due to the ordering here.
+ # export TOOLCHAIN_ROOT="$workspace_root/.toolchain"
+ # export GOROOT=
+ # export GOCACHE="$TOOLCHAIN_ROOT/go/cache"
+ # export GOENV="$TOOLCHAIN_ROOT/go/env"
+ # export GOPATH="$TOOLCHAIN_ROOT/go/path"
+ # export GOMODCACHE="$GOPATH/pkg/mod"
+ # export PATH=$(go env GOPATH)/bin:$PATH
+ # export CGO_ENABLED=1
+ #
+ # # Make it easy to test while developing; add the golang and nix
+ # # build outputs to the path.
+ # export PATH="$workspace_root/bin:$workspace_root/result/bin:$PATH"
+ # '';
+ #
+ # # Need to disable fortify hardening because GCC is not built with -oO,
+ # # which means that if CGO_ENABLED=1 (which it is by default) then the golang
+ # # debugger fails.
+ # # see https://github.com/NixOS/nixpkgs/pull/12895/files
+ # hardeningDisable = [ "fortify" ];
+ # };
+ # };
+ });
+}