Skip to content

Commit

Permalink
several updates
Browse files Browse the repository at this point in the history
- executable is now "sf"
- update readme
- flake bump
- version bump
  • Loading branch information
rfaulhaber committed Jun 20, 2024
1 parent a7877ec commit a269741
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# sfdx-nix

Simple NixOS flake that provides the [SFDX CLI](https://developer.salesforce.com/tools/sfdxcli). You can use it like any other flake. The executable name is `salesforce-cli` instead of `sf`.
Simple Nix flake that provides the [SFDX CLI](https://developer.salesforce.com/tools/sfdxcli). You can use it like any other flake.

This project is in no way affiliated with Salesforce.

This project's license only covers the code in this repository, and is licensed
under the same license that the SFDX CLI itself is.

## Usage

I hope the usage should be self-explanatory. This flake can be used like any other flake. For example, within the CLI:

```sh
nix run github:rfaulhaber/sfdx-nix
```

is the same as just running `sf`. Similarly,

``` sh
nix shell github:rfaulhaber/sfdx-nix
```

will add the `sf` command to your environment.

You can add it to a NixOS configuration like any other flake as well.
6 changes: 3 additions & 3 deletions flake.lock

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

28 changes: 19 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
inherit system;
};

sf = let
sfPackage = let
name = "salesforce-cli";
version = "2.39.1";
version = "2.46.6";
src = pkgs.fetchFromGitHub {
owner = "salesforcecli";
repo = "cli";
rev = version;
hash = "sha256-BQAL3SFI/GUj42urdRyTWbSeX3jrwXXejqpH6M4CXk8=";
hash = "sha256-8LurAYl1Nba17lps+F/m5QMa1/6Lr833Lxqo4HL2imc=";
};
lib = pkgs.lib;
offlineCache = pkgs.fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-OkiphOEXpUhXp5Hh8Tn+62SvmbNwD4qGsIalp7vCpuk=";
hash = "sha256-aoSKGRYByyetUF5SXISHva2a2nt62TKTGAcWGV4seoE=";
};
in
pkgs.stdenv.mkDerivation {
inherit version src;
pname = name;
nativeBuildInputs = with pkgs; [nodejs yarn prefetch-yarn-deps];
nativeBuildInputs = with pkgs; [nodejs yarn prefetch-yarn-deps fixup-yarn-lock];
phases = ["unpackPhase" "configurePhase" "buildPhase" "installPhase" "distPhase"];

configurePhase = ''
Expand All @@ -57,20 +58,29 @@
mv node_modules $out/
mv dist $out/
mkdir -p $out/bin
mv bin/run.js $out/bin/${name}
mv bin/run.js $out/bin/sf
# necessary for some runtime configuration
cp ./package.json $out
patchShebangs $out
'';

distPhase = ''
mkdir -p $out/tarballs/
yarn pack --offline --ignore-scripts --production=true --filename $out/tarballs/${name}/.tgz
yarn pack --offline --ignore-scripts --production=true --filename $out/tarballs/sf/.tgz
'';
};
in {
packages.sf = sf;
packages.default = sf;
packages = rec {
sf = sfPackage;
default = sf;
};
apps = rec {
sf = flake-utils.lib.mkApp {
drv = self.packages.${system}.sf;
exePath = "/bin/sf";
};
default = sf;
};
formatter = pkgs.alejandra;
devShells.default =
pkgs.mkShell {buildInputs = with pkgs; [nodejs yarn];};
Expand Down

0 comments on commit a269741

Please sign in to comment.