From b7b441a933b9abfe5a382ffbd0ee38c03b480149 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 13 Aug 2023 19:46:19 -0700 Subject: [PATCH] Configure project --- .vscode/settings.json | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- {helloworld => dyesub-tool}/Cargo.toml | 2 +- {helloworld => dyesub-tool}/src/main.rs | 0 flake.lock | 96 +++++++++++++++++++++++++ flake.nix | 79 ++++---------------- 7 files changed, 113 insertions(+), 70 deletions(-) rename {helloworld => dyesub-tool}/Cargo.toml (88%) rename {helloworld => dyesub-tool}/src/main.rs (100%) create mode 100644 flake.lock diff --git a/.vscode/settings.json b/.vscode/settings.json index 0baf00e..4fafcea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "rust-analyzer.linkedProjects": [ - "./helloworld/Cargo.toml", + "./dyesub-tool/Cargo.toml", ] } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 97a944e..3226484 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "helloworld" +name = "dyesub-tool" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 0bda405..06f08e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["helloworld"] \ No newline at end of file +members = ["dyesub-tool"] \ No newline at end of file diff --git a/helloworld/Cargo.toml b/dyesub-tool/Cargo.toml similarity index 88% rename from helloworld/Cargo.toml rename to dyesub-tool/Cargo.toml index 5371865..d032fce 100644 --- a/helloworld/Cargo.toml +++ b/dyesub-tool/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "helloworld" +name = "dyesub-tool" version = "0.1.0" edition = "2021" diff --git a/helloworld/src/main.rs b/dyesub-tool/src/main.rs similarity index 100% rename from helloworld/src/main.rs rename to dyesub-tool/src/main.rs diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d0e21c2 --- /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": 1691899779, + "narHash": "sha256-IBf4KVr/UQJlzrqB2/IHtlvmwsvyIVLPerSzCPU/6Xk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "100a1550b0e7a64b960c625b656f9229bdef5f87", + "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": 1691979003, + "narHash": "sha256-kT7FB6+wiTPzXtzNdQJmBGyFGM3/9QvjDTF5YK3eYTs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "ce646c4052c4979078a1ed263bc6e8c1a14c0d07", + "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 5b171c7..f25a342 100644 --- a/flake.nix +++ b/flake.nix @@ -1,30 +1,18 @@ -/* -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: - `nix flake update --commit-lock-file` - `nix flake lock update-input ` -- `nix build .#helloworld` -- `nix run .#helloworld` +- `nix build .#dyesub-tool` +- `nix run .#dyesub-tool` Updating `cargoHash`: - Set `cargoHash` to an empty string -- run `nix run .#helloworld` +- run `nix run .#dyesub-tool` - Update `cargoHash` with correct hash from output -rust-project TODO: write shell script for automatically updating `cargoHash` */ { - description = ""; + description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift 拇指シフト keycaps."; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -40,15 +28,12 @@ rust-project TODO: write shell script for automatically updating `cargoHash` }; rustSettings = with pkgs; { src = ./.; - #nativeBuildInputs = [ pkg-config ]; - #buildInputs = [ openssl ]; cargoHash = nixpkgs.lib.fakeHash; }; meta = with nixpkgs.lib; { - #homepage = "https://example.com"; - #license = [ licenses.gpl3 ]; + license = [ licenses.gpl3 ]; platforms = [ system ]; - #maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ elnudev ]; }; in { devShells.${system}.default = with pkgs; mkShell { @@ -58,57 +43,19 @@ rust-project TODO: write shell script for automatically updating `cargoHash` }) bacon ]; - inputsFrom = with self.packages.${system}; [ helloworld ]; + inputsFrom = with self.packages.${system}; [ dyesub-tool ]; }; packages.${system} = { - helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // { - pname = "helloworld"; + default = self.packages.${system}.dyesub-tool; + dyesub-tool = pkgs.rustPlatform.buildRustPackage (rustSettings // { + pname = "dyesub-tool"; version = "0.1.0"; - buildAndTestSubdir = "helloworld"; - cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo="; + buildAndTestSubdir = "dyesub-tool"; + cargoHash = "sha256-hFxEu/sPAxrjOpXqSPDucOqmgsOjb6YBxnWeVl4MV74="; meta = meta // { - description = ""; + description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift 拇指シフト keycaps."; }; }); }; - /* - nixosModules.default = { config, ... }: let - lib = nixpkgs.lib; - in { - options.services.helloworld = { - enable = lib.mkEnableOption (lib.mdDoc "helloworld service"); - package = lib.mkOption { - type = lib.types.package; - default = self.packages.${system}.helloworld; - defaultText = "pkgs.helloworld"; - description = lib.mdDoc '' - The helloworld package that should be used. - ''; - }; - port = lib.mkOption { - type = lib.types.port; - default = 8000; - description = lib.mdDoc '' - The port at which to run. - ''; - }; - }; - config.systemd.services.helloworld = let - cfg = config.services.helloworld; - pkg = self.packages.${system}.helloworld; - 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} - ''; - Restart = "always"; - DynamicUser = true; - }; - }; - }; - */ }; }