generated from stubbfel/nix-project-template
add example
This commit is contained in:
5
playground/example/config/default.nix
Normal file
5
playground/example/config/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{ config ? import ../../../config { } }:
|
||||
|
||||
{
|
||||
playground = { port = "8081"; server = import ../services/python; };
|
||||
} // config
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
inputs = { config.url = "path:config"; };
|
||||
|
||||
outputs = { self, config }: config //. {playground = { port = "8080"; }; };
|
||||
}
|
||||
16
playground/example/default.nix
Normal file
16
playground/example/default.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ config ? import ../config { } }:
|
||||
|
||||
let
|
||||
|
||||
app = import ./services { config = config; };
|
||||
|
||||
in {
|
||||
|
||||
package = app;
|
||||
|
||||
app = {
|
||||
type = "app";
|
||||
program = "${app}";
|
||||
};
|
||||
|
||||
}
|
||||
@@ -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}";
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
5
playground/example/services/default.nix
Normal file
5
playground/example/services/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{ config ? import ../config { } }:
|
||||
|
||||
config.nixpkgs.writeScript "example-web-server" ''
|
||||
${config.playground.server {config = config;}}
|
||||
''
|
||||
5
playground/example/services/python/default.nix
Normal file
5
playground/example/services/python/default.nix
Normal 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}
|
||||
''
|
||||
6
playground/example/services/rust/default.nix
Normal file
6
playground/example/services/rust/default.nix
Normal 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}
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user