diff --git a/flake.lock b/flake.lock index 66387a0..da3c96c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,30 +1,12 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1711715736, - "narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=", + "lastModified": 1731245184, + "narHash": "sha256-vmLS8+x+gHRv1yzj3n+GTAEObwmhxmkkukB2DwtJRdU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "807c549feabce7eddbf259dbdcec9e0600a0660d", + "rev": "aebe249544837ce42588aa4b2e7972222ba12e8f", "type": "github" }, "original": { @@ -34,22 +16,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "nixpkgs": "nixpkgs", @@ -58,15 +24,16 @@ }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1711851236, - "narHash": "sha256-EJ03x3N9ihhonAttkaCrqxb0djDq3URCuDpmVPbNZhA=", + "lastModified": 1731464916, + "narHash": "sha256-WZ5rpjr/wCt7yBOUsvDE2i22hYz9g8W921jlwVktRQ4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "f258266af947599e8069df1c2e933189270f143a", + "rev": "2c19bad6e881b5a154cafb7f9106879b5b356d1f", "type": "github" }, "original": { @@ -74,21 +41,6 @@ "repo": "rust-overlay", "type": "github" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3e09667..8971903 100644 --- a/flake.nix +++ b/flake.nix @@ -1,111 +1,117 @@ { - description = "Mint development shell"; + description = "Mint development shell"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - rust-overlay.url = "github:oxalica/rust-overlay"; - }; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; + }; - outputs = { nixpkgs, rust-overlay, ... }: + outputs = + { nixpkgs, rust-overlay, ... }: let - system = "x86_64-linux"; - - lib = nixpkgs.lib; - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { - inherit system overlays; - }; - - rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override { - extensions = [ "rust-src" "rust-analyzer" ]; - }; - rustPlatform = pkgs.makeRustPlatform { - cargo = rustToolchain; - rustc = rustToolchain; - }; - - mingwPkgs = pkgs.pkgsCross.mingwW64; - mingwCompiler = mingwPkgs.buildPackages.gcc; - mingwRustflags = "-L ${mingwPkgs.windows.pthreads}/lib"; - mingwTool = name: "${mingwCompiler}/bin/${mingwCompiler.targetPrefix}${name}"; - - libs = with pkgs; [ - gtk3 - libGL - openssl - atk - libxkbcommon - wayland - ]; - - buildTools = with pkgs; [ - rustToolchain - pkg-config - mingwCompiler - makeWrapper + system = "x86_64-linux"; + + lib = nixpkgs.lib; + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + + rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override { + extensions = [ + "rust-src" + "rust-analyzer" ]; + }; + rustPlatform = pkgs.makeRustPlatform { + cargo = rustToolchain; + rustc = rustToolchain; + }; + + mingwPkgs = pkgs.pkgsCross.mingwW64; + mingwCompiler = mingwPkgs.buildPackages.gcc; + mingwRustflags = "-L ${mingwPkgs.windows.pthreads}/lib"; + mingwTool = name: "${mingwCompiler}/bin/${mingwCompiler.targetPrefix}${name}"; + + libs = with pkgs; [ + gtk3 + libGL + openssl + atk + libxkbcommon + wayland + ]; + + buildTools = with pkgs; [ + rustToolchain + pkg-config + mingwCompiler + makeWrapper + ]; + + libraryPath = lib.makeLibraryPath libs; + + manifest = lib.importTOML ./Cargo.toml; + packageName = manifest.package.name; + packageVersion = manifest.workspace.package.version; + + package = rustPlatform.buildRustPackage { + nativeBuildInputs = buildTools; + buildInputs = libs; + + pname = packageName; + version = packageVersion; + src = lib.cleanSource ./.; + + verbose = true; + + cargoLock = { + lockFile = ./Cargo.lock; + allowBuiltinFetchGit = true; + }; - libraryPath = lib.makeLibraryPath libs; - - manifest = lib.importTOML ./Cargo.toml; - packageName = manifest.package.name; - packageVersion = manifest.workspace.package.version; - - package = rustPlatform.buildRustPackage { - nativeBuildInputs = buildTools; - buildInputs = libs; - - pname = packageName; - version = packageVersion; - src = lib.cleanSource ./.; - - verbose = true; - - cargoLock = { - lockFile = ./Cargo.lock; - allowBuiltinFetchGit = true; - }; - - doCheck = false; + doCheck = false; - preConfigure = '' - export LD_LIBRARY_PATH="${libraryPath}" - export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="${mingwRustflags}"; - ''; + preConfigure = '' + export LD_LIBRARY_PATH="${libraryPath}" + export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="${mingwRustflags}"; + ''; - postInstall = '' - wrapProgram $out/bin/${packageName} \ - --prefix LD_LIBRARY_PATH : "${libraryPath}" \ - --prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" - ''; + postInstall = '' + wrapProgram $out/bin/${packageName} \ + --prefix LD_LIBRARY_PATH : "${libraryPath}" \ + --prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" + ''; - meta = with lib; { - description = "Deep Rock Galactic mod loader and integration"; - license = licenses.mit; - homepage = "https://github.com/trumank/mint"; - mainProgram = packageName; - }; + meta = with lib; { + description = "Deep Rock Galactic mod loader and integration"; + license = licenses.mit; + homepage = "https://github.com/trumank/mint"; + mainProgram = packageName; }; + }; - devShell = pkgs.mkShell { - name = "mint"; + devShell = pkgs.mkShell { + name = "mint"; - buildInputs = buildTools ++ libs; + buildInputs = buildTools ++ libs; - LD_LIBRARY_PATH = libraryPath; - CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = mingwRustflags; + LD_LIBRARY_PATH = libraryPath; + CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = mingwRustflags; - # Necessary for cross compiled build scripts, otherwise it will build as ELF format - # https://docs.rs/cc/latest/cc/#external-configuration-via-environment-variables - CC_x86_64_pc_windows_gnu = mingwTool "cc"; - AR_x86_64_pc_windows_gnu = mingwTool "ar"; - }; - in { - packages.${system} = { - ${packageName} = package; - default = package; - }; + # Necessary for cross compiled build scripts, otherwise it will build as ELF format + # https://docs.rs/cc/latest/cc/#external-configuration-via-environment-variables + CC_x86_64_pc_windows_gnu = mingwTool "cc"; + AR_x86_64_pc_windows_gnu = mingwTool "ar"; + }; + in + { + packages.${system} = { + ${packageName} = package; + default = package; + }; - devShells.${system}.default = devShell; + devShells.${system}.default = devShell; }; }