Skip to content

Commit

Permalink
nix build for linux + macos, inline into flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
bryceberger authored and dlvhdr committed Jan 31, 2025
1 parent 87f2087 commit e5a144f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 65 deletions.
1 change: 0 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# If we are a computer with nix-shell available, then use that to setup
# the build environment with exactly what we need.
if has nix; then
watch_file nix/{devShell,package}.nix
use flake
fi
34 changes: 34 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 32 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,43 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
outputs = {
self,
nixpkgs,
flake-utils,
}:
{
self,
nixpkgs,
...
}:
let
system = "aarch64-darwin";
overlays.default = final: prev: {
gh-dash = self.packages.${prev.system}.default;
};
}
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell.${system} = pkgs.callPackage ./nix/devShell.nix { };

# this allows users to install gh-dash with nix
# by including gh-dash.packages.aarch64-darwin.default in their systemPackages
packages.${system}.default = pkgs.callPackage ./nix/package.nix { };
gh-dash = pkgs.buildGoModule {
pname = "gh-dash";
version = "v4.10.0";
src = ./.;
vendorHash = "sha256-lqmz+6Cr9U5IBoJ5OeSN6HKY/nKSAmszfvifzbxG7NE=";
};
in {
packages = {
default = gh-dash;
inherit gh-dash;
};

# why do I need this?
overlays.default = final: prev: {
gh-dash = self.packages.${prev.system}.default;
devShells.default = pkgs.mkShell {
name = "gh-dash";
inherit (gh-dash) nativeBuildInputs buildInputs;
packages = with pkgs; [
gopls
golangci-lint
golangci-lint-langserver
goimports-reviser
];
};
};
});
}
15 changes: 0 additions & 15 deletions nix/devShell.nix

This file was deleted.

32 changes: 0 additions & 32 deletions nix/package.nix

This file was deleted.

0 comments on commit e5a144f

Please sign in to comment.