aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-08 23:39:38 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-08 23:39:38 +0200
commit507da65900ccb3c6356673e93ad2271c58e43b07 (patch)
tree9a7e0ca0442500107170efeee982486b7638d656
parent47727252ff4e536dd47b73949033d3349923fbbb (diff)
Move flake template into a separate file
-rw-r--r--.gitignore2
-rw-r--r--src/nix/flake-template.nix15
-rw-r--r--src/nix/flake.cc19
-rw-r--r--src/nix/local.mk2
4 files changed, 20 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index b75c5d489..da0e7c843 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,7 +46,7 @@ perl/Makefile.config
/src/libexpr/nix.tbl
# /src/libstore/
-/src/libstore/*.gen.hh
+*.gen.*
/src/nix/nix
diff --git a/src/nix/flake-template.nix b/src/nix/flake-template.nix
new file mode 100644
index 000000000..fe89e647e
--- /dev/null
+++ b/src/nix/flake-template.nix
@@ -0,0 +1,15 @@
+{
+ name = "hello";
+
+ description = "A flake for building Hello World";
+
+ epoch = 2019;
+
+ requires = [ "nixpkgs" ];
+
+ provides = deps: rec {
+
+ packages.hello = deps.nixpkgs.provides.packages.hello;
+
+ };
+}
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 01385ff8d..3d2fb7832 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -207,23 +207,8 @@ struct CmdFlakeInit : virtual Args, Command
throw Error("file '%s' already exists", flakePath);
writeFile(flakePath,
-R"str(
-{
- name = "hello";
-
- description = "A flake for building Hello World";
-
- epoch = 2019;
-
- requires = [ "nixpkgs" ];
-
- provides = deps: rec {
-
- packages.hello = deps.nixpkgs.provides.packages.hello;
-
- };
-}
-)str");
+#include "flake-template.nix.gen.hh"
+ );
}
};
diff --git a/src/nix/local.mk b/src/nix/local.mk
index ca4604d56..4003d0005 100644
--- a/src/nix/local.mk
+++ b/src/nix/local.mk
@@ -23,3 +23,5 @@ $(foreach name, \
nix-build nix-channel nix-collect-garbage nix-copy-closure nix-daemon nix-env nix-hash nix-instantiate nix-prefetch-url nix-shell nix-store, \
$(eval $(call install-symlink, nix, $(bindir)/$(name))))
$(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote))
+
+$(d)/flake.cc: $(d)/flake-template.nix.gen.hh