Commit graph

755 commits

Author SHA1 Message Date
jakobrs 34f242c13d nixos/installer: Add terminus_font to installation_iso_base 2020-04-15 14:21:42 +02:00
Maximilian Bosch ec6bac99cc
nixos/build-vms: propagate file location
When trying to build a VM using `nixos-build-vms` with a configuration
that doesn't evaluate, an error "at `<unknown-file>`" is usually shown.

This happens since the `build-vms.nix` creates a VM-network of
NixOS-configurations that are attr-sets or functions and don't contain
any file information. This patch manually adds the `_file`-attribute to
tell the module-system which file contained broken configuration:

```
$ cat vm.nix
{ vm.invalid-option = 1; }

$ nixos-build-vms vm.nix
error: The option `invalid-option' defined in `/home/ma27/Projects/nixpkgs/vm.nix@node-vm' does not exist.
(use '--show-trace' to show detailed location information)
```
2020-04-13 17:50:13 +02:00
Eelco Dolstra aa084e2a24
nix: Fix fallback paths 2020-04-10 21:13:15 +02:00
Michael Reilly 84cf00f980
treewide: Per RFC45, remove all unquoted URLs 2020-04-10 17:54:53 +01:00
Eelco Dolstra cea352d276
nix: 2.3.3 -> 2.3.4 2020-04-10 17:23:28 +02:00
worldofpeace df8c30fa25 iso-image: make $ARCH shorter
we use stdenv.hostPlatform.uname.processor, which I believe is just like
`uname -p`.

Example values:
```
(import <nixpkgs> { system = "x86_64-linux"; }).stdenv.hostPlatform.uname.processor
"x86_64"

(import <nixpkgs> { system = "aarch64-linux"; }).stdenv.hostPlatform.uname.processor
aarch64

(import <nixpkgs> { system = "armv7l-linux"; }).stdenv.hostPlatform.uname.processor
"armv7l"
```
2020-04-09 20:10:01 -04:00
worldofpeace a775961c8f Revert "Revert "iso-image: normalize volumeID""
This reverts commit 21b50e6f68.
2020-04-09 20:06:32 -04:00
worldofpeace 21b50e6f68
Revert "iso-image: normalize volumeID" 2020-04-09 19:43:59 -04:00
worldofpeace 8583d99e42
Merge pull request #83551 from worldofpeace/iso-id
iso-image: normalize volumeID
2020-04-09 19:31:52 -04:00
Jörg Thalheim e6a15db534
nixos: default nix.maxJobs to auto
Instead of making the configuration less portable by hard coding the number of
jobs equal to the cores we can also let nix set the same number at runtime.
2020-04-07 08:45:56 +01:00
worldofpeace 591e8d5708 iso-image: make sure volumeID is less than 32 chars 2020-03-27 21:35:12 -04:00
worldofpeace 70a8e9ace9 iso-image: normalize volumeID
The volumeID will now be in the format of:
nixos-$EDITON-$RELEASE-$ARCH

an example for the minimal image would look like:
nixos-minimal-20.09-x86-64-linux
2020-03-27 21:30:54 -04:00
Eelco Dolstra a0a61c3e34 nixos-option: Disable on Nix >= 2.4 because it doesn't compile
This is needed when using the overlay from the Nix flake.
2020-03-20 14:52:22 +01:00
Eelco Dolstra 21a3b141c3
nix-fallback-paths.nix: Fix x86_64-linux path
https://github.com/NixOS/nix/issues/3370
2020-02-24 10:16:26 +01:00
worldofpeace 65bdc05ae8
Merge pull request #78935 from worldofpeace/update-gnome3-iso-expression
installation-cd-graphical-gnome: updates
2020-02-23 07:39:48 -05:00
worldofpeace ad4565caa1 installation-cd-graphical-gnome: updates
Note we're not using wayland default in the graphical media because it
could cause headaches for Nvidia users. But the session is still available
if someone logs out.
2020-02-23 07:17:37 -05:00
Eelco Dolstra 3c47f78e82
nix: 2.3.2 -> 2.3.3 2020-02-19 01:54:25 +01:00
Eelco Dolstra a5f883e535 nixos/modules/installer/cd-dvd/channel.nix: Handle null config.system.nixos.revision 2020-02-15 20:16:14 +01:00
Maximilian Bosch c391343fcd
nixos/nixos-build-vms: switch to python test-driver
In 0945178b3c we decided that Perl-based
VM tests should be deprecated and will be removed between 20.03 and
20.09. So let's switch `nixos-build-vms(8)` to python as well (which is
entirely interactive, so other scripts won't break).

In my experience, the test-driver isn't used most of the time, so this
patch is mainly supposed to get rid of the (probably misleading)
deprecation warning when running `nixos-build-vms`. Apart from that, the
interface for python's test-driver is way nicer.
2020-02-15 19:35:17 +01:00
snicket2100 50a597cd7a
installation-cd-graphical-base.nix: adding git (#79098) 2020-02-14 18:52:18 +02:00
Graham Christensen 2d42fc240c
nixos-enter: redirect to fd2 instead of a file named /dev/stderr
In some cases, /dev/stderr may not point to a sensible location. For
example, running nixos-enter inside a systemd unit where the unit's
StandardOutput and StandardError are set to be sockets. In these
cases, this line would fail.

Piping to fd2 directly works just as well, even under strange and
twisted executions.

Co-authored-by: Michael Bishop <michael.bishop@iohk.io>
2020-02-12 21:18:27 -05:00
Eelco Dolstra fb05afd78d Doh 2020-02-10 16:32:59 +01:00
Eelco Dolstra 8f86624ac9 nixos-rebuild: Remove TODOs 2020-02-10 15:45:27 +01:00
Eelco Dolstra c05cc615f2 nixos.revision: Use null instead of "master"
"master" is not a valid SHA-1 commit hash, and it's not even
necessarily the branch used. 'nixos-version --revision' now returns an
error if the commit hash is not known.
2020-02-10 15:45:15 +01:00
Eelco Dolstra b98ea45608 nixos-version --json: Use builtins.toJSON 2020-02-10 15:45:10 +01:00
Eelco Dolstra f9392f04ae nixos-rebuild: Remove --keep-going flag 2020-02-10 15:45:06 +01:00
Eelco Dolstra 4089dbf090 nixos-rebuild: Make 'edit' work with with flakes 2020-02-10 15:45:03 +01:00
Eelco Dolstra c08930874a nixos-rebuild: Propagate various flake lock file flags
And also --refresh and --no-net.
2020-02-05 23:15:18 +01:00
Eelco Dolstra 2a0cf385d2 nixos-rebuild: Avoid subshell reading hostname
Co-Authored-By: Jörg Thalheim <Mic92@users.noreply.github.com>
2020-02-05 23:15:18 +01:00
Eelco Dolstra 2452042c47 nixos-rebuild: Support -L flag 2020-02-05 23:15:18 +01:00
Eelco Dolstra 98e322b929 nixos-rebuild: uri -> url 2020-02-05 23:15:18 +01:00
Eelco Dolstra fb051f0dec nixos-{rebuild,container}: Use flakeref#attrpath syntax
This makes them consistent with the 'nix' command line.
2020-02-05 23:15:18 +01:00
Eelco Dolstra cfd468adbb nixos-rebuild: Use /etc/nixos/flake.nix if it exists 2020-02-05 23:15:18 +01:00
Eelco Dolstra 7e9b745174 nixos-version: Add --json flag and show system.configurationRevision 2020-02-05 23:15:18 +01:00
Eelco Dolstra 22cc7ab78c nixos-rebuild: Add --flake option 2020-02-05 23:15:18 +01:00
Frederik Rietdijk 419bc0a4cd Revert "Revert "Merge master into staging-next""
In 87a19e9048 I merged staging-next into master using the GitHub gui as intended.
In ac241fb7a5 I merged master into staging-next for the next staging cycle, however, I accidentally pushed it to master.
Thinking this may cause trouble, I reverted it in 0be87c7979. This was however wrong, as it "removed" master.

This reverts commit 0be87c7979.
2020-02-05 19:41:25 +01:00
Frederik Rietdijk 0be87c7979 Revert "Merge master into staging-next"
I merged master into staging-next but accidentally pushed it to master.
This should get us back to 87a19e9048.

This reverts commit ac241fb7a5, reversing
changes made to 76a439239e.
2020-02-05 19:18:35 +01:00
Richard Marko 0c20feb231 use overlayfs by default for netboot and iso 2020-02-05 10:35:59 +01:00
Eelco Dolstra eaf1fbaef4
nixos-rebuild: --use-remote-sudo does not take an argument
Also remove outdated comment about trailing space.
2020-02-01 10:09:33 +01:00
Maximilian Bosch 7f49fa63ca
Merge pull request #75439 from Ma27/submodule-fixes-for-nixos-option
nixos/nixos-option: fix evaluator to render a full submodule entry
2020-02-01 10:00:59 +01:00
worldofpeace 0f2536f15b nixos/release: rename iso_graphical to iso_plasma5
And all the other things and paths to match it
2020-01-27 16:34:37 -05:00
zimbatm ab10bac1b1
nixos-rebuild: fix the maybeSudo usage
* properly expand the command using arrays instead of strings
* also handle sudo on the localhost
2020-01-21 13:17:38 +01:00
Malte Brandy c1d7850f85
Improve documentation for stateVersion
The meaning of stateVersion often leads to a lot of confusion. This
commit trys to improve that situation.
2020-01-07 22:27:03 +01:00
rnhmjoj 1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
Eelco Dolstra 3b15451291
nix: 2.3.1 -> 2.3.2 2020-01-05 20:35:43 +01:00
Linus Heckemann b9bf846080
Merge pull request #76189 from Ma27/nixos-install-verbosity-level
nixos/nixos-installer: add flags for verbosity and build logs
2019-12-28 11:50:25 +01:00
Pavol Rusnak 4899c6992c
nixos-generate-config: i18n.consoleFont has been renamed to console.font
fixes #76391
2019-12-25 15:02:58 +01:00
Maximilian Bosch 1fc248afcc
nixos/nixos-installer: add flags for verbosity and build logs
When installing a fresh NixOS system it occasionally happens that you
encounter issues that are rather hard to track down since
`nixos-install(8)` doesn't provide any debugging flags.

This patch adds `-L` to force `nix build` to display the build-log on
stderr and `-v` to increase the log-level of Nix.
2019-12-22 22:46:58 +01:00
buckley310 ebbb7165c5 nixos-generate-config: don't generate swapDevices for zram devices (#75921) 2019-12-19 22:03:21 +02:00
Chuck ed51fd0033 nixos/nixos-option: Convert --all into -r 2019-12-19 15:00:43 +01:00
Chuck 9dd23e8743 nixos/nixos-option: Refactor: Move functions around 2019-12-19 15:00:43 +01:00
Chuck 09ac7cb55f nixos/nixos-option: Show values inside aggregate options uniformly
1. This makes aggregates of submodules (including the very important
"nixos-option users.users.<username>" case) behave the same way as any
other you-need-to-keep-typing-to-get-to-an-option-leaf (eg:
"nixos-option environment").

Before e0780c5:

  $ nixos-option users.users.root
  error: At 'root' in path 'users.users.root': Attribute not found
  An error occurred while looking for attribute names. Are you sure that 'users.users.root' exists?

After e0780c5 but before this change, this query just printed out a raw
thing, which is behavior that belongs in "nix eval", "nix-instantiate
--eval", or "nix repl <<<":

  $ nixos-option users.users.root
  {
    _module = {
      args = { name = "root"; };
      check = true;
    };
    createHome = false;
    cryptHomeLuks = null;
    description = "System administrator";
    ...

After this change:

  $ nixos-option users.users.root
  This attribute set contains:
  createHome
  cryptHomeLuks
  description
  extraGroups
  group
  hashedPassword
  ...

2. For aggregates of other types (not submodules), print out the option
that contains them rather than printing an error message.

Before:

  $ nixos-option environment.shellAliases.l
  error: At 'l' in path 'environment.shellAliases.l': Attribute not found
  An error occurred while looking for attribute names. Are you sure that 'environment.shellAliases.l' exists?

After:

  $ nixos-option environment.shellAliases.l
  Note: showing environment.shellAliases instead of environment.shellAliases.l
  Value:
  {
    l = "ls -alh";
    ll = "ls -l";
    ls = "ls --color=tty";
  }
  ...
2019-12-19 15:00:43 +01:00
Bernardo Meurer 70c5a78062
nixos: compress make-ext4-fs with zstd 2019-12-13 16:18:04 -08:00
Maximilian Bosch e0780c5cff
nixos/nixos-option: fix evaluator to render a full submodule entry
When running e.g. `nixos-option users.users.ma27`, the evaluation breaks
since `ma27` is the attribute name in `attrsOf (submodule {})`, but not
a part of the option tree and therefore breaks with the following
errors:

```
error: At 'ma27' in path 'users.users.ma27': Attribute not found
An error occurred while looking for attribute names. Are you sure that 'users.users.ma27' exists?
```

This happens since the option evaluator expects that either the option
exists or the option is a submodule and the "next" token in the
attribute path points to an option (e.g. `users.users.ma27.createHome`).

This patch checks in the `Attribute not found` condition if the attribute-path
actually exists in the config tree. If that's true, a dummy-attrset is created
which contains `{_type = "__nixos-option-submodule-attr";}`, in that case, the
entire entry of the submodule will be displayed.
2019-12-12 14:27:36 +01:00
Arnout Engelen 88ee3b021d installer/cd-dvd/iso-image: avoid leaking build timestamps
When 'grafting' '/nix/store/<hash>-loopback.cfg' from disk onto
'/boot/grub/loopback.cfg' on the iso, the parent 'grub' directory does not
exist yet. In this case it is automatically created and inherits its
attributes, including timestamp, from /nix/store.

This is correct/expected/intentional behavior of xorriso, but has the
undesired result of leaking the timestamps of /nix/store into the iso. For
this reason we put the loopback.cfg in a
'/nix/store/<hash>-loopback.cfg/grub/loopback.cfg' instead, so it will inherit
the attributes from the correctly-timestamped
'/nix/store/<hash>-loopback.cfg/grub' directory.

For the same reason we move '/EFI/boot/efi-background.png' down in the list
so it is grafted after its parent '/EFI/boot' directory is created with
the correct timestamp.

fixes #74944
2019-12-11 09:07:40 +01:00
Jan Tojnar 77661f8cfd
nixos/plasma5: drop enableQt4Support option
Phonon no longer supports Qt4 so this is useless.
2019-11-22 09:01:05 +01:00
worldofpeace c9601a67a5
Merge pull request #71622 from worldofpeace/iso-no-slim
installer: use sddm in plasma5
2019-11-11 20:46:32 +00:00
Samuel Dionne-Riel 40f7a343e1
Merge pull request #72751 from c00w/sd_image_hydra
sd-image: Add the compressed file path for hydra.
2019-11-10 13:44:52 -05:00
Bjørn Forsman 2c09cfc097 nixos-rebuild: add explicit option to enable (remote) sudo
Add --use-remote-sudo option. When set, remote commands will be prefixed
with 'sudo'. This allows using sudo remotely _without_ having to use
sudo locally (when using --build-host/--taget-host).
2019-11-07 17:03:12 +01:00
Colin L Rice c861f8083d sd-image: Add the compressed file path for hydra.
This makes the nixos on arm user instructions work again.
2019-11-05 10:10:51 -05:00
Chuck 1e7985942b snake_case -> camelCase 2019-11-04 15:11:45 +01:00
Chuck 445145d5b9 Support aggregate types attrsOf and listOf 2019-11-04 15:11:45 +01:00
Chuck a3e31df4d7 (clang-format for has_example) 2019-11-04 15:11:45 +01:00
Chuck 57a5752300 Add maintainer 2019-11-04 15:11:45 +01:00
Chuck 5646240870 Only print example when there is one 2019-11-04 15:11:45 +01:00
Chuck 4d17d5b31f snake_case -> camelCase 2019-11-04 15:11:45 +01:00
Chuck 84d55716a9 Don't print header on stderr
Automated consumers can use 'sed 1d' or similar to remove this header.

This probably makes this output *easier* to consume correctly.  Having
this header show up in consumers' terminal or log output is probably not
useful, but hiding it without hiding all error messages would have been
more troublesome that just stripping it from stdout.

I.e., previously, unsophisticated use would show undesired output:
  $ some-other-tool
  This attribute set contains:
  This attribute set contains:
  This attribute set contains:
  This attribute set contains:
  <Actual some-other-tool output>

The simplest way to hide this undesired output would have been
nixos-option ... 2>/dev/null, which would hide all error messages.
We do not wish to encourage that.

Correct use would have been something like:
  nixos-option ... 2> >( grep --line-buffered -v 'This attribute set contains:')

After this change, correct use is simpler:
  nixos-option ... | sed 1d
or
  nixos-option ... | sed '1/This attribute set contains:/d'
if the caller don't know if this invocation of nixos-option will yield
an attribute listing or an option description.
2019-11-04 15:11:45 +01:00
Chuck 2ddd2d0760 Explain why header goes on stderr 2019-11-04 15:11:45 +01:00
Chuck 94a068fe36 Pass values by reference
Switch from convention "appease clang-tidy --checks='*'" to
"References are like non-nullptr pointers".  The clang-tidy check
"google-runtime-references" complains about non-const reference
arguments, but this is not a convention used in Nix.
2019-11-04 15:11:45 +01:00
Chuck 3d3ce8df7f Pass Context by reference
Switch from convention "appease clang-tidy --checks='*'" to
"References are like non-nullptr pointers".  The clang-tidy check
"google-runtime-references" complains about non-const reference
arguments, but this is not a convention used in Nix.
2019-11-04 15:11:45 +01:00
Chuck c967e3fd3e Hold state and autoArgs by reference
Switch from convention "appease clang-tidy --checks='*'" to
"References are like non-nullptr pointers".  The clang-tidy check
"google-runtime-references" complains about non-const reference
arguments, but this is not a convention used in Nix.
2019-11-04 15:11:45 +01:00
Chuck c457766a1f Use std::get_if 2019-11-04 15:11:45 +01:00
Chuck 88183eb484 Per reviewer request, cast the other side.
I don't think this matters.  As long as one or the other of these is
a std::string, I get an operator== that looks at content rather than
pointer equality.  I picked casting the constant over casting the dynamic
thing in hopes that the compiler would have a better chance at optimizing
away any runtime cost.

Deferring to reviewer.
2019-11-04 15:11:45 +01:00
Chuck aa8e1d5f1e Always say which path component had trouble 2019-11-04 15:11:45 +01:00
Chuck c352bfeaf0 Switch from east const to west const
For consistency with the Nix C++ convention.

:~(
2019-11-04 15:11:45 +01:00
Chuck b8db81573a Support submodules (Fixes #13121) 2019-11-04 15:11:45 +01:00
Chuck 88349921a4 clang-format 2019-11-04 15:11:45 +01:00
Chuck 6b405f9789 Fix missing "using ThrownError" 2019-11-04 15:11:45 +01:00
Chuck 0adf77e2ee Narrow the «not defined» check to just ThrownError 2019-11-04 15:11:45 +01:00
Chuck c7c684aaa3 Preserve type of rethrown exceptions 2019-11-04 15:11:45 +01:00
Chuck d89ccc1554 Correct syntax for license specification 2019-11-04 15:11:45 +01:00
Chuck 2336982957 Add license
This is important because this contains some code copied from nix (as an
interim expediency until that functionality can be exported via nix's
API).  The license specified here must be compatible with this borrowing.
Select the same license that nix is released under: lgpl2Plus.
2019-11-04 15:11:45 +01:00
Chuck f3eedb6020 Parallel build is the default, so no need to specify 2019-11-04 15:11:45 +01:00
Chuck e1ecc2b6c1 Remove list sorting 2019-11-04 15:11:45 +01:00
Chuck 36c00c1080 Use format strings, not concatenation, in error messages 2019-11-04 15:11:44 +01:00
Chuck 4af8dbf896 Reformat for 4-space indentation
Specifically, with
  clang-format --style='{ IndentWidth: 4, BreakBeforeBraces: Mozilla, ColumnLimit: 120, PointerAlignment: Middle }'
which was the clang-format invocation that produced the fewest diffs on
the nix source out of ~20 that I tried.
2019-11-04 15:11:44 +01:00
Chuck 74f05df671 nixos/nixos-option: Fix references to old name 2019-11-04 15:11:44 +01:00
Chuck 26c45dfec2 nixos/nixos-option: Show options' types #27920 2019-11-04 15:11:44 +01:00
Chuck 59c5bfc86b nixos/nixos-option: Rewrite in a more suitable language
Also add --all, which shows the value of all options.  Diffing the --all
output on either side of contemplated changes is a lovely way to better
understand what's going on inside nixos.
2019-11-04 15:11:44 +01:00
Daniel Fullmer c7b123a81a nixos-generate-config: Fix incorrectly named option
This appears to be a typo from c2576266ba
2019-11-02 15:46:16 -04:00
Frederik Rietdijk a85e58ac13 Merge master into staging-next 2019-10-23 09:38:37 +02:00
Bjørn Forsman 263a81e285 nixos-rebuild: support sudo + --target-host
This adds support for deploying to remote hosts without being root:

  sudo nixos-rebuild --target-host non-root@host

Without this change, only root@host is able to deploy.

The idea is that if the local command is run with sudo, so should the
remote one, thus there is no need for adding any CLI options.
2019-10-22 20:44:25 +02:00
worldofpeace 7dc84e1824 installer: use sddm in plasma5
Slim is abandoned and won't work with wayland.
It's in our best interest to use the display-manager
that makes most sense for Plasma5, sddm.

We've already moved on from it being default in #30890
and the graphical.nix profile, which the virtualbox profile uses,
has sddm anyway.
2019-10-22 00:28:47 -04:00
Franz Pletz c2576266ba nixos/gnupg: add option for setting pinentry flavours
Co-authored-by: Florian Klink <flokli@flokli.de>
2019-10-16 20:31:05 -04:00
worldofpeace 2fbccbc728 Revert "Merge pull request #71095 from flokli/pinentry-cleanup"
This reverts commit 823da4d492, reversing
changes made to b75c8ee3bc.
2019-10-16 20:28:21 -04:00
Franz Pletz edea9fed72 nixos/gnupg: add option for setting pinentry flavours
Co-authored-by: Florian Klink <flokli@flokli.de>
2019-10-16 19:56:49 -04:00
Jan Tojnar 1739d34904
Merge pull request #70734 from jtojnar/nixos-rebuild-remote-fish
nixos-rebuild: Fix target-host using fish
2019-10-11 13:26:11 +02:00
Eelco Dolstra 3ab3614e2b
nix: 2.3 -> 2.3.1 2019-10-10 16:23:33 +02:00
Jan Tojnar 316d4faba4
nixos-rebuild: Fix target-host using fish
I have `users.defaultUserShell = pkgs.fish;` set on my server and when I ran `nixos-rebuild switch --target-host …`, the command failed with the following error:

    fish: Unsupported use of '='. To run 'nix-store' with a modified environment, please use 'env PATH=… nix-store…'

That is because fish requires env to set environment variables for a program. It should also work on other shells.
2019-10-08 11:43:05 +02:00
Vladimír Čunát f760f0ef48
Revert "Merge #67232: machinectl compliant NixOS installation"
This reverts commit 66967ec752, reversing
changes made to fb6595eafd.
Fixes #70442; discussion: https://github.com/NixOS/nixpkgs/pull/70027
2019-10-07 20:56:59 +02:00