aboutsummaryrefslogtreecommitdiff
path: root/nixos/lib/make-channel.nix
diff options
context:
space:
mode:
authorDan Peebles <pumpkingod@gmail.com>2015-06-13 21:55:29 -0400
committerDan Peebles <pumpkingod@gmail.com>2015-06-13 21:55:29 -0400
commit10e75453b2cc1406d9d53aab46c88025505dd169 (patch)
tree37b30618b6c7194f1602eec14b0801a31c11b3a1 /nixos/lib/make-channel.nix
parentebde5fd9d48e79b4ee9fabf51440f09d27f3fc5f (diff)
Factor the NixOS channel building code out into its own file, so I can use it elsewhere
Diffstat (limited to 'nixos/lib/make-channel.nix')
-rw-r--r--nixos/lib/make-channel.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixos/lib/make-channel.nix b/nixos/lib/make-channel.nix
new file mode 100644
index 000000000000..7764527ffa7e
--- /dev/null
+++ b/nixos/lib/make-channel.nix
@@ -0,0 +1,31 @@
+{ pkgs, nixpkgs, version, versionSuffix }:
+
+pkgs.releaseTools.makeSourceTarball {
+ name = "nixos-channel";
+
+ src = nixpkgs;
+
+ officialRelease = false; # FIXME: fix this in makeSourceTarball
+ inherit version versionSuffix;
+
+ buildInputs = [ pkgs.nixUnstable ];
+
+ expr = builtins.readFile ./channel-expr.nix;
+
+ distPhase = ''
+ rm -rf .git
+ echo -n $VERSION_SUFFIX > .version-suffix
+ echo -n ${nixpkgs.rev or nixpkgs.shortRev} > .git-revision
+ releaseName=nixos-$VERSION$VERSION_SUFFIX
+ mkdir -p $out/tarballs
+ mkdir ../$releaseName
+ cp -prd . ../$releaseName/nixpkgs
+ chmod -R u+w ../$releaseName
+ ln -s nixpkgs/nixos ../$releaseName/nixos
+ 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.xz $releaseName
+ '';
+}