inital setup stages for the project
This commit is contained in:
parent
daf7683032
commit
0d48150dc7
4 changed files with 81 additions and 19 deletions
62
flake.lock
Normal file
62
flake.lock
Normal file
|
@ -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
|
||||
}
|
38
flake.nix
38
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 <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;
|
||||
|
|
Loading…
Reference in a new issue