nixos

How to build Nix packages from source?

孤街醉人 提交于 2021-02-19 07:46:06
问题 I think NixOS is great, but can't figure out how to build a package from source. Understanding the Nix expression language is not the problem, but to know what to put in a default.nix in order to build a package. Take for example the Nix expression for gedit : { stdenv, intltool, fetchurl, enchant, isocodes , pkgconfig, gtk3, glib , bash, wrapGAppsHook, itstool, libsoup, libxml2 , gnome3, librsvg, gdk_pixbuf, file, gspell }: stdenv.mkDerivation rec { inherit (import ./src.nix fetchurl) name

How to `nix-build` again a built store path?

十年热恋 提交于 2021-02-18 05:32:09
问题 I create my own repository to fetch some git source. # packages.nix with (import <nixpkgs> {}); rec { rustcSource = fetchgit { url = https://github.com/rust-lang/rust; rev = "3191fbae9da539442351f883bdabcad0d72efcb6"; sha256 = "0w1l14kz9kxyj5dw3w9xxk1fzww5xqs3sf8saay0mh7nkmvrdb59"; }; } Then I build rustcSource , sudo nix-env -f package.nix -A rustcSource It reveals a store path of /nix/store/096fpy9qjbz5r14aadjnq9d2md9ql9cg-rust-3191fba . The problem is, I forgot to download it's submodules,

nix-shell: how to specify a custom environment variable?

巧了我就是萌 提交于 2020-07-17 11:22:05
问题 I'm learning about nixos and nix expressions. In a project folder I created a shell.nix and I when I run nix-shell I want it to preset an environment variable for me. For example to set the PGDATA env var. I know there are several ways to write nix expression files (I'm not yet used to most of them). Here is my sample: shell.nix let pkgs = import <nixpkgs> {}; name = "test"; in pkgs.myEnvFun { buildInputs = [ pkgs.python pkgs.libxml2 ]; inherit name; extraCmds = '' export TEST="ABC" ''; } 回答1

How can I restart a service on Nixos?

独自空忆成欢 提交于 2020-06-26 05:23:14
问题 I've enabled the emacs daemon in my 'nix' config via: services.emacs.enable = true; However I'd now like to restart the daemon, due to changing my emacs config. How can I restart it? systemctl list-unit-files | grep emacs does not return any results (it would also be useful to know why). pstree -s emacs -+= 00001 root systemd \-+= 01301 chris /nix/store/3hmpbbcv1db42m9g34c9g4q6qinw50x4-systemd-237/lib/systemd/systemd --user \-+= 01351 chris /nix/store/zkss82a853cv9d8w9iq25cp26q3jh4fp-emacs-25

How can I restart a service on Nixos?

本秂侑毒 提交于 2020-06-26 05:20:40
问题 I've enabled the emacs daemon in my 'nix' config via: services.emacs.enable = true; However I'd now like to restart the daemon, due to changing my emacs config. How can I restart it? systemctl list-unit-files | grep emacs does not return any results (it would also be useful to know why). pstree -s emacs -+= 00001 root systemd \-+= 01301 chris /nix/store/3hmpbbcv1db42m9g34c9g4q6qinw50x4-systemd-237/lib/systemd/systemd --user \-+= 01351 chris /nix/store/zkss82a853cv9d8w9iq25cp26q3jh4fp-emacs-25

Nix: Building `waf` produces a file, but I seem to need a folder

不问归期 提交于 2020-01-24 19:57:28
问题 I've cloned the nixpkgs repo. From the top of that repo, I can run nix-build -A waf to build waf , and nix-env -f . -iA waf to make waf part of my user environment. Neither complains -- but afterward I am still unable to call waf : [jeff@jbb-dell:~/nix/nixpkgs]$ waf waf: command not found [jeff@jbb-dell:~/nix/nixpkgs]$ Most packages, when I build them using nix-build -A , produce a symlink called result that goes to a folder containing the executable in question. Strangely, though, in waf 's

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

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;