From dd6c33bab788d3a0f9383e19620f6c4710689529 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Sun, 18 Dec 2022 04:25:07 +0300 Subject: [PATCH 1/2] fix: update flake --- flake.lock | 100 +++++++++++----- flake.nix | 263 ++++++++++++++++++++--------------------- nix/dateTimeFormat.nix | 29 ++++- 3 files changed, 225 insertions(+), 167 deletions(-) diff --git a/flake.lock b/flake.lock index d769ed60d5..ed6eb45ff4 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "crane": { "flake": false, "locked": { - "lastModified": 1661875961, - "narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=", + "lastModified": 1670900067, + "narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=", "owner": "ipetkov", "repo": "crane", - "rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24", + "rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b", "type": "github" }, "original": { @@ -19,11 +19,11 @@ "devshell": { "flake": false, "locked": { - "lastModified": 1660811669, - "narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=", + "lastModified": 1667210711, + "narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=", "owner": "numtide", "repo": "devshell", - "rev": "c2feacb46ee69949124c835419861143c4016fb5", + "rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7", "type": "github" }, "original": { @@ -35,45 +35,49 @@ "dream2nix": { "inputs": { "alejandra": [ - "nci", - "nixpkgs" + "nci" + ], + "all-cabal-json": [ + "nci" ], "crane": "crane", "devshell": [ "nci", "devshell" ], + "flake-parts": "flake-parts", "flake-utils-pre-commit": [ - "nci", - "nixpkgs" + "nci" + ], + "ghc-utils": [ + "nci" ], "gomod2nix": [ - "nci", - "nixpkgs" + "nci" ], "mach-nix": [ - "nci", - "nixpkgs" + "nci" + ], + "nix-pypi-fetcher": [ + "nci" ], "nixpkgs": [ "nci", "nixpkgs" ], "poetry2nix": [ - "nci", - "nixpkgs" + "nci" ], "pre-commit-hooks": [ - "nci", - "nixpkgs" + "nci" ] }, "locked": { - "lastModified": 1662507674, - "narHash": "sha256-vnXfje4pfTqDEqI837GCT+hNKqzfVwPen++gnLVO9F0=", + "lastModified": 1671323629, + "narHash": "sha256-9KHTPjIDjfnzZ4NjpE3gGIVHVHopy6weRDYO/7Y3hF8=", "owner": "nix-community", "repo": "dream2nix", - "rev": "5ba9061857e3e265538c9785bb56bda2bb8f9bca", + "rev": "2d7d68505c8619410df2c6b6463985f97cbcba6e", "type": "github" }, "original": { @@ -82,6 +86,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1668450977, + "narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nci": { "inputs": { "devshell": "devshell", @@ -90,11 +112,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1662507702, - "narHash": "sha256-Q8zfpLNCJublP7t4oHizr5tgsCS4BHFk7Fc7wzWbrzE=", + "lastModified": 1671326550, + "narHash": "sha256-FmGeaTd9FF64jhA8+J3ZJtFROQtfjeu1WESp+DRsVfg=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "97aa58c683ccf628175118052b3306f40ac21ca0", + "rev": "44c525562513cd818e515f556fa4b7393939cc8e", "type": "github" }, "original": { @@ -105,11 +127,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1662019588, - "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=", + "lastModified": 1671200928, + "narHash": "sha256-mZfzDyzojwj6I0wyooIjGIn81WtGVnx6+avU5Wv+VKU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2da64a81275b68fdad38af669afeda43d401e94b", + "rev": "757b82211463dd5ba1475b6851d3731dfe14d377", "type": "github" }, "original": { @@ -119,6 +141,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1665349835, + "narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "nci": "nci" @@ -127,11 +167,11 @@ "rust-overlay": { "flake": false, "locked": { - "lastModified": 1662433378, - "narHash": "sha256-DqMtTtIownl+UIPG1O917IH10UF0Hwql636p22vOJfw=", + "lastModified": 1671243596, + "narHash": "sha256-vQ1q6uwx2gKsHbQVhkq17nT8HwUmRbIG8cJVFafNb5s=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "12aa8ea4381b28b7a3118f96682dc3ffb13fb6b6", + "rev": "905db21103d646ddc1eb81920e05180e6e2b6734", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e584466f7b..a8513f18e2 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,8 @@ "CODE_OF_CONDUCT.md" "clippy.toml" ".cargo" + ".github" + ".gitlab" ]; ignorePaths = path: type: let split = lib.splitString "/" path; @@ -43,105 +45,93 @@ # filter out unnecessary paths filter = ignorePaths; }; - - wrapWithAssets = common: _: old: let - pkgs = common.pkgs; - runtimeLibs = with pkgs; [ - xorg.libX11 - xorg.libXi - xorg.libxcb - xorg.libXcursor - xorg.libXrandr - libxkbcommon - shaderc.lib - udev - alsa-lib - vulkan-loader - ]; - assets = pkgs.runCommand "veloren-assets" {} '' - mkdir $out - ln -sf ${./assets} $out/assets - # check if LFS was setup properly - checkFile="$out/assets/voxygen/background/bg_main.jpg" - result="$(${pkgs.file}/bin/file --mime-type $checkFile)" - if [ "$result" = "$checkFile: image/jpeg" ]; then - echo "Git LFS seems to be setup properly." - else - echo " - Git Large File Storage (git-lfs) has not been set up correctly. - Most common reasons: - - git-lfs was not installed before cloning this repository. - - This repository was not cloned from the primary GitLab mirror. - - The GitHub mirror does not support LFS. - See the book at https://book.veloren.net/ for details. - Run 'nix-shell -p git git-lfs --run \"git lfs install --local && git lfs fetch && git lfs checkout\"' - or 'nix shell nixpkgs#git-lfs nixpkgs#git -c sh -c \"git lfs install --local && git lfs fetch && git lfs checkout\"'. - " - false - fi - ''; - wrapped = - common.internal.nci-pkgs.utils.wrapDerivation old - {nativeBuildInputs = [pkgs.makeWrapper];} - '' - rm -rf $out/bin - mkdir $out/bin - ln -sf ${old}/bin/* $out/bin/ - wrapProgram $out/bin/* \ - ${lib.optionalString (old.pname == "veloren-voxygen") "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}"} \ - --set VELOREN_ASSETS ${assets} \ - --set VELOREN_GIT_VERSION "${git.prettyRev}" \ - --set VELOREN_GIT_TAG "${git.tag}" - ''; - in - wrapped; + checkIfLfsIsSetup = pkgs: checkFile: '' + checkFile="${checkFile}" + result="$(${pkgs.file}/bin/file --mime-type $checkFile)" + if [ "$result" = "$checkFile: image/jpeg" ]; then + echo "Git LFS seems to be setup properly." + true + else + echo " + Git Large File Storage (git-lfs) has not been set up correctly. + Most common reasons: + - git-lfs was not installed before cloning this repository. + - This repository was not cloned from the primary GitLab mirror. + - The GitHub mirror does not support LFS. + See the book at https://book.veloren.net/ for details. + Run 'nix-shell -p git git-lfs --run \"git lfs install --local && git lfs fetch && git lfs checkout\"' + or 'nix shell nixpkgs#git-lfs nixpkgs#git -c sh -c \"git lfs install --local && git lfs fetch && git lfs checkout\"'. + " + false + fi + ''; in inputs.nci.lib.makeOutputs { root = ./.; - defaultOutputs = { - package = "veloren-voxygen"; - app = "veloren-voxygen"; - }; - perCrateOverrides = { - veloren-voxygen = { - packageMetadata = _: { - features = rec { - release = ["default-publish"]; - debug = release; - test = release; - }; - }; - wrapper = wrapWithAssets; + config = common: { + cCompiler.package = common.pkgs.clang; + outputs.defaults = { + package = "veloren-voxygen"; + app = "veloren-voxygen"; }; - veloren-server-cli.wrapper = wrapWithAssets; - }; - disableVendoredCrateOverrides = true; - overrides = { - cCompiler = common: common.pkgs.clang; - crates = common: prev: let - pkgs = common.pkgs; - - configMoldLinker = '' - touch $CARGO_HOME/config.toml - cat >>$CARGO_HOME/config.toml <= 0 then z else z - 146096) / 146097; + era = + ( + if z >= 0 + then z + else z - 146096 + ) + / 146097; doe = z - era * 146097; yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; y = yoe + era * 400; doy = doe - (365 * yoe + yoe / 4 - yoe / 100); mp = (5 * doy + 2) / 153; d = doy - (153 * mp + 2) / 5 + 1; - m = mp + (if mp < 10 then 3 else -9); - y' = y + (if m <= 2 then 1 else 0); + m = + mp + + ( + if mp < 10 + then 3 + else -9 + ); + y' = + y + + ( + if m <= 2 + then 1 + else 0 + ); - pad = s: if builtins.stringLength s < 2 then "0" + s else s; + pad = s: + if builtins.stringLength s < 2 + then "0" + s + else s; in "${toString y'}-${pad (toString m)}-${pad (toString d)}-${pad (toString hours)}:${pad (toString minutes)}" From 4191b341d00719b8b33e55c755c8df1da47e38b9 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Mon, 19 Dec 2022 01:03:50 +0300 Subject: [PATCH 2/2] build(nix): update flake deps --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index ed6eb45ff4..44c7289f68 100644 --- a/flake.lock +++ b/flake.lock @@ -112,11 +112,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1671326550, - "narHash": "sha256-FmGeaTd9FF64jhA8+J3ZJtFROQtfjeu1WESp+DRsVfg=", + "lastModified": 1671400340, + "narHash": "sha256-VvRL3w+TbnlB1d9eXNJjuJQOYUL64kXA5508lV9Dq5E=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "44c525562513cd818e515f556fa4b7393939cc8e", + "rev": "7d894cd374f6394482c8de234c8a8cdeaf8908a5", "type": "github" }, "original": { @@ -167,11 +167,11 @@ "rust-overlay": { "flake": false, "locked": { - "lastModified": 1671243596, - "narHash": "sha256-vQ1q6uwx2gKsHbQVhkq17nT8HwUmRbIG8cJVFafNb5s=", + "lastModified": 1671330075, + "narHash": "sha256-20Pa/jOxfE6QX4bnQReKjXgrnslY6u54wO4tpVkTZQs=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "905db21103d646ddc1eb81920e05180e6e2b6734", + "rev": "31f0276dd8bc0dff576394a985e89be4a4995b4e", "type": "github" }, "original": {