summaryrefslogtreecommitdiff
path: root/templates/standard/nix
diff options
context:
space:
mode:
Diffstat (limited to 'templates/standard/nix')
-rw-r--r--templates/standard/nix/module.nix27
-rw-r--r--templates/standard/nix/package.nix1
2 files changed, 28 insertions, 0 deletions
diff --git a/templates/standard/nix/module.nix b/templates/standard/nix/module.nix
new file mode 100644
index 0000000..36e91ea
--- /dev/null
+++ b/templates/standard/nix/module.nix
@@ -0,0 +1,27 @@
+self:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+let
+ namespace = "myProgram";
+ cfg = config.services.${namespace};
+
+ inherit (pkgs.stdenv.hostPlatform) system;
+ packages = self.packages.${system} or throw "myProgram: ${system} is not supported";
+in
+
+{
+ options.services.${namespace} = {
+ enable = lib.mkEnableOption "something amazing";
+
+ package = lib.mkPackageOption packages "hello" { };
+ };
+
+ config = {
+ environment.systemPackages = [ cfg.package ];
+ };
+}
diff --git a/templates/standard/nix/package.nix b/templates/standard/nix/package.nix
new file mode 100644
index 0000000..46f9694
--- /dev/null
+++ b/templates/standard/nix/package.nix
@@ -0,0 +1 @@
+{ runCommand }: runCommand "hello" { } "echo 'hello' > $out"