diff --git a/flake.lock b/flake.lock index b7f12b4..b11e0ba 100644 --- a/flake.lock +++ b/flake.lock @@ -24,7 +24,9 @@ "beam": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1708268823, @@ -113,16 +115,17 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1706830856, - "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", "type": "github" }, "original": { - "id": "flake-parts", - "type": "indirect" + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" } }, "flake-parts_3": { @@ -180,12 +183,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -194,21 +200,23 @@ "type": "github" } }, - "flake-utils_3": { + "git-branchless": { "inputs": { - "systems": "systems_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "lastModified": 1709742645, + "narHash": "sha256-3bsRnjkwXN8GdJ6PFTabRv9PxG00DJa80J6kOHCXGmQ=", + "owner": "arxanas", + "repo": "git-branchless", + "rev": "3faa0744cf0b0c7c2fe2bf20e5f441776f21c6dd", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "arxanas", + "repo": "git-branchless", "type": "github" } }, @@ -241,16 +249,17 @@ ] }, "locked": { - "lastModified": 1708806879, - "narHash": "sha256-MSbxtF3RThI8ANs/G4o1zIqF5/XlShHvwjl9Ws0QAbI=", + "lastModified": 1709764752, + "narHash": "sha256-+lM4J4JoJeiN8V+3WSWndPHj1pJ9Jc1UMikGbXLqCTk=", "owner": "nix-community", "repo": "home-manager", - "rev": "4ee704cb13a5a7645436f400b9acc89a67b9c08a", + "rev": "cf111d1a849ddfc38e9155be029519b0e2329615", "type": "github" }, "original": { - "id": "home-manager", - "type": "indirect" + "owner": "nix-community", + "repo": "home-manager", + "type": "github" } }, "home-manager_2": { @@ -277,7 +286,7 @@ "lexical": { "inputs": { "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "systems": "systems" }, "locked": { @@ -315,39 +324,17 @@ "type": "github" } }, - "nix-elixir": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1704300128, - "narHash": "sha256-G5qMIxeoKvcXjsBOP32E9UCh0Atjvc/mcatG8MH8QZ4=", - "owner": "hauleth", - "repo": "nix-elixir", - "rev": "fcdeded8314bed0ef21b7d9b25a17b2d290f2bc3", - "type": "github" - }, - "original": { - "owner": "hauleth", - "repo": "nix-elixir", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1708118438, - "narHash": "sha256-kk9/0nuVgA220FcqH/D2xaN6uGyHp/zoxPNUmPCMmEE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5863c27340ba4de8f83e7e3c023b9599c3cb3c80", - "type": "github" + "lastModified": 1699725108, + "narHash": "sha256-NTiPW4jRC+9puakU4Vi8WpFEirhp92kTOSThuZke+FA=", + "path": "/nix/store/1ryprai4bllkrna60cmcygxc4qyn79s1-source", + "rev": "911ad1e67f458b6bcf0278fa85e33bb9924fed7e", + "type": "path" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-lib": { @@ -406,44 +393,18 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1699725108, - "narHash": "sha256-NTiPW4jRC+9puakU4Vi8WpFEirhp92kTOSThuZke+FA=", - "path": "/nix/store/1ryprai4bllkrna60cmcygxc4qyn79s1-source", - "rev": "911ad1e67f458b6bcf0278fa85e33bb9924fed7e", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1704008649, - "narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=", + "lastModified": 1709780214, + "narHash": "sha256-p4iDKdveHMhfGAlpxmkCtfQO3WRzmlD11aIcThwPqhk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d44d59d2b5bd694cd9d996fd8c51d03e3e9ba7f7", + "rev": "f945939fd679284d736112d3d5410eb867f3b31c", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1708847675, - "narHash": "sha256-RUZ7KEs/a4EzRELYDGnRB6i7M1Izii3JD/LyzH0c6Tg=", "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "2a34566b67bef34c551f204063faeecc444ae9da", "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixpkgs-unstable", - "type": "indirect" } }, "nixvim": { @@ -474,7 +435,7 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ "nixvim", @@ -505,10 +466,10 @@ "beam": "beam", "darwin": "darwin", "flake-parts": "flake-parts_2", + "git-branchless": "git-branchless", "home-manager": "home-manager", "lexical": "lexical", - "nix-elixir": "nix-elixir", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim" } }, diff --git a/flake.nix b/flake.nix index 257a740..b69a8f1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,27 +2,33 @@ description = "Hauleth's configuration"; inputs = { - nixpkgs.url = "nixpkgs/nixpkgs-unstable"; - flake-parts.url = "flake:flake-parts"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; home-manager = { - url = "flake:home-manager"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; agnoster = { url = "github:hauleth/agnoster"; inputs.nixpkgs.follows = "nixpkgs"; }; - nix-elixir.url = "github:hauleth/nix-elixir"; - # nix-elixir.url = "flake:nix-elixir"; darwin = { url = "github:lnl7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + git-branchless = { + url = "github:arxanas/git-branchless"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + lexical.url = "github:lexical-lsp/lexical"; - beam.url = "github:shanesveller/nix-beam-flakes"; + beam = { + url = "github:shanesveller/nix-beam-flakes"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nixvim = { url = "github:nix-community/nixvim"; @@ -71,7 +77,6 @@ perSystem = { self', pkgs, - system, inputs', ... }: { diff --git a/modules/common.nix b/modules/common.nix index cfc1805..bbc155e 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -14,11 +14,12 @@ nix.registry = { - nixpkgs.flake = inputs.nixpkgs; - dotfiles.flake = inputs.self; - } - // pkgs.lib.optionals pkgs.stdenv.isDarwin { + beam.flake = inputs.beam; darwin.flake = inputs.darwin; + dotfiles.flake = inputs.self; + flake-parts.flake = inputs.flake-parts; + lexical.flake = inputs.lexical; + nixpkgs.flake = inputs.nixpkgs; }; nix.package = pkgs.nixFlakes; diff --git a/modules/git.nix b/modules/git.nix index 1a21d60..75b06c5 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -14,51 +14,34 @@ ]; settings.aliases.co = "pr checkout"; + settings.aliases.patch = "!patch2pr"; settings.version = "1"; }; # manual.manpages.enable = true; home.packages = let - git-branchless-man = pkgs.runCommand "git-branchless-man" {} '' - mkdir -p $out/share/man - ${pkgs.git-branchless}/bin/git-branchless install-man-pages $out/share/man - ''; - git-cliff = pkgs.rustPlatform.buildRustPackage { - pname = "git-cliff"; - version = "2.0.0-pre"; - - src = pkgs.fetchFromGitHub { - owner = "orhun"; - repo = "git-cliff"; - rev = "d408e6377a5157f6d285b2733e6640d36316cfd4"; - hash = "sha256-DqfcSSG/XmeFHckP9Mmv560WA9VJjhDhpYSkYT9YW9I="; - }; - - cargoHash = "sha256-Qw7ZHLWPgIKqCmjhHwJ4QEz/WQMxrR8eG3tAgAKN7v0="; - - buildNoDefaultFeatures = true; - buildFeatures = ["github"]; + git-branchless = inputs.git-branchless.packages.${pkgs.stdenv.hostPlatform.system}.git-branchless.overrideAttrs (_: _: { + patches = [ + ./git/no-stack-index.patch + ]; - # attempts to run the program on .git in src which is not deterministic - doCheck = false; + postInstall = '' + mkdir -p $out/share/man - buildInputs = lib.optionals pkgs.stdenv.isDarwin [ - pkgs.darwin.apple_sdk.frameworks.CoreFoundation - pkgs.darwin.apple_sdk.frameworks.Security - pkgs.darwin.apple_sdk.frameworks.SystemConfiguration - ]; - }; + $out/bin/git-branchless install-man-pages $out/share/man + ''; + }); in [ pkgs.git-absorb - pkgs.git-branchless - git-branchless-man + git-branchless pkgs.git-gone - git-cliff + pkgs.git-cliff pkgs.git-revise pkgs.gitAndTools.git-imerge pkgs.prr pkgs.hut + pkgs.patch2pr inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.imbox ]; diff --git a/modules/git/no-stack-index.patch b/modules/git/no-stack-index.patch new file mode 100644 index 0000000..a47af9b --- /dev/null +++ b/modules/git/no-stack-index.patch @@ -0,0 +1,49 @@ +diff --git i/git-branchless-submit/src/github.rs w/git-branchless-submit/src/github.rs +index 2e8abbb..9973f5a 100644 +--- i/git-branchless-submit/src/github.rs ++++ w/git-branchless-submit/src/github.rs +@@ -523,7 +523,6 @@ fn make_updated_pull_request_info( + pull_request_infos: &HashMap, + commit_oid: NonZeroOid, + ) -> EyreExitOr { +- let mut stack_index = None; + let mut stack_pull_request_infos: IndexMap = + Default::default(); + +@@ -612,9 +611,6 @@ fn make_updated_pull_request_info( + None => continue, + }; + stack_pull_request_infos.insert(stack_commit_oid, pull_request_info); +- if stack_commit_oid == commit_oid { +- stack_index = Some(stack_pull_request_infos.len()); +- } + } + + let stack_size = stack_pull_request_infos.len(); +@@ -625,17 +621,6 @@ fn make_updated_pull_request_info( + "No pull requests in stack for commit" + ); + } +- let stack_index = match stack_index { +- Some(stack_index) => stack_index.to_string(), +- None => { +- warn!( +- ?commit_oid, +- ?stack_pull_request_infos, +- "Could not determine index in stack for commit" +- ); +- "?".to_string() +- } +- }; + + let stack_list = { + let mut result = String::new(); +@@ -650,7 +635,7 @@ fn make_updated_pull_request_info( + let commit = self.repo.find_commit_or_fail(commit_oid)?; + let commit_summary = commit.get_summary()?; + let commit_summary = String::from_utf8_lossy(&commit_summary).into_owned(); +- let title = format!("[{stack_index}/{stack_size}] {commit_summary}"); ++ let title = commit_summary; + let commit_message = commit.get_message_pretty(); + let commit_message = String::from_utf8_lossy(&commit_message); + let body = format!( diff --git a/modules/tools.nix b/modules/tools.nix index 568be4e..d853e51 100644 --- a/modules/tools.nix +++ b/modules/tools.nix @@ -14,5 +14,6 @@ in { jo glow pkgs-self.ubin-client + reuse ]; }