Compare commits
2 commits
02cfda62a2
...
423ef593de
Author | SHA1 | Date | |
---|---|---|---|
|
423ef593de | ||
|
3aa8aefaa9 |
4 changed files with 210 additions and 1 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/target
|
/target
|
||||||
settings.toml
|
settings.toml
|
||||||
|
.direnv/*
|
||||||
|
|
96
flake.lock
Normal file
96
flake.lock
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1705309234,
|
||||||
|
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1711163522,
|
||||||
|
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1706487304,
|
||||||
|
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "90f456026d284c22b3e3497be980b2e47d0b28ac",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1711332768,
|
||||||
|
"narHash": "sha256-SFnlIwnrwJxEawLcrH7+zGb8spePcYyai5asMZnm0BM=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "8a8e3ea9a9a4b2225cb5e33e07c3a337f820168c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
111
flake.nix
Normal file
111
flake.nix
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
TODO
|
||||||
|
1. Find and replace "joystick-controller-client" 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Some utility commands:
|
||||||
|
- `nix flake update --commit-lock-file`
|
||||||
|
- `nix flake lock update-input <input>`
|
||||||
|
- `nix build .#joystick-controller-client` or `nix build .`
|
||||||
|
- `nix run .#joystick-controller-client` or `nix run .`
|
||||||
|
*/
|
||||||
|
|
||||||
|
{
|
||||||
|
description = "Joystick Controller client for the VCC motorized camera";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, rust-overlay }:
|
||||||
|
let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system overlays;
|
||||||
|
};
|
||||||
|
rustSettings = with pkgs; {
|
||||||
|
src = ./.;
|
||||||
|
nativeBuildInputs = [ pkg-config ];
|
||||||
|
buildInputs = [ openssl systemd gtk4 ];
|
||||||
|
cargoHash = nixpkgs.lib.fakeHash;
|
||||||
|
};
|
||||||
|
meta = with nixpkgs.lib; {
|
||||||
|
#homepage = "https://example.com";
|
||||||
|
#license = [ licenses.gpl3 ];
|
||||||
|
platforms = [ system ];
|
||||||
|
#maintainers = with maintainers; [ ];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
devShells.${system}.default = with pkgs; mkShell {
|
||||||
|
packages = [
|
||||||
|
(pkgs.rust-bin.stable.latest.default.override {
|
||||||
|
extensions = [ "rust-src" ];
|
||||||
|
})
|
||||||
|
cargo-edit
|
||||||
|
bacon
|
||||||
|
];
|
||||||
|
inputsFrom = with self.packages.${system}; [ joystick-controller-client ];
|
||||||
|
};
|
||||||
|
packages.${system} = {
|
||||||
|
default = self.packages.${system}.joystick-controller-client;
|
||||||
|
joystick-controller-client = pkgs.rustPlatform.buildRustPackage (rustSettings // {
|
||||||
|
pname = "joystick-controller-client";
|
||||||
|
version = "0.1.0";
|
||||||
|
buildAndTestSubdir = "joystick-controller-client";
|
||||||
|
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
|
||||||
|
meta = meta // {
|
||||||
|
description = "";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
nixosModules.default = { config, ... }: let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
in {
|
||||||
|
options.services.joystick-controller-client = {
|
||||||
|
enable = lib.mkEnableOption (lib.mdDoc "joystick-controller-client service");
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = self.packages.${system}.joystick-controller-client;
|
||||||
|
defaultText = "pkgs.joystick-controller-client";
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
The joystick-controller-client package that should be used.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 8000;
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
The port at which to run.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config.systemd.services.joystick-controller-client = let
|
||||||
|
cfg = config.services.joystick-controller-client;
|
||||||
|
pkg = self.packages.${system}.joystick-controller-client;
|
||||||
|
in lib.mkIf cfg.enable {
|
||||||
|
description = pkg.meta.description;
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${cfg.package}/bin/joystick-controller-client --port ${builtins.toString cfg.port}
|
||||||
|
'';
|
||||||
|
Restart = "always";
|
||||||
|
DynamicUser = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue