GithubHelp home page GithubHelp logo

Comments (7)

nrdxp avatar nrdxp commented on May 20, 2024 1

I've got some ideas for making the bootstrap process simpler and more automatic and this could definitely be a part of it. It'll take some time, but I'll have a new branch up soon(ish) and I'll see if this can work.

from digga.

blaggacao avatar blaggacao commented on May 20, 2024 1

When running nix edit nixpkgs#hello, there is a heuristic to find the package declaration which essentially goes like this:

$ nix repl
Welcome to Nix version 3.0pre20200829_f156513. Type :? for help.

nix-repl> pkgs = import <nixpkgs> {}

nix-repl> builtins.unsafeGetAttrPos "description" pkgs.hello.meta
{ column = 5; file = "/home/zimbatm/go/src/github.com/NixOS/nixpkgs/pkgs/applications/misc/hello/default.nix"; line = 15; } 

Once the file and line have been found, call $EDITOR $file +$line.

Here is what happens when an attribute cannot be found:

nix-repl> builtins.unsafeGetAttrPos "broken" pkgs.hello.meta
null 

It wouldn’t be too hard to write a tool that relies on this information and then combines it with an AST patcher. We have a number of those in the community.

Quote from zimbatm from a private conversation.

from digga.

nrdxp avatar nrdxp commented on May 20, 2024

I've decided not to opt for external tools, but instead I created a bare branch which should suffice if you're wanting the benefits of this template without any of the predefined profiles. I've also wired up the template output, so creating a new iteration of a bare template is as simple as:

nix flake new -t "github:nrdxp/nixflk/bare" flk

from digga.

nrdxp avatar nrdxp commented on May 20, 2024

I'm reopening this, as we might be able to use cookiecutter during the building of the system generation to easily solve some current introspective problems, such as knowing available users to assign user properties to each, without causing infinite recursion.

Not to mention, cookiecutter or similar tools could help with #179 in general.

from digga.

blaggacao avatar blaggacao commented on May 20, 2024

I'd have thought ideally nix templates would offer us something, here.

Instead of a template, we might use annotations, so that an unprocessed template is still a valid project.

{
  name = "hey"; # setter: name
}

And I think nix even provides something to manipulate values on the fly over the cli.

from digga.

blaggacao avatar blaggacao commented on May 20, 2024

With suites, we have a cheap way of introspecting the global composing components for a host by name and coukd write those into a host template via substitute --replace '@suites@' "${suiteNames}".

That could go into flk up which already partly addresses this use case.

from digga.

blaggacao avatar blaggacao commented on May 20, 2024

This template has evolved quite a bit, and also flk gained a boostrapping command. I don't think there is a need to improve the templating experience further.

from digga.

Related Issues (20)

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.