This commit is contained in:
parent
4b27415d2a
commit
e815cdd434
1 changed files with 32 additions and 0 deletions
32
modules/scripts/open-repo-url.nix
Normal file
32
modules/scripts/open-repo-url.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ withSystem, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
name = "open-repo-url";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
packages.${name} = pkgs.writeShellApplication {
|
||||||
|
inherit name;
|
||||||
|
|
||||||
|
runtimeInputs = with pkgs; [ coreutils git ];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
repo_url=$(git remote get-url origin | sed -E 's#(git|forgejo)@([A-Za-z0-9.-]+):#https://\2/#;s#.git$##')
|
||||||
|
|
||||||
|
repo_url="''${repo_url//ssh.oliverdavies.uk/code.oliverdavies.uk}"
|
||||||
|
|
||||||
|
xdg-open "$repo_url"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager.base =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
(withSystem pkgs.system (psArgs: psArgs.config.packages.${name}))
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue