Cheatsheet: Difference between revisions

Pigeon (talk | contribs)
m use "console" highlight instead of "shell", add $ prompt indicator where it's missing
update subsection "upgrading invdividual packages to a different channel" so it can be easier for newer users of nix-channel usage
 
(One intermediate revision by one other user not shown)
Line 262: Line 262:
For example one can have both the unstable and stable channels on system root:
For example one can have both the unstable and stable channels on system root:


<syntaxHighlight lang="console">
<syntaxhighlight lang="console">
$ sudo nix-channel --list
$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-17.03
nixos https://nixos.org/channels/nixos-25.11
nixos-unstable https://nixos.org/channels/nixos-unstable
nixos-unstable https://nixos.org/channels/nixos-unstable
</syntaxHighlight>
</syntaxhighlight>


and the following in <code>configuration.nix</code>:
update the channels using the following command:<syntaxhighlight lang="bash">
$ sudo nix-channel -update nixos nixos-unstable
</syntaxhighlight>and the following in <code>configuration.nix</code>:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 352: Line 354:


using channels
using channels
<syntaxhighlight lang="nix">
<syntaxhighlight lang="console">
$ nix-build -E 'with (import <nixpkgs>{}); polybar.override { i3Support = true; }'
$ nix-build -E 'with (import <nixpkgs>{}); polybar.override { i3Support = true; }'
</syntaxhighlight>
</syntaxhighlight>
using a local repo
using a local repo
<syntaxhighlight lang="nix">
<syntaxhighlight lang="console">
$ nix-build -E 'with (import ./default.nix{}); polybar.override { i3Support = true; }'
$ nix-build -E 'with (import ./default.nix{}); polybar.override { i3Support = true; }'
</syntaxhighlight>
</syntaxhighlight>