Merge branch 'main' into teutat3s

This commit is contained in:
teutat3s 2022-08-13 17:43:58 +02:00
commit 6d5025b17b
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
8 changed files with 100 additions and 38 deletions

View file

@ -0,0 +1,23 @@
{ lib, config, pkgs, ... }:
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.devops;
in
{
options.pub-solar.arduino = {
enable = mkEnableOption "Life with home automation";
};
config = mkIf cfg.enable {
users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] {
extraGroups = [ "dialout" ];
};
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
home.packages = [
arduino
arduino-cli
];
};
};
}

View file

@ -9,10 +9,21 @@ in
options.pub-solar.audio = { options.pub-solar.audio = {
enable = mkEnableOption "Life in highs and lows"; enable = mkEnableOption "Life in highs and lows";
mopidy.enable = mkEnableOption "Life with mopidy"; mopidy.enable = mkEnableOption "Life with mopidy";
spotify.enable = mkEnableOption "Life in DRM";
spotify.username = mkOption {
description = "Spotify login username or email";
type = types.str;
example = "yourname@example.com";
default = "";
};
bluetooth.enable = mkEnableOption "Life with bluetooth"; bluetooth.enable = mkEnableOption "Life with bluetooth";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] {
extraGroups = [ "audio" ];
};
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
home.packages = [ home.packages = [
# easyeffects, e.g. for microphone noise filtering # easyeffects, e.g. for microphone noise filtering
@ -24,9 +35,23 @@ in
# Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?) # Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?)
pulseaudio pulseaudio
vimpc vimpc
]; ] ++ (if cfg.spotify.enable then [ pkgs.spotify-tui ] else [ ]);
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc; xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs; systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs;
services.spotifyd = mkIf cfg.spotify.enable {
enable = true;
settings = {
global = {
username = cfg.spotify.username;
password_cmd = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus ${pkgs.libsecret}/bin/secret-tool lookup spotify password";
bitrate = 320;
volume_normalisation = true;
no_audio_cache = false;
max_cache_size = 1000000000;
};
};
};
}; };
# Enable sound using pipewire-pulse # Enable sound using pipewire-pulse
@ -47,7 +72,7 @@ in
# Bluetooth configuration using wireplumber # Bluetooth configuration using wireplumber
# https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration # https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration
environment.etc = { environment.etc = mkIf cfg.bluetooth.enable {
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = { bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true, ["bluez5.enable-sbc-xq"] = true,

View file

@ -81,6 +81,8 @@ lua <<EOF
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html -- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
local use_denols_for_typescript = not(os.getenv('NVIM_USE_DENOLS') == nil)
for lsp_key, lsp_settings in pairs({ for lsp_key, lsp_settings in pairs({
'bashls', ------------------------------- Bash 'bashls', ------------------------------- Bash
'ccls', --------------------------------- C / C++ / Objective-C 'ccls', --------------------------------- C / C++ / Objective-C
@ -133,7 +135,13 @@ lua <<EOF
['terraformls'] = { --------------------- Terraform ['terraformls'] = { --------------------- Terraform
['filetypes'] = { 'terraform', 'hcl', 'tf' } ['filetypes'] = { 'terraform', 'hcl', 'tf' }
}, },
'tsserver', ----------------------------- Typescript / JavaScript
-- The TS/JS server is chosen depending on an environment variable,
-- since denols is nicer for Deno based projects
------------------------ Deno TS/JS
------------------------------------ Typescript / JavaScript
(use_denols_for_typescript and 'denols' or 'tsserver'),
'vuels', -------------------------------- Vue 'vuels', -------------------------------- Vue
'svelte', ------------------------------- Svelte 'svelte', ------------------------------- Svelte
['yamlls'] = { -------------------------- YAML ['yamlls'] = { -------------------------- YAML
@ -217,21 +225,26 @@ lua <<EOF
}, },
} }
-- Configure diagnostics -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#denols
vim.diagnostic.config({ vim.g.markdown_fenced_languages = {
virtual_text = false, "ts=typescript"
signs = true, }
underline = true,
update_in_insert = false,
severity_sort = false,
})
-- Change diagnostic symbols in the sign column (gutter) -- Configure diagnostics
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } vim.diagnostic.config({
for type, icon in pairs(signs) do virtual_text = false,
local hl = "DiagnosticSign" .. type signs = true,
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) underline = true,
end update_in_insert = false,
severity_sort = false,
})
-- Change diagnostic symbols in the sign column (gutter)
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
EOF EOF
" have a fixed column for the diagnostics to appear in " have a fixed column for the diagnostics to appear in

View file

@ -115,6 +115,12 @@ in
precmd () { precmd () {
DIR_NAME=$(pwd | sed "s|^$HOME|~|g") DIR_NAME=$(pwd | sed "s|^$HOME|~|g")
echo -e -n "\e]2;$DIR_NAME\e\\" echo -e -n "\e]2;$DIR_NAME\e\\"
if [ $(date +%d%m) = '0104' ]; then
if [ $? -eq 0 ]; then
echo "Success! That was a great command! I can't wait to see what amazing stuff you'll be up to next."
fi
fi
} }
# If a command is not found, show me where it is # If a command is not found, show me where it is

View file

@ -1,19 +0,0 @@
pkgs:
{
enable = true;
wantedBy = [ "multi-user.target" ];
unitConfig = {
Description = "Scream IVSHMEM pulse reciever";
BindsTo = [ "pipewire-pulse.service" ];
After = [ "pipewire-pulse.service" ];
Wants = [ "pipewire-pulse.service" ];
};
serviceConfig = {
Type = "simple";
ExecStartPre = [
"${pkgs.coreutils-full}/bin/truncate -s 0 /dev/shm/scream-ivshmem"
"${pkgs.coreutils-full}/bin/dd if=/dev/zero of=/dev/shm/scream-ivshmem bs=1M count=2"
];
ExecStart = "${pkgs.scream}/bin/scream -m /dev/shm/scream-ivshmem";
};
}

View file

@ -9,6 +9,11 @@ in
default = false; default = false;
description = "Feature flag for iso builds"; description = "Feature flag for iso builds";
}; };
options.pub-solar.x-os.disk-encryption-active = mkOption {
type = types.bool;
default = true;
description = "Whether it should be assumed that there is a cryptroot device";
};
config = { config = {
# Enable plymouth for better experience of booting # Enable plymouth for better experience of booting
boot.plymouth.enable = true; boot.plymouth.enable = true;
@ -16,7 +21,7 @@ in
# Mount / luks device in initrd # Mount / luks device in initrd
# Allow fstrim to work on it. # Allow fstrim to work on it.
# The ! makes this enabled by default # The ! makes this enabled by default
boot.initrd = mkIf (!cfg.iso-options.enable) { boot.initrd = mkIf (!cfg.iso-options.enable && cfg.disk-encryption-active) {
luks.devices."cryptroot" = { luks.devices."cryptroot" = {
allowDiscards = true; allowDiscards = true;
}; };

View file

@ -15,6 +15,8 @@ channels: final: prev: {
deploy-rs deploy-rs
tdesktop tdesktop
arduino
arduino-cli
; ;
inherit (channels.master) inherit (channels.master)

View file

@ -16,7 +16,14 @@ in
# home to /home/username, useDefaultShell to true, and isSystemUser to false. # home to /home/username, useDefaultShell to true, and isSystemUser to false.
isNormalUser = true; isNormalUser = true;
description = psCfg.user.description; description = psCfg.user.description;
extraGroups = [ "wheel" "docker" "input" "audio" "video" "networkmanager" "lp" "scanner" ]; extraGroups = [
"input"
"lp"
"networkmanager"
"scanner"
"video"
"wheel"
];
initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else ""; initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else "";
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ]; openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ];