Reorganize repository

This commit is contained in:
Charlotte Van Petegem 2021-07-10 09:03:38 +02:00
parent da1824edb6
commit 0fc6c32a47
No known key found for this signature in database
GPG key ID: 019E764B7184435A
124 changed files with 16295 additions and 1229 deletions

View file

@ -0,0 +1,20 @@
{ config, lib, ... }:
{
options.chvp.work.citrix.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.work.citrix.enable {
chvp.base = {
nix.unfreePackages = [ "citrix-workspace" ];
zfs.homeLinks = [
{ path = ".ICAClient"; type = "data"; }
];
};
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = with pkgs; [ citrix_workspace ];
};
};
}

29
modules/work/default.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, ... }:
{
imports = [
./citrix
./mounts
./teams
./vpn
./zotero
];
options.chvp.work.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.work.enable {
chvp = {
development.enable = true;
work = {
citrix.enable = lib.mkDefault true;
mounts.enable = lib.mkDefault true;
teams.enable = lib.mkDefault true;
vpn.enable = lib.mkDefault true;
zotero.enable = lib.mkDefault true;
};
};
};
}

View file

@ -0,0 +1,67 @@
{ config, lib, pkgs, ... }:
{
options.chvp.work.mounts.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.work.mounts.enable {
fileSystems =
let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in
{
"/mnt/ugent/files" = {
device = "//files.ugent.be/ecvpeteg";
fsType = "cifs";
options = [ "credentials=/run/secrets/passwords/ugent-mount-credentials,${automount_opts},users,vers=3.0,noperm,domain=UGENT,sec=ntlmv2i" ];
noCheck = true;
};
"/mnt/ugent/webhost" = {
device = "//webhost.ugent.be/ecvpeteg";
fsType = "cifs";
options = [ "credentials=/run/secrets/passwords/ugent-mount-credentials,${automount_opts},users,vers=3.0" ];
noCheck = true;
};
};
age.secrets."passwords/ugent-mount-credentials".file = ../../../secrets/passwords/ugent-mount-credentials.age;
environment.systemPackages = [ pkgs.keyutils ];
# Remove this once https://github.com/NixOS/nixpkgs/issues/34638 is resolved
# The TL;DR is: the kernel calls out to the hard-coded path of
# /sbin/request-key as part of its CIFS auth process, which of course does
# not exist on NixOS due to the usage of Nix store paths.
system.activationScripts.symlink-requestkey = ''
if [ ! -d /sbin ]; then
mkdir /sbin
fi
ln -sfn /run/current-system/sw/bin/request-key /sbin/request-key
'';
# request-key expects a configuration file under /etc
environment.etc."request-key.conf" = {
text =
let
upcall = "${pkgs.cifs-utils}/bin/cifs.upcall";
keyctl = "${pkgs.keyutils}/bin/keyctl";
in
''
#OP TYPE DESCRIPTION CALLOUT_INFO PROGRAM
# -t is required for DFS share servers...
create cifs.spnego * * ${upcall} -t %k
create dns_resolver * * ${upcall} %k
# Everything below this point is essentially the default configuration,
# modified minimally to work under NixOS. Notably, it provides debug
# logging.
create user debug:* negate ${keyctl} negate %k 30 %S
create user debug:* rejected ${keyctl} reject %k 30 %c %S
create user debug:* expired ${keyctl} reject %k 30 %c %S
create user debug:* revoked ${keyctl} reject %k 30 %c %S
create user debug:loop:* * |${pkgs.coreutils}/bin/cat
create user debug:* * ${pkgs.keyutils}/share/keyutils/request-key-debug.sh %k %d %c %S
negate * * * ${keyctl} negate %k 30 %S
'';
};
};
}

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
{
options.chvp.work.teams.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.work.teams.enable {
chvp.base = {
nix.unfreePackages = [ "teams" ];
zfs.homeLinks = [
{ path = ".config/Microsoft"; type = "data"; }
];
};
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = with pkgs; [ teams ];
};
};
}

View file

@ -0,0 +1,38 @@
{ config, lib, pkgs, ... }:
{
imports = [
./secret.nix
];
options = {
chvp.work.vpn.enable = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf config.chvp.work.vpn.enable {
systemd.services = {
ugent-global-vpn = {
after = [ "network.target" ];
conflicts = [ "ugent-local-vpn.service" ];
};
ugent-local-vpn = {
after = [ "network.target" ];
conflicts = [ "ugent-global-vpn.service" ];
};
};
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "ugent-global-vpn.service") {
return polkit.Result.YES;
}
if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "ugent-local-vpn.service") {
return polkit.Result.YES;
}
});
'';
age.secrets."passwords/ugent-vpn".file = ../../../secrets/passwords/ugent-vpn.age;
};
}

BIN
modules/work/vpn/secret.nix Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
options.chvp.work.zotero.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.work.zotero.enable {
chvp.base.zfs.homeLinks = [{ path = ".zotero"; type = "data"; }];
home-manager.users.charlotte = { ... }: {
home.packages = [ pkgs.zotero ];
};
};
}