Author: eelco
Date: Tue Apr 10 20:56:38 2012
New Revision: 33730
URL: https://nixos.org/websvn/nix/?rev=33730&sc=1

Log:
* Add a command "nixos-version" that prints the version of the
  currently activated NixOS.  This is "0.1pre-svn" when built from a
  SVN tree, but contains the actual revision when installed from the
  NixOS channel or from the ISO.

Added:
   nixos/trunk/.version
      - copied unchanged from r33716, nixos/trunk/VERSION
   nixos/trunk/modules/misc/version.nix
Deleted:
   nixos/trunk/VERSION
Modified:
   nixos/trunk/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
   nixos/trunk/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
   nixos/trunk/modules/installer/tools/tools.nix
   nixos/trunk/modules/module-list.nix
   nixos/trunk/modules/profiles/installation-device.nix
   nixos/trunk/release.nix

Copied: nixos/trunk/.version (from r33716, nixos/trunk/VERSION)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/.version        Tue Apr 10 20:56:38 2012        (r33730, copy 
of r33716, nixos/trunk/VERSION)
@@ -0,0 +1 @@
+0.1
\ No newline at end of file

Modified: nixos/trunk/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
==============================================================================
--- nixos/trunk/modules/installer/cd-dvd/system-tarball-fuloong2f.nix   Tue Apr 
10 20:28:06 2012        (r33729)
+++ nixos/trunk/modules/installer/cd-dvd/system-tarball-fuloong2f.nix   Tue Apr 
10 20:56:38 2012        (r33730)
@@ -28,16 +28,6 @@
 
   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:

Modified: nixos/trunk/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
==============================================================================
--- nixos/trunk/modules/installer/cd-dvd/system-tarball-sheevaplug.nix  Tue Apr 
10 20:28:06 2012        (r33729)
+++ nixos/trunk/modules/installer/cd-dvd/system-tarball-sheevaplug.nix  Tue Apr 
10 20:56:38 2012        (r33730)
@@ -29,16 +29,6 @@
 
   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:

Modified: nixos/trunk/modules/installer/tools/tools.nix
==============================================================================
--- nixos/trunk/modules/installer/tools/tools.nix       Tue Apr 10 20:28:06 
2012        (r33729)
+++ nixos/trunk/modules/installer/tools/tools.nix       Tue Apr 10 20:56:38 
2012        (r33730)
@@ -51,6 +51,12 @@
     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 @@
         nixosHardwareScan
         nixosGenSeccureKeys
         nixosOption
+        nixosVersion
       ] ++ pkgs.lib.optional cfg.enableGraphicalTools nixosGui;
 
     system.build = {

Added: nixos/trunk/modules/misc/version.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/misc/version.nix        Tue Apr 10 20:56:38 2012        
(r33730)
@@ -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.";
+    };
+    
+  };
+
+}

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Tue Apr 10 20:28:06 2012        (r33729)
+++ nixos/trunk/modules/module-list.nix Tue Apr 10 20:56:38 2012        (r33730)
@@ -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

Modified: nixos/trunk/modules/profiles/installation-device.nix
==============================================================================
--- nixos/trunk/modules/profiles/installation-device.nix        Tue Apr 10 
20:28:06 2012        (r33729)
+++ nixos/trunk/modules/profiles/installation-device.nix        Tue Apr 10 
20:56:38 2012        (r33730)
@@ -67,13 +67,7 @@
   ];
 
   options = {
-    system.nixosVersion = mkOption {
-      default = "${builtins.readFile ../../VERSION}";
-      description = ''
-        NixOS version number.
-      '';
-    };
-
+  
     installer.cloneConfig = mkOption {
       default = true;
       description = ''
@@ -101,6 +95,7 @@
         in live CDs.
       '';
     };
+    
   };
 
   config = {

Modified: nixos/trunk/release.nix
==============================================================================
--- nixos/trunk/release.nix     Tue Apr 10 20:28:06 2012        (r33729)
+++ nixos/trunk/release.nix     Tue Apr 10 20:56:38 2012        (r33730)
@@ -17,7 +17,7 @@
 
     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 @@
 
     with import <nixpkgs> {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 @@
       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 @@
       releaseTools.makeSourceTarball {
         name = "nixos-channel";
 
-        version = builtins.readFile ./VERSION;
+        version = builtins.readFile ./.version;
 
         src = nixosSrc;
 
@@ -126,6 +128,7 @@
           '';
 
         distPhase = ''
+          echo -n $VERSION_SUFFIX > .version-suffix
           releaseName=nixos-$VERSION$VERSION_SUFFIX
           ensureDir "$out/tarballs"
           mkdir ../$releaseName
@@ -134,6 +137,7 @@
           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
         ''; # */
       };
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to