Git Product home page Git Product logo

ak-nix's Introduction

ak-nix

Various nix and NixOS extensions

Outputs

REPL Extensions

The output ak-nix#repl holds convenience functions for use in a Nix REPL. The highlights are ls which behaves like your shell's ls command, pwd which does exactly what you think, and show which uses builtins.trace to print values or lists of values to the console.

nix-repl> :a ( builtins.getFlake "ak-nix" ).repl
nix-repl> pwd
/home/sally/src/ak-nix
nix-repl> ls "./*"
trace: 
./attrsets.nix
./debug.nix
./default.nix
./filesystem.nix
./json.nix
./lists.nix
./paths.nix
./repl.nix
./stdenv.nix
./strings.nix
true
nix-repl> show ["oh" "dip" ( it: "is" ) 420]
trace:
oh
dip
<LAMBDA>
420
true

Lib

A set of extensions to nixpkgs.lib. This is constructed using nixpkgs.lib.extend, so it can be used as an alternate in existing expressions which already take lib as an argument.

The lib attribute contains librepl and is available as at the top-level, or as a subdir flake:

nix-repl> lib = builtins.getFlake "github:aakropotkin/ak-nix?dir=lib"
nix-repl> :a lib.librepl
nix-repl> pwd
/home/sally/src/ak-nix
nix-repl> add = curryDefaultSystems' ( system:
                  { x, y }: builtins.trace system ( x + y ) )
nix-repl> add { x = 1; y = 2; }
{ __functor      = <lambda>;
  aarch64-darwin = 3; trace: aarch64-darwin
  aarch64-linux  = 3; trace: aarch64-linux
  i686-linux     = 3; trace: i686-linux
  x86_64-darwin  = 3; trace: x86_64-darwin
  x86_64-linux   = 3; trace: x86_64-linux
}
nix-repl> ( add { x = 2; y = 2; } ).x86_64-linux
3
nix-repl> ( add { x = 3; y = 2; } ) "x86_64-linux"
trace: x86_64-linux
5
nix-repl> add "x86_64-linux" { x = 4; y = 20; }
trace: x86_64-linux
24

ak-nix's People

Contributors

aakropotkin avatar aameen-tulip avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.