Code Monkey home page Code Monkey logo

nixfs's Introduction

NixFS

Access any Nix derivation through filesystem paths with NixFS.

NixFS is a FUSE-based filesystem that allows you to access any Nix derivation by simply accessing a corresponding path. This can be helpful for exploring the Nix store and easily accessing the derivations without having to explicitly build them first.

How it works

/nixfs
└── flake
    ├── b64
    └── str
    └── urlenc

When you attempt to access /nixfs/flake/str/nixpkgs#hello or any subpaths of it, NixFS will automatically trigger a nix-build of nixpkgs#hello. The path will then appear as a symlink to the store path of the build result.

For flakes with / in their URL, you can use /nixfs/flake/urlenc/<url encoded flake URL> to access them. You can also use base64url encoding (i.e. b64 with +/ replaced by -_) at /nixfs/flake/b64/<base64url encoded flake URL>.

Usage

nixfs [--debug] [<fuse mount options>] /mount/path

This will mount the NixFS filesystem to the specified mount path.

$ ls /tmp/nixfs/flake/urlenc/$(echo -n github:illustris/nixfs | jq -sRr @uri)/bin
mount.fuse.nixfs  mount.nixfs  nixfs
$ ls /tmp/nixfs/flake/b64/$(echo -n github:illustris/nixfs | base64 -w0 | tr '+/' '-_')/bin
mount.fuse.nixfs  mount.nixfs  nixfs

NixOS module

You can also integrate NixFS into your NixOS configuration as a module.

To do this, add the following to your flake.nix:

{
	inputs.nixfs.url = "github:illustris/nixfs";
	
	outputs = {nixpkgs, nixfs, ...}: {
		nixosConfigurations.my_machine = {
			imports = [ nixfs.nixosModules.nixfs ];
			services.nixfs.enable = true;
		};
	};
}

This will enable the NixFS service on your NixOS machine, and the filesystem will be automatically mounted on startup.

Contributing

If you'd like to contribute to the development of NixFS, please feel free to submit issues or pull requests on the GitHub repository.

nixfs's People

Contributors

illustris 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.