diff --git a/nix/derivation.nix b/nix/derivation.nix deleted file mode 100644 index 384b7b8..0000000 --- a/nix/derivation.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - self, - stdenv, - lib, - rustPlatform, - pkg-config, - libiconv, - darwin, - lto ? false, - optimizeSize ? false, -}: -rustPlatform.buildRustPackage { - pname = "valfisk"; - version = builtins.substring 0 8 self.lastModifiedDate; - - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions [ - ../src - ../build.rs - ../Cargo.lock - ../Cargo.toml - ]; - }; - cargoLock.lockFile = ../Cargo.lock; - - __structuredAttrs = true; - - buildInputs = lib.optionals stdenv.isDarwin [ - libiconv - darwin.apple_sdk.frameworks.CoreFoundation - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; - - nativeBuildInputs = [ pkg-config ]; - - doCheck = false; - - env = - { - METADATA_LAST_MODIFIED = self.lastModified; - METADATA_GIT_REV = self.dirtyRev or self.rev; - } - // lib.optionalAttrs lto { CARGO_PROFILE_RELEASE_LTO = "fat"; } - // lib.optionalAttrs optimizeSize { - CARGO_PROFILE_RELEASE_OPT_LEVEL = "z"; - CARGO_PROFILE_RELEASE_PANIC = "abort"; - CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; - CARGO_PROFILE_RELEASE_STRIP = "symbols"; - }; - - meta = with lib; { - mainProgram = "valfisk"; - description = "Next generation Ryanland Discord bot, written in Rust"; - homepage = "https://github.com/ryanccn/valfisk"; - maintainers = with maintainers; [ - getchoo - ryanccn - ]; - licenses = licenses.agpl3Only; - }; -} diff --git a/nix/package.nix b/nix/package.nix index f12b7d5..34892f8 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -9,9 +9,16 @@ enableLTO ? true, enableOptimizeSize ? false, }: +let + year = builtins.substring 0 4 self.lastModifiedDate; + month = builtins.substring 4 2 self.lastModifiedDate; + day = builtins.substring 6 2 self.lastModifiedDate; + + formattedDate = "${year}-${month}-${day}"; +in rustPlatform.buildRustPackage rec { pname = passthru.cargoToml.package.name; - inherit (passthru.cargoToml.package) version; + version = passthru.cargoToml.package.version + "-unstable-" + formattedDate; strictDeps = true; @@ -40,7 +47,11 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = lib.optionals stdenv.isDarwin [ pkg-config ]; env = - lib.optionalAttrs enableLTO { + { + METADATA_LAST_MODIFIED = self.lastModified; + METADATA_GIT_REV = self.dirtyRev or self.rev; + } + // lib.optionalAttrs enableLTO { CARGO_PROFILE_RELEASE_LTO = "fat"; CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; }