From d51b9fefa4be6e5cc5c64b4cae8b027c31f0962f Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Mon, 6 Nov 2023 20:40:25 -0800 Subject: [PATCH] updated template form project --- .vscode/settings.json | 5 -- Cargo.lock | 2 +- Cargo.toml | 2 +- {helloworld => ewwtilities}/Cargo.toml | 2 +- {helloworld => ewwtilities}/src/main.rs | 0 flake.lock | 96 +++++++++++++++++++++++++ flake.nix | 34 ++++----- 7 files changed, 116 insertions(+), 25 deletions(-) delete mode 100644 .vscode/settings.json rename {helloworld => ewwtilities}/Cargo.toml (88%) rename {helloworld => ewwtilities}/src/main.rs (100%) create mode 100644 flake.lock diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0baf00e..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rust-analyzer.linkedProjects": [ - "./helloworld/Cargo.toml", - ] -} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 97a944e..c26bd40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "helloworld" +name = "ewwtilities" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 3076892..a759d65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members = ["helloworld"] +members = ["ewwtilities"] resolver = "2" diff --git a/helloworld/Cargo.toml b/ewwtilities/Cargo.toml similarity index 88% rename from helloworld/Cargo.toml rename to ewwtilities/Cargo.toml index 5371865..aa69372 100644 --- a/helloworld/Cargo.toml +++ b/ewwtilities/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "helloworld" +name = "ewwtilities" version = "0.1.0" edition = "2021" diff --git a/helloworld/src/main.rs b/ewwtilities/src/main.rs similarity index 100% rename from helloworld/src/main.rs rename to ewwtilities/src/main.rs diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1129915 --- /dev/null +++ b/flake.lock @@ -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": 1699323235, + "narHash": "sha256-ZFRItRv0dDSzsfpqSjj9qWM/SA1kRrOk6R04qhBZuxM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "8a9d6f544c08ee898c7f3761cc9587be7565db5e", + "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 +} diff --git a/flake.nix b/flake.nix index ff7dbee..7c55429 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ /* TODO -1. Find and replace "helloworld" with your package name for **ALL FILES IN REPOSITORY** +1. Find and replace "ewwtilities" 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 @@ -13,8 +13,8 @@ TODO Some utility commands: - `nix flake update --commit-lock-file` - `nix flake lock update-input ` -- `nix build .#helloworld` or `nix build .` -- `nix run .#helloworld` or `nix run .` +- `nix build .#ewwtilities` or `nix build .` +- `nix run .#ewwtilities` or `nix run .` */ { @@ -53,14 +53,14 @@ Some utility commands: cargo-edit bacon ]; - inputsFrom = with self.packages.${system}; [ helloworld ]; + inputsFrom = with self.packages.${system}; [ ewwtilities ]; }; packages.${system} = { - default = self.packages.${system}.helloworld; - helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // { - pname = "helloworld"; + default = self.packages.${system}.ewwtilities; + ewwtilities = pkgs.rustPlatform.buildRustPackage (rustSettings // { + pname = "ewwtilities"; version = "0.1.0"; - buildAndTestSubdir = "helloworld"; + buildAndTestSubdir = "ewwtilities"; cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo="; meta = meta // { description = ""; @@ -71,14 +71,14 @@ Some utility commands: nixosModules.default = { config, ... }: let lib = nixpkgs.lib; in { - options.services.helloworld = { - enable = lib.mkEnableOption (lib.mdDoc "helloworld service"); + options.services.ewwtilities = { + enable = lib.mkEnableOption (lib.mdDoc "ewwtilities service"); package = lib.mkOption { type = lib.types.package; - default = self.packages.${system}.helloworld; - defaultText = "pkgs.helloworld"; + default = self.packages.${system}.ewwtilities; + defaultText = "pkgs.ewwtilities"; description = lib.mdDoc '' - The helloworld package that should be used. + The ewwtilities package that should be used. ''; }; port = lib.mkOption { @@ -89,16 +89,16 @@ Some utility commands: ''; }; }; - config.systemd.services.helloworld = let - cfg = config.services.helloworld; - pkg = self.packages.${system}.helloworld; + config.systemd.services.ewwtilities = let + cfg = config.services.ewwtilities; + pkg = self.packages.${system}.ewwtilities; in lib.mkIf cfg.enable { description = pkg.meta.description; after = [ "network.target" ]; wantedBy = [ "network.target" ]; serviceConfig = { ExecStart = '' - ${cfg.package}/bin/helloworld --port ${builtins.toString cfg.port} + ${cfg.package}/bin/ewwtilities --port ${builtins.toString cfg.port} ''; Restart = "always"; DynamicUser = true;