Giter VIP home page Giter VIP logo

nix-cleaned-path-issue's Introduction

Test of cleaned paths and restricted mode in Nix

This is a small experiment that demonstrates an issue with flake's restricted mode.

Related issues

Structure and usage

This project contains legacy and flake implementation of building simple hello project. To run flake build, use nix build .#<Type> and to run legacy build, use nix build -f ./default.nix --argstr type "<Type>".

There is also test.sh script which runs all builds automatically.

Available Types of builds

There are 4 types, of builds:

  • hello-passed-src - Simply passes ./. folder into hello.nix which uses it to build derivation. Works for flake and legacy.
  • hello-passed-cleaned-src - Passes ./. folder cleaned with cleanSource and uses it to build derivation. Works for legacy, fails for flake due to restricted mode.
  • hello-not-passed-src - Loads ./. folder by itself and uses it to build derivation. Works for flake and legacy.
  • hello-not-passed-cleaned-src - Loads ./. folder by itself, cleans it with cleanSource and uses it to build derivation. Works for legacy, fails for flake due to restricted mode.

Dump of test.sh which shows above statements

Current type: hello-passed-src
Legacy:
Hello World !

Flake:
Hello World !

Current type: hello-passed-cleaned-src
Legacy:
Hello World !

Flake:
error: access to path '/nix/store/4p7vhys75r7bv8dl9lhfcvgxk01jh704-source/test.txt' is forbidden in restricted mode
(use '--show-trace' to show detailed location information)

Current type: hello-not-passed-src
Legacy:
Hello World !

Flake:
Hello World !

Current type: hello-not-passed-cleaned-src
Legacy:
Hello World !

Flake:
error: access to path '/nix/store/4p7vhys75r7bv8dl9lhfcvgxk01jh704-source/test.txt' is forbidden in restricted mode
(use '--show-trace' to show detailed location information)

Fixing PR

It seems like Tomberek's PR fixes this issue.

$ nix shell "github:tomberek/nix/flakes_filterSource"
$ sh test.sh 

Does not produce any errors.

nix-cleaned-path-issue's People

Contributors

mazurel avatar

Watchers

 avatar  avatar

nix-cleaned-path-issue's Issues

Test invariants

This tests to ensure lib.cleanSource and friends works as expected. I'm not 100% sure about the PR in the negative sense; does it accidentally allow something that it shouldn't? Are we breaking the hermetic flake evaluation somehow?

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.