aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/flake-template.nix15
-rw-r--r--src/nix/flake.cc19
-rw-r--r--src/nix/local.mk2
3 files changed, 19 insertions, 17 deletions
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