Compare commits

..

No commits in common. "926f213923a5837abd1dcb4d59974e8bfecf4b22" and "91d62bf0ffa9136dd6656360adae8ac1b52ff521" have entirely different histories.

4 changed files with 35 additions and 108 deletions

3
.gitignore vendored
View file

@ -23,6 +23,3 @@ target/
# debug # debug
.vscode/ .vscode/
# nix
result/

View file

@ -38,16 +38,16 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1712543224, "lastModified": 1712439257,
"narHash": "sha256-9RSfZL1TKYdGxZwgDxwtBtsKMGR4Zgn+DAnF9s71/lU=", "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b0dab7cc34ef4d8a1b2de36178da801090bcb271", "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -55,8 +55,7 @@
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix", "fenix": "fenix",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2"
"systems": "systems"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
@ -75,21 +74,6 @@
"repo": "rust-analyzer", "repo": "rust-analyzer",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,48 +1,26 @@
{ {
description = "A basic flake"; description = "forcebot_rs flake";
inputs = { inputs = {
systems.url = "github:nix-systems/default-linux"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix.url = "github:nix-community/fenix/monthly"; fenix.url = "github:nix-community/fenix/monthly";
}; };
outputs = { outputs = {
self,
systems,
nixpkgs, nixpkgs,
fenix, fenix,
...
} @ inputs: let } @ inputs: let
eachSystem = nixpkgs.lib.genAttrs (import systems); system = "x86_64-linux";
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = [fenix.overlays.default]; overlays = [fenix.overlays.default];
}); pkgs = import nixpkgs {
in { inherit system overlays;
packages = eachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
in {
default = pkgsFor.${system}.rustPlatform.buildRustPackage {
pname = "forcebot_rs";
version = "${version}";
src = self;
cargoLock = {
lockFile = ./Cargo.lock;
}; };
in {
nativeBuildInputs = with pkgs; [pkg-config]; devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [openssl]; name = "forcebot_rs-devenv";
nativeBuildInputs = [pkgs.pkg-config];
doCheck = false; buildInputs = with pkgs; [openssl libiconv];
}; packages = with pkgs; [
});
devShells = eachSystem (system: {
default = pkgsFor.${system}.mkShell {
packages = with pkgsFor.${system}; [
nil nil
alejandra alejandra
rust-analyzer-nightly rust-analyzer-nightly
@ -57,7 +35,5 @@
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
RUST_SRC_PATH = "${fenix.packages.${system}.complete.rust-src}/lib/rustlib/src/rust/library"; RUST_SRC_PATH = "${fenix.packages.${system}.complete.rust-src}/lib/rustlib/src/rust/library";
}; };
});
nixosModules.default = import ./nix/module.nix {inherit self;};
}; };
} }

View file

@ -1,30 +0,0 @@
{self}: {
pkgs,
config,
lib,
...
}: let
inherit (lib) types;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;
inherit (pkgs.stdenv.hostPlatform) system;
cfg = config.services.forcebot_rs;
in {
options.services.forcebot_rs = {
enable = mkEnableOption ''
Enable forcebot
'';
package = mkOption {
type = types.package;
default = self.packages.${system}.default;
};
};
config = mkIf cfg.enable {
systemd.services.forcebot_rs = {
wantedBy = ["multi-user.target"];
serviceConfig.ExecStart = "${cfg.package}/bin/forcebot_rs";
};
};
}