This commit is contained in:
Dmitriy Holkin 2019-09-17 02:31:17 +04:00
commit 7c8a7bab46
9 changed files with 155 additions and 34 deletions

View File

@ -42,6 +42,9 @@ with import ../support.nix { inherit lib config; }; {
cmd = "${pkgs.xarchiver}/bin/xarchiver";
desktop = "xarchiver";
};
viewtube = {
desktop = "viewtube";
};
# archive = {
# cmd = "${pkgs.ark}/bin/ark";
# desktop = "org.kde.ark";
@ -59,37 +62,38 @@ with import ../support.nix { inherit lib config; }; {
# desktop = "gnumeric";
# };
};
# home-manager.users.alukard.xdg.configFile."mimeapps.list.home".text =
# with config.defaultApplications;
# let
# apps = builtins.mapAttrs (name: value: "${value.desktop}.desktop;") {
# "text/html" = browser;
# # "image/*" = { desktop = "org.kde.gwenview"; };
# "application/x-bittorrent" = torrent;
# "application/zip" = archive;
# "application/rar" = archive;
# "application/7z" = archive;
# "application/*tar" = archive;
# "application/x-kdenlive" = archive;
# "x-scheme-handler/http" = browser;
# "x-scheme-handler/https" = browser;
# "x-scheme-handler/about" = browser;
# "x-scheme-handler/unknown" = browser;
# # "x-scheme-handler/mailto" = mail;
# # "application/pdf" = { desktop = "org.kde.okular"; };
# # "application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
# # text_processor;
# # "application/msword" = text_processor;
# # "application/vnd.oasis.opendocument.text" = text_processor;
# # "text/csv" = spreadsheet;
# # "application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
# # This actually makes Emacs an editor for everything... XDG is wierd
# "text/plain" = editor;
# };
# in genIni {
# "Default Applications" = apps;
# "Added Associations" = apps;
# };
home-manager.users.alukard.xdg.configFile."mimeapps.list".text =
with config.defaultApplications;
let
apps = builtins.mapAttrs (name: value: "${value.desktop}.desktop;") {
"text/html" = browser;
# "image/*" = { desktop = "org.kde.gwenview"; };
"application/x-bittorrent" = torrent;
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"application/x-kdenlive" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/unknown" = browser;
"x-scheme-handler/viewtube" = viewtube;
# "x-scheme-handler/mailto" = mail;
# "application/pdf" = { desktop = "org.kde.okular"; };
# "application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
# text_processor;
# "application/msword" = text_processor;
# "application/vnd.oasis.opendocument.text" = text_processor;
# "text/csv" = spreadsheet;
# "application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
# This actually makes Emacs an editor for everything... XDG is wierd
"text/plain" = editor;
};
in genIni {
"Default Applications" = apps;
"Added Associations" = apps;
};
home-manager.users.alukard.xdg.configFile."filetypesrc".text = genIni {
EmbedSettings = {
"embed-application/*" = false;

View File

@ -1,4 +1,4 @@
{ ... }: {
{ config, lib, ... }: {
imports = [
./applications/packages.nix
./applications/rofi.nix
@ -17,6 +17,8 @@
./workspace/compton.nix
./workspace/misc.nix
./workspace/dunst.nix
./workspace/cursor.nix
./workspace/mpv.nix
./workspace/kde
# ./workspace/synergy.nix
# ./workspace/ssh.nix
@ -41,5 +43,6 @@
./network.nix
./wireguard.nix
./filesystems.nix
./samba.nix
];
}

View File

@ -6,10 +6,20 @@
else
[ "noatime" "compress=zstd" ];
};
"/shared" = lib.mkIf config.deviceSpecific.isVM {
"/shared/nixos" = lib.mkIf config.deviceSpecific.isVM {
fsType = "vboxsf";
device = "shared";
options = [ "rw" "nodev" "relatime" "iocharset=utf8" "uid=1000" "gid=100" "dmode=0770" "fmode=0770" "nofail" ];
options = [
"rw"
"nodev"
"relatime"
"nofail"
"dmode=0755"
"fmode=0644"
"uid=${toString config.users.users.alukard.uid}"
# "gid=${toString config.users.groups.users.gid}"
"gid=${toString config.users.groups.smbgrp.gid}"
];
};
};

View File

@ -27,6 +27,7 @@ with deviceSpecific; {
GST_VAAPI_ALL_DRIVERS = "1";
LIBVA_DRIVER_NAME = "iHD";
};
# --- END ---
hardware.bluetooth.enable = isLaptop;
@ -41,6 +42,9 @@ with deviceSpecific; {
pkgs.linuxPackages_latest;
supportedFilesystems = [ "ntfs" ];
# extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];
blacklistedKernelModules = lib.mkIf (device == "Dell-Laptop") [
"psmouse"
];
};
sound.enable = true;

54
modules/samba.nix Normal file
View File

@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }: {
users.groups.smbgrp.gid = 2001;
# TODO: add nologin shell to this user
users.users.smbuser =
lib.mkIf (config.device == "AMD-Workstation" || config.device == "NixOS-VM") {
isNormalUser = false;
extraGroups = [
"smbgrp"
];
description = "User for samba sharing";
};
services.samba =
lib.mkIf (config.device == "AMD-Workstation" || config.device == "NixOS-VM") {
enable = true;
enableNmbd = false;
enableWinbindd = false;
invalidUsers = [ "root" ];
nsswins = false;
securityType = "user";
syncPasswordsByPam = false;
# shares = {
# };
# extraConfig = ''
configText = ''
[global]
server string = samba home server
server role = standalone server
disable netbios = yes
smb ports = 445
[private]
path = /shared/samba
browsable = yes
read only = no
force create mode = 0660
force directory mode = 2770
valid users = @smbgrp
[files]
path = /shared/files
browsable = yes
read only = no
guest only = yes
force create mode = 0660
force directory mode = 2770
force user = smbuser
'';
};
environment.systemPackages =
if (config.device == "AMD-Workstation" || config.device == "NixOS-VM") then
[ config.services.samba.package ]
else
[ ];
}

View File

@ -18,6 +18,7 @@
# "adbusers"
"input"
"vboxusers"
"smbgrp"
];
description = "Дмитрий Холкин";
uid = 1000;

View File

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [
bibata-cursors
];
# Bibata_Amber, Bibata_Ice, Bibata_Oil
home-manager.users.alukard.home.file.".icons/default" = {
source = "${pkgs.bibata-cursors}/share/icons/Bibata_Oil";
};
}

32
modules/workspace/mpv.nix Normal file
View File

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }: {
home-manager.users.alukard.programs.mpv = {
enable = true;
};
home-manager.users.alukard.home.file.".local/share/applications/viewtube.desktop" = {
text = ''
[Desktop Entry]
Name=ViewTube Protocol
Exec=/home/alukard/.scripts/viewtube.sh %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/viewtube
'';
};
home-manager.users.alukard.home.file.".scripts/viewtube.sh" = {
executable = true;
text = ''
#!/usr/bin/env bash
s="$(echo "$1" | sed -e "s/viewtube://")"
v="$(echo "$s" | awk -F 'SEPARATOR' '{print $1}')"
a="$(echo "$s" | awk -F 'SEPARATOR' '{print $2}')"
if [ "$a" = "" ]; then
mpv --hwdec=vaapi --osc --fs --ytdl=yes "$v"
#cvlc -f "$v"
else
mpv --hwdec=vaapi --osc --fs --ytdl=yes --audio-file "$a" "$v"
#cvlc -f --input-slave "$a" "$v"
fi
'';
};
}

View File

@ -41,5 +41,8 @@
};
}
];
shellAliases = {
"mpv" = "mpv --hwdec=vaapi";
};
};
}