summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Crotti <andrea.crotti.0@gmail.com>2016-02-23 14:02:13 +0000
committerAndrea Crotti <andrea.crotti.0@gmail.com>2016-02-23 14:02:13 +0000
commit0e0e097128afa96a3942156c8be3a9d57c5f249e (patch)
treeb31c051c8307e88bb02585766bd13c221b88c6eb
parentc774c61b6507408f66ffdc11cfcb2d90d9f104c4 (diff)
parente4fb1c49f2c37c730840d9d2ea50c11a3b0b73c5 (diff)
Merge pull request #127 from magnetophon/nix-mode
add nix-mode, for http://nixos.org
-rw-r--r--nix-mode/buildPhase8
-rw-r--r--nix-mode/checkPhase8
-rw-r--r--nix-mode/configurePhase8
-rw-r--r--nix-mode/distPhase8
-rw-r--r--nix-mode/fixPhase8
-rw-r--r--nix-mode/installCheckPhase8
-rw-r--r--nix-mode/installPhase12
-rw-r--r--nix-mode/package_github56
-rw-r--r--nix-mode/package_url55
-rw-r--r--nix-mode/patchPhase8
-rw-r--r--nix-mode/phases5
-rw-r--r--nix-mode/unpackPhase8
12 files changed, 192 insertions, 0 deletions
diff --git a/nix-mode/buildPhase b/nix-mode/buildPhase
new file mode 100644
index 0000000..c912f41
--- /dev/null
+++ b/nix-mode/buildPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: buildPhase
+# key: bp
+# --
+buildPhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/checkPhase b/nix-mode/checkPhase
new file mode 100644
index 0000000..76622fa
--- /dev/null
+++ b/nix-mode/checkPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: checkPhase
+# key: ch
+# --
+checkPhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/configurePhase b/nix-mode/configurePhase
new file mode 100644
index 0000000..c07bf09
--- /dev/null
+++ b/nix-mode/configurePhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: configurePhase
+# key: cp
+# --
+configurePhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/distPhase b/nix-mode/distPhase
new file mode 100644
index 0000000..88524f6
--- /dev/null
+++ b/nix-mode/distPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: distPhase
+# key: dp
+# --
+distPhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/fixPhase b/nix-mode/fixPhase
new file mode 100644
index 0000000..9db5bb4
--- /dev/null
+++ b/nix-mode/fixPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: fixPhase
+# key: fp
+# --
+fixPhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/installCheckPhase b/nix-mode/installCheckPhase
new file mode 100644
index 0000000..b017621
--- /dev/null
+++ b/nix-mode/installCheckPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: installCheckPhase
+# key: ic
+# --
+installCheckPhase= ''
+$1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/installPhase b/nix-mode/installPhase
new file mode 100644
index 0000000..f30bfb2
--- /dev/null
+++ b/nix-mode/installPhase
@@ -0,0 +1,12 @@
+# -*- mode: snippet -*-
+# name: installPhase
+# key: ip
+# --
+installPhase= ''
+${1: mkdir -p \$out/bin
+ for f in \$(find . -executable -type f);
+ do
+ cp \$f \$out/bin/
+ done}
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/package_github b/nix-mode/package_github
new file mode 100644
index 0000000..5a7230e
--- /dev/null
+++ b/nix-mode/package_github
@@ -0,0 +1,56 @@
+# -*- mode: snippet -*-
+# name: package github
+# key: pg
+# --
+{ stdenv, fetchFromGitHub$1 }:
+stdenv.mkDerivation rec {
+ name = "$2-\$\{version\}";
+ version = "$3";
+
+ src = fetchFromGitHub {
+ owner = "$4";
+ repo = "$2";
+ rev = "${5:v\$\{version\}}";
+ sha256 = "$6";
+ };
+
+ buildInputs = [ $1];
+
+ meta = {
+ description = "$7";
+ homepage = https://${8:github.com/$4/$2};
+
+ license = stdenv.lib.licenses.${9:$$
+ (yas-choose-value '(
+ "agpl3"
+ "asl20"
+ "bsd2"
+ "bsd3"
+ "gpl2"
+ "gpl3"
+ "lgpl3"
+ "mit"
+ ))};
+ maintainers = [ stdenv.lib.maintainers.$10 ];
+ platforms = stdenv.lib.platforms.${11:$$
+ (yas-choose-value '(
+ "gnu"
+ "linux"
+ "darwin"
+ "freebsd"
+ "openbsd"
+ "netbsd"
+ "cygwin"
+ "illumos"
+ "unix"
+ "all"
+ "none"
+ "allBut"
+ "mesaPlatforms"
+ "x86"
+ "i686"
+ "arm"
+ "mips"
+ ))};
+ };
+}
diff --git a/nix-mode/package_url b/nix-mode/package_url
new file mode 100644
index 0000000..a9d5ba3
--- /dev/null
+++ b/nix-mode/package_url
@@ -0,0 +1,55 @@
+# -*- mode: snippet -*-
+# name: package url
+# key: pu
+# --
+
+{ stdenv, fetchurl$1}:
+
+stdenv.mkDerivation rec {
+ version = "$2";
+ name = "$3-${version}";
+
+ src = fetchurl {
+ url = "$4";
+ sha256 = "$5";
+ };
+
+ buildInputs = [ $1 ];
+
+ meta = {
+ description = "$6";
+ homepage = https://$7;
+ license = stdenv.lib.licenses.${8:$$
+ (yas-choose-value '(
+ "agpl3"
+ "asl20"
+ "bsd2"
+ "bsd3"
+ "gpl2"
+ "gpl3"
+ "lgpl3"
+ "mit"
+ ))};
+ maintainers = [ stdenv.lib.maintainers.$9 ];
+ platforms = stdenv.lib.platforms.${10:$$
+ (yas-choose-value '(
+ "gnu"
+ "linux"
+ "darwin"
+ "freebsd"
+ "openbsd"
+ "netbsd"
+ "cygwin"
+ "illumos"
+ "unix"
+ "all"
+ "none"
+ "allBut"
+ "mesaPlatforms"
+ "x86"
+ "i686"
+ "arm"
+ "mips"
+ ))};
+ };
+}
diff --git a/nix-mode/patchPhase b/nix-mode/patchPhase
new file mode 100644
index 0000000..329f527
--- /dev/null
+++ b/nix-mode/patchPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: patchPhase
+# key: pp
+# --
+patchPhase = ''
+ $1
+'';
+$0 \ No newline at end of file
diff --git a/nix-mode/phases b/nix-mode/phases
new file mode 100644
index 0000000..50326f2
--- /dev/null
+++ b/nix-mode/phases
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: phases
+# key: ph
+# --
+ phases="${1:\$prePhases unpackPhase patchPhase \$preConfigurePhases configurePhase \$preBuildPhases buildPhase checkPhase \$preInstallPhases installPhase fixupPhase installCheckPhase \$preDistPhases distPhase \$postPhases}";
diff --git a/nix-mode/unpackPhase b/nix-mode/unpackPhase
new file mode 100644
index 0000000..558dbe8
--- /dev/null
+++ b/nix-mode/unpackPhase
@@ -0,0 +1,8 @@
+# -*- mode: snippet -*-
+# name: unpackPhase
+# key: up
+# --
+unpackPhase = ''
+ $1
+'';
+$0