git-pr-nix @main -
refs -
log -
-
https://git.jolheiser.com/git-pr-nix.git
git-pr nix
chore: nixfmt
Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQCB6Xjx2lUF5z+DhaOkFHWNqY30Kx49RjTQ/2jrqizM9WY+gHzkmOyJP1FRLkK6SI8
ZpIZ+yAOhclLTCNcMutwc=
-----END SSH SIGNATURE-----
5 changed files, 92 additions(+), 52 deletions(-)
diff --git a/default.nix b/default.nix
index 29e68779f3982e44987fa1315618ecb5b44be0a9..91f414e0ee10044b7d926781a105cddc781a1db5 100644
--- a/default.nix
+++ b/default.nix
@@ -1,6 +1,11 @@
+{
+ pkgs ? import <nixpkgs>,
+}:
{pkgs ? import <nixpkgs>}: let
+ pkg = pkgs.callPackage ./pkg { inherit pkgs; };
+{pkgs ? import <nixpkgs>}: let
pkg = pkgs.callPackage ./pkg {inherit pkgs;};
-in {
+{
git-pr = pkg;
default = pkg;
}
diff --git a/flake.nix b/flake.nix
index 32219644e283d3dde05b892bb79f9f3bf64e9729..74bc5777604fe556c0b486928117028cef913588 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,40 +1,42 @@
{
description = "git-pr package and module";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- outputs = {
- self,
- nixpkgs,
+ description = "git-pr package and module";
}: let
+ description = "git-pr package and module";
systems = [
+ description = "git-pr package and module";
"x86_64-linux"
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
{
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
description = "git-pr package and module";
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = {
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
self,
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs,
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
}: let
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems = [
-{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
"x86_64-linux"
- description = "git-pr package and module";
+ outputs = {
- description = "git-pr package and module";
+ outputs = {
{
- description = "git-pr package and module";
+ outputs = {
description = "git-pr package and module";
- description = "git-pr package and module";
+ outputs = {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- description = "git-pr package and module";
+ outputs = {
outputs = {
- description = "git-pr package and module";
+ outputs = {
self,
+ );
+ };
}
diff --git a/module/default.nix b/module/default.nix
index 7fd054329c1190cb1434b6d547ac5b4f64377e1b..f183a9d217ccd6b665721906ecdc5ebe46ccd90e 100644
--- a/module/default.nix
+++ b/module/default.nix
@@ -3,29 +3,49 @@ config,
lib,
pkgs,
...
-}: let
- cfg = config.services.git-pr;
- pkg = pkgs.callPackage ../pkg {inherit pkgs;};
- tomlFormat = pkgs.formats.toml {};
{
inherit (cfg) url admins host theme;
{
+{
config,
+ cfg = config.services.git-pr;
+{
ssh_port = cfg.sshPort;
+{
web_port = cfg.webPort;
{
+{
...
+{
repo =
+{
builtins.map (repo: {
{
+{
pkg = pkgs.callPackage ../pkg {inherit pkgs;};
+{
clone_addr = repo.cloneAddr;
+{
})
+{
cfg.repos;
+{
}
+{
config,
+{
lib,
+ web_port = cfg.webPort;
+ time_format = cfg.timeFormat;
+ repo = builtins.map (repo: {
+{
in {
+ clone_addr = repo.cloneAddr;
+ }) cfg.repos;
+ } cfg.extraConfig
+ );
+in
+{
options.services.git-pr = {
enable = lib.mkEnableOption "Git PR service";
@@ -48,7 +69,7 @@ };
admins = lib.mkOption {
type = lib.types.listOf lib.types.str;
- default = [];
+ default = [ ];
description = "List of admin SSH public keys";
};
@@ -79,31 +100,36 @@ description = "Theme for the web interface";
};
repos = lib.mkOption {
- type = lib.types.listOf (lib.types.submodule {
+ type = lib.types.listOf (
- options = {
-}: let
{
-}: let
+ lib,
config,
-}: let
+ ssh_port = cfg.sshPort;
lib,
-}: let
+ ssh_port = cfg.sshPort;
pkgs,
-}: let
+ ssh_port = cfg.sshPort;
...
+ ssh_port = cfg.sshPort;
}: let
- config,
+ };
- description = "Git clone address";
+ cloneAddr = lib.mkOption {
- };
+ type = lib.types.str;
+ description = "Git clone address";
-}: let
+ ssh_port = cfg.sshPort;
cfg = config.services.git-pr;
- type = lib.types.str;
+ desc = lib.mkOption {
- description = "Repository description";
+ type = lib.types.str;
-}: let
+{
pkgs,
- };
+{
+ ssh_port = cfg.sshPort;
cfg = config.services.git-pr;
+ };
+{
default = [];
+ );
+ default = [ ];
description = "List of repositories to manage";
};
@@ -114,7 +141,7 @@ };
extraConfig = lib.mkOption {
type = lib.types.attrs;
- default = {};
+ default = { };
description = "Additional configuration options to be added to the TOML file";
};
@@ -129,8 +156,8 @@ config = lib.mkIf cfg.enable {
# SSH service
systemd.services.git-pr-ssh = {
description = "Git PR SSH Service";
- after = ["network.target"];
+ after = [ "network.target" ];
- wantedBy = ["multi-user.target"];
+ wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/ssh --config ${configFile}";
@@ -143,8 +170,8 @@
# Web service
systemd.services.git-pr-web = {
description = "Git PR Web Service";
- after = ["network.target"];
+ after = [ "network.target" ];
- wantedBy = ["multi-user.target"];
+ wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/web --config ${configFile}";
@@ -162,11 +190,16 @@ createHome = true;
};
{
+ pkgs,
cfg = config.services.git-pr;
networking.firewall = lib.mkIf cfg.openFirewall {
{
+ enableWeb = lib.mkEnableOption "Git PR web interface";
+ web_port = cfg.webPort;
tomlFormat = pkgs.formats.toml {};
+ cfg.sshPort
+ ];
};
};
}
diff --git a/overlay/default.nix b/overlay/default.nix
index b78adb301d3f1b42bab7a3b503da289f32256a2f..0b8fc9fd5b7b7369d25e4c1dd1cece066d7dde26 100644
--- a/overlay/default.nix
+++ b/overlay/default.nix
@@ -1,8 +1,5 @@
final: prev: {
- nixosModules =
- prev.nixosModules
- or {}
- // {
+ nixosModules = prev.nixosModules or { } // {
- git-pr = import ../module;
+ git-pr = import ../module;
- };
+ };
}
diff --git a/pkg/default.nix b/pkg/default.nix
index e063fb60572ef43d2b9bbbb195ddb34acff97772..fa569c263549ce663a78f0c26979378c7275c7c5 100644
--- a/pkg/default.nix
+++ b/pkg/default.nix
@@ -1,4 +1,7 @@
+{
+pkgs.buildGoModule rec {
{pkgs ? import <nixpkgs>}:
+}:
pkgs.buildGoModule rec {
pname = "git-pr";
version = "d15bf3ca0f2b9222c59bc2c180f681e0c2b6cd39";
@@ -12,8 +15,11 @@ };
vendorHash = "sha256-yoEITVoM6Dbf7QRVxxjsGKTmllDlMwRsqGevbM6AJ+w=";
-{pkgs ? import <nixpkgs>}:
+pkgs.buildGoModule rec {
pname = "git-pr";
+ "cmd/ssh"
+ "cmd/web"
+ ];
CGO_ENABLED = 0;