4 Commits

  1. 4
      config/zsh.nix
  2. 7
      machines/Marid/configuration.nix
  3. 79
      machines/Marid/hardware-configuration.nix
  4. 67
      machines/Marid/options.nix
  5. 4
      pkgsets/emacs/lsp.nix
  6. 15
      pkgsets/emacs/telega.nix
  7. 31
      pkgsets/emacs/web-mode.nix
  8. 6
      pkgsets/xpkgs.nix
  9. 1
      services/desktop.nix
  10. 18
      services/fprintd.nix

4
config/zsh.nix

@ -16,6 +16,7 @@ mkIf (elem "zsh" config.machine.conffiles) {
ustrip = "sed -e '/\.service\|\.timer\|\.target\|\.socket\|\.slice\|\.scope\|\.path\|\.mount\|\.device)/!d' -e 's/loaded.*$//g' -e 's/^ \|^ //g'";
lsunits = "systemctl list-units | ustrip";
};
shellInit = ''
function ll() { exa -abgHhl@ --git --color=always --group-directories-first $@ | bat --paging=always --style=changes --color=always --theme="Solarized (dark)" }
function lln() { exa -abgHhl@ --git --color=always --group-directories-first $@ | bat --paging=always --style=changes --color=always --theme="Solarized (dark)" -n }
@ -23,8 +24,9 @@ mkIf (elem "zsh" config.machine.conffiles) {
function rwhich() { realpath $(which $@) }
function cdf() { cd $(rwhich $@ | sed "s/$@$//") }
function sfu() { lsunits | rg -i $@ }
function map() { for f in "$\{@:2\}"; do; eval $1 $f; done }
function map() { for f in "$\{@:2\}"; do; eval $1 \"$f\"; done }
'';
ohMyZsh = {
enable = true;
plugins = [ "cabal" "docker" "gitfast" "python" "pip" "sudo" "systemd" "man" ];

7
machines/Marid/configuration.nix

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
services.cron.enable = false;
networking.dhcpcd.extraConfig = "noarp";
system.stateVersion = "21.05";
}

79
machines/Marid/hardware-configuration.nix

@ -0,0 +1,79 @@
{ config, pkgs, modulesPath, ... }:
let
cfg = config.machine;
in {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
loader.systemd-boot = {
enable = true;
};
loader.efi.canTouchEfiVariables = true;
tmpOnTmpfs = true;
cleanTmpDir = true;
kernelPackages = pkgs.linuxPackages_latest;
initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ "kvm-amd" ];
kernelParams = [
# get backlight service to work part one (fixes systemd backlight service)
"acpi_backlight=native"
];
kernel.sysctl = {
"kernel.nmi_watchdog" = 0;
"fs.inotify.max_user_watches" = 524288;
"vm.dirty_writeback_centisecs" = 1500;
};
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cf8db7d5-5da7-4fb9-818d-ed5dd2815f0d";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/96E4-9DF3";
fsType = "vfat";
};
hardware = {
firmware = with pkgs; [ firmwareLinuxNonfree ];
enableAllFirmware = true;
ksm.enable = true;
opengl = {
driSupport = true;
driSupport32Bit = true;
};
pulseaudio = {
enable = true;
support32Bit = true;
package = pkgs.pulseaudioFull;
zeroconf.discovery.enable = false;
extraClientConf = ''
autospawn = no
'';
};
bluetooth = {
enable = true;
powerOnBoot = true;
};
};
powerManagement = {
enable = true;
cpuFreqGovernor = "powersave";
};
services = {
upower.enable = true;
# Fix Backlight Part 2 (allows acpilight to modify brightness)
udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chmod 664 /sys/class/backlight/%k/brightness"
'';
};
time.timeZone = "Europe/Berlin";
}

67
machines/Marid/options.nix

@ -0,0 +1,67 @@
{ pkgs, lib, ... }:
with lib;
{
imports = [
../../options/copySysConf.nix
];
config.machine = {
allowUnfree = true;
hostName = "Marid";
administrators = [ { name = "derped"; id = 1337; } ];
conffiles = [
"etcfiles"
"etcvars"
"fonts"
"zsh"
];
pkgs = [
"base"
"dict"
"nodejs"
"emacs"
"emacs::company"
"emacs::docker"
"emacs::doom-modeline"
"emacs::doom-themes"
"emacs::elpy"
"emacs::fcitx"
"emacs::flycheck"
"emacs::flyspell"
"emacs::undo-tree"
"emacs::lsp"
"emacs::magit"
"emacs::mu4e"
"emacs::nix-mode"
"emacs::org"
"emacs::php-mode"
"emacs::web-mode"
"emacs::yasnippet"
"extra"
"mail_utils"
"python3"
"xpkgs"
];
services = [
"docker"
"desktop"
"udev"
"fprintd"
];
firewall = {
enable = true;
allowPing = true;
allowedUDPPorts = [ ];
allowedTCPPorts = [ ];
allowedUDPPortRanges = [ ];
allowedTCPPortRanges = [ ];
};
desktop.wms = [ "none+i3" "i3" ];
};
config.system.copySysConf = {
enable = false;
addToNixPath = false;
};
}

4
pkgsets/emacs/lsp.nix

@ -18,6 +18,10 @@ mkIf (elem "emacs::lsp" config.machine.pkgs) {
${optionalString (elem "emacs::rust" config.machine.pkgs) ''
(setq lsp-rust-clippy-preference "on")
''}
${optionalString (elem "emacs::web-mode" config.machine.pkgs) ''
(setq lsp-clients-deno-enable-unstable 't)
(setq lsp-disabled-clients '(ts-ls))
''}
'';
};

15
pkgsets/emacs/telega.nix

@ -0,0 +1,15 @@
{ config, lib, ... }:
with lib;
mkIf (elem "emacs::telega" config.machine.pkgs) {
programs.emacs.init.usePackage.telegram = {
enable = true;
defer = true;
package = epkgs: [ epkgs.telega epkgs.visual-fill-column ];
command = [ "telega" ];
config = ''
(telega-alert-mode 1)
'';
};
}

31
pkgsets/emacs/web-mode.nix

@ -28,19 +28,32 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
};
js2-mode = {
enable = true;
mode = [
''("\\.js\\'" . js2-mode)''
];
};
tide = {
typescript-mode = {
enable = true;
after = [ "typescript-mode" "company" "flycheck" ];
hook = [
"(typescript-mode . tide-setup)"
"(typescript-mode . tide-hl-identifier-mode)"
"(before-save . tide-format-before-save)"
hook = lib.optional (elem "emacs::lsp" config.machine.pkgs)
''(typescript-mode . (lambda () (lsp)))'';
mode = [
''("\\.ts\\'" . typescript-mode)''
];
config = ''
(setq company-tooltip-align-annotations t)
'';
};
# tide = {
# enable = true;
# after = [ "typescript-mode" "company" "flycheck" ];
# hook = [
# "(typescript-mode . tide-setup)"
# "(typescript-mode . tide-hl-identifier-mode)"
# "(before-save . tide-format-before-save)"
# ];
# config = ''
# (flycheck-mode +1)
# (setq flycheck-check-syntax-automatically '(save mode-enabled))
# (setq company-tooltip-align-annotations t)
# '';
# };
impatient-mode = {
enable = true;
};

6
pkgsets/xpkgs.nix

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
let
cfg = config.machine;
in {
config.machine.pkgsets.xpkgs.pkgs = with pkgs; [
feh
scrot
@ -15,7 +17,7 @@
pavucontrol
xclip
xlibs.xkill
xorg.xbacklight
(if (cfg.hostName == "Marid") then xbacklight else xorg.xbacklight)
xdiskusage
];
}

1
services/desktop.nix

@ -39,7 +39,6 @@ in mkIf (elem "desktop" cfg.services) {
services.xserver = {
enable = !(elem "sway" cfg.desktop.wms);
layout = "de";
videoDrivers = [ "intel" ];
displayManager.defaultSession = ifelse (cfg.desktop.wms != []) (elemAt cfg.desktop.wms 0) null;
windowManager = mkIf (cfg.desktop.wms != []) {
i3 = mkIf (elem "i3" cfg.desktop.wms) (import ./desktop/i3.nix { inherit pkgs; });

18
services/fprintd.nix

@ -0,0 +1,18 @@
{ config, lib, ... }:
with lib;
mkIf (elem "fprintd" config.machine.services) {
security.pam.services = let
unlock = [
"sudo"
"i3lock"
"login"
"lightdm"
];
in listToAttrs (forEach unlock (n: {name = n; value = { fprintAuth = true; }; }));
services.fprintd = {
enable = true;
};
}
Loading…
Cancel
Save