nix

Does nix build deamon keep build log?

笑着哭i 提交于 2020-01-15 06:25:10
问题 Sometime when running nix-build and nixos-rebuild I found easy-to-fix problem (like deprecated warnings, redundant import) and I thought "Interesting, I might be able to fix that on my free time". I know I could redirect the build log to a file but I keep forget doing it until I see the warning again. Question: Does nix build daemon keep building log somewhere? 回答1: You can enable build-cache-failures in your nix.conf and then use a combination of nix-store --query-failed-paths and nix-store

How does Nix's “callPackage” call functions defined without an ellipsis?

这一生的挚爱 提交于 2020-01-03 08:48:33
问题 To call a Nix function that uses set destructuring, you need to pass it a set with exactly the keys it requires, no more and no less: nix-repl> ({ a }: a) { a = 4; b = 5; } error: anonymous function at (string):1:2 called with unexpected argument ‘b’, at (string):1:1 The exception to this is if the function's argument list contains an ellipsis at the end: nix-repl> ({ a, ... }: a) { a = 4; b = 5; } 4 However, most of the packages in nixpkgs consist of a default.nix file containing a function

Import unstable and inherit config

别来无恙 提交于 2020-01-02 21:02:41
问题 I have a package-upgrades.nix that I use to upgrade packages from unstable or a fork. {...}: { nixpkgs.config = { packageOverrides = let pkgsUnstable = import ( fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz ) { }; pkgsMaster = import ( fetchTarball https://github.com/NixOS/nixpkgs/archive/master.tar.gz ) { }; pkgsLocal = import ( fetchTarball https://github.com/moaxcp/nixpkgs/archive/local.tar.gz ) { }; in pkgs: rec { dropbox = pkgsUnstable.dropbox;

Import unstable and inherit config

前提是你 提交于 2020-01-02 21:01:13
问题 I have a package-upgrades.nix that I use to upgrade packages from unstable or a fork. {...}: { nixpkgs.config = { packageOverrides = let pkgsUnstable = import ( fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz ) { }; pkgsMaster = import ( fetchTarball https://github.com/NixOS/nixpkgs/archive/master.tar.gz ) { }; pkgsLocal = import ( fetchTarball https://github.com/moaxcp/nixpkgs/archive/local.tar.gz ) { }; in pkgs: rec { dropbox = pkgsUnstable.dropbox;

Coqide 8.5: No syntax highlighting on Linux

蓝咒 提交于 2019-12-30 07:30:09
问题 I installed Coqide 8.5 w/ nix . Unfortunately, the text is blakc in all panels; there's no syntax highlighting of any kind (otherwise, 8.5 seems a big improvement over 8.4, which I've installed as well). I also get the following: (coqide:17272): GtkSourceView-WARNING **: Unknown parent scheme 'classic' in scheme 'coq_style' (coqide:17272): GtkSourceView-WARNING **: Failed to load '/nix/store/2sxcqfc4q3ls4g2q13n1zwfhnydvgq-coq-8.5pl1/share/coq/coq.lang': could not find the RelaxNG schema file

Nix: Querying packages' packages

元气小坏坏 提交于 2019-12-22 18:22:21
问题 I can query available packages w/ nix-env -qa [package] but how can I look for optional packages (e.g. libraries) that depend on a primary package and can be loaded or installed separately? Example: Coq ( coq-8.6 ) has packages coqPackages_8_6.ssreflect and coqPackages_8_6.mathcomp that I can get no information about in Nix AFAIK 回答1: I personally never use nix-env -qa because it is very slow. Instead, when I'm looking for a top-level package (an application), I use http://nixos.org/nixos

nix-shell as #! interpreter for runghc

别等时光非礼了梦想. 提交于 2019-12-22 04:28:26
问题 I'm trying to use nix-shell as a #! wrapper for runghc, as suggested in the manpage. But it cannot find the libraries. Given the following example, cut-down from the manpage #! /usr/bin/env nix-shell #! nix-shell -i runghc -p haskellPackages.HTTP import Network.HTTP main = return () I get the following result: [~:0]$ ./nixshelltest nixshelltest:4:1: error: Failed to load interface for ‘Network.HTTP’ Use -v to see a list of the files searched for. [~:1]$ to my mind, that's exactly what nix

How to use Nix to setup a development environment?

不羁岁月 提交于 2019-12-21 03:43:28
问题 Let's say I need PostgreSQL 9.6.3 and Ruby 2.3.1 and various other tools. I can't find a tutorial that explains what I need to do. From the Nix manual, I seem to need to write a Nix expression to install the needed dependencies, but I can't make the leap from: { stdenv, fetchurl, perl }: stdenv.mkDerivation { name = "hello-2.1.1"; builder = ./builder.sh; src = fetchurl { url = ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz; md5 = "70c9ccf9fac07f762c24f2df2290784d"; }; inherit perl; } to

how to add NixOS unstable channel declaratively in configuration.nix

十年热恋 提交于 2019-12-20 09:31:33
问题 The NixOS cheatsheet describes how to install packages from unstable in configuration.nix . It starts off by saying to add the unstable channel like so: $ sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable $ sudo nix-channel --update Then, it is easy to use this channel in configuration.nix (since it should now be on NIX_PATH ): nixpkgs.config = { allowUnfree = true; packageOverrides = pkgs: { unstable = import <nixos-unstable> { config = config.nixpkgs.config; }; }; };

我如何获得执行Python程序的时间?

こ雲淡風輕ζ 提交于 2019-12-18 12:49:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我在Python中有一个命令行程序,需要花一些时间才能完成。 我想知道完成跑步所需的确切时间。 我已经看过 timeit 模块,但它似乎仅适用于一小段代码。 我想安排整个节目的时间。 #1楼 我真的很喜欢 Paul McGuire的答案 ,但是我使用Python3。所以对于那些感兴趣的人:这是他的答案的修改,可以在* nix上的Python 3上使用(我想在Windows下,应该使用 clock() 代替 time() ): #python3 import atexit from time import time, strftime, localtime from datetime import timedelta def secondsToStr(elapsed=None): if elapsed is None: return strftime("%Y-%m-%d %H:%M:%S", localtime()) else: return str(timedelta(seconds=elapsed)) def log(s, elapsed=None): line = "="*40 print(line) print(secondsToStr(), '-', s) if elapsed: print(