aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-07-16 21:54:44 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-07-16 21:54:44 +0900
commit09507a541bb3ed6e19f2e61e332b9a6c1941d17a (patch)
tree2d56a0ba01e08d49470165b19750c643dd74379a /flake.nix
parent1f72c30033cb0a09f735c90bc41521abd92050ea (diff)
nix: build directly with buildGoModules
Since we have no dependencies, we don't need a vendor hash, so doing this actually makes sense. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix64
1 files changed, 42 insertions, 22 deletions
diff --git a/flake.nix b/flake.nix
index cba5051f..48cb435d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,32 +5,52 @@
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
};
- outputs = { self, nixpkgs }:
+ outputs =
+ { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
- devShells = forAllSystems
- (system:
- let
- pkgs = import nixpkgs {
- inherit system;
+ devShells = forAllSystems (
+ system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ in
+ {
+ default =
+ let
+ inherit (pkgs)
+ mkShell
+ buildGoModule
+ acl
+ xorg
+ ;
+ in
+ mkShell {
+ packages = [
+ (buildGoModule rec {
+ pname = "ego";
+ version = "flake";
+
+ src = ./.;
+ vendorHash = null; # we have no dependencies :3
+
+ ldflags = [
+ "-s"
+ "-w"
+ "-X"
+ "main.Version=v${version}"
+ ];
+
+ buildInputs = [
+ acl
+ xorg.libxcb
+ ];
+ })
+ ];
};
- in
- {
- default = with pkgs; mkShell
- {
- packages = [
- clang
- acl
- xorg.libxcb
- (pkgs.writeShellScriptBin "build" ''
- go build -v -ldflags '-s -w -X main.Version=flake'
- '')
- ];
- };
- }
- );
+ }
+ );
};
-} \ No newline at end of file
+}