generated from ElnuDev/rust-project
Rename repo
This commit is contained in:
parent
351ae0248f
commit
85c91f3052
7 changed files with 116 additions and 31 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"rust-analyzer.linkedProjects": [
|
"rust-analyzer.linkedProjects": [
|
||||||
"./helloworld/Cargo.toml",
|
"./webcam-streamer/Cargo.toml",
|
||||||
]
|
]
|
||||||
}
|
}
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -3,5 +3,5 @@
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "helloworld"
|
name = "webcam-streamer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["helloworld"]
|
members = ["webcam-streamer"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
96
flake.lock
generated
Normal file
96
flake.lock
generated
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681202837,
|
||||||
|
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1699099776,
|
||||||
|
"narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681358109,
|
||||||
|
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1699236891,
|
||||||
|
"narHash": "sha256-J0uhoYlufJncIFbM/pAoggzHK/qERB9KfQRkmYD56yo=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "a7f9bf91dc5065d470cd57169a9f2ebdbdfe1f24",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
43
flake.nix
43
flake.nix
|
@ -1,20 +1,9 @@
|
||||||
/*
|
|
||||||
TODO
|
|
||||||
1. Find and replace "helloworld" with your package name for **ALL FILES IN REPOSITORY**
|
|
||||||
2. Add a flake description that describes the workspace on line 27
|
|
||||||
3. Add a package description on line 70
|
|
||||||
4. (optional) uncomment `nativeBuildInputs` and `buildInputs` on lines 43 and 44 if you need openssl
|
|
||||||
5. (optional) set your project homepage, license, and maintainers list on lines 48-51
|
|
||||||
6. (optional) uncomment the NixOS module and update it for your needs
|
|
||||||
7. Delete this comment block
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some utility commands:
|
Some utility commands:
|
||||||
- `nix flake update --commit-lock-file`
|
- `nix flake update --commit-lock-file`
|
||||||
- `nix flake lock update-input <input>`
|
- `nix flake lock update-input <input>`
|
||||||
- `nix build .#helloworld` or `nix build .`
|
- `nix build .#webcam-streamer` or `nix build .`
|
||||||
- `nix run .#helloworld` or `nix run .`
|
- `nix run .#webcam-streamer` or `nix run .`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -53,14 +42,14 @@ Some utility commands:
|
||||||
cargo-edit
|
cargo-edit
|
||||||
bacon
|
bacon
|
||||||
];
|
];
|
||||||
inputsFrom = with self.packages.${system}; [ helloworld ];
|
inputsFrom = with self.packages.${system}; [ webcam-streamer ];
|
||||||
};
|
};
|
||||||
packages.${system} = {
|
packages.${system} = {
|
||||||
default = self.packages.${system}.helloworld;
|
default = self.packages.${system}.webcam-streamer;
|
||||||
helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
webcam-streamer = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
||||||
pname = "helloworld";
|
pname = "webcam-streamer";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
buildAndTestSubdir = "helloworld";
|
buildAndTestSubdir = "webcam-streamer";
|
||||||
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
||||||
meta = meta // {
|
meta = meta // {
|
||||||
description = "";
|
description = "";
|
||||||
|
@ -71,14 +60,14 @@ Some utility commands:
|
||||||
nixosModules.default = { config, ... }: let
|
nixosModules.default = { config, ... }: let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
in {
|
in {
|
||||||
options.services.helloworld = {
|
options.services.webcam-streamer = {
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "helloworld service");
|
enable = lib.mkEnableOption (lib.mdDoc "webcam-streamer service");
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default = self.packages.${system}.helloworld;
|
default = self.packages.${system}.webcam-streamer;
|
||||||
defaultText = "pkgs.helloworld";
|
defaultText = "pkgs.webcam-streamer";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The helloworld package that should be used.
|
The webcam-streamer package that should be used.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
|
@ -89,16 +78,16 @@ Some utility commands:
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config.systemd.services.helloworld = let
|
config.systemd.services.webcam-streamer = let
|
||||||
cfg = config.services.helloworld;
|
cfg = config.services.webcam-streamer;
|
||||||
pkg = self.packages.${system}.helloworld;
|
pkg = self.packages.${system}.webcam-streamer;
|
||||||
in lib.mkIf cfg.enable {
|
in lib.mkIf cfg.enable {
|
||||||
description = pkg.meta.description;
|
description = pkg.meta.description;
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "network.target" ];
|
wantedBy = [ "network.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${cfg.package}/bin/helloworld --port ${builtins.toString cfg.port}
|
${cfg.package}/bin/webcam-streamer --port ${builtins.toString cfg.port}
|
||||||
'';
|
'';
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "helloworld"
|
name = "webcam-streamer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
Loading…
Add table
Reference in a new issue