diff --git a/VERSION b/.version similarity index 100% rename from VERSION rename to .version diff --git a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix index 618f5ea96279..5a23a394f7f7 100644 --- a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix +++ b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix @@ -28,16 +28,6 @@ let pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; - options = { - - system.nixosVersion = mkOption { - default = "${builtins.readFile ../../../VERSION}"; - description = '' - NixOS version number. - ''; - }; - }; - # A clue for the kernel loading kernelParams = pkgs.writeText "kernel-params.txt" '' Kernel Parameters: diff --git a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix index e49bcf3a66a8..9052badfe0eb 100644 --- a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix +++ b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix @@ -29,16 +29,6 @@ let pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; - options = { - - system.nixosVersion = mkOption { - default = "${builtins.readFile ../../../VERSION}"; - description = '' - NixOS version number. - ''; - }; - }; - # A clue for the kernel loading kernelParams = pkgs.writeText "kernel-params.txt" '' Kernel Parameters: diff --git a/modules/installer/tools/tools.nix b/modules/installer/tools/tools.nix index 930be55a0de2..ad9ea2d61dc4 100644 --- a/modules/installer/tools/tools.nix +++ b/modules/installer/tools/tools.nix @@ -51,6 +51,12 @@ let src = ./nixos-option.sh; }; + nixosVersion = makeProg { + name = "nixos-version"; + src = ./nixos-version.sh; + inherit (config.system) nixosVersion; + }; + nixosGui = pkgs.xulrunnerWrapper { launcher = "nixos-gui"; application = pkgs.stdenv.mkDerivation { @@ -116,6 +122,7 @@ in nixosHardwareScan nixosGenSeccureKeys nixosOption + nixosVersion ] ++ pkgs.lib.optional cfg.enableGraphicalTools nixosGui; system.build = { diff --git a/modules/misc/version.nix b/modules/misc/version.nix new file mode 100644 index 000000000000..32e2e1b1dc08 --- /dev/null +++ b/modules/misc/version.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + options = { + + system.nixosVersion = mkOption { + default = + builtins.readFile ../../.version + + (if builtins.pathExists ../../.version-suffix then builtins.readFile ../../.version-suffix else "pre-svn"); + description = "NixOS version."; + }; + + }; + +} diff --git a/modules/module-list.nix b/modules/module-list.nix index 684d1ad516e9..48171f62150c 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -36,6 +36,7 @@ ./misc/locate.nix ./misc/nixpkgs.nix ./misc/passthru.nix + ./misc/version.nix ./programs/bash/bash.nix ./programs/blcr.nix ./programs/info.nix diff --git a/modules/profiles/installation-device.nix b/modules/profiles/installation-device.nix index 40daa10c8cee..d56cec64a0c2 100644 --- a/modules/profiles/installation-device.nix +++ b/modules/profiles/installation-device.nix @@ -67,13 +67,7 @@ in ]; options = { - system.nixosVersion = mkOption { - default = "${builtins.readFile ../../VERSION}"; - description = '' - NixOS version number. - ''; - }; - + installer.cloneConfig = mkOption { default = true; description = '' @@ -101,6 +95,7 @@ in in live CDs. ''; }; + }; config = { diff --git a/release.nix b/release.nix index 286e314ac1e3..9ec5f9c8761e 100644 --- a/release.nix +++ b/release.nix @@ -17,7 +17,7 @@ let let - version = builtins.readFile ./VERSION + (lib.optionalString (!officialRelease) versionSuffix); + version = builtins.readFile ./.version + (lib.optionalString (!officialRelease) versionSuffix); versionModule = { system.nixosVersion = version; @@ -55,7 +55,7 @@ let with import {inherit system;}; let - version = builtins.readFile ./VERSION + (lib.optionalString (!officialRelease) versionSuffix); + version = builtins.readFile ./.version + (lib.optionalString (!officialRelease) versionSuffix); versionModule = { system.nixosVersion = version; }; @@ -86,18 +86,20 @@ let releaseTools.makeSourceTarball { name = "nixos-tarball"; - version = builtins.readFile ./VERSION; + version = builtins.readFile ./.version; src = nixosSrc; inherit officialRelease; distPhase = '' + echo -n $VERSION_SUFFIX > .version-suffix releaseName=nixos-$VERSION$VERSION_SUFFIX ensureDir "$out/tarballs" mkdir ../$releaseName cp -prd . ../$releaseName cd .. + chmod -R u+w $releaseName tar cfvj $out/tarballs/$releaseName.tar.bz2 $releaseName ''; # */ }; @@ -111,7 +113,7 @@ let releaseTools.makeSourceTarball { name = "nixos-channel"; - version = builtins.readFile ./VERSION; + version = builtins.readFile ./.version; src = nixosSrc; @@ -126,6 +128,7 @@ let ''; distPhase = '' + echo -n $VERSION_SUFFIX > .version-suffix releaseName=nixos-$VERSION$VERSION_SUFFIX ensureDir "$out/tarballs" mkdir ../$releaseName @@ -134,6 +137,7 @@ let echo "$expr" > ../$releaseName/default.nix NIX_STATE_DIR=$TMPDIR nix-env -f ../$releaseName/default.nix -qaP --meta --xml \* > /dev/null cd .. + chmod -R u+w $releaseName tar cfj $out/tarballs/$releaseName.tar.bz2 $releaseName ''; # */ };