Skip to content

Commit

Permalink
rewrite in rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Artturin committed Apr 18, 2022
1 parent 10ba38d commit 8efa4e1
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 159 deletions.
73 changes: 0 additions & 73 deletions ,

This file was deleted.

1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# ignore nix-build result folder
result


# Added by cargo

/target


# Added by cargo
#
# already existing elements were commented out

#/target
146 changes: 146 additions & 0 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "comma"
description = "runs programs without installing them"
version = "0.1.0"
edition = "2021"
authors = ["Artturin <[email protected]>"]
license = "MIT"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = "3.1.9"
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ,
# comma

Comma runs software without installing it.

Expand All @@ -13,9 +13,6 @@ nix-env -i -f .

## Usage

[See a quick demo on
YouTube](https://www.youtube.com/watch?v=VUM3Km_4gUg&list=PLRGI9KQ3_HP_OFRG6R-p4iFgMSK1t5BHs)

```bash
, cowsay neato
```
Expand Down
45 changes: 10 additions & 35 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
{ pkgs ? import <nixpkgs> { }

, stdenv ? pkgs.stdenv
, lib ? pkgs.lib
, fetchurl ? pkgs.fetchurl
, nix ? pkgs.nix
, fzy ? pkgs.fzy
, makeWrapper ? pkgs.makeWrapper

# We use this to add matchers for stuff that's not in upstream nixpkgs, but is
# in our own overlay. No fuzzy matching from multiple options here, it's just:
# Was the command `, mything`? Run `nixpkgs.mything`.
, overlayPackages ? []
}:

stdenv.mkDerivation rec {
name = "comma";

src = ./.;

nativeBuildInputs = [ makeWrapper ];

installPhase = let
caseCondition = lib.concatStringsSep "|" (overlayPackages ++ [ "--placeholder--" ]);
in ''
mkdir -p $out/bin
sed -e 's/@OVERLAY_PACKAGES@/${caseCondition}/' < , > $out/bin/,
chmod +x $out/bin/,
wrapProgram $out/bin/, \
--prefix PATH : ${nix}/bin \
--prefix PATH : ${fzy}/bin
ln -s $out/bin/, $out/bin/comma
'';
}
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
Loading

0 comments on commit 8efa4e1

Please sign in to comment.