From 50f7235fabe738ec95d25b3b92df749126374957 Mon Sep 17 00:00:00 2001 From: Denis Craig Date: Mon, 16 Mar 2026 21:05:35 +0000 Subject: [PATCH 1/3] Add nix flake --- .gitignore | 4 ++ flake.lock | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 94 +++++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 9d50ca2d96f..d934a9f4d29 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,10 @@ compile_commands.json .cache/ dbc_extract3/cache/live/DBCache.bin dbc_extract3/cache/ptr/DBCache.bin +.direnv +.envrc +result +.pre-commit-config.yaml apikey.txt diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..d59d3ec63c5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,142 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772893680, + "narHash": "sha256-JDqZMgxUTCq85ObSaFw0HhE+lvdOre1lx9iI6vYyOEs=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "8baab586afc9c9b57645a734c820e4ac0a604af9", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1773597492, + "narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773297127, + "narHash": "sha256-6E/yhXP7Oy/NbXtf1ktzmU8SdVqJQ09HC/48ebEGBpk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "71b125cd05fbfd78cab3e070b73544abe24c5016", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000000..b4d5f1a2844 --- /dev/null +++ b/flake.nix @@ -0,0 +1,94 @@ +{ + description = "simulationcraft"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + git-hooks = { + url = "github:cachix/git-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + flake-utils, + treefmt-nix, + nixpkgs, + git-hooks, + self, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + treefmt = treefmt-nix.lib.evalModule pkgs (_: { + projectRootFile = "flake.nix"; + programs = { + actionlint.enable = true; + dockerfmt.enable = true; + nixfmt.enable = true; + }; + }); + + githooksEval = git-hooks.lib.${system}.run { + src = self; + hooks.treefmt = { + enable = true; + package = treefmt.config.build.wrapper; + }; + }; + + llvm = pkgs.llvmPackages_latest; + packages = with pkgs; [ + clang-tools + llvm.clang + llvm.lldb + qt6.qtbase + qt6.qtwebengine + ]; + + nbi = with pkgs; [ + pkg-config + curlFull + cmake + qt6.wrapQtAppsHook + ]; + + qtCmakePath = pkgs.symlinkJoin { + name = "qt6-cmake"; + paths = with pkgs.qt6; [ + qtbase + qtwebengine + ]; + }; + in + { + formatter = treefmt.config.build.wrapper; + devShells.default = pkgs.mkShell { + nativeBuildInputs = nbi; + packages = packages; + shellHook = '' + ${githooksEval.shellHook} + ''; + }; + + packages.simc = llvm.stdenv.mkDerivation rec { + pname = "simc"; + version = "0.0.1"; + src = self; + nativeBuildInputs = nbi; + buildInputs = packages; + sconsFlags = ""; + enableParallelBuilding = true; + cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${qtCmakePath}/lib/cmake" ]; + }; + packages.default = self.packages.${system}.simc; + } + ); +} From 4e692d1a3206856c2cd026fdc828eba6991a6613 Mon Sep 17 00:00:00 2001 From: Denis Craig Date: Mon, 16 Mar 2026 21:38:29 +0000 Subject: [PATCH 2/3] Add git rev version to package --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b4d5f1a2844..8b141b7d784 100644 --- a/flake.nix +++ b/flake.nix @@ -67,6 +67,8 @@ qtwebengine ]; }; + + rev = self.rev or "dirty"; in { formatter = treefmt.config.build.wrapper; @@ -80,7 +82,7 @@ packages.simc = llvm.stdenv.mkDerivation rec { pname = "simc"; - version = "0.0.1"; + version = "1201.01.${rev}"; src = self; nativeBuildInputs = nbi; buildInputs = packages; From 9d6b8c61d3e3e1f6ca8ef49e4ce98f47e9b552cb Mon Sep 17 00:00:00 2001 From: Denis Craig Date: Wed, 18 Mar 2026 23:23:11 +0000 Subject: [PATCH 3/3] Remove recursive package config --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 8b141b7d784..7727644aef9 100644 --- a/flake.nix +++ b/flake.nix @@ -80,7 +80,7 @@ ''; }; - packages.simc = llvm.stdenv.mkDerivation rec { + packages.simc = llvm.stdenv.mkDerivation { pname = "simc"; version = "1201.01.${rev}"; src = self;