How to refer to user's home directory in configuration.nix? - nix

I can't seem to refer to ${users.users.username.home} within the same file where this configuration is set up:
undefined variable 'users'
How should I refer to this piece of configuration from within the same file? In case it's relevant, both users.users.username and the reference are in a file included by /etc/nixos/configuration.nix.

I just needed config. at the start of the reference: ${config.users.users.username.home}.

Related

Where should the erlang_ls.config go

I want to use coc.nvim and elrang_ls in vim8.2. There are some problems. It report missing an erlang_ls.config when I open a erlang file. But i have erlang_ls.config in project root.
the result of CocCommand workspace.showOutput show it read config from unexpected place
Where is correct position for erlang_ls.config?
Sorry for my poor English. Thanks.
It is possible to customize the behaviour of the erlang_ls server via
a configuration file, named erlang_ls.config. The erlang_ls.config
file should be placed in the root directory of a given project to
store the configuration for that project.
According to the picture, the clue has already been given to you. In the els_config.erl file consult_config function, line 126. error type = 2.
I think the information is enough, you can find source code file and read it and find why?
It is need create erlang_ls.config in C:\Users\Administrator\AppData\Roaming\erlang_ls and erlang_ls.config erlang_ls.yaml in the project root path. But I don't know why.

Generate URL of resources that are handled by Grails AssetPipeline

I need to access a local JSON file. Since Grails 2.4 implements the AssetPipeline plugin by default, I saved my local JSON file at:
/grails-app/assets/javascript/vendor/me/json/local.json
Now what I need is to generate a URL to this JSON file, to be used as a function parameter on my JavaScript's $.getJSON() . I've tried using:
var URL.local = ""${ raw(asset.assetPath(src: "local.json")) }";
but it generates an invalid link:
console.log(URL.local);
// prints /project/assets/local.json
// instead of /project/assets/vendor/me/json/local.json
I also encountered the same scenario with images that are handled by AssetPipeline1.9.9— that are supposed to be inserted dynamically on the page. How can I generate the URL pointing this resource? I know, I can always provide a static String for the URL, but it seems there would be a more proper solution.
EDIT
I was asked if I could move the local JSON file directly under the assets/javascript root directory instead of placing it under a subdirectory to for an easier solution. I prefer not to, for organization purposes.
Have you tried asset.assetPath(src: "/me/json/local.json")
The assets plugin looks in all of the immediate children of assets/. Your local.json file would need to be placed in /project/assets/foo/ for your current code to pick it up.
Check out the relevant documentation here which contains an example.
The first level deep within the assets folder is simply used for organization purposes and can contain folders of any name you wish. File types also don't need to be in any specific folder. These folders are omitted from the URL mappings and relative path calculations.

Using custom Environment Variables in JetBrains products for File watcher Arguments

I am trying to use node-sass as File Watcher in WebStorm.
I created a local variable named STYLE with main stylesheet name inside to add it as variable to File Watcher settings everywhere it needed.
But if I add $STYLE$ in a Path I get an error:
/Users/grawl/Sites/sitename/node_modules/node-sass/bin/node-sass app/styles/$STYLE$.scss public/$STYLE$.css
error reading file "app/styles/$STYLE$.scss"
Process finished with exit code 1
IDE just don't interprets my variable.
Also I tried to use %STYLE% but with no luck.
Please do not blame me for direct mapping filenames in File Watcher without using built-in variables like $FileName$ or $FileNameWithoutExtension$ because even WebStorm 9 EAP does not support preprocessor's dependencies except of built-in preprocessors like Sass and Jade.
This case is not only case to use local variables.
For example I want to put into variables my public/ path (that can be dest/ in other projects) and app/ (can be source/). And so on.
So let's figure out this feature.

grails render tag: can't find file unless it's located in src/templates/scaffolding?

I tried to follow the example under "Shared Templates" here:
http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.2.3%20Views%20and%20Templates
But this just plain didn't work. The tag I used was:
<g:render template="/includes/mySearch"></g:render>
I created a directory under the views called "includes" and created a gsp file, with a very basic form in it, named mySearch.gsp.
However, grails reported being unable to find the file:
java.io.FileNotFoundException: C:\springsource\sts-2.8.1.RELEASE\grails-1.3.7\src\grails\templates\scaffolding_mySearch.gsp
According to the documentation: "In this case you can place them in the root views directory at grails-app/views or any subdirectory below that location and then with the template attribute use a / before the template name to indicate the relative template path."
It would appear that this is exactly what I did, but grails was not looking there? Any advice?
Many thanks,
Alexx
Template files need to be starting with an underscore. Therefore you need to rename your mySearch.gsp to _mySearch.gsp.

Where and How to define Constant in Symfony?

I have a few of my own constants in symfony, and I need to make them available throughout the application, where to best define them?
I tried, in the directory myapps\config\config.php, define my constant in this way:
sfConfig::set('aaa', 'mya');
But when I tried to access the constant in myapps\apps\frontend\modules\login\actions\actions.class.php, using this comand
sfConfig::get('aaa')
I simply get a null, indicating that it hasn't been defined.
How and where to define symfony constant so that it is accessible throughout the whole project?
This is how I solved the problem:
Put the following into my myapp/apps/frontend/config/app.yml:
all:
.app_set:
bpobackend: me
bpoRedirectScreen: allow
Then in action module, call the var_dump to check the value
var_dump(sfConfig::get('app_bpobackend'));
looks like you are trying to use symfony 1.0 style configuration with symfony 1.1 or 1.2. all config.php files have been removed in 1.1. see Overview of the Configuration Files for what to use instead. and always be sure to look at the documentation for the proper version (1_2 (or whatever version you are using) in the url).
I have tried to add constant in the config.php in Symfony 1.0..
So If you want to add constant variables in config.php then
sfConfig::add(array('SF_DEFAULT_DATEFORMAT' => 'dd-MM-yyyy'));
This is the code where I have define the date format with name 'SF_DEFAULT_DATEFORMAT'...
So You can Tried with this One ...

Resources