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
|
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
|
2. Add a flake description that describes the workspace on line 27
|
||||||
3. Add a package description on line 70
|
3. Add a package description on line 70
|
||||||
4. (optional) uncomment `nativeBuildInputs` and `buildInputs` on lines 43 and 44 if you need openssl
|
4. (optional) uncomment `nativeBuildInputs` and `buildInputs` on lines 43 and 44 if you need openssl
|
||||||
|
@ -13,12 +13,12 @@ TODO
|
||||||
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 .#artist-alerts` or `nix build .`
|
||||||
- `nix run .#helloworld` or `nix run .`
|
- `nix run .#artist-alerts` or `nix run .`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
description = "";
|
description = "Webservice with subscription features for new artist releases";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
@ -53,17 +53,17 @@ Some utility commands:
|
||||||
cargo-edit
|
cargo-edit
|
||||||
bacon
|
bacon
|
||||||
];
|
];
|
||||||
inputsFrom = with self.packages.${system}; [ helloworld ];
|
inputsFrom = with self.packages.${system}; [ artist-alerts ];
|
||||||
};
|
};
|
||||||
packages.${system} = {
|
packages.${system} = {
|
||||||
default = self.packages.${system}.helloworld;
|
default = self.packages.${system}.artist-alerts;
|
||||||
helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
artist-alerts = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
||||||
pname = "helloworld";
|
pname = "artist-alerts";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
buildAndTestSubdir = "helloworld";
|
buildAndTestSubdir = "artist-alerts";
|
||||||
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
||||||
meta = meta // {
|
meta = meta // {
|
||||||
description = "";
|
description = "Webservice with subscription features for new artist releases";
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -71,14 +71,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.artist-alerts = {
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "helloworld service");
|
enable = lib.mkEnableOption (lib.mdDoc "artist-alerts service");
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default = self.packages.${system}.helloworld;
|
default = self.packages.${system}.artist-alerts;
|
||||||
defaultText = "pkgs.helloworld";
|
defaultText = "pkgs.artist-alerts";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The helloworld package that should be used.
|
The artist-alerts package that should be used.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
|
@ -89,16 +89,16 @@ Some utility commands:
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config.systemd.services.helloworld = let
|
config.systemd.services.artist-alerts = let
|
||||||
cfg = config.services.helloworld;
|
cfg = config.services.artist-alerts;
|
||||||
pkg = self.packages.${system}.helloworld;
|
pkg = self.packages.${system}.artist-alerts;
|
||||||
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/artist-alerts --port ${builtins.toString cfg.port}
|
||||||
'';
|
'';
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
Loading…
Reference in a new issue