Commit graph

338 commits

Author SHA1 Message Date
Maximilian Bosch eaf98c7bcf
nixos/nixos-install: tell the user what to do if setting a root password failed
If setting a root password using the `passwd` call in the
`nixos-install` script fails, it should be explained how set it manually
to ensure that nobody gets accidentally locked out of the system.
2019-03-08 19:57:02 +01:00
Matthew Bauer b0799b4219
Merge pull request #56115 from matthewbauer/nixos-rebuild-upgrade-nix
nixos-rebuild: try to get Nix fallback from new channel first
2019-03-02 18:48:28 -05:00
Daiderd Jordan 50fec3dcd2 nixos-rebuild: add edit command (#56241) 2019-02-25 00:59:35 +01:00
Matthew Bauer 475c8aa018 nixos-rebuild: get Nix from channel
If our old Nix can’t evaluate the Nixpkgs channel, try the fallback
from the new channel /first/. That way we can upgrade Nix to a newer
version and support breaking changes to Nix (like seen in the upgrade
o Nix 2.0).

This change should be backported to older NixOS versions!
2019-02-20 20:02:20 -05:00
Eelco Dolstra 07208e7a0b
nixos-generate-config: Don't suggest setting a uid
This hasn't been needed for a long time, even when `mutableUsers =
false`. Setting a uid manually is potentially risky since it could
collide with non-declarative user accounts. (We do check for
collisions between declarative accounts.)
2019-02-11 10:49:25 +01:00
aanderse c01eeda8e9 nixos-generate-config: account for mount points & devices with spaces & tabs in the name (#50234) 2019-02-03 14:33:31 +01:00
Graham Christensen 18119f2d93
Merge pull request #54519 from devhell/modify_ngc.pl
nixos-generate-config: Include extraGroups "wheel"
2019-01-27 15:59:29 -05:00
devhell c3d22fdca1 nixos-generate-config: Include extraGroups "wheel"
I've been asked, on numerous occasions, by my students and others, how
to 'sudo' on NixOS.

Of course new users could read up in the manual on how to do that, or we
could make it more accessible for them by simply making it visible in
the default `configuration.nix` file.

Additionally, as raised in [1], replacing `guest` with something more
recognizable could be potentially beneficial to new users. I've
opted for `jane` for now.

[1]: https://github.com/NixOS/nixpkgs/pull/54519#issuecomment-457012223
2019-01-27 20:33:36 +00:00
Danylo Hlynskyi 0abf181066
Merge pull request #48153 from Ma27/fix-nixos-option-for-invalid-options
nixos-option: don't abort with shell failures if options are not existant
2019-01-24 02:38:02 +02:00
Danylo Hlynskyi a866551226
nixos-option: prune backtick from output
It doesn't work good with double-click selection in terminal (it gets into selection buffer of some terminals)
2019-01-24 02:37:29 +02:00
Claudio Bley 352e06d3da installer/tools: Avoid duplicate LUKS device entries in hw config
There are situations where several filesystems reside on a single encrypted LUKS
device (e.g. when using BTRFS subvolumes).

Simply generating a `boot.init.luks.devices.NAME.device` entry for each mounted
filesystem will result in an error later when evaluating the nix expression in
`hardware-configuration.nix`.
2019-01-19 22:02:49 +01:00
Jörg Thalheim bfbadab4a4
Merge pull request #53801 from Mic92/nixos-builders
nixos-rebuild: allow to override builders
2019-01-13 21:59:43 +00:00
Eelco Dolstra 94ea1c2d83
nix: 2.1.3 -> 2.2 2019-01-11 12:47:06 +01:00
Jörg Thalheim e40bfa4d85
nixos-rebuild: allow to override builders
Since nix 2.0 the no-build-hook option was replaced by the builders options
that allows to override remote builders ad-hoc.
Since it is useful to disable remote builders updating nixos without network,
this commit reintroduces the option.
2019-01-11 11:40:25 +00:00
Frederik Rietdijk 2da31b80bb Merge master into staging-next 2019-01-03 20:07:35 +01:00
(cdep)illabout 46ecec8239
nixos/cpufreq: Remove the alias to set the cpu frequency governor
This PR temporarily fixes the issue with PR 53041 as explained
here:

https://github.com/NixOS/nixpkgs/pull/53041#commitcomment-31825338

The alias `powerManagement.cpufreq.governor` to
`powerManagement.cpuFreqGovernor` has been removed.
2019-01-03 20:57:49 +09:00
Frederik Rietdijk 092e3b50a8 Merge master into staging-next 2019-01-02 21:08:27 +01:00
(cdep)illabout b0f10d2d53
cpufreq: add option for setting the cpu max and min frequencies
This adds a NixOS option for setting the CPU max and min frequencies
with `cpufreq`.  The two options that have been added are:

- `powerManagement.cpufreq.max`
- `powerManagement.cpufreq.min`

It also adds an alias to the `powerManagement.cpuFreqGovernor` option as
`powerManagement.cpufreq.governor`.  This updates the installer to use
the new option name.  It also updates the manual with a note about
the new name.
2019-01-01 19:18:12 +09:00
volth bb9557eb7c lib.makePerlPath -> perlPackages.makePerlPath 2018-12-15 03:50:31 +00:00
Maximilian Bosch b36fa8ef91
nixos-build-vms: fix eval
Previously I got the following error message:

```
error: opening file '/home/ma27/Projects/nixpkgs/nixos/modules/installer/default.nix': No such file or directory
```

Probably related to 6c68fbd4e1.
2018-11-23 13:43:47 +01:00
Jörg Thalheim a91a1eede5
Merge pull request #50495 from zimbatm/nixos-move-autoupgrade
nixos: move system.autoUpgrade
2018-11-17 13:08:27 +00:00
zimbatm 7b9a553e21
nixos: move system.autoUpgrade
This is not installer-specific
2018-11-17 14:05:30 +01:00
Silvan Mosberger 5c4ed80ad7
Merge pull request #49835 from Synthetica9/fix-49826
nixos-generate-config: fix for swapless kernels
2018-11-17 02:53:43 +01:00
Léo Gaspard 27a5427526
nixos-build-vms: fix syntax error
Introduced by 6c68fbd4e1
2018-11-13 00:40:07 +09:00
Léo Gaspard 6c68fbd4e1
tests: refactor to carry the package set as an argument
This way, the package set will be possible to pass without re-importing
all the time
2018-11-11 23:11:45 +09:00
Patrick Hilhorst ce65df3a36
nixos-generate-config: fix for swapless kernels
Fixes #49826
2018-11-06 17:32:54 +01:00
Eelco Dolstra b6bac6c144
Revert "Merge pull request #48122 from zimbatm/pkg-nixos-rebuild"
This reverts commit 10addad603, reversing
changes made to 7786575c6c.

NixOS scripts should be kept in the NixOS source tree, not in
pkgs. Moving them around is just confusing and creates unnecessary
code/history churn.
2018-10-16 20:25:44 +02:00
zimbatm 1875344542
nixos-*: init as package
Move all the nixos-* scripts from the nixos distribution as real
packages in the pkgs/ package set.

This allows non-nixos users to run the script as well. For example,
deploying a remote machine with:

    nixos-rebuild --target-host root@hostname --build-host root@hostname
2018-10-16 11:12:36 +02:00
Janne Heß 7748c3da1b nixos/nixos-install: Unset system
The system variable is used from the (possibly polluted) shell
environment.
This causes nixos-install to fail in a nix-shell because the system
shell variable is automatically set to the current system (e.g.
x86_64-linux).
2018-10-14 20:12:08 +02:00
Maximilian Bosch 76cc15a364
nixos-option: don't abort with shell failures if options are not existant
`nixos-option` basically handles two cases: the given option is either a
valid option defined using `mkOption` or an attribute set which contains
a set of options.

If none of the above cases is valid, `$1` is invalid. Unfortunatley the
script interpreted invalid options as an attribute set which rendered
shell failures when trying to evaluate the arguments.

First of all, `if names=$(attrNames ...)` resulted in `<PRIMOP>` as
`attrNames` simply evaluated `builtins.attrNames $result` which results
in a non-applied function with `$result` being empty. Trying to map over
this string using `nixMap` while applying `escapeQuotes` causes the bash
error as `eval echo "<PRIMOP>"` is invalid syntax.

Explicitly checking if `$result' contains a value (do we have an
attribute set?) and otherwise returning a warning and asking if $option
exists fixes the problem.

Fixes #48060
2018-10-10 13:19:52 +02:00
Vladimír Čunát de93b32f90
nixos-option: fix #47722 when missing ~/.nix-defexpr/channels
The problem was that the non-fatal warning was not omitted
from the output when constructing a nix expression.
Now it seems OK for me.  When return code is OK,
the warnings don't get passed anywhere, but I expect
that won't matter for this utility.  Fatal errors are still shown.
2018-10-04 16:52:17 +02:00
Peter Hoeg 7af39cb9b8
Merge pull request #47482 from peterhoeg/f/hyperv
nixos on hyperv: load proper modules and make installer use the module
2018-10-03 11:45:29 +08:00
Eelco Dolstra 2c9265c950
nix: 2.1.2 -> 2.1.3 2018-10-02 11:07:48 +02:00
Peter Hoeg ca6d41ae65 nixos-installer: use the hyperv module on hyperv 2018-09-28 22:28:18 +08:00
Eelco Dolstra 869f615ff4
nix: 2.1.1 -> 2.1.2 2018-09-20 00:17:45 +02:00
Eelco Dolstra 1510f324a3
nix: 2.1 -> 2.1.1 2018-09-06 01:12:03 +02:00
Eelco Dolstra 347638ccfe
nix: 2.0.4 -> 2.1 2018-09-03 01:37:55 +02:00
Uli Baum d660428f85 nixos-generate-config.pl: remove executable bit
it was erroneously set in cb1ca42009
although this file isn't executable before patching shebangs.
2018-09-01 21:29:30 +02:00
Vladimír Čunát 37a45e5a97
nixos-generate-config: fix perl quoting after cb1ca42 2018-09-01 21:13:54 +02:00
Venkateswara Rao Mandela cb1ca42009 nixos/doc: add instructions for installation behind a proxy (#45854)
The instructions to install nixos behind a proxy were not clear. While
one could guess that setting http_proxy variables can get the install
rolling, one could end up with an installed system where the proxy
settings for the nix-daemon are not configured.

This commit updates the documentation with

1. steps to install behind a proxy

2. configure the global proxy settings so that nix-daemon can access
internet.

3. Pointers to use nesting.clone in case one has to use different proxy
settings on different networks.
2018-09-01 16:12:35 +02:00
Silvan Mosberger 47b3cdf9be
Merge pull request #44108 from bennofs/gen-config-extlinux
nixos-generate-config: detect extlinux bootloader
2018-08-05 22:59:46 +02:00
Tuomas Tynkkynen 96190535e5 Revert "nixos: rename system.{stateVersion,defaultChannel} -> system.nixos.\1"
This reverts commit 095fe5b43d.

Pointless renames considered harmful. All they do is force people to
spend extra work updating their configs for no benefit, and hindering
the ability to switch between unstable and stable versions of NixOS.

Like, what was the value of having the "nixos." there? I mean, by
definition anything in a NixOS module has something to do with NixOS...
2018-07-28 00:12:55 +03:00
Benno Fünfstück 29af6a6080 nixos-generate-config: detect extlinux bootloader 2018-07-25 22:45:09 +02:00
volth 2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
volth 87f5930c3f [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
Maximilian Bosch 6f72b63601
nixos/nixos-option: don't abort in case of evaluation errors
When running e.g. `nixos-option boot.kernelPackages` I get an output
like this on the current unstable channel (18.09pre144959.be1461fc0ab):

```
$ nixos-option boot.kernelPackages
Value:
*exit 1*
```

This is fairly counter-intuitive as I have no clue what might went
wrong. `strace` delivers an output like this:

```
read(3, "error: Package \342\200\230cryptodev-linu"..., 128) = 128
read(3, "ux/cryptodev/default.nix:22 is m"..., 128) = 128
read(3, "lowBroken = true; }\nin configura"..., 128) = 128
read(3, "you can add\n  { allowBroken = tr"..., 128) = 128
read(3, "n)\n", 128)                    = 3
read(3, "", 128)                        = 0
```

`nixos-option` evaluates the system config using `nix-instantiate` which
might break when the evaluation fails (e.g. due to broken or unfree
packages that are prohibited to evaluate by default). The script aborts
due to the shebang `@shell@ -e`.

In order to ensure that no unexpected
behavior occurs due to removing `-e` from the interpreter the easiest
way to work around this was to wrap `nix-instantiate` in `evalNix()`
with a `set +e`. The function checks the success of the evaluation with
`$?` in the end. Additionally `evalNix` shouldn't break, if one
evaluation (e.g. the values that contain a package set by default) to
return additional information like a description.

With the change `nixos-option boot.kernelPackages` delivers the
following output for me:

```
Value:
error: Package ‘cryptodev-linux-1.9-4.14.52’ in /nix/store/47z2s8cwppymmgzw6n7pbcashikyk5jk-nixos/nixos/pkgs/os-specific/linux/cryptodev/default.nix:22 is marked as broken, refusing to evaluate.

Default:
{ __unfix__ = <LAMBDA>; acpi_call = <CODE>; amdgpu-pro = <CODE>; ati_drivers_x11 = <CODE>; batman_adv = <CODE>; bbswitch = <CODE>; bcc = <CODE>; beegfs-module = <CODE>; blcr = <CODE>; broadcom_sta = <CODE>; callPackage = <CODE>; cpupower = <CODE>; cryptodev = <CODE>; dpdk = <CODE>; e1000e = <CODE>; ena = <CODE>; evdi = <CODE>; exfat-nofuse = <CODE>; extend = <CODE>; facetimehd = <CODE>; fusionio-vsl = <CODE>; hyperv-daemons = <CODE>; ixgbevf = <CODE>; jool = <CODE>; kernel = <CODE>; lttng-modules = <CODE>; mba6x_bl = <CODE>; mwprocapture = <CODE>; mxu11x0 = <CODE>; ndiswrapper = <CODE>; netatop = <CODE>; nvidiaPackages = <CODE>; nvidia_x11 = <CODE>; nvidia_x11_beta = <CODE>; nvidia_x11_legacy304 = <CODE>; nvidia_x11_legacy340 = <CODE>; nvidiabl = <CODE>; odp-dpdk = <CODE>; openafs = <CODE>; openafs_1_8 = <CODE>; perf = <CODE>; phc-intel = <CODE>; pktgen = <CODE>; ply = <CODE>; prl-tools = <CODE>; recurseForDerivations = true; rtl8192eu = <CODE>; rtl8723bs = <CODE>; rtl8812au = <CODE>; rtl8814au = <CODE>; rtlwifi_new = <CODE>; sch_cake = <CODE>; spl = <CODE>; splLegacyCrypto = <CODE>; splStable = <CODE>; splUnstable = <CODE>; stdenv = <CODE>; sysdig = <CODE>; systemtap = <CODE>; tbs = <CODE>; tmon = <CODE>; tp_smapi = <CODE>; usbip = <CODE>; v4l2loopback = <CODE>; v86d = <CODE>; vhba = <CODE>; virtualbox = <CODE>; virtualboxGuestAdditions = <CODE>; wireguard = <CODE>; x86_energy_perf_policy = <CODE>; zfs = <CODE>; zfsLegacyCrypto = <CODE>; zfsStable = <CODE>; zfsUnstable = <CODE>; }

Example:
{ _type = "literalExample"; text = "pkgs.linuxPackages_2_6_25"; }

Description:

"This option allows you to override the Linux kernel used by\nNixOS. Since things like external kernel module packages are\ntied to the kernel you're using, it also overrides those.\nThis option is a function that takes Nixpkgs as an argument\n(as a convenience), and returns an attribute set containing at\nthe very least an attribute <varname>kernel</varname>.\nAdditional attributes may be needed depending on your\nconfiguration. For instance, if you use the NVIDIA X driver,\nthen it also needs to contain an attribute\n<varname>nvidia_x11</varname>.\n"

Declared by:
  "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/kernel.nix"

Defined by:
  "/home/ma27/Projects/nixos-config/system/boot.nix"
```
2018-07-12 00:37:01 +02:00
Florian Klink 0868aa76f6 nixos-generate-config.pl: users.extraUsers-> users.users 2018-06-30 02:26:47 +02:00
Eelco Dolstra 47b85dc5ab
nix: 2.0.3 -> 2.0.4 2018-05-31 11:31:04 +02:00
Eelco Dolstra 0eea0209cf
nix: 2.0.2 -> 2.0.3 2018-05-30 11:47:09 +02:00
Philippe Grégoire 536a41171b
Remove all references to absent nixos-prepare-root
Fixes the broken 0f5d5970b2 commit.
2018-05-18 09:53:11 -04:00