restructure
This commit is contained in:
parent
4922f8f7cb
commit
ffe40ca5e7
25 changed files with 84 additions and 66 deletions
30
home/default.nix
Normal file
30
home/default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# This is a NixOS module, not a home-manager module!
|
||||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
config = lib.mkIf config.hd.desktop.enable {
|
||||
home-manager.users."hd" = lib.mkAliasDefinitions options.home;
|
||||
# install to /etc/profiles, not ~/.nix-profile
|
||||
home-manager.useUserPackages = true;
|
||||
# dont use home.nixpkgs
|
||||
home-manager.useGlobalPkgs = true;
|
||||
|
||||
home = {
|
||||
imports = [
|
||||
./unison.nix
|
||||
./protonmail-bridge.nix
|
||||
];
|
||||
|
||||
home.stateVersion = config.system.stateVersion;
|
||||
};
|
||||
};
|
||||
}
|
||||
60
home/protonmail-bridge.nix
Normal file
60
home/protonmail-bridge.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.protonmail-bridge;
|
||||
in
|
||||
{
|
||||
options.services.protonmail-bridge = {
|
||||
enable = lib.mkEnableOption "protonmail bridge";
|
||||
|
||||
package = lib.mkPackageOption pkgs "protonmail-bridge" { };
|
||||
|
||||
path = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [ ];
|
||||
example = lib.literalExpression "with pkgs; [ pass gnome-keyring ]";
|
||||
description = "List of derivations to put in protonmail-bridge's path.";
|
||||
};
|
||||
|
||||
logLevel = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"panic"
|
||||
"fatal"
|
||||
"error"
|
||||
"warn"
|
||||
"info"
|
||||
"debug"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "Log level of the Proton Mail Bridge service. If set to null then the service uses it's default log level.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
systemd.user.services.protonmail-bridge = {
|
||||
Unit = {
|
||||
Description = "protonmail bridge";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Service =
|
||||
let
|
||||
logLevel = lib.optionalString (cfg.logLevel != null) "--log-level ${cfg.logLevel}";
|
||||
in
|
||||
{
|
||||
ExecStart = "${lib.getExe cfg.package} --noninteractive ${logLevel}";
|
||||
Restart = "always";
|
||||
Environment = [ "PATH=${lib.makeBinPath (cfg.path ++ [ cfg.package ])}" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
home/unison.nix
Normal file
28
home/unison.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.services.unison';
|
||||
in
|
||||
{
|
||||
options.services.unison' = {
|
||||
enable = lib.mkEnableOption "Unison file synchronizer";
|
||||
pairs = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.attrsOf (lib.types.listOf lib.types.str));
|
||||
default = { };
|
||||
description = "";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.file = lib.mapAttrs' (name: roots: {
|
||||
name = ".unison/${name}.prf";
|
||||
value.text =
|
||||
''
|
||||
watch = true
|
||||
logfile = /dev/null
|
||||
confirmbigdeletes = true
|
||||
confirmmerge = true
|
||||
''
|
||||
+ lib.concatStringsSep "\n" (map (root: "root = ${root}") roots.roots);
|
||||
}) cfg.pairs;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue