diff --git a/updater/flake.lock b/updater/flake.lock index acf54c0..d2b450b 100644 --- a/updater/flake.lock +++ b/updater/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1669556130, - "narHash": "sha256-6qRQVSgpw+Tw17TroiUg8nAte9/KVDH+v30MOOd+pQU=", + "lastModified": 1683272394, + "narHash": "sha256-4XQZbSZ8XYAeASpr0Er8mNPnjbYLJwvaB+VyH+bt6DE=", "owner": "RustSec", "repo": "advisory-db", - "rev": "a66a3049c98395410a2afadf0382882b0a04d8b1", + "rev": "50bed3ba4066e6255dab434dc845e7f655812ce1", "type": "github" }, "original": { @@ -16,29 +16,16 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -50,15 +37,16 @@ "naersk": { "inputs": { "nixpkgs": [ + "rust", "nixpkgs" ] }, "locked": { - "lastModified": 1662220400, - "narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=", + "lastModified": 1679567394, + "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", "owner": "nix-community", "repo": "naersk", - "rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3", + "rev": "88cd22380154a2c36799fe8098888f0f59861a15", "type": "github" }, "original": { @@ -69,11 +57,25 @@ }, "nixpkgs": { "locked": { - "lastModified": 1669597967, - "narHash": "sha256-R+2NaDkXsYkOpFOhmVR8jBZ77Pq55Z6ilaqwFLLn000=", + "lastModified": 1684120848, + "narHash": "sha256-gIwJ5ac1FwZEkCRwjY+gLwgD4G1Bw3Xtr2jr2XihMPo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "be9e3762e719211368d186f547f847737baad720", + "rev": "0cb867999eec4085e1c9ca61c09b72261fa63bb4", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1684120848, + "narHash": "sha256-gIwJ5ac1FwZEkCRwjY+gLwgD4G1Bw3Xtr2jr2XihMPo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cb867999eec4085e1c9ca61c09b72261fa63bb4", "type": "github" }, "original": { @@ -85,27 +87,46 @@ }, "root": { "inputs": { - "advisory-db": "advisory-db", - "flake-compat": "flake-compat", - "naersk": "naersk", "nixpkgs": "nixpkgs", + "rust": "rust" + } + }, + "rust": { + "inputs": { + "advisory-db": "advisory-db", + "naersk": "naersk", + "nixpkgs": "nixpkgs_2", "rust-overlay": "rust-overlay", "utils": "utils" + }, + "locked": { + "lastModified": 1684183882, + "narHash": "sha256-Ed692aLxADTPRThPE6FdgGXWdKuLWgj84jX7Hsl4zpY=", + "ref": "refs/heads/trunk", + "rev": "9c6ccfcbc17736559181ca214e711bc493944e8a", + "revCount": 12, + "type": "git", + "url": "https://git.stranger.systems/nix/Rust" + }, + "original": { + "type": "git", + "url": "https://git.stranger.systems/nix/Rust" } }, "rust-overlay": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": [ + "rust", "nixpkgs" ] }, "locked": { - "lastModified": 1669689198, - "narHash": "sha256-YsWu3C9IGbH3+xguTzEDyQorFe/igr6FGZ+Q5T2ocxE=", + "lastModified": 1684117262, + "narHash": "sha256-ZSF4CZqeyk6QwTjal73KPMuTWiU6w/p8ygEimrPb7u4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4e093ce661a63aca4bcbace33695225eae4ef4e4", + "rev": "4679872d2dd3e94ffef75efcbf77ea11549d90a7", "type": "github" }, "original": { @@ -114,13 +135,46 @@ "type": "github" } }, - "utils": { + "systems": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { diff --git a/updater/flake.nix b/updater/flake.nix index 403eda5..044199d 100644 --- a/updater/flake.nix +++ b/updater/flake.nix @@ -1,183 +1,10 @@ { - description = "updater"; + inputs = { rust = { url = "git+https://git.stranger.systems/nix/Rust"; }; }; + description = "Java Flake Updater"; - nixConfig = { - extra-substituters = [ "https://nix-cache.mccarty.io/" ]; - extra-trusted-public-keys = - [ "nathan-nix-cache:R5/0GiItBM64sNgoFC/aSWuAopOAsObLcb/mwDf335A=" ]; - }; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - utils.url = "github:numtide/flake-utils"; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; + outputs = { self, nixpkgs, rust }: + rust.single { + crateName = "updater"; + src = ./.; }; - naersk = { - url = "github:nix-community/naersk"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # Used for rust compiler - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # Advisory db from rust-sec - advisory-db = { - url = "github:RustSec/advisory-db"; - flake = false; - }; - }; - - outputs = - { self, nixpkgs, flake-compat, utils, naersk, rust-overlay, advisory-db }: - utils.lib.eachDefaultSystem (system: - let - crateName = "updater"; - pkgs = import nixpkgs { - inherit system; - overlays = [ (import rust-overlay) ]; - - }; - rust = pkgs.rust-bin.stable.latest.default.override { - extensions = [ "llvm-tools-preview" ]; - }; - naersk-lib = naersk.lib."${system}".override { - rustc = rust; - cargo = rust; - }; - cargo-llvm-cov = naersk-lib.buildPackage { - pname = "cargo-llvm-cov"; - src = pkgs.fetchzip { - url = - "https://crates.io/api/v1/crates/cargo-llvm-cov/0.5.0/download"; - extension = ".tar.gz"; - sha256 = "sha256-ifnwiOuFnpryYxLgescpxN8CzgFzSZlY+RlbyW7ND6g="; - }; - }; - cargo-nextest = naersk-lib.buildPackage { - pname = "cargo-nextest"; - src = pkgs.fetchzip { - url = - "https://crates.io/api/v1/crates/cargo-nextest/0.9.37/download"; - extension = ".tar.gz"; - sha256 = "sha256-1tEEZipJ8GqQqESKD9664Pax4evIp+G2tOpZuh6xN3U="; - }; - }; - devBase = with pkgs; [ - # Build tools - rust-analyzer - cmake - gnuplot - # git tooling - gitFull - pre-commit - git-lfs - git-cliff - # Cargo addons - cargo-llvm-cov - cargo-nextest - cargo-release - cargo-udeps - cargo-audit - # Formatters - nixpkgs-fmt - python39Packages.mdformat - # for ci reasons - bash - cacert - # Sourcehut - hut - ]; - sharedDeps = with pkgs; [ curl openssl pkg-config ]; - sharedNativeDeps = with pkgs; - [ - - ]; - in rec { - # Main binary - packages.${crateName} = naersk-lib.buildPackage { - pname = "${crateName}"; - buildInputs = sharedDeps; - nativeBuildInputs = sharedNativeDeps; - root = ./.; - }; - # binary + tests - packages.tests.${crateName} = naersk-lib.buildPackage { - pname = "${crateName}"; - buildInputs = sharedDeps; - nativeBuildInputs = sharedNativeDeps; - root = ./.; - doCheck = true; - }; - - packages.docs.${crateName} = naersk-lib.buildPackage { - pname = "${crateName}"; - buildInputs = sharedDeps; - nativeBuildInputs = sharedNativeDeps; - root = ./.; - dontBuild = true; - doDoc = true; - doDocFail = true; - }; - - defaultPackage = packages.${crateName}; - - # Make some things eaiser to do in CI - packages.lints = { - # lint formatting - format.${crateName} = with import nixpkgs { inherit system; }; - stdenv.mkDerivation { - name = "format lint"; - src = self; - nativeBuildInputs = with pkgs; - [ rust-bin.stable.latest.default ] ++ sharedNativeDeps; - buildInputs = sharedDeps; - buildPhase = "cargo fmt -- --check"; - installPhase = "mkdir -p $out; echo 'done'"; - }; - # audit against stored advisory db - audit.${crateName} = with import nixpkgs { inherit system; }; - stdenv.mkDerivation { - name = "format lint"; - src = self; - nativeBuildInputs = with pkgs; - [ rust-bin.stable.latest.default cargo-audit ] - ++ sharedNativeDeps; - buildInputs = sharedDeps; - buildPhase = '' - export HOME=$TMP - mkdir -p ~/.cargo - cp -r ${advisory-db} ~/.cargo/advisory-db - cargo audit -n - ''; - installPhase = "mkdir -p $out; echo 'done'"; - }; - # Clippy - clippy.${crateName} = naersk-lib.buildPackage { - pname = "${crateName}"; - root = ./.; - buildInputs = sharedDeps; - nativeBuildInputs = sharedNativeDeps; - cargoTestCommands = (old: [ "cargo $cargo_options clippy" ]); - doCheck = true; - dontBuild = true; - }; - }; - - devShell = pkgs.mkShell { - inputsFrom = builtins.attrValues self.packages.${system}; - buildInputs = [ rust ] ++ devBase ++ sharedDeps ++ sharedNativeDeps; - }; - - packages.nightlyRustShell = pkgs.mkShell { - buildInputs = [ - (pkgs.rust-bin.selectLatestNightlyWith (toolchain: - toolchain.default.override { - extensions = [ "rust-src" "clippy" "llvm-tools-preview" ]; - })) - ] ++ devBase ++ sharedDeps ++ sharedNativeDeps; - }; - }); }