1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00

modularize

This commit is contained in:
Kierán Meinhardt
2019-04-19 03:11:51 +02:00
parent a90799f39b
commit a763c63de4
58 changed files with 1317 additions and 1172 deletions

39
modules/constants.nix Normal file
View File

@@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
with lib;
with import <dot/theme.nix>;
let
stringOption = mkOption { type = types.string; };
themeOption = mkOption {
type = types.submodule {
options = {
name = mkOption { type = types.string; };
package = mkOption { type = types.package; };
};
};
};
in {
options.niveum = {
applications = {
terminal = stringOption;
browser = stringOption;
fileManager = stringOption;
};
user = {
github = stringOption;
name = stringOption;
email = stringOption;
};
ignore = mkOption {
type = types.listOf types.string;
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.py[co]" "*.o" "*.hi" "*.aux" "*.bbl" "*.bcf" "*.blg" "*.fdb_latexmk" "*.fls" "*.out" "*.run.xml" "*.toc" "*.bbl" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
};
theme = {
gtk = themeOption;
icon = themeOption;
cursor = themeOption;
};
};
}

9
modules/default.nix Normal file
View File

@@ -0,0 +1,9 @@
{
imports = [
<modules/constants.nix>
<modules/dropbox.nix>
<modules/google-drive.nix>
<modules/retiolum.nix>
<modules/seafile.nix>
];
}

View File

@@ -1,44 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
with import <dot/theme.nix>;
let
unstable = import <nixos-unstable> {};
stringOption = def: mkOption { type = types.string; default = def; };
themeOption = def: mkOption {
type = types.submodule {
options = {
name = mkOption { type = types.string; default = def.name; };
package = mkOption { type = types.package; default = def.package; };
};
};
default = def;
};
in {
options.defaultApplications = mapAttrs (const stringOption) rec {
terminal = "${pkgs.rxvt_unicode-with-plugins}/bin/urxvtc";
browser = "${pkgs.chromium}/bin/chromium";
fileManager = "${terminal} -e ${pkgs.ranger}/bin/ranger";
# locker = "${pkgs.i3lock}/bin/i3lock -u -c ${strings.removePrefix "#" colorScheme.background}";
locker = "${pkgs.lightlocker}/bin/light-locker-command -l";
};
options.constants = {
user = mapAttrs (const stringOption) {
github = "kmein";
name = "Kierán Meinhardt";
email = "kieran.meinhardt@gmail.com";
};
ignore = mkOption {
type = types.listOf types.string;
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.py[co]" "*.o" "*.hi" "*.aux" "*.bbl" "*.bcf" "*.blg" "*.fdb_latexmk" "*.fls" "*.out" "*.run.xml" "*.toc" "*.bbl" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
};
theme = mapAttrs (const themeOption) {
gtk = { name = "Arc"; package = pkgs.arc-theme; };
icon = { name = "Arc"; package = pkgs.arc-icon-theme; };
cursor = { name = "capitaine-cursors"; package = pkgs.capitaine-cursors; };
};
};
}

15
modules/dropbox.nix Normal file
View File

@@ -0,0 +1,15 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.niveum.dropbox;
in
{
options.niveum.dropbox = {
enable = mkEnableOption "Dropbox";
};
config = mkIf cfg.enable {
services.xserver.displayManager.sessionCommands = "${pkgs.dropbox}/bin/dropbox &";
environment.systemPackages = [ pkgs.dropbox-cli ];
};
}

31
modules/google-drive.nix Normal file
View File

@@ -0,0 +1,31 @@
{ pkgs, config, lib, ... }:
with lib;
let cfg = config.niveum.google-drive;
in
{
options.niveum.google-drive = {
enable = mkEnableOption "Google Drive";
directory = mkOption { type = types.path; };
user = mkOption { type = types.attrs; };
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.grive2
];
systemd.services.google-drive = {
description = "Google Drive synchronisation service";
wants = [ "network-online.target" ];
script = ''
${pkgs.grive2}/bin/grive -p ${cfg.directory}
'';
startAt = "*:0/5";
serviceConfig = {
Type = "oneshot";
User = cfg.user.name;
};
};
};
}

14
modules/seafile.nix Normal file
View File

@@ -0,0 +1,14 @@
{ pkgs, config, lib, ... }:
with lib;
let cfg = config.niveum.seafile;
in {
options.niveum.seafile = {
enable = mkEnableOption "Seafile";
};
config = lib.mkIf cfg.enable {
services.xserver.displayManager.sessionCommands = "${pkgs.seafile-client}/bin/seafile-applet &";
environment.systemPackages = [ pkgs.seafile-client pkgs.seafile-shared ];
};
}