|
|
@ -1,6 +1,6 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
TODO
|
|
|
|
TODO
|
|
|
|
1. Find and replace "helloworld" with your package name for **ALL FILES IN REPOSITORY**
|
|
|
|
1. Find and replace "dorm-controller" 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,8 +13,8 @@ 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 .#dorm-controller` or `nix build .`
|
|
|
|
- `nix run .#helloworld` or `nix run .`
|
|
|
|
- `nix run .#dorm-controller` or `nix run .`
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -34,8 +34,8 @@ Some utility commands:
|
|
|
|
};
|
|
|
|
};
|
|
|
|
rustSettings = with pkgs; {
|
|
|
|
rustSettings = with pkgs; {
|
|
|
|
src = ./.;
|
|
|
|
src = ./.;
|
|
|
|
#nativeBuildInputs = [ pkg-config ];
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
#buildInputs = [ openssl ];
|
|
|
|
buildInputs = [ libudev-zero ];
|
|
|
|
cargoHash = nixpkgs.lib.fakeHash;
|
|
|
|
cargoHash = nixpkgs.lib.fakeHash;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
meta = with nixpkgs.lib; {
|
|
|
|
meta = with nixpkgs.lib; {
|
|
|
@ -53,14 +53,14 @@ Some utility commands:
|
|
|
|
cargo-edit
|
|
|
|
cargo-edit
|
|
|
|
bacon
|
|
|
|
bacon
|
|
|
|
];
|
|
|
|
];
|
|
|
|
inputsFrom = with self.packages.${system}; [ helloworld ];
|
|
|
|
inputsFrom = with self.packages.${system}; [ dorm-controller ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
packages.${system} = {
|
|
|
|
packages.${system} = {
|
|
|
|
default = self.packages.${system}.helloworld;
|
|
|
|
default = self.packages.${system}.dorm-controller;
|
|
|
|
helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
|
|
|
dorm-controller = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
|
|
|
pname = "helloworld";
|
|
|
|
pname = "dorm-controller";
|
|
|
|
version = "0.1.0";
|
|
|
|
version = "0.1.0";
|
|
|
|
buildAndTestSubdir = "helloworld";
|
|
|
|
buildAndTestSubdir = "dorm-controller";
|
|
|
|
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
|
|
|
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
|
|
|
meta = meta // {
|
|
|
|
meta = meta // {
|
|
|
|
description = "";
|
|
|
|
description = "";
|
|
|
@ -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.dorm-controller = {
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "helloworld service");
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "dorm-controller service");
|
|
|
|
package = lib.mkOption {
|
|
|
|
package = lib.mkOption {
|
|
|
|
type = lib.types.package;
|
|
|
|
type = lib.types.package;
|
|
|
|
default = self.packages.${system}.helloworld;
|
|
|
|
default = self.packages.${system}.dorm-controller;
|
|
|
|
defaultText = "pkgs.helloworld";
|
|
|
|
defaultText = "pkgs.dorm-controller";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
The helloworld package that should be used.
|
|
|
|
The dorm-controller 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.dorm-controller = let
|
|
|
|
cfg = config.services.helloworld;
|
|
|
|
cfg = config.services.dorm-controller;
|
|
|
|
pkg = self.packages.${system}.helloworld;
|
|
|
|
pkg = self.packages.${system}.dorm-controller;
|
|
|
|
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/dorm-controller --port ${builtins.toString cfg.port}
|
|
|
|
'';
|
|
|
|
'';
|
|
|
|
Restart = "always";
|
|
|
|
Restart = "always";
|
|
|
|
DynamicUser = true;
|
|
|
|
DynamicUser = true;
|
|
|
|