add example

This commit is contained in:
2023-06-10 18:08:31 +00:00
parent 72591b23c4
commit 23173d0875
11 changed files with 64 additions and 115 deletions

View File

@@ -0,0 +1,5 @@
{ config ? import ../../../config { } }:
{
playground = { port = "8081"; server = import ../services/python; };
} // config

View File

@@ -1,5 +0,0 @@
{
inputs = { config.url = "path:config"; };
outputs = { self, config }: config //. {playground = { port = "8080"; }; };
}

View File

@@ -0,0 +1,16 @@
{ config ? import ../config { } }:
let
app = import ./services { config = config; };
in {
package = app;
app = {
type = "app";
program = "${app}";
};
}

View File

@@ -1,31 +0,0 @@
{
description = "";
inputs = { config.url = "path:playground/example/config"; };
outputs = { self, config }:
let
version = "0.0.1";
name = "develnixos";
forAllSystems = config.forAllSystems;
nixpkgsFor = config.nixpkgsFor;
devTaskScripts = forAllSystems (system: {
autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" ''
git tag --force v${version}
git push origin v${version}
'';
});
in rec {
packages = forAllSystems (system: {
default = nixpkgsFor.${system}.writeScript "python-webserver" ''
python -m http.server 8080
'';
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${packages.${system}.default}";
};
});
};
}

View File

@@ -0,0 +1,5 @@
{ config ? import ../config { } }:
config.nixpkgs.writeScript "example-web-server" ''
${config.playground.server {config = config;}}
''

View File

@@ -0,0 +1,5 @@
{ config ? import ../../config { } }:
config.nixpkgs.writeScript "python-example-web-server" ''
${config.nixpkgs.python3}/bin/python -m http.server ${config.playground.port}
''

View File

@@ -0,0 +1,6 @@
{ config ? import ../../config { } }:
config.nixpkgs.writeScript "rust-example-web-server" ''
${config.nixpkgs.simple-http-server}/bin/simple-http-server --port ${config.playground.port}
''