Things
- new host `devbox`
- `flake-parts` module to manage agenix secrets
- Searx -> Google again 😩 (it was too slow)
- WIP `git-workspace` module for `home-manager`
- `cgit` module
- `spotify-adblocked` packaged
This commit is contained in:
parent
29bea282e7
commit
52298435cd
23 changed files with 947 additions and 67 deletions
45
hmModules/git-workspace/default.nix
Normal file
45
hmModules/git-workspace/default.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{age, ...}: {
|
||||
imports = [
|
||||
./git-workspace-program.nix
|
||||
./git-workspace-service.nix
|
||||
];
|
||||
|
||||
programs.git-workspace.enable = true;
|
||||
services.git-workspace = {
|
||||
enable = true;
|
||||
frequency = "04:00:00";
|
||||
environmentFile = age.secrets.git-workspace-tokens.path;
|
||||
workspaces = {
|
||||
aciceri = {
|
||||
provider = [
|
||||
{
|
||||
provider = "github";
|
||||
name = "aciceri";
|
||||
path = "/home/ccr/projects";
|
||||
skips_forks = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
mlabs = {
|
||||
provider = [
|
||||
{
|
||||
provider = "github";
|
||||
name = "mlabs-haskell";
|
||||
path = "/home/ccr/projects";
|
||||
skip_forks = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
ethereansos = {
|
||||
provider = [
|
||||
{
|
||||
provider = "github";
|
||||
name = "EthereansOS";
|
||||
path = "/home/ccr/projects";
|
||||
skip_forks = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
20
hmModules/git-workspace/git-workspace-program.nix
Normal file
20
hmModules/git-workspace/git-workspace-program.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.programs.git-workspace;
|
||||
in {
|
||||
options.programs.git-workspace = {
|
||||
enable = lib.mkEnableOption "git-workspace";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.git-workspace;
|
||||
description = "The git-workspace to use";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [pkgs.git-workspace];
|
||||
};
|
||||
}
|
96
hmModules/git-workspace/git-workspace-service.nix
Normal file
96
hmModules/git-workspace/git-workspace-service.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.git-workspace;
|
||||
tomlFormat = pkgs.formats.toml {};
|
||||
in {
|
||||
options.services.git-workspace = {
|
||||
enable = lib.mkEnableOption "git-workspace systemd timer";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default =
|
||||
if config.programs.git-workspace.enable
|
||||
then config.programs.git-workspace.package
|
||||
else pkgs.git-workspace;
|
||||
description = "The git-workspace to use";
|
||||
};
|
||||
frequency = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "";
|
||||
};
|
||||
environmentFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "";
|
||||
description = "";
|
||||
example = "";
|
||||
};
|
||||
workspaces = lib.mkOption {
|
||||
type = lib.types.attrsOf tomlFormat.type;
|
||||
default = {};
|
||||
description = "Workspaces verbatims";
|
||||
# example = {
|
||||
# workspace-foo = {
|
||||
# provider = [
|
||||
# {
|
||||
# provider = "github";
|
||||
# name = "";
|
||||
# path = "...";
|
||||
# skip_forks = false;
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# };
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
xdg.configFile =
|
||||
lib.mapAttrs' (workspaceName: workspace: {
|
||||
name = "git-workspace/${workspaceName}/workspace.toml";
|
||||
value.source =
|
||||
(tomlFormat.generate "${workspaceName}-workspace.toml" workspace).outPath;
|
||||
})
|
||||
cfg.workspaces;
|
||||
systemd.user.services =
|
||||
lib.mapAttrs' (workspaceName: workspace: rec {
|
||||
name = "git-workspace-${workspaceName}-update";
|
||||
value = {
|
||||
Unit.Description = "Runs `git-workspace update` for ${workspaceName}";
|
||||
Service = {
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
ExecStart = let
|
||||
script = pkgs.writeShellApplication {
|
||||
name = "${name}-launcher";
|
||||
text = ''
|
||||
${cfg.package}/bin/git-workspace \
|
||||
--workspace ${config.xdg.configHome}/git-workspace/${workspaceName} \
|
||||
update
|
||||
'';
|
||||
runtimeInputs = with pkgs; [busybox openssh git];
|
||||
};
|
||||
in "${script}/bin/${name}-launcher";
|
||||
};
|
||||
};
|
||||
})
|
||||
cfg.workspaces;
|
||||
systemd.user.timers =
|
||||
lib.mapAttrs' (workspaceName: workspace: {
|
||||
name = "git-workspace-${workspaceName}-update";
|
||||
value = {
|
||||
Unit = {
|
||||
Description = "Automatically runs `git-workspace update` for ${workspaceName}";
|
||||
};
|
||||
Timer = {
|
||||
Unit = "git-workspace-${workspaceName}-update.unit";
|
||||
OnCalendar = cfg.frequency;
|
||||
Persistent = true;
|
||||
};
|
||||
Install.WantedBy = ["timers.target"];
|
||||
};
|
||||
})
|
||||
cfg.workspaces;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue