Skip to content
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

Add Nix(OS) support + Revamp README.md #103

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Geode Command Line
Command-line utilities for working w/ geode.
Command-line utilities for working w/ Geode.

[Instructions](https://docs.geode-sdk.org/getting-started/geode-cli)
36 changes: 36 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ pkgs ? import <nixpkgs> {} }:

let
isDarwin = pkgs.stdenv.isDarwin;
darwinFrameworks = with pkgs.darwin.apple_sdk.frameworks; [
Security
AppKit
SystemConfiguration
];
in

pkgs.rustPlatform.buildRustPackage {
pname = "geode-cli";
version = "3.4.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;

nativeBuildInputs = with pkgs; [
pkg-config
openssl
] ++ (if isDarwin then darwinFrameworks else []);

buildInputs = with pkgs; [
openssl
] ++ (if isDarwin then darwinFrameworks else []);

postInstall = ''
mkdir -p $out/share/bash-completion/completions
mkdir -p $out/share/zsh/site-functions
mkdir -p $out/share/fish/vendor_completions.d

$out/bin/geode completions bash > $out/share/bash-completion/completions/geode
$out/bin/geode completions zsh > $out/share/zsh/site-functions/_geode
$out/bin/geode completions fish > $out/share/fish/vendor_completions.d/geode.fish
'';
}
61 changes: 61 additions & 0 deletions flake.lock

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

72 changes: 72 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
description = "A flake to install the Geode CLI";

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};
isDarwin = system == "x86_64-darwin" || system == "aarch64-darwin";
darwinFrameworks = with pkgs.darwin.apple_sdk.frameworks; [
Security
AppKit
SystemConfiguration
];
in
{
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "geode-cli";
version = "3.4.0";

src = self;

cargoInstallFlags = [ "--release" ];
cargoLock = {
lockFile = ./Cargo.lock;
};

nativeBuildInputs = with pkgs; [
pkg-config
openssl
] ++ (if isDarwin then darwinFrameworks else []);

buildInputs = with pkgs; [
openssl
] ++ (if isDarwin then darwinFrameworks else []);

postInstall = ''
mkdir -p $out/share/bash-completion/completions
mkdir -p $out/share/zsh/site-functions
mkdir -p $out/share/fish/vendor_completions.d

$out/bin/geode completions bash > $out/share/bash-completion/completions/geode
$out/bin/geode completions zsh > $out/share/zsh/site-functions/_geode
$out/bin/geode completions fish > $out/share/fish/vendor_completions.d/geode.fish
'';

meta = with pkgs.lib; {
description = "Geode CLI";
homepage = "https://github.com/geode-sdk/cli";
license = licenses.boost; # Boost License
};
};

apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/geode";
};

devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cargo
rustc
pkg-config
openssl
] ++ (if isDarwin then darwinFrameworks else []);
};
});
}