Moved git-worspace
modules to home-manager
(created PR upstream)
https://github.com/nix-community/home-manager/pull/3811
This commit is contained in:
parent
52298435cd
commit
091b4150e8
5 changed files with 14 additions and 121 deletions
|
@ -10,6 +10,11 @@
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
||||||
};
|
};
|
||||||
|
# TODO: remove after https://github.com/nix-community/home-manager/pull/3811
|
||||||
|
homeManagerGitWorkspace = {
|
||||||
|
url = "github:aciceri/home-manager/git-workspace";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
||||||
|
};
|
||||||
disko = {
|
disko = {
|
||||||
url = "github:nix-community/disko";
|
url = "github:nix-community/disko";
|
||||||
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
inputs.nixpkgs.follows = "nixpkgsUnstable";
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
{age, ...}: {
|
{age, ...}: {
|
||||||
imports = [
|
|
||||||
./git-workspace-program.nix
|
|
||||||
./git-workspace-service.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.git-workspace.enable = true;
|
programs.git-workspace.enable = true;
|
||||||
services.git-workspace = {
|
services.git-workspace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
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];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
{
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -170,6 +170,15 @@
|
||||||
extraModules = [inputs.disko.nixosModules.disko];
|
extraModules = [inputs.disko.nixosModules.disko];
|
||||||
extraHmModules = [
|
extraHmModules = [
|
||||||
inputs.ccrEmacs.hmModules.default
|
inputs.ccrEmacs.hmModules.default
|
||||||
|
{
|
||||||
|
# TODO: remove after https://github.com/nix-community/home-manager/pull/3811
|
||||||
|
imports = let
|
||||||
|
hmModules = "${inputs.homeManagerGitWorkspace}/modules";
|
||||||
|
in [
|
||||||
|
"${hmModules}/programs/git-workspace.nix"
|
||||||
|
"${hmModules}/services/git-workspace.nix"
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
secrets = {
|
secrets = {
|
||||||
"git-workspace-tokens".owner = "ccr";
|
"git-workspace-tokens".owner = "ccr";
|
||||||
|
|
Loading…
Add table
Reference in a new issue