Commit Graph

349 Commits

Author SHA1 Message Date
Bas van Dijk
810388afd2 nixos-generate-config: enable overriding configuration.nix 2019-08-08 17:00:10 +02:00
Bjørn Forsman
8f551be935 nixos-generate-config: don't emit tmpfs entry for /tmp
Because it most likely comes from the boot.tmpOnTmpfs option in
configuration.nix (managed declaratively).
2019-06-16 16:21:54 +02:00
Bjørn Forsman
4213e48dd9 nixos-generate-config: add dm-snapshot module if LVM is detected
Without this, the system becomes unbootable if the user creates a LVM
snapshot and reboots.

Fixes https://github.com/NixOS/nixpkgs/issues/33646

(The same kind of problem was fixed in RHEL a few years back:
https://bugzilla.redhat.com/show_bug.cgi?id=1287940)
2019-06-16 15:30:54 +02:00
Bjørn Forsman
9e45f6feac nixos-generate-config: don't generate swapDevices for *files*
Up until now, the output has been the same for swap devices and swap
files:

  { device = "/var/swapfile"; }

Whereas for swap *files* it's easier to manage them declaratively in
configuration.nix:

  { device = "/var/swapfile"; size = 8192; }

(NixOS will create the swapfile, and later resize it, if the size
attribute is changed.)

With the assumption that swap files are specified in configuration.nix,
it's silly to output them to hardware-configuration.nix.
2019-06-16 15:26:33 +02:00
Bjørn Forsman
4755811a12 nixos-generate-config: add support for bcache
Add "bcache" to boot.initrd.availableKernelModules if a bcache device is
detected.

This fixes a problem I've had one too many times: I install NixOS and
forget to add "bcache", resulting in an unbootable machine (until fixed
with Live CD). Now NixOS will do it for me.
2019-06-10 21:22:07 +02:00
Yegor Timoshenko
6a63021eba
Merge pull request #60207 from volth/patch-329
nixos-generate-config: do not build btrfs-tools when btrfs is not used
2019-05-22 15:32:00 +03:00
Linus Heckemann
89b64ab5e1 nixos-generate-config: add rudimentary high-DPI detection
Fixes the main remaining part of #12345
2019-05-15 06:34:40 +02:00
volth
c01ea27ce3
nixos-generate-config: do not build btrfs-tools when btrfs is not used
cross-compilation of `btrfs-tools` is broken, and this usually needless dependency of each system closure on `btrfs-tools` prevents cross-compilation of whole system closures
2019-04-25 12:08:20 +00:00
Eelco Dolstra
5399f34ad9
nix: 2.2 -> 2.2.2 2019-04-15 19:06:57 +02:00
Danylo Hlynskyi
eddb31be99
Merge pull request #55121 from Ma27/add-option-support-to-nixos-build-vms
nixos-build-vms: pass `--option` to `nix-build`
2019-04-14 02:57:57 +03:00
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
Maximilian Bosch
e998f5140f
nixos-build-vms: pass --option to nix-build
Also simplified the argument parsing to write all currently supported
CLI options into a bash array and pass this to `nix-build`.

Also documented `--option` usage in the corresponding manpage.
2019-02-04 10:46:12 +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 6c68fbd4e1f8beac39cb1f499ff90c78256262d6.
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 10addad6035034b2b78f3c74ef436cd7146d5231, reversing
changes made to 7786575c6c0e1b010d46ad00b14d0bb5bf08d7d2.

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 cb1ca420092c8854592afcf1cc0245b7245358f1
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