1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-20 09:39:39 +01:00
* switch to sway

* Add greetd pam integration, Add waybar base config

* waybar (multiple modules do not behave as documented)
* nm-applet
* systemd-integration due to "normal" call via greetd

configure mako
adding base commands for nm-applet, blueman-applet

* add kanshi

* swayconfig keybindings for special multimedia keys

* waybar base stylefile + basic modules

* Add more portals to wayland/sway and fix fonts

* Add nixosConfiguration-awareness to the homemanager module

* Add alacritty.nix for home-manager configuration

* Add formatter to flake

* Format with alejandra style

* Add apheleia to emacs

* Add local configuration to use alejandra in this flake with emacs
This commit is contained in:
Stefan Ellmauthaler 2022-08-22 16:39:47 +02:00 committed by GitHub
parent fda7303945
commit 1e6e85ae2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 2390 additions and 1367 deletions

1
.dir-locals.el Normal file
View File

@ -0,0 +1 @@
((nix-mode . ((apheleia-formatter . alejandra))))

3
.gitignore vendored
View File

@ -41,9 +41,6 @@ flycheck_*.el
# projectiles files # projectiles files
.projectile .projectile
# directory configuration
.dir-locals.el
# network security # network security
/network-security.data /network-security.data

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config = { config = {
elss = { elss = {

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config.elss.wireguard = { config.elss.wireguard = {
interfaces = { interfaces = {
stelnet = { stelnet = {
servers = { servers = {

View File

@ -1,41 +1,59 @@
{ flakes, flakeOutputs, ...}: {
let flakes,
mkMachine = args: flakeOutputs,
let ...
name = if builtins.isString args then args else args.name; }: let
system = if args ? system then args.system else "x86_64-linux"; mkMachine = args: let
extraModules = if args ? extraModules then args.extraModules else [ ]; name =
extraOverlays = if args ? extraOverlays then args.extraOverlays else [ if builtins.isString args
then args
else args.name;
system =
if args ? system
then args.system
else "x86_64-linux";
extraModules =
if args ? extraModules
then args.extraModules
else [];
extraOverlays =
if args ? extraOverlays
then args.extraOverlays
else [
overlay-unstable overlay-unstable
# overlay-comma # overlay-comma
]; ];
pkgs = flakes.nixpkgs; pkgs = flakes.nixpkgs;
configuration = if args ? configuration then args.configuration else import ./baseconfiguration.nix {inherit extraOverlays system pkgs name flakes flakeOutputs;} ; configuration =
if args ? configuration
then args.configuration
else import ./baseconfiguration.nix {inherit extraOverlays system pkgs name flakes flakeOutputs;};
overlay-unstable = final: prev: { overlay-unstable = final: prev: {
unstable = import flakes.nixpkgs-unstable { unstable = import flakes.nixpkgs-unstable {
system = "${system}"; system = "${system}";
config.allowUnfree = true; config.allowUnfree = true;
}; };
}; };
# overlay-comma = final: prev: { # overlay-comma = final: prev: {
# comma = flakes.comma.packages."${system}"; # comma = flakes.comma.packages."${system}";
# }; # };
in in {
{
inherit name; inherit name;
value = pkgs.lib.nixosSystem { value = pkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules =
[
configuration configuration
{ nix = { {
nix = {
package = pkgs.legacyPackages.${system}.nixUnstable; package = pkgs.legacyPackages.${system}.nixUnstable;
nixPath = ["nixpkgs=${pkgs}"]; nixPath = ["nixpkgs=${pkgs}"];
registry.nixpkgs.flake = pkgs; registry.nixpkgs.flake = pkgs;
registry.nixpkgs-unstable.flake = flakes.nixpkgs-unstable; registry.nixpkgs-unstable.flake = flakes.nixpkgs-unstable;
};
} }
;} ]
] ++ extraModules ++ extraModules
++ flakes.nixpkgs.lib.mapAttrsToList (_: module: module) ++ flakes.nixpkgs.lib.mapAttrsToList (_: module: module)
flakeOutputs.nixosModules; flakeOutputs.nixosModules;
}; };

30
flake.lock generated
View File

@ -71,11 +71,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1660762183, "lastModified": 1661142448,
"narHash": "sha256-9yMWV83YPO7AFYhs0GPRwCIedue+SoyS2dwEGoNv4ik=", "narHash": "sha256-MKqQWdUnbQ7UVeEXhbuASvin8d42/AhmD2fanzWXkZg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "f391425e518aae894dd95c9165140f1dda8283af", "rev": "97a0b4e8d1bfc77f1159bad987c119394b7c2f26",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -275,11 +275,11 @@
}, },
"nixpkgs-22_05_2": { "nixpkgs-22_05_2": {
"locked": { "locked": {
"lastModified": 1660410996, "lastModified": 1661009065,
"narHash": "sha256-arkfX1YYFmwMyDTCguzoOI4epABC41FGQU4J1/G3/9M=", "narHash": "sha256-i+Q2ttGp4uOL3j0wEYP3MXLcu/4L/WbChxGQogiNSZo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "70b6236f3cbc815f2cae8d597418c714cf83d1c8", "rev": "9a91318fffec81ad009b73fd3b640d2541d87909",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -307,11 +307,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1660646295, "lastModified": 1660998696,
"narHash": "sha256-V4G+egGRc3elXPTr7QLJ7r7yrYed0areIKDiIAlMLC8=", "narHash": "sha256-N5eDv9THZz5pFn7NR1swaFrAJYByfrA5gU5L7JONItA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "762b003329510ea855b4097a37511eb19c7077f0", "rev": "13711c9ab9f5a160a44affb7a6221be53318a873",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -323,11 +323,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1660581366, "lastModified": 1661009065,
"narHash": "sha256-et+bi9/jlSF/pHx5AYB9ZP2XDdZEQ0vnF7xlvs4503Y=", "narHash": "sha256-i+Q2ttGp4uOL3j0wEYP3MXLcu/4L/WbChxGQogiNSZo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3d47bbaa26e7a771059d828eecf3bd8bf28a8b0f", "rev": "9a91318fffec81ad009b73fd3b640d2541d87909",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -383,11 +383,11 @@
"nixpkgs-22_05": "nixpkgs-22_05_2" "nixpkgs-22_05": "nixpkgs-22_05_2"
}, },
"locked": { "locked": {
"lastModified": 1660540143, "lastModified": 1661054796,
"narHash": "sha256-oqeOdJH0ey/UyG1G31BV6Lk8qjI+VKboTpTJB317OhM=", "narHash": "sha256-SWiWmENiim8liUNOZ1oxjc5yKb/fNpcyfSRo41bsEy0=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "773365016f5202a199f5aff72cac75c64add4528", "rev": "6068774a8e85fea4b0177efcc90afb3c3b74430b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -2,7 +2,6 @@
description = "Flake to define configurations of 'elss' - ellmauthaler stefan's systems"; description = "Flake to define configurations of 'elss' - ellmauthaler stefan's systems";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -59,9 +58,14 @@
}; };
}; };
outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs: outputs = {
let self,
extended-lib = nixpkgs.lib.extend nixpkgs,
flake-utils-plus,
...
} @ inputs: let
extended-lib =
nixpkgs.lib.extend
(final: prev: { (final: prev: {
elss = (import ./lib {lib = final;}) prev; elss = (import ./lib {lib = final;}) prev;
}); });
@ -74,7 +78,8 @@
lib = extended-lib; lib = extended-lib;
channelsConfig = { channelsConfig = {
allowUnfreePredicate = pkg: builtins.elem (extended-lib.getName pkg) [ allowUnfreePredicate = pkg:
builtins.elem (extended-lib.getName pkg) [
"slack" "slack"
"steam" "steam"
"steam-original" "steam-original"
@ -97,37 +102,44 @@
hostDefaults = { hostDefaults = {
system = "x86_64-linux"; system = "x86_64-linux";
channelName = "nixpkgs"; channelName = "nixpkgs";
modules = [ modules =
[
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.dwarffs.nixosModules.dwarffs inputs.dwarffs.nixosModules.dwarffs
inputs.simple-nixos-mailserver.nixosModules.mailserver inputs.simple-nixos-mailserver.nixosModules.mailserver
./common/wireguard.nix ./common/wireguard.nix
] ++ (map (name: ./modules + "/${name}") (moduleNames ./modules)); ]
++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
specialArgs = { specialArgs = {
nixos-hardware = inputs.nixos-hardware.nixosModules; nixos-hardware = inputs.nixos-hardware.nixosModules;
inherit inputs; inherit inputs;
}; };
extraArgs = { extraArgs = {
homeConfigurations = withModules ./users homeConfigurations =
withModules ./users
( (
{ name, path }: {
name,
path,
}:
#import (./users + "/${name}") #import (./users + "/${name}")
import path import path
); );
}; };
}; };
hosts = discoverMachines ./machines hosts =
discoverMachines ./machines
{ {
specialArgs = {lib = extended-lib;}; specialArgs = {lib = extended-lib;};
}; };
nixosModules = discoverModules ./modules; nixosModules = discoverModules ./modules;
homeConfigurations = withModules ./users homeConfigurations =
(name: withModules ./users
let (name: let
username = extended-lib.removeSuffix ".nix" name; username = extended-lib.removeSuffix ".nix" name;
in in
inputs.home-manager.lib.homeManagerConfiguration { inputs.home-manager.lib.homeManagerConfiguration {
@ -143,18 +155,18 @@
pkgs = channels.nixpkgs; pkgs = channels.nixpkgs;
sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}"; sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}";
}; };
formatter = channels.nixpkgs.alejandra;
}; };
templates = discoverTemplates ./templates { templates = discoverTemplates ./templates {
basic_tool = { base = {
description = "Basic setup of tools in nixpkgs/unstable"; description = "Basic setup of tools in nixpkgs/unstable";
welcomeText = "Change into the folder and add the wanted packages to the buildInputs"; welcomeText = "Change into the folder and add the wanted packages to the buildInputs";
}; };
rust = { rust = {
description = "Rust development environment flake"; description = "Rust development environment flake";
welcomeText = welcomeText = "Change into the folder and follow the prompt to create an automatic rust environment in this folder";
"Change into the folder and follow the prompt to create an automatic rust environment in this folder";
}; };
jupyter = { jupyter = {
description = "Jupyter server flake"; description = "Jupyter server flake";

View File

@ -1,6 +1,6 @@
{lib}: {lib}:
(lib.composeManyExtensions [ (lib.composeManyExtensions [
(import ./users.nix) (import ./users.nix)
(import ./files.nix) (import ./files.nix)
]) lib ])
lib

View File

@ -1,25 +1,33 @@
final: prev: final: prev:
with prev; rec { with prev; rec {
moduleNames = dir: pipe dir [ moduleNames = dir:
pipe dir [
builtins.readDir builtins.readDir
(filterAttrs (filterAttrs
(name: type: (!hasPrefix "." name && !hasPrefix "_" name (name: type: (!hasPrefix "." name
&& !hasPrefix "_" name
&& (hasSuffix ".nix" name || type == "directory")))) && (hasSuffix ".nix" name || type == "directory"))))
attrNames attrNames
]; ];
withModules = dir: f: withModules = dir: f:
listToAttrs (map listToAttrs (map
(filename: (filename: let
let
path = dir + "/${filename}"; path = dir + "/${filename}";
name = removeSuffix ".nix" filename; name = removeSuffix ".nix" filename;
in in
nameValuePair name (f {inherit path name;})) nameValuePair name (f {inherit path name;}))
(moduleNames dir)); (moduleNames dir));
discoverModules = dir: withModules dir ({ path, name }: import path); discoverModules = dir:
withModules dir ({
path,
name,
}:
import path);
discoverMachines = dir: args: discoverMachines = dir: args:
withModules dir ({ path, name }: withModules dir ({
path,
name,
}:
{modules = [path];} // args); {modules = [path];} // args);
discoverTemplates = dir: overrides: discoverTemplates = dir: overrides:
pipe dir [ pipe dir [
@ -32,11 +40,11 @@ with prev; rec {
path = "${dir}/${template}"; path = "${dir}/${template}";
description = "a template for ${template} projects"; description = "a template for ${template} projects";
} }
(if hasAttr template overrides then (
getAttr template overrides if hasAttr template overrides
else then getAttr template overrides
{ })))) else {}
))))
listToAttrs listToAttrs
]; ];
} }

View File

@ -1,18 +1,15 @@
final: prev: final: prev: {
withConfig = config: let
{
withConfig = config:
let
cfg = config.elss.users; cfg = config.elss.users;
mapAccount = f: login: prev.nameValuePair login (f login); mapAccount = f: login: prev.nameValuePair login (f login);
mapList = f: lst: builtins.listToAttrs (map (mapAccount f) lst); mapList = f: lst: builtins.listToAttrs (map (mapAccount f) lst);
in in rec {
rec {
mapUsers = f: mapList f cfg.users; mapUsers = f: mapList f cfg.users;
mapAdmins = f: mapList f cfg.admins; mapAdmins = f: mapList f cfg.admins;
mapAllUsers = f: (mapUsers f) // (mapAdmins f); mapAllUsers = f: (mapUsers f) // (mapAdmins f);
mapAllUsersAndRoot = f: (mapAllUsers f) // { mapAllUsersAndRoot = f:
(mapAllUsers f)
// {
root = f "root"; root = f "root";
}; };
}; };

View File

@ -1,5 +1,10 @@
{ config, pkgs, inputs, nixos-hardware, ... }:
{ {
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [ imports = [
../../common/users.nix ../../common/users.nix
./hardware-configuration.nix ./hardware-configuration.nix
@ -41,7 +46,6 @@
# enable wireguard # enable wireguard
wireguard.enable = true; wireguard.enable = true;
# user setup # user setup
users = { users = {
enable = true; enable = true;
@ -61,14 +65,18 @@
networking = { networking = {
interfaces.ens3 = { interfaces.ens3 = {
ipv4.addresses = [{ ipv4.addresses = [
{
address = "89.58.45.113"; address = "89.58.45.113";
prefixLength = 22; prefixLength = 22;
}]; }
ipv6.addresses = [{ ];
ipv6.addresses = [
{
address = "fe80::94e0:6eff:fecd:d6cb"; address = "fe80::94e0:6eff:fecd:d6cb";
prefixLength = 64; prefixLength = 64;
}]; }
];
}; };
defaultGateway = "89.58.44.1"; defaultGateway = "89.58.44.1";
defaultGateway6 = { defaultGateway6 = {
@ -81,7 +89,6 @@
externalInterface = "ens3"; externalInterface = "ens3";
internalInterfaces = ["wg-stelnet"]; internalInterfaces = ["wg-stelnet"];
}; };
}; };
system.stateVersion = "22.05"; system.stateVersion = "22.05";
} }

View File

@ -1,11 +1,14 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
@ -14,20 +17,17 @@
boot.kernelModules = []; boot.kernelModules = [];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{
device = "/dev/disk/by-label/nixos-root"; device = "/dev/disk/by-label/nixos-root";
fsType = "xfs"; fsType = "xfs";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{
device = "/dev/disk/by-label/BOOT"; device = "/dev/disk/by-label/BOOT";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [{device = "/dev/disk/by-label/swap";}];
[{ device = "/dev/disk/by-label/swap"; }];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -1,12 +1,16 @@
{ config, pkgs, inputs, nixos-hardware, ...}:
{ {
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [ imports = [
../../common/users.nix ../../common/users.nix
./hardware-configuration.nix ./hardware-configuration.nix
./software.nix ./software.nix
]; ];
elss = { elss = {
# base system # base system
base.enable = true; base.enable = true;
@ -19,6 +23,8 @@
# enable X11 with lightdm and i3 # enable X11 with lightdm and i3
graphical = { graphical = {
enable = true; enable = true;
sway.enable = true;
i3.enable = false;
# set dpi if used in mobile applications # set dpi if used in mobile applications
# dpi = 180; # dpi = 180;
}; };

View File

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"];
@ -13,23 +17,23 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/da267a3c-34e3-4218-933f-10738ee61eb6"; device = "/dev/disk/by-uuid/da267a3c-34e3-4218-933f-10738ee61eb6";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/9ebd7aff-629b-449b-83d8-6381a04eb708"; device = "/dev/disk/by-uuid/9ebd7aff-629b-449b-83d8-6381a04eb708";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/DE6D-C383"; device = "/dev/disk/by-uuid/DE6D-C383";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/0069f1fa-dd8e-4c0a-8f01-a576af29909e"; } {device = "/dev/disk/by-uuid/0069f1fa-dd8e-4c0a-8f01-a576af29909e";}
]; ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

View File

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libreoffice-fresh libreoffice-fresh
onlyoffice-bin onlyoffice-bin

View File

@ -1,5 +1,10 @@
{ config, pkgs, inputs, nixos-hardware, ... }:
{ {
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [ imports = [
../../common/users.nix ../../common/users.nix
./printer.nix ./printer.nix
@ -20,6 +25,8 @@
# enable X11 with lightdm and i3 # enable X11 with lightdm and i3
graphical = { graphical = {
enable = true; enable = true;
sway.enable = true;
i3.enable = false;
# set dpi if used in mobile applications # set dpi if used in mobile applications
# dpi = 180; # dpi = 180;
}; };

View File

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
@ -13,20 +17,20 @@
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/6b7f9f80-af34-4317-b017-f883a2316674"; device = "/dev/disk/by-uuid/6b7f9f80-af34-4317-b017-f883a2316674";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."crypted".device = "/dev/disk/by-uuid/9c84f143-023d-4fcb-a49c-ca78ce69e0e0"; boot.initrd.luks.devices."crypted".device = "/dev/disk/by-uuid/9c84f143-023d-4fcb-a49c-ca78ce69e0e0";
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/39E0-047B"; device = "/dev/disk/by-uuid/39E0-047B";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/93381a25-6704-408e-b091-cfda6cddbda0"; } {device = "/dev/disk/by-uuid/93381a25-6704-408e-b091-cfda6cddbda0";}
]; ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

View File

@ -1,6 +1,8 @@
{ config, pkgs, ...}: {
config,
let pkgs,
...
}: let
ppd-local = pkgs.stdenv.mkDerivation rec { ppd-local = pkgs.stdenv.mkDerivation rec {
pname = "local-ppds"; pname = "local-ppds";
version = "2021-07-04"; version = "2021-07-04";
@ -14,13 +16,14 @@ let
cp -R Ricoh $out/share/cups/model cp -R Ricoh $out/share/cups/model
''; '';
}; };
in in {
{ services.printing.drivers = with pkgs;
services.printing.drivers = with pkgs; [ [
foomatic-filters foomatic-filters
gutenprint gutenprint
hplip hplip
] ++ [ ]
++ [
ppd-local ppd-local
]; ];

View File

@ -1,5 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
brightnessctl brightnessctl
libreoffice-fresh libreoffice-fresh

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
let pkgs,
lib,
...
}: let
aspellConf = '' aspellConf = ''
data-dir /run/current-system/sw/lib/aspell data-dir /run/current-system/sw/lib/aspell
dict-dir /run/current-system/sw/lib/aspell dict-dir /run/current-system/sw/lib/aspell
@ -8,12 +11,12 @@ let
extra-dicts en-computers.rws extra-dicts en-computers.rws
add-extra-dicts en_GB-science.rws add-extra-dicts en_GB-science.rws
''; '';
in in {
{
options.elss.programs.aspell.enable = lib.mkEnableOption "setup aspell"; options.elss.programs.aspell.enable = lib.mkEnableOption "setup aspell";
config = lib.mkIf config.elss.programs.aspell.enable { config = lib.mkIf config.elss.programs.aspell.enable {
environment.systemPackages = [ pkgs.aspell ] environment.systemPackages =
[pkgs.aspell]
++ (with pkgs.aspellDicts; [de en sv en-computers en-science]); ++ (with pkgs.aspellDicts; [de en sv en-computers en-science]);
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss = { options.elss = {
base.enable = mkEnableOption "Set the base configuration for the system"; base.enable = mkEnableOption "Set the base configuration for the system";

View File

@ -1,13 +1,17 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.programs.communication.enable = mkEnableOption "enable the basic graphical communication tools"; options.elss.programs.communication.enable = mkEnableOption "enable the basic graphical communication tools";
config = config = let
let
cfg = config.elss.programs.communication; cfg = config.elss.programs.communication;
in in
mkIf cfg.enable { mkIf cfg.enable {
elss.graphical.enable = true; # elss.graphical.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
element-desktop element-desktop
jitsi-meet-electron jitsi-meet-electron

View File

@ -577,6 +577,30 @@
"/=" ":::" ">=>" "->>" "<=>" "<=<" "<->")) "/=" ":::" ">=>" "->>" "<=>" "<=<" "<->"))
(global-ligature-mode t)) (global-ligature-mode t))
;; apheleia
(use-package apheleia
:defer t
:diminish apheleia-mode
:custom
(apheleia-formatters
`((alejandra "alejandra")
(black "black" "-")
(brittany "brittany")
(clang-format "clang-format")
(fish-indent . ("fish_indent"))
(gofmt . ("gofmt"))
(google-java-format . ("google-java-format" "-"))
(isort . ("isort" "-"))
;(latexindent . ("latexindent" "--logfile=/dev/null"))
(mix-format . ("mix" "format" "-"))
(nixfmt . ("nixfmt"))
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-"))))
:preface
(diminish 'apheleia-mode)
:init
(apheleia-global-mode t))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.

View File

@ -1,6 +1,10 @@
{ config, lib, pkgs, ... }: {
with lib; config,
let lib,
pkgs,
...
}:
with lib; let
defaultEl = ./default.el; defaultEl = ./default.el;
environment.systemPackages = [pkgs.gdb]; # use gdb for dap-mode environment.systemPackages = [pkgs.gdb]; # use gdb for dap-mode
@ -8,9 +12,9 @@ let
mkdir -p $out/share/emacs/site-lisp mkdir -p $out/share/emacs/site-lisp
cp ${defaultEl} $out/share/emacs/site-lisp/default.el cp ${defaultEl} $out/share/emacs/site-lisp/default.el
''; '';
emacsPackage = (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages emacsPackage =
(epkgs: (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages
let (epkgs: let
lpkgs = import ./packages.nix { lpkgs = import ./packages.nix {
inherit config lib pkgs epkgs; inherit config lib pkgs epkgs;
}; };
@ -21,19 +25,24 @@ let
# gnupg # gnupg
# nixpkgs-fmt # nixpkgs-fmt
#]) #])
[(defaultConfig)] ++ [defaultConfig]
[(with epkgs.elpaPackages; [ ++ [
(with epkgs.elpaPackages; [
auctex auctex
org org
flymake flymake
])] ])
++ (with epkgs.melpaStablePackages; [ ]) ++ (with epkgs.melpaPackages; [ ]
++ (with epkgs.melpaStablePackages; [])
++ (with epkgs.melpaPackages;
[
ac-helm ac-helm
academic-phrases academic-phrases
add-hooks add-hooks
alert alert
all-the-icons all-the-icons
all-the-icons-dired all-the-icons-dired
apheleia
beacon beacon
bln-mode bln-mode
cargo-mode cargo-mode
@ -86,12 +95,12 @@ let
yaml-mode yaml-mode
yasnippet yasnippet
#zenburn-theme #zenburn-theme
] ++ (with lpkgs; [ ]
++ (with lpkgs; [
org-roam-ui org-roam-ui
ligatures ligatures
]))); ])));
in in {
{
options.elss.programs.emacs.enable = mkEnableOption "Setup emacs package and install it"; options.elss.programs.emacs.enable = mkEnableOption "Setup emacs package and install it";
config = mkIf config.elss.programs.emacs.enable { config = mkIf config.elss.programs.emacs.enable {
services.emacs = { services.emacs = {

View File

@ -1,5 +1,10 @@
{ config, lib, pkgs, epkgs, ...}: {
let config,
lib,
pkgs,
epkgs,
...
}: let
in in
with epkgs; rec { with epkgs; rec {
org-roam-ui = trivialBuild { org-roam-ui = trivialBuild {

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.graphical = { options.elss.graphical = {
enable = mkEnableOption "configure i3-based graphical layer"; enable = mkEnableOption "configure graphical layer";
greeterCursorsize = mkOption { greeterCursorsize = mkOption {
type = types.int; type = types.int;
default = 16; default = 16;
@ -16,19 +21,22 @@ with lib; {
DPI setting for the xserver DPI setting for the xserver
''; '';
}; };
i3.enable = mkEnableOption "enable i3";
}; };
config = config = let
let
cfg = config.elss.graphical; cfg = config.elss.graphical;
#cursorsize = if config.variables.hostName == "nucturne" then 14 else 16; #cursorsize = if config.variables.hostName == "nucturne" then 14 else 16;
#xserverDPI = if config.variables.hostName == "stel-xps" then 180 else null; #xserverDPI = if config.variables.hostName == "stel-xps" then 180 else null;
in in
mkIf cfg.enable { mkIf cfg.enable {
elss.users.x11.enable = true; elss.users.x11.enable =
if cfg.i3.enable
then true
else false;
elss.networking.useNetworkManager = true; elss.networking.useNetworkManager = true;
services = { services = {
xserver = { xserver = mkIf cfg.i3.enable {
enable = true; enable = true;
dpi = cfg.dpi; dpi = cfg.dpi;
displayManager.lightdm = { displayManager.lightdm = {
@ -59,7 +67,7 @@ with lib; {
sound.enable = true; sound.enable = true;
hardware = { hardware = {
pulseaudio.enable = true; #pulseaudio.enable = true;
bluetooth.enable = true; bluetooth.enable = true;
}; };
@ -68,6 +76,7 @@ with lib; {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
firefox firefox
thunderbird # v102 has various starting time issues - so back to stable thunderbird # v102 has various starting time issues - so back to stable
ungoogled-chromium
okular okular
texlive.combined.scheme-full texlive.combined.scheme-full
usbutils usbutils
@ -75,6 +84,5 @@ with lib; {
libsecret libsecret
arandr arandr
]; ];
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ...}: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.locale.enable = mkEnableOption "setup default locale and font-handling"; options.elss.locale.enable = mkEnableOption "setup default locale and font-handling";

View File

@ -1,9 +1,13 @@
{ config, pkgs, lib, ...}: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.networking.useNetworkManager = mkEnableOption "enable networkmanager"; options.elss.networking.useNetworkManager = mkEnableOption "enable networkmanager";
config = config = let
let
connections = [ connections = [
"tartaros" "tartaros"
"eduroam" "eduroam"
@ -24,4 +28,3 @@ with lib; {
sops.secrets = mkMerge (map mkSopsSecrets connections); sops.secrets = mkMerge (map mkSopsSecrets connections);
}; };
} }

View File

@ -1,11 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.nix-index-db-update.enable = options.elss.nix-index-db-update.enable =
mkEnableOption "periodically update the nix-index database"; mkEnableOption "periodically update the nix-index database";
config = config = let
let
cfg = config.elss.nix-index-db-update; cfg = config.elss.nix-index-db-update;
nix-index-db-update = pkgs.writeShellScript "nix-index-db-update" '' nix-index-db-update = pkgs.writeShellScript "nix-index-db-update" ''
set -euo pipefail set -euo pipefail
@ -48,8 +51,7 @@ with lib; {
}; };
}; };
home-manager.users = mapAllUsers (_: home-manager.users = mapAllUsers (_: {config, ...}: {
{ config, ... }: {
home.file.".cache/nix-index".source = home.file.".cache/nix-index".source =
config.lib.file.mkOutOfStoreSymlink "/var/db/nix-index/"; config.lib.file.mkOutOfStoreSymlink "/var/db/nix-index/";
}); });

View File

@ -1,6 +1,8 @@
{ pkgs, config, ... }:
{ {
pkgs,
config,
...
}: {
config = { config = {
nix = { nix = {
useSandbox = true; useSandbox = true;

View File

@ -1,6 +1,10 @@
{ config, pkgs, lib, ...}:
with lib;
{ {
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.programs.obsstudio.enable = mkEnableOption "install obs-studio"; options.elss.programs.obsstudio.enable = mkEnableOption "install obs-studio";
config = mkIf config.elss.programs.obsstudio.enable { config = mkIf config.elss.programs.obsstudio.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@ -1,8 +1,12 @@
{ config, lib, pkgs, ...}: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.openvpn.enable = mkEnableOption "Setup TUD openvpn"; options.elss.openvpn.enable = mkEnableOption "Setup TUD openvpn";
config = config = let
let
cfg = config.elss.openvpn; cfg = config.elss.openvpn;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,14 +1,19 @@
{ config, lib, pkgs, ... }: {
with pkgs; with lib; config,
let lib,
my-python-packages = python-packages: with python-packages; [ pkgs,
...
}:
with pkgs;
with lib; let
my-python-packages = python-packages:
with python-packages; [
pandas pandas
requests requests
# other python packages you want # other python packages you want
]; ];
python-with-my-packages = python3.withPackages my-python-packages; python-with-my-packages = python3.withPackages my-python-packages;
in in {
{
options.elss.programs.python.enable = mkEnableOption "install python 3"; options.elss.programs.python.enable = mkEnableOption "install python 3";
config = mkIf config.elss.programs.python.enable { config = mkIf config.elss.programs.python.enable {
environment.systemPackages = [python-with-my-packages]; environment.systemPackages = [python-with-my-packages];

View File

@ -1,16 +1,19 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.sops.enable = mkEnableOption "Use sops config"; options.elss.sops.enable = mkEnableOption "Use sops config";
config = config = let
let
cfg = config.elss.sops; cfg = config.elss.sops;
in in
mkIf cfg.enable { mkIf cfg.enable {
sops = { sops = {
defaultSopsFile = ../secrets/secrets.yaml; defaultSopsFile = ../secrets/secrets.yaml;
secrets.example_key.format = "yaml"; secrets.example_key.format = "yaml";
}; };
}; };
} }

View File

@ -1,15 +1,17 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server; cfg = config.elss.server;
staging = config.elss.server.acme.staging; staging = config.elss.server.acme.staging;
in in
mkIf cfg.enable { mkIf cfg.enable {
security.acme = { security.acme = {
defaults = { defaults = {
server = mkIf staging "https://acme-staging-v02.api.letsencrypt.org/directory"; server = mkIf staging "https://acme-staging-v02.api.letsencrypt.org/directory";
email = "stefan.ellmauthaler@gmail.com"; # Do not use ellmauthaler.net as the mail server will be covered by acme email = "stefan.ellmauthaler@gmail.com"; # Do not use ellmauthaler.net as the mail server will be covered by acme
}; };

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.server = { options.elss.server = {
acme.staging = mkEnableOption "Whether to use the staging or the default server for acme"; acme.staging = mkEnableOption "Whether to use the staging or the default server for acme";
@ -8,7 +13,6 @@ with lib; {
nextcloud.enable = mkEnableOption "Set up nextcloud"; nextcloud.enable = mkEnableOption "Set up nextcloud";
smailserver.enable = mkEnableOption "Set up simple mail server"; smailserver.enable = mkEnableOption "Set up simple mail server";
unbound.enable = mkEnableOption "Set unbound dns up"; unbound.enable = mkEnableOption "Set unbound dns up";
}; };
imports = [ imports = [
@ -20,8 +24,7 @@ with lib; {
./unbound.nix ./unbound.nix
]; ];
config = config = let
let
cfg = config.elss.server; cfg = config.elss.server;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server.nextcloud; cfg = config.elss.server.nextcloud;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,7 +1,11 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server.nginx; cfg = config.elss.server.nginx;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server.smailserver; cfg = config.elss.server.smailserver;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server.sql; cfg = config.elss.server.sql;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -9,10 +13,12 @@ with lib;{
enable = true; enable = true;
package = pkgs.postgresql_14; package = pkgs.postgresql_14;
ensureDatabases = ["nextcloud"]; ensureDatabases = ["nextcloud"];
ensureUsers = [{ ensureUsers = [
{
name = "nextcloud"; name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}]; }
];
}; };
}; };
} }

View File

@ -1,7 +1,11 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = config.elss.server.unbound; cfg = config.elss.server.unbound;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -21,7 +25,6 @@ with lib; {
settings.server.interface = ["127.0.0.0" "::1"]; settings.server.interface = ["127.0.0.0" "::1"];
settings.server.access-control = ["192.168.244.0/24 allow" "fdaa:3313:9dfa:dfa3::/64 allow"]; settings.server.access-control = ["192.168.244.0/24 allow" "fdaa:3313:9dfa:dfa3::/64 allow"];
}; };
}; };
networking = { networking = {
nameservers = ["127.0.0.1" "::1"]; nameservers = ["127.0.0.1" "::1"];

View File

@ -1,9 +1,13 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.sshd.enable = mkEnableOption "Set up sshd"; options.elss.sshd.enable = mkEnableOption "Set up sshd";
config = config = let
let
cfg = config.elss.sshd; cfg = config.elss.sshd;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,10 +1,13 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.steam-run.enable = mkEnableOption "configure steam-run to support unpatched binaries"; options.elss.steam-run.enable = mkEnableOption "configure steam-run to support unpatched binaries";
config = config = let
let
cfg = config.elss.steam-run; cfg = config.elss.steam-run;
in in
mkIf cfg.enable { mkIf cfg.enable {

84
modules/sway.nix Normal file
View File

@ -0,0 +1,84 @@
{
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.graphical.sway.enable = mkEnableOption "Use sway";
config = let
cfg = config.elss.graphical.sway;
in
mkIf cfg.enable {
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# xdg-desktop-portal works by exposing a series of D-Bus interfaces
# known as portals under a well-known name
# (org.freedesktop.portal.Desktop) and object path
# (/org/freedesktop/portal/desktop).
# The portal interfaces include APIs for file access, opening URIs,
# printing and others.
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-wlr
];
gtkUsePortal = true;
};
# enable sway window manager
programs = {
sway = {
enable = true;
extraPackages = with pkgs; [
rofi
swaylock
swayidle
waybar
];
wrapperFeatures = {
base = true;
gtk = true;
};
};
nm-applet = {
enable = true;
indicator = true;
};
};
# greetd login manager
services.greetd = {
enable = true;
package = pkgs.greetd.tuigreet;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway; swaymsg exit";
};
};
};
security.pam.services.greetd = {
enableGnomeKeyring = true;
gnupg.enable = true;
};
environment.systemPackages = with pkgs; [
gnome3.adwaita-icon-theme
wl-clipboard
wl-mirror
networkmanagerapplet
pavucontrol
pamixer
];
};
}

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; { with lib; {
options.elss.texlive = { options.elss.texlive = {
enable = mkEnableOption "configure texlife on the system"; enable = mkEnableOption "configure texlife on the system";
@ -12,8 +17,7 @@ with lib; {
}; };
}; };
config = config = let
let
cfg = config.elss.texlive; cfg = config.elss.texlive;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,5 +1,10 @@
{ config, pkgs, lib, homeConfigurations, ... }: {
config,
pkgs,
lib,
homeConfigurations,
...
}:
with lib; { with lib; {
options.elss.users = { options.elss.users = {
enable = mkEnableOption "elss specific user configuration"; enable = mkEnableOption "elss specific user configuration";
@ -15,14 +20,16 @@ with lib; {
type = types.listOf types.str; type = types.listOf types.str;
}; };
meta = mkOption { meta = mkOption {
type = types.attrsOf type =
types.attrsOf
(types.submodule { (types.submodule {
options = { options = {
description = mkOption { description = mkOption {
type = types.str; type = types.str;
description = "full name of the user"; description = "full name of the user";
}; };
hashedPassword = mkOption hashedPassword =
mkOption
{ {
type = types.str; type = types.str;
default = null; default = null;
@ -63,8 +70,7 @@ with lib; {
}; };
}; };
config = config = let
let
cfg = config.elss.users; cfg = config.elss.users;
inherit (elss.withConfig config) mapAdmins mapUsers mapAllUsersAndRoot mapAllUsers; inherit (elss.withConfig config) mapAdmins mapUsers mapAllUsersAndRoot mapAllUsers;
@ -78,10 +84,9 @@ with lib; {
inherit (getMeta login) hashedPassword; inherit (getMeta login) hashedPassword;
} }
]; ];
mkUser = login: mkUser = login: let
let meta = getMeta login; meta = getMeta login;
in in {
{
inherit (meta) description; inherit (meta) description;
isNormalUser = true; isNormalUser = true;
home = "/home/${login}"; home = "/home/${login}";
@ -89,10 +94,9 @@ with lib; {
openssh.authorizedKeys.keys = meta.publicKeys; openssh.authorizedKeys.keys = meta.publicKeys;
}; };
mkGitUser = login: mkGitUser = login: let
let meta = getMeta login; meta = getMeta login;
in in {
{
programs.git = { programs.git = {
userEmail = meta.mailAddress; userEmail = meta.mailAddress;
userName = meta.description; userName = meta.description;
@ -111,8 +115,8 @@ with lib; {
}; };
}; };
mkX11User = login: mkX11User = login: let
let meta = getMeta login; meta = getMeta login;
in in
mkIf (cfg.x11.enable) mkIf (cfg.x11.enable)
{ {
@ -132,21 +136,19 @@ with lib; {
dunst.enable = true; dunst.enable = true;
}; };
}; };
in in
mkIf (cfg.enable) mkIf (cfg.enable)
{ {
assertions = assertions = let
let
cfg = config.elss.users; cfg = config.elss.users;
in in [
[
{ {
assertion = mutuallyExclusive cfg.users cfg.admins; assertion = mutuallyExclusive cfg.users cfg.admins;
message = "elss.users.users and elss.users.admins are mutually exclusive"; message = "elss.users.users and elss.users.admins are mutually exclusive";
} }
{ {
assertion = all (hash: hash != "") assertion =
all (hash: hash != "")
(catAttrs "hashedPassword" (attrVals cfg.admins cfg.meta)); (catAttrs "hashedPassword" (attrVals cfg.admins cfg.meta));
message = "No admin without password"; message = "No admin without password";
} }
@ -158,8 +160,7 @@ with lib; {
users = { users = {
mutableUsers = false; mutableUsers = false;
users = users = mkMerge [
mkMerge [
(mapAdmins mkAdmin) (mapAdmins mkAdmin)
(mapUsers mkUser) (mapUsers mkUser)
]; ];
@ -167,17 +168,19 @@ with lib; {
home-manager = { home-manager = {
useUserPackages = true; useUserPackages = true;
useGlobalPkgs = true; useGlobalPkgs = true;
users = users = mkMerge [
mkMerge [
(mapAllUsers mkX11User) (mapAllUsers mkX11User)
(mapAllUsers mkGitUser) (mapAllUsers mkGitUser)
(mapAllUsersAndRoot (login: (mapAllUsersAndRoot (login:
mkMerge [ mkMerge [
{config.home.stateVersion = mkDefault "21.11";} {config.home.stateVersion = mkDefault "21.11";}
(if homeConfigurations ? "${login}" then homeConfigurations."${login}" else { }) (
if homeConfigurations ? "${login}"
then homeConfigurations."${login}"
else {}
)
])) ]))
]; ];
}; };
}; };
} }

View File

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}: {
options.elss.wireguard = with lib; { options.elss.wireguard = with lib; {
enable = mkEnableOption "wireguard overlay network"; enable = mkEnableOption "wireguard overlay network";
@ -78,14 +81,12 @@
ipv6 = { ipv6 = {
ula = mkOption { ula = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = description = "IPv6 prefixes to use for ULA wireguard addressing";
"IPv6 prefixes to use for ULA wireguard addressing";
}; };
gua = mkOption { gua = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = description = "IPv6 prefixes to use for GUA wireguard addressing";
"IPv6 prefixes to use for GUA wireguard addressing";
}; };
}; };
@ -99,21 +100,25 @@
}; };
}; };
config = config = let
let
cfg = config.elss; cfg = config.elss;
hostName = config.system.name; hostName = config.system.name;
secretsFile = ../machines secretsFile =
../machines
+ builtins.toPath "/${hostName}/secrets/wireguard.yaml"; + builtins.toPath "/${hostName}/secrets/wireguard.yaml";
takeNonEmpty = lib.filter (interface: interface != ""); takeNonEmpty = lib.filter (interface: interface != "");
testInterface = predicate: testInterface = predicate:
lib.mapAttrsToList lib.mapAttrsToList
(interface: value: if (predicate interface value) then interface else "") (interface: value:
if (predicate interface value)
then interface
else "")
cfg.wireguard.interfaces; cfg.wireguard.interfaces;
onlyInterfaces = predicate: takeNonEmpty (testInterface predicate); onlyInterfaces = predicate: takeNonEmpty (testInterface predicate);
peerInterfaces = peerInterfaces =
onlyInterfaces (interface: value: builtins.hasAttr hostName value.peers); onlyInterfaces (interface: value: builtins.hasAttr hostName value.peers);
serverInterfaces = onlyInterfaces serverInterfaces =
onlyInterfaces
(interface: value: builtins.hasAttr hostName value.servers); (interface: value: builtins.hasAttr hostName value.servers);
interfaces = serverInterfaces ++ peerInterfaces; interfaces = serverInterfaces ++ peerInterfaces;
@ -135,39 +140,42 @@
}; };
mkPeerPeer = prefixes: peers: peer: { mkPeerPeer = prefixes: peers: peer: {
allowedIPs = (mkAddresses prefixes peer.localIp) allowedIPs =
++ (lib.concatMap (mkAddresses prefixes) peer.extraIps) ++ (if lib.hasAttr hostName peers then peers.${hostName}.additionalAllowedIps else [ ]); (mkAddresses prefixes peer.localIp)
++ (lib.concatMap (mkAddresses prefixes) peer.extraIps)
++ (
if lib.hasAttr hostName peers
then peers.${hostName}.additionalAllowedIps
else []
);
persistentKeepalive = 25; persistentKeepalive = 25;
inherit (peer) publicKey endpoint; inherit (peer) publicKey endpoint;
}; };
mkPostSetup = name: prefixes: servers: mkPostSetup = name: prefixes: servers: let
let
ifName = mkInterfaceName name; ifName = mkInterfaceName name;
serverIps = name: server: mkServerAddresses prefixes server.localIp; serverIps = name: server: mkServerAddresses prefixes server.localIp;
dnsServers = lib.concatLists (lib.mapAttrsToList serverIps servers); dnsServers = lib.concatLists (lib.mapAttrsToList serverIps servers);
in in
lib.concatStrings ([ lib.concatStrings ([
'' ''
${pkgs.systemd}/bin/resolvectl domain ${ifName} ${name}.${config.elss.dns.wgZone} ${pkgs.systemd}/bin/resolvectl domain ${ifName} ${name}.${config.elss.dns.wgZone}
${pkgs.systemd}/bin/resolvectl default-route ${ifName} true ${pkgs.systemd}/bin/resolvectl default-route ${ifName} true
'' ''
] ++ (map ]
++ (map
(ip: '' (ip: ''
${pkgs.systemd}/bin/resolvectl dns ${ifName} ${ip} ${pkgs.systemd}/bin/resolvectl dns ${ifName} ${ip}
'') '')
dnsServers)); dnsServers));
mkInterfaceConfig = hostName: interface: value: mkInterfaceConfig = hostName: interface: value: let
let
isServer = builtins.hasAttr hostName value.servers; isServer = builtins.hasAttr hostName value.servers;
isPeer = builtins.hasAttr hostName value.peers; isPeer = builtins.hasAttr hostName value.peers;
myConfig = myConfig =
if isServer then if isServer
value.servers."${hostName}" then value.servers."${hostName}"
else else value.peers."${hostName}";
value.peers."${hostName}";
in in
assert lib.asserts.assertMsg assert lib.asserts.assertMsg
((isServer || isPeer) && !(isServer && isPeer)) ((isServer || isPeer) && !(isServer && isPeer))
@ -176,25 +184,30 @@
privateKeyFile = config.sops.secrets."wireguard-${interface}".path; privateKeyFile = config.sops.secrets."wireguard-${interface}".path;
ips = mkAddresses value.prefixes myConfig.localIp; ips = mkAddresses value.prefixes myConfig.localIp;
inherit (myConfig) listenPort; inherit (myConfig) listenPort;
} // (if isServer then { }
// (
if isServer
then {
peers = lib.mapAttrsToList (_: mkServerPeer value.prefixes) value.peers; peers = lib.mapAttrsToList (_: mkServerPeer value.prefixes) value.peers;
} else if isPeer then { }
else if isPeer
then {
peers = lib.mapAttrsToList (_: mkPeerPeer value.prefixes value.peers) value.servers; peers = lib.mapAttrsToList (_: mkPeerPeer value.prefixes value.peers) value.servers;
postSetup = mkPostSetup interface value.prefixes value.servers; postSetup = mkPostSetup interface value.prefixes value.servers;
} else }
{ })); else {}
));
mkInterfaceSecret = interface: { mkInterfaceSecret = interface: {
"wireguard-${interface}" = {sopsFile = secretsFile;}; "wireguard-${interface}" = {sopsFile = secretsFile;};
}; };
mkListenPorts = hostName: interface: value: mkListenPorts = hostName: interface: value:
if builtins.hasAttr hostName value.servers then if builtins.hasAttr hostName value.servers
value.servers."${hostName}".listenPort then value.servers."${hostName}".listenPort
else if builtins.hasAttr hostName value.peers then else if builtins.hasAttr hostName value.peers
value.peers."${hostName}".listenPort then value.peers."${hostName}".listenPort
else else -1;
-1;
mkSysctl = hostName: interface: [ mkSysctl = hostName: interface: [
{ {
@ -210,7 +223,6 @@
value = "1"; value = "1";
} }
]; ];
in in
lib.mkIf cfg.wireguard.enable { lib.mkIf cfg.wireguard.enable {
networking = { networking = {
@ -243,7 +255,6 @@
}) })
interfaces); interfaces);
boot.kernel.sysctl = boot.kernel.sysctl =
builtins.listToAttrs (lib.concatMap (mkSysctl hostName) serverInterfaces); builtins.listToAttrs (lib.concatMap (mkSysctl hostName) serverInterfaces);

View File

@ -1,8 +1,12 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.zsh.enable = mkEnableOption "Setup systemwide zsh"; options.elss.zsh.enable = mkEnableOption "Setup systemwide zsh";
config = config = let
let
inherit (elss.withConfig config) mapAllUsers; inherit (elss.withConfig config) mapAllUsers;
cfg = config.elss.zsh; cfg = config.elss.zsh;
in in
@ -58,8 +62,8 @@ with lib; {
}; };
}; };
users.users = mapAllUsers (_: { shell = pkgs.zsh; } users.users = mapAllUsers (
_: {shell = pkgs.zsh;}
); );
}; };
} }

View File

@ -1,9 +1,8 @@
{ pkgs ? import <nixpkgs> { } {
, sops-nix ? pkgs.callPackage <sops-nix> { } pkgs ? import <nixpkgs> {},
, ... sops-nix ? pkgs.callPackage <sops-nix> {},
}: ...
}: let
let
sops-rekey = pkgs.writeShellScriptBin "sops-rekey" '' sops-rekey = pkgs.writeShellScriptBin "sops-rekey" ''
${pkgs.findutils}/bin/find . -wholename '*/secrets/*.yaml' -exec ${pkgs.sops}/bin/sops updatekeys {} \; ${pkgs.findutils}/bin/find . -wholename '*/secrets/*.yaml' -exec ${pkgs.sops}/bin/sops updatekeys {} \;
''; '';

View File

@ -8,19 +8,25 @@
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
}; };
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, flake-utils-plus, ... }@inputs: outputs = {
{ } // (flake-utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
nixpkgs-unstable,
flake-utils,
flake-utils-plus,
...
} @ inputs:
{}
// (flake-utils.lib.eachDefaultSystem (
system: let
unstable = import nixpkgs-unstable { unstable = import nixpkgs-unstable {
inherit system; inherit system;
}; };
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
in in rec {
rec { devShell = pkgs.mkShell {
devShell =
pkgs.mkShell {
buildInputs = [ buildInputs = [
# add packages here, like # add packages here, like
# pkgs.clingo # pkgs.clingo

View File

@ -6,9 +6,14 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, jupyterWith, flake-utils }: outputs = {
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system: self,
let nixpkgs,
jupyterWith,
flake-utils,
}:
flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin"] (
system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
system = system; system = system;
overlays = nixpkgs.lib.attrValues jupyterWith.overlays; overlays = nixpkgs.lib.attrValues jupyterWith.overlays;

View File

@ -18,20 +18,27 @@
}; };
}; };
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, gitignoresrc, rust-overlay, ... }@inputs: outputs = {
self,
nixpkgs,
nixpkgs-unstable,
flake-utils,
gitignoresrc,
rust-overlay,
...
} @ inputs:
{ {
#overlay = import ./nix { inherit gitignoresrc; }; #overlay = import ./nix { inherit gitignoresrc; };
} // (flake-utils.lib.eachDefaultSystem (system: }
let // (flake-utils.lib.eachDefaultSystem (
system: let
unstable = import nixpkgs-unstable {inherit system;}; unstable = import nixpkgs-unstable {inherit system;};
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [(import rust-overlay)]; overlays = [(import rust-overlay)];
}; };
in in rec {
rec { devShell = pkgs.mkShell {
devShell =
pkgs.mkShell {
RUST_LOG = "debug"; RUST_LOG = "debug";
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
buildInputs = [ buildInputs = [
@ -50,4 +57,3 @@
} }
)); ));
} }

View File

@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
...
}: {
programs.alacritty = {
enable = true;
settings = {
window = {
decorations = "none";
};
alt_send_esc = true;
font = {
normal.family = "Hasklug Nerd Font";
size = 14;
};
# colors = {
# primary = {
# background = "#282828"; # base3
# foreground = "#dfbf8e"; # base00
# };
# cursor = {
# text = "CellBackground";
# cursor = "CellForeground";
# };
# normal = {
# black = "#665c54"; # base02
# red = "#ea6962"; # red
# green = "#a9b665"; # green
# yellow = "#e78a4e"; # yellow
# blue = "#7daea3"; # blue
# magenta = "#d3869b"; # magenta
# cyan = "#89b482"; # cyan
# white = "#dfbf8e"; # base2
# };
# bright = {
# black = "#928374"; # base03
# red = "#ea6962"; # orange
# green = "#a6b665"; # base01
# yellow = "#e3a84e"; # base00
# blue = "#7daea3"; # base0
# magenta = "#d3869b"; # violet
# cyan = "#89b482"; # base1
# white = "#dfbf8e"; # base3
# };
# };
};
};
}

View File

@ -1,5 +1,15 @@
{ config, pkgs, lib, ...}:
{ {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.i3;
in
mkIf cfg.enable {
programs.autorandr = { programs.autorandr = {
enable = true; enable = true;
profiles = { profiles = {
@ -117,4 +127,5 @@
"polybar" = "systemctl --user restart polybar.service"; "polybar" = "systemctl --user restart polybar.service";
}; };
}; };
};
} }

View File

@ -0,0 +1,313 @@
/* -----------------------------------------------------------------------------
* Keyframes
* -------------------------------------------------------------------------- */
@keyframes blink-warning {
70% {
color: @light;
}
to {
color: @light;
background-color: @warning;
}
}
@keyframes blink-critical {
70% {
color: @light;
}
to {
color: @light;
background-color: @critical;
}
}
@define-color critical #cc241d;
@define-color warning #fabd2f;
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: Hasklug Nerd Font, FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
border: none;
border-radius: 0;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
/*
window#waybar.hidden {
opacity: 0.2;
}*/
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
/* Each module that should blink */
#mode,
#battery {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/* Each critical that should blink */
#mode,
#battery.critical.discharging {
animation-name: blink-critical;
animation-duration: 2s;
}
/* Each warning */
#network.disconnected,
#battery.warning {
background-color: @warning;
color: #000000;
}
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
#network.wifi {
background-color: #C9CBFF;
color: #000000;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each workspace name */
border: none;
border-radius: 5;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -2px #ecf0f1;
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -2px #ecf0f1;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 2px solid #ecf0f1;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#mpd {
margin-left: 2px;
margin-right: 2px;
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}

View File

@ -1,14 +1,24 @@
{ config, lib, pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}: {
imports = [ imports = [
./alacritty.nix
./autorandr.nix ./autorandr.nix
./dunst.nix ./dunst.nix
./git.nix ./git.nix
./gpg.nix ./gpg.nix
./i3.nix ./i3.nix
./kanshi.nix
./mako.nix
./nextcloud.nix ./nextcloud.nix
./polybar.nix ./polybar.nix
./zsh.nix ./zsh.nix
./sway.nix
./waybar.nix
]; ];
services = { services = {
gnome-keyring = { gnome-keyring = {
@ -35,19 +45,10 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
# comma did not compile on 15.07.2022 # comma did not compile on 15.07.2022
comma comma
kanshi
]; ];
programs = { programs = {
alacritty = {
enable = true;
settings = {
window = {
decorations = "full";
};
alt_send_esc = true;
};
};
direnv = { direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;

View File

@ -1,5 +1,15 @@
{ config, pkgs, ...}:
{ {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.i3;
in
mkIf cfg.enable {
services.dunst = { services.dunst = {
iconTheme = { iconTheme = {
package = pkgs.numix-icon-theme; package = pkgs.numix-icon-theme;
@ -34,4 +44,5 @@
}; };
}; };
}; };
};
} }

View File

@ -1,5 +1,9 @@
{ config, pkgs, lib, ...}:
{ {
config,
pkgs,
lib,
...
}: {
programs = { programs = {
git = { git = {
enable = true; enable = true;

View File

@ -1,5 +1,9 @@
{ config, pkgs, lib, ...}:
{ {
config,
pkgs,
lib,
...
}: {
home.file = { home.file = {
".gnupg/gpgsm.conf".text = '' ".gnupg/gpgsm.conf".text = ''
keyserver ldap.pca.dfn.de::::o=DFN-Verein,c=DE keyserver ldap.pca.dfn.de::::o=DFN-Verein,c=DE
@ -10,7 +14,5 @@
".gnupg/chain.txt".source = ./conf/gpgsm/chain.txt; ".gnupg/chain.txt".source = ./conf/gpgsm/chain.txt;
}; };
programs.gpg.enable = true; programs.gpg.enable = true;
} }

View File

@ -1,9 +1,20 @@
{ config, pkgs, lib, ...}:
{ {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical;
in
mkIf cfg.enable {
xdg = { xdg = {
configFile."i3" = { configFile."i3" = {
source = conf/i3; source = conf/i3;
recursive = true; recursive = true;
}; };
}; };
};
} }

38
users/ellmau/kanshi.nix Normal file
View File

@ -0,0 +1,38 @@
{
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.sway;
in
mkIf cfg.enable {
services.kanshi = {
enable = true;
profiles = {
work = {
outputs = [
{
criteria = "Dell Inc. DELL U2720Q 1DNY123";
position = "1920,0";
}
{
criteria = "eDP-1";
position = "5760,0";
}
];
};
unplugged = {
outputs = [
{
criteria = "eDP-1";
}
];
};
};
};
};
}

23
users/ellmau/mako.nix Normal file
View File

@ -0,0 +1,23 @@
{
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.sway;
in
mkIf cfg.enable {
programs.mako = {
enable = true;
iconPath = "${pkgs.numix-icon-theme}";
font = "Hasklug Nerd Font 10";
defaultTimeout = 8000;
# ignoreTimeout = true;
};
home.packages = [pkgs.numix-icon-theme];
};
}

View File

@ -1,7 +1,18 @@
{ pkgs, ... }:
{ {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical;
in
mkIf cfg.enable {
services.nextcloud-client = { services.nextcloud-client = {
enable = true; enable = true;
startInBackground = true; startInBackground = true;
}; };
};
} }

View File

@ -1,12 +1,20 @@
{ config, pkgs, ...}:
{ {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.i3;
in
mkIf cfg.enable {
services.polybar = { services.polybar = {
enable = true; enable = true;
package = pkgs.polybarFull; package = pkgs.polybarFull;
settings = settings = let
let
# solarized theme colours ~ https://en.wikipedia.org/wiki/Solarized # solarized theme colours ~ https://en.wikipedia.org/wiki/Solarized
#content tones #content tones
Base01 = "#586e75"; Base01 = "#586e75";
Base00 = "#657b83"; Base00 = "#657b83";
@ -52,8 +60,7 @@
"Weather Icons:size=12;0" "Weather Icons:size=12;0"
"Hasklug Nerd Font,Hasklig Medium:style=Medium,Regular" "Hasklug Nerd Font,Hasklig Medium:style=Medium,Regular"
]; ];
in in {
{
"bar/main" = { "bar/main" = {
font = fonts; font = fonts;
modules = { modules = {
@ -199,7 +206,6 @@
#;label-disconnected = %ifname% disconnected #;label-disconnected = %ifname% disconnected
#;label-disconnected-foreground = ${colors.foreground-alt} #;label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-foreground = foreground_altcol; ramp-signal-foreground = foreground_altcol;
}; };
"module/eth" = { "module/eth" = {
@ -352,4 +358,5 @@
done; done;
''; '';
}; };
};
} }

125
users/ellmau/sway.nix Normal file
View File

@ -0,0 +1,125 @@
{
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.sway;
in
mkIf cfg.enable {
services = {
blueman-applet.enable = true;
swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "swaylock -KfeFi ~/.background-image";
}
{
event = "lock";
command = "swaylock -KfeFi ~/.background-image";
}
];
timeouts = [
{
timeout = 60;
command = "swaylock -KfeFi ~/.background-image";
}
];
};
};
home.file.".background-image".source = ../../common/wallpaper/nix-wallpaper-nineish-dark-gray.png;
gtk.enable = true;
home.packages = [
pkgs.gnome-icon-theme
pkgs.swaylock
pkgs.pulseaudioFull
];
wayland.windowManager.sway = {
enable = true;
config = {
down = "k";
up = "l";
left = "j";
right = "semicolon";
modifier = "Mod4";
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
bctl = "${pkgs.brightnessctl}/bin/brightnessctl";
in
lib.mkOptionDefault {
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun";
"${modifier}+Tab" = "exec ${pkgs.rofi}/bin/rofi -show window";
"${modifier}+BackSpace" = ''mode "$mode_system"'';
XF86MonBrightnessDown = "exec ${bctl} s 2%-";
XF86MonBrightnessUp = "exec ${bctl} s 2%+";
XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer -t";
XF86AudioLowerVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ -10%";
XF86AudioRaiseVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ +10%";
};
keycodebindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in {};
startup = [
{
command = "--no-startup-id nm-applet --indicator";
always = true;
}
{
command = "--no-startup-id blueman-applet";
always = true;
}
{
command = "--no-startup-id systemctl --user restart waybar.service";
always = true;
}
{
command = "--no-startup-id .config/i3/keepassxc.sh";
}
{
command = ''--no-startup-id swaymsg output "*" bg .background-image fill'';
always = true;
}
];
terminal = "alacritty";
window = {
titlebar = true;
};
bars = [];
};
extraConfig = ''
input "type:keyboard" {
xkb_layout us,de
xkb_variant euro,nodeadkeys
xkb_options grp:win_space_toggle
}
set $mode_system System (l) lock, (CTRL+e) logout, (CTRL+r) reboot, (CTRL+s) shutdown
set $i3lockwall swaylock -KfeFi ~/.background-image
mode "$mode_system" {
bindsym l exec --no-startup-id $i3lockwall, mode "default"
bindsym Ctrl+e exec --no-startup-id swaymsg exit, mode "default"
#bindsym s exec --no-startup-id $i3lockwall && systemctl suspend, mode "default"
#bindsym h exec --no-startup-id $i3lockwall && systemctl hibernate, mode "default"
bindsym Ctrl+r exec --no-startup-id systemctl reboot, mode "default"
bindsym Ctrl+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
'';
};
};
}

94
users/ellmau/waybar.nix Normal file
View File

@ -0,0 +1,94 @@
{
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config = let
cfg = nixosConfig.elss.graphical.sway;
in
mkIf cfg.enable {
xdg.configFile."waybar/style.css" = {
source = conf/waybar/style.css;
};
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
modules-left = ["sway/workspaces" "sway/mode"];
modules-center = ["sway/window"];
modules-right = ["idle_inhibitor" "sway/language" "network#wifi" "network#base" "battery" "pulseaudio" "clock" "tray"];
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
battery = {
states = {
good = 95;
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = ["" "" "" "" ""];
};
"clock" = {
format-alt = "{:%a, %d. %b %H:%M}";
};
"network#wifi" = {
interface = "wlp2s0";
format = "{ifname}";
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
format-disconnected = "wifi:";
tooltip-format = "{ifname} via {gwaddr} ";
tooltip-format-wifi = "{essid} ({signalStrength}%) ";
tooltip-format-ethernet = "{ifname} ";
tooltip-format-disconnected = "Disconnected";
max-length = 50;
};
"network#base" = {
format = "{ifname}";
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
format-disconnected = "";
tooltip-format = "{ifname} via {gwaddr} ";
tooltip-format-wifi = "{essid} ({signalStrength}%) ";
tooltip-format-ethernet = "{ifname} ";
tooltip-format-disconnected = "Disconnected";
max-length = 50;
};
pulseaudio = {
format = "{icon} {volume:2}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "🔇";
format-icons = {
headphones = "";
default = [
"🔈"
"🔉"
"🔊"
];
};
scroll-step = 5;
on-click = "${pkgs.pamixer}/bin/pamixer -t";
on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol &";
};
};
};
};
};
}

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
programs = { programs = {
zsh = { zsh = {
enable = true; enable = true;