diff --git a/.gitignore b/.gitignore index ea8c4bf..d787b70 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/result diff --git a/Cargo.lock b/Cargo.lock index d0133a5..06b5d60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,9 +86,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" [[package]] name = "block-buffer" @@ -469,9 +469,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +checksum = "b915661dd01db3f05050265b2477bcc6527b3792388e2749b41623cc592be67d" dependencies = [ "crossbeam-deque", "globset", diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8f095cd --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1780453794, + "narHash": "sha256-bXMRa9VTsHSPXL4Cw8R6JJLQeY3Y/IP4+YJCYVmQ7FY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6b316287bae2ee04c9b93c8c858d930fd07d7338", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-26.05", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bfac211 --- /dev/null +++ b/flake.nix @@ -0,0 +1,80 @@ +{ + description = "A non-linear writing instrument."; + + inputs.nixpkgs.url = "nixpkgs/nixos-26.05"; + + outputs = { nixpkgs, self }: let + name = "en"; + version = "0.4.0"; + + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + nixpkgsFor = forAllSystems (system: import nixpkgs { + inherit system; + }); + + in { + packages = forAllSystems (system: let + pkgs = nixpkgsFor.${system}; + in { + default = pkgs.rustPlatform.buildRustPackage { + inherit name version; + src = ./.; + + cargoHash = + "sha256-" + + "em229cShq/IShRnxlp5mgcIu7pIOf0LflV8Pw0lLUEY="; + }; + }); + + apps = forAllSystems (system: { + default = { + type = "app"; + program = + "${self.packages.${system}.default}/bin/en"; + }; + }); + + devShells = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + rustup + just + watchexec + cargo-deny + cargo-llvm-cov + cargo-mutants + go-tools + typos + taplo + ]; + }; + } + ); + + + nixosModules.bot = { config, lib, system, ... }: { + options.within.services.en.enable = + lib.mkEnableOption "enable en server"; + + config = lib.mkIf config.within.services.en.enable { + systemd.services.en = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "always"; + ExecStart = + "${self.packages."${system}".default}/bin/en"; + }; + }; + }; + }; + + + }; +}