forked from pub-solar/os
Merge branch 'main' into teutat3s
This commit is contained in:
commit
6d5025b17b
23
modules/arduino/default.nix
Normal file
23
modules/arduino/default.nix
Normal 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
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -9,10 +9,21 @@ in
|
|||
options.pub-solar.audio = {
|
||||
enable = mkEnableOption "Life in highs and lows";
|
||||
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";
|
||||
};
|
||||
|
||||
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.packages = [
|
||||
# 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?)
|
||||
pulseaudio
|
||||
vimpc
|
||||
];
|
||||
] ++ (if cfg.spotify.enable then [ pkgs.spotify-tui ] else [ ]);
|
||||
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
|
||||
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
|
||||
|
@ -47,7 +72,7 @@ in
|
|||
|
||||
# Bluetooth configuration using wireplumber
|
||||
# https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration
|
||||
environment.etc = {
|
||||
environment.etc = mkIf cfg.bluetooth.enable {
|
||||
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
|
||||
bluez_monitor.properties = {
|
||||
["bluez5.enable-sbc-xq"] = true,
|
||||
|
|
|
@ -81,6 +81,8 @@ lua <<EOF
|
|||
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
|
||||
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({
|
||||
'bashls', ------------------------------- Bash
|
||||
'ccls', --------------------------------- C / C++ / Objective-C
|
||||
|
@ -133,7 +135,13 @@ lua <<EOF
|
|||
['terraformls'] = { --------------------- Terraform
|
||||
['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
|
||||
'svelte', ------------------------------- Svelte
|
||||
['yamlls'] = { -------------------------- YAML
|
||||
|
@ -217,21 +225,26 @@ lua <<EOF
|
|||
},
|
||||
}
|
||||
|
||||
-- Configure diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
})
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#denols
|
||||
vim.g.markdown_fenced_languages = {
|
||||
"ts=typescript"
|
||||
}
|
||||
|
||||
-- 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
|
||||
-- Configure diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
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
|
||||
|
||||
" have a fixed column for the diagnostics to appear in
|
||||
|
|
|
@ -115,6 +115,12 @@ in
|
|||
precmd () {
|
||||
DIR_NAME=$(pwd | sed "s|^$HOME|~|g")
|
||||
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
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
}
|
|
@ -9,6 +9,11 @@ in
|
|||
default = false;
|
||||
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 = {
|
||||
# Enable plymouth for better experience of booting
|
||||
boot.plymouth.enable = true;
|
||||
|
@ -16,7 +21,7 @@ in
|
|||
# Mount / luks device in initrd
|
||||
# Allow fstrim to work on it.
|
||||
# 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" = {
|
||||
allowDiscards = true;
|
||||
};
|
||||
|
|
|
@ -15,6 +15,8 @@ channels: final: prev: {
|
|||
deploy-rs
|
||||
|
||||
tdesktop
|
||||
arduino
|
||||
arduino-cli
|
||||
;
|
||||
|
||||
inherit (channels.master)
|
||||
|
|
|
@ -16,7 +16,14 @@ in
|
|||
# home to /home/username, useDefaultShell to true, and isSystemUser to false.
|
||||
isNormalUser = true;
|
||||
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 "";
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ];
|
||||
|
|
Loading…
Reference in a new issue