From a581f72f222043936e78d1fe8ad09380c46bfa53 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 29 Jan 2016 15:58:03 +0100 Subject: nixos-manual: Fix stripping declaration prefixes Regression introduced by e6cd147ae7ae05900ec2ab8ad933bfac7428feac. This broke all of the installer tests, because they needed to rebuild the manual within the test machine, while it only has a closure of the already pre-built system in place. The problem here was just that the order of the arguments got mixed up in stripAnyPrefixes, so it was actually trying to strip the path off the prefix, not the other way around. So in the end no prefix was stripped at all, so we ended up having full store paths in the manual, which in turn caused the build within the VM to fail, because the prefixes differed. Signed-off-by: aszlig --- nixos/doc/manual/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/doc') diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index eb2ceb7fd021..5a4d36d9dcc0 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -33,7 +33,7 @@ let prefixesToStrip = [ herePrefix ] ++ extraSources; stripAnyPrefixes = fn: - flip (flip fold fn) prefixesToStrip (fn: prefix: + flip (flip fold fn) prefixesToStrip (prefix: fn: if substring 0 (stringLength prefix) fn == prefix then substring (stringLength prefix + 1) 1000 fn else -- cgit 1.4.1 From ae466ba15c2f74cdd621a4fb548813b30cc524e4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 29 Jan 2016 16:20:22 +0100 Subject: nixos-manual: Simplify stripping prefixes Let's use a simple (unflipped) fold and break out the actual core stripPrefix function from stripAnyPrefixes (I personally love point-less^H^H^H^Hfree style but if I'd be anal I'd even go further and factor away the "fn:"). Also, let's use path as a better name for "fn" (filename), because that's what it is and also cannot be confused with "fn" meaning "function". We now toString all of the prefixes, so there shouldn't be any need to implicily toString the extraSources anymore. Signed-off-by: aszlig --- nixos/doc/manual/default.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nixos/doc') diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 5a4d36d9dcc0..de3f9a95d95a 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -17,7 +17,7 @@ let # Clean up declaration sites to not refer to the NixOS source tree. optionsList' = flip map optionsList (opt: opt // { - declarations = map (fn: stripAnyPrefixes fn) opt.declarations; + declarations = map stripAnyPrefixes opt.declarations; } // optionalAttrs (opt ? example) { example = substFunction opt.example; } // optionalAttrs (opt ? default) { default = substFunction opt.default; } @@ -28,16 +28,16 @@ let # or else the build will fail. # # E.g. if some `options` came from modules in ${pkgs.customModules}/nix, - # you'd need to include `extraSources = [ "#{pkgs.customModules}" ]` - herePrefix = toString ../../..; - prefixesToStrip = [ herePrefix ] ++ extraSources; - - stripAnyPrefixes = fn: - flip (flip fold fn) prefixesToStrip (prefix: fn: - if substring 0 (stringLength prefix) fn == prefix then - substring (stringLength prefix + 1) 1000 fn - else - fn); + # you'd need to include `extraSources = [ pkgs.customModules ]` + prefixesToStrip = map toString ([ ../../.. ] ++ extraSources); + + stripPrefix = prefix: fullPath: + if substring 0 (stringLength prefix) fullPath == prefix then + substring (stringLength prefix + 1) 1000 fullPath + else + fileName; + + stripAnyPrefixes = fullPath: fold stripPrefix fullPath prefixesToStrip; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList'); -- cgit 1.4.1 From 6fec28e04313161b0d330fc3a4d3dfa9f85e53f9 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 29 Jan 2016 19:34:00 +0100 Subject: nixos-manual: Further simplify stripAnyPrefixes First of all this fixes an evaluation error I introduced in ae466ba, which wasn't triggered by any of my own tests against the change because there are usually no NixOS options that are declared outside of the tree. I renamed the attribute name from "fn" to "fileName" first and later to "fullPath" but forgot one still occuring "filename". Thanks to @vcunat for noticing this. Another thing that he pointed out was that the "stripPrefix" function can be factored away entirely, because it's very similar to "removePrefix" in . Unfortunately we can't use "removePrefix" as is, because we need to account for the final shlash. So instead of removing it twice and/or retaining "stripPrefix", let's append a shlash on every "prefixesToStrip" and we can use "removePrefix" as is. Tested with: taalo-build nixos/release.nix -A tests.installer.simple.x86_64-linux And: w3m -dump "$( nix-build nixos/release.nix -A manual.x86_64-linux )/share/doc/nixos/options.html" Signed-off-by: aszlig Cc: @vcunat --- nixos/doc/manual/default.nix | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'nixos/doc') diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index de3f9a95d95a..b4eb3cde81bf 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -29,15 +29,8 @@ let # # E.g. if some `options` came from modules in ${pkgs.customModules}/nix, # you'd need to include `extraSources = [ pkgs.customModules ]` - prefixesToStrip = map toString ([ ../../.. ] ++ extraSources); - - stripPrefix = prefix: fullPath: - if substring 0 (stringLength prefix) fullPath == prefix then - substring (stringLength prefix + 1) 1000 fullPath - else - fileName; - - stripAnyPrefixes = fullPath: fold stripPrefix fullPath prefixesToStrip; + prefixesToStrip = map (p: "${toString p}/") ([ ../../.. ] ++ extraSources); + stripAnyPrefixes = flip (fold removePrefix) prefixesToStrip; # Convert the list of options into an XML file. optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList'); -- cgit 1.4.1 From de2d609317b813096e00d00ab93da836f07947a5 Mon Sep 17 00:00:00 2001 From: Tomas Vestelind Date: Mon, 1 Feb 2016 09:47:23 +0100 Subject: haka in unstable release notes --- nixos/doc/manual/release-notes/rl-unstable.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'nixos/doc') diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml index 6099b5218714..3d7819803697 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-unstable.xml @@ -42,6 +42,7 @@ nixos.path = ./nixpkgs-unstable-2015-12-06/nixos; services/monitoring/longview.nix services/web-apps/pump.io.nix + services/security/haka.nix -- cgit 1.4.1 From 3c5fca9618241334f40bfd2199cdfabb4fad55ec Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 21 Oct 2015 17:37:14 +0000 Subject: filesystems: use list of strings for fs options Allow usage of list of strings instead of a comma-separated string for filesystem options. Deprecate the comma-separated string style with a warning message; convert this to a hard error after 16.09. 15.09 was just released, so this provides a deprecation period during the 16.03 release. closes #10518 Signed-off-by: Robin Gloster --- nixos/doc/manual/configuration/config-file.xml | 2 +- nixos/doc/manual/man-nixos-generate-config.xml | 4 ++-- nixos/doc/manual/release-notes/rl-unstable.xml | 17 +++++++++++++++++ nixos/modules/installer/cd-dvd/iso-image.nix | 8 ++++---- nixos/modules/installer/tools/nixos-generate-config.pl | 4 ++-- nixos/modules/system/boot/stage-1.nix | 2 +- nixos/modules/tasks/filesystems.nix | 18 +++++++++++------- nixos/modules/virtualisation/qemu-vm.nix | 12 ++++++------ nixos/tests/misc.nix | 2 +- nixos/tests/nfs.nix | 2 +- 10 files changed, 46 insertions(+), 25 deletions(-) (limited to 'nixos/doc') diff --git a/nixos/doc/manual/configuration/config-file.xml b/nixos/doc/manual/configuration/config-file.xml index b613c7f06cc8..9b240979273d 100644 --- a/nixos/doc/manual/configuration/config-file.xml +++ b/nixos/doc/manual/configuration/config-file.xml @@ -157,7 +157,7 @@ boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60; fileSystems."/boot" = { device = "/dev/sda1"; fsType = "ext4"; - options = "rw,data=ordered,relatime"; + options = [ "rw" "data=ordered" "relatime" ]; }; diff --git a/nixos/doc/manual/man-nixos-generate-config.xml b/nixos/doc/manual/man-nixos-generate-config.xml index e4fba4a40a97..140642bc9c9c 100644 --- a/nixos/doc/manual/man-nixos-generate-config.xml +++ b/nixos/doc/manual/man-nixos-generate-config.xml @@ -165,13 +165,13 @@ look like this: fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext3"; - options = "rw,data=ordered,relatime"; + options = [ "rw" "data=ordered" "relatime" ]; }; fileSystems."/boot" = { device = "/dev/sda1"; fsType = "ext3"; - options = "rw,errors=continue,user_xattr,acl,barrier=1,data=writeback,relatime"; + options = [ "rw" "errors=continue" "user_xattr" "acl" "barrier=1" "data=writeback" "relatime" ]; }; swapDevices = diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml index 3d7819803697..c814d61bcf4c 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-unstable.xml @@ -155,6 +155,23 @@ nginx.override { rights, new aliasFiles and mapFiles options and more. + + + Filesystem options should now be configured as a list of strings, not + a comma-separated string. The old style will continue to work, but print a + warning, until the 16.09 release. An example of the new style: + + +fileSystems."/example" = { + device = "/dev/sdc"; + fsType = "btrfs"; + options = [ "noatime" "compress=lzo" "space_cache" "autodefrag" ]; +}; + + + + + diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 248b0f00283c..5702e2d9a1e5 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -249,7 +249,7 @@ in fileSystems."/" = { fsType = "tmpfs"; - options = "mode=0755"; + options = [ "mode=0755" ]; }; # Note that /dev/root is a symlink to the actual root device @@ -266,20 +266,20 @@ in fileSystems."/nix/.ro-store" = { fsType = "squashfs"; device = "/iso/nix-store.squashfs"; - options = "loop"; + options = [ "loop" ]; neededForBoot = true; }; fileSystems."/nix/.rw-store" = { fsType = "tmpfs"; - options = "mode=0755"; + options = [ "mode=0755" ]; neededForBoot = true; }; fileSystems."/nix/store" = { fsType = "unionfs-fuse"; device = "unionfs"; - options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro"; + options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ]; }; boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "usb-storage" ]; diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 2284eba07a2d..ec880e084726 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -349,7 +349,7 @@ foreach my $fs (read_file("/proc/self/mountinfo")) { fileSystems.\"$mountPoint\" = { device = \"$base$path\"; fsType = \"none\"; - options = \"bind\"; + options = \[ \"bind\" \]; }; EOF @@ -409,7 +409,7 @@ EOF if (scalar @extraOptions > 0) { $fileSystems .= <mount; defaults to "auto"), and options (the mount options passed to mount using the - flag; defaults to "defaults"). + flag; defaults to [ "defaults" ]). Instead of specifying device, you can also specify a volume label (label) for file @@ -177,7 +181,7 @@ in else throw "No device specified for mount point ‘${fs.mountPoint}’.") + " " + fs.mountPoint + " " + fs.fsType - + " " + fs.options + + " " + builtins.concatStringsSep "," fs.options + " 0" + " " + (if skipCheck fs then "0" else if fs.mountPoint == "/" then "1" else "2") diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 82b58aa67a3d..6e0dc065387a 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -427,38 +427,38 @@ in ${if cfg.writableStore then "/nix/.ro-store" else "/nix/store"} = { device = "store"; fsType = "9p"; - options = "trans=virtio,version=9p2000.L,cache=loose"; + options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ]; neededForBoot = true; }; "/tmp/xchg" = { device = "xchg"; fsType = "9p"; - options = "trans=virtio,version=9p2000.L,cache=loose"; + options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ]; neededForBoot = true; }; "/tmp/shared" = { device = "shared"; fsType = "9p"; - options = "trans=virtio,version=9p2000.L"; + options = [ "trans=virtio" "version=9p2000.L" ]; neededForBoot = true; }; } // optionalAttrs cfg.writableStore { "/nix/store" = { fsType = "unionfs-fuse"; device = "unionfs"; - options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro"; + options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ]; }; } // optionalAttrs (cfg.writableStore && cfg.writableStoreUseTmpfs) { "/nix/.rw-store" = { fsType = "tmpfs"; - options = "mode=0755"; + options = [ "mode=0755" ]; neededForBoot = true; }; } // optionalAttrs cfg.useBootLoader { "/boot" = { device = "/dev/vdb2"; fsType = "vfat"; - options = "ro"; + options = [ "ro" ]; noCheck = true; # fsck fails on a r/o filesystem }; }); diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix index 6297452df95e..73af0cfad21f 100644 --- a/nixos/tests/misc.nix +++ b/nixos/tests/misc.nix @@ -16,7 +16,7 @@ import ./make-test.nix ({ pkgs, ...} : { systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ]; fileSystems = mkVMOverride { "/tmp2" = { fsType = "tmpfs"; - options = "mode=1777,noauto"; + options = [ "mode=1777" "noauto" ]; }; }; systemd.automounts = singleton diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix index 24f6e0f2ed95..36cd6a395779 100644 --- a/nixos/tests/nfs.nix +++ b/nixos/tests/nfs.nix @@ -8,7 +8,7 @@ let [ { mountPoint = "/data"; device = "server:/data"; fsType = "nfs"; - options = "vers=${toString version}"; + options = [ "vers=${toString version}" ]; } ]; networking.firewall.enable = false; # FIXME: only open statd -- cgit 1.4.1