From 0d48150dc7eaf3cb40027b21dc6422dec09c4010 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Sat, 6 Jul 2024 21:23:59 +0000 Subject: [PATCH] inital setup stages for the project --- {helloworld => artist-alerts}/Cargo.toml | 0 {helloworld => artist-alerts}/src/main.rs | 0 flake.lock | 62 +++++++++++++++++++++++ flake.nix | 38 +++++++------- 4 files changed, 81 insertions(+), 19 deletions(-) rename {helloworld => artist-alerts}/Cargo.toml (100%) rename {helloworld => artist-alerts}/src/main.rs (100%) create mode 100644 flake.lock diff --git a/helloworld/Cargo.toml b/artist-alerts/Cargo.toml similarity index 100% rename from helloworld/Cargo.toml rename to artist-alerts/Cargo.toml diff --git a/helloworld/src/main.rs b/artist-alerts/src/main.rs similarity index 100% rename from helloworld/src/main.rs rename to artist-alerts/src/main.rs diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..90f96e7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1720031269, + "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1720232258, + "narHash": "sha256-eR5glZHS2bLpzUgTDhWGm04j+j5KMYKoDsY5DXAiuKQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "05ccbe21233d4e9110fc6428d2c3d74b430c3c69", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index ff7dbee..eb691de 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 "artist-alerts" 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,12 +13,12 @@ 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 .#artist-alerts` or `nix build .` +- `nix run .#artist-alerts` or `nix run .` */ { - description = ""; + description = "Webservice with subscription features for new artist releases"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -53,17 +53,17 @@ Some utility commands: cargo-edit bacon ]; - inputsFrom = with self.packages.${system}; [ helloworld ]; + inputsFrom = with self.packages.${system}; [ artist-alerts ]; }; packages.${system} = { - default = self.packages.${system}.helloworld; - helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // { - pname = "helloworld"; + default = self.packages.${system}.artist-alerts; + artist-alerts = pkgs.rustPlatform.buildRustPackage (rustSettings // { + pname = "artist-alerts"; version = "0.1.0"; - buildAndTestSubdir = "helloworld"; + buildAndTestSubdir = "artist-alerts"; cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo="; meta = meta // { - description = ""; + description = "Webservice with subscription features for new artist releases"; }; }); }; @@ -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.artist-alerts = { + enable = lib.mkEnableOption (lib.mdDoc "artist-alerts service"); package = lib.mkOption { type = lib.types.package; - default = self.packages.${system}.helloworld; - defaultText = "pkgs.helloworld"; + default = self.packages.${system}.artist-alerts; + defaultText = "pkgs.artist-alerts"; description = lib.mdDoc '' - The helloworld package that should be used. + The artist-alerts 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.artist-alerts = let + cfg = config.services.artist-alerts; + pkg = self.packages.${system}.artist-alerts; 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/artist-alerts --port ${builtins.toString cfg.port} ''; Restart = "always"; DynamicUser = true;