set up basic nix build

main
Nickiel12 1 year ago
parent 7677eb1425
commit d8ee5d076e

@ -1,9 +1,5 @@
/*
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
@ -13,18 +9,18 @@ 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 .#nicks_nextcloud_integrations` or `nix build .`
- `nix run .#nicks_nextcloud_integrations` or `nix run .`
Updating `cargoHash`:
- Set `cargoHash` to an empty string
- run `nix run .#helloworld`
- run `nix run .#nicks_nextcloud_integrations`
- Update `cargoHash` with correct hash from output
rust-project TODO: write shell script for automatically updating `cargoHash`
*/
{
description = "";
description = "A group of utilities Nick created to manage his server through nextcloud notes";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -59,58 +55,57 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
openssl
bacon
];
inputsFrom = with self.packages.${system}; [ helloworld ];
inputsFrom = with self.packages.${system}; [ status_cloud ];
};
packages.${system} = {
default = self.packages.${system}.helloworld;
helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "helloworld";
status_cloud = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "status_cloud";
version = "0.1.0";
buildAndTestSubdir = "helloworld";
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
buildAndTestSubdir = "status_cloud";
cargoHash = "sha256-GpAWrgFBzOTBCfZy/Ehy7IszuSgSOc/4N
2gbeed0jqI=";
meta = meta // {
description = "";
description = "Server status saved to a nextcloud note service.";
};
});
};
/*
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
options.services.helloworld = {
enable = lib.mkEnableOption (lib.mdDoc "helloworld service");
# status_cloud
options.services.status_cloud = {
enable = lib.mkEnableOption (lib.mdDoc "status_cloud service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.helloworld;
defaultText = "pkgs.helloworld";
default = self.packages.${system}.status_cloud;
defaultText = "pkgs.status_cloud";
description = lib.mdDoc ''
The helloworld package that should be used.
The status_cloud package that should be used.
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 8000;
default = 3001;
description = lib.mdDoc ''
The port at which to run.
'';
};
};
config.systemd.services.helloworld = let
cfg = config.services.helloworld;
pkg = self.packages.${system}.helloworld;
config.systemd.services.status_cloud = let
cfg = config.services.status_cloud;
pkg = self.packages.${system}.status_cloud;
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/status_cloud --port ${builtins.toString cfg.port}
'';
Restart = "always";
DynamicUser = true;
};
};
};
*/
};
}

Loading…
Cancel
Save