1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Format with alejandra style

This commit is contained in:
Stefan Ellmauthaler 2022-08-22 11:00:00 +02:00
parent 6b41b87f67
commit d44a40605f
Failed to extract signature
62 changed files with 1553 additions and 1291 deletions

View File

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

View File

@ -1,13 +1,17 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
config.elss.wireguard = { config.elss.wireguard = {
interfaces = { interfaces = {
stelnet = { stelnet = {
servers = { servers = {
metis = { metis = {
localIp = "1"; localIp = "1";
extraIps = [ "1" "2" "142" ]; extraIps = ["1" "2" "142"];
publicKey = "wP49t1TYXI3ucsYb8RavNGwIf+8nx5UBgDU0PM9VlnI="; publicKey = "wP49t1TYXI3ucsYb8RavNGwIf+8nx5UBgDU0PM9VlnI=";
endpoint = "metis.ellmauthaler.net:51820"; #TODO endpoint = "metis.ellmauthaler.net:51820"; #TODO
}; };
@ -32,10 +36,10 @@ with lib; {
}; };
prefixes = { prefixes = {
ipv4 = [ "192.168.244" ]; ipv4 = ["192.168.244"];
ipv6 = { ipv6 = {
ula = [ "fdaa:3313:9dfa:dfa3" ]; # TODO ula = ["fdaa:3313:9dfa:dfa3"]; # TODO
gua = [ ]; gua = [];
}; };
serial = "2022073100"; serial = "2022073100";
}; };

View File

@ -1,57 +1,75 @@
{ 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;
}; };
}; };
in in
flakes.nixpkgs.lib.listToAttrs (map mkMachine [ flakes.nixpkgs.lib.listToAttrs (map mkMachine [
{ {
name = "stel-xps"; name = "stel-xps";
extraModules = [ flakes.nixos-hardware.nixosModules.dell-xps-13-7390 flakes.home-manager.nixosModules.home-manager ]; extraModules = [flakes.nixos-hardware.nixosModules.dell-xps-13-7390 flakes.home-manager.nixosModules.home-manager];
} }
{ {
name = "nucturne"; name = "nucturne";
extraModules = [ flakes.home-manager.nixosModules.home-manager ]; extraModules = [flakes.home-manager.nixosModules.home-manager];
} }
{ {
name = "ellmauthaler"; name = "ellmauthaler";
extraModules = [ flakes.home-manager.nixosModules.home-manager flakes.simple-nixos-mailserver.nixosModule flakes.sops-nix.nixosModules.sops ]; extraModules = [flakes.home-manager.nixosModules.home-manager flakes.simple-nixos-mailserver.nixosModule flakes.sops-nix.nixosModules.sops];
} }
]) ])

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,22 +58,28 @@
}; };
}; };
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;
}); });
inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules discoverTemplates; inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules discoverTemplates;
in in
flake-utils-plus.lib.mkFlake rec{ flake-utils-plus.lib.mkFlake rec {
inherit self inputs; inherit self inputs;
supportedSystems = [ "x86_64-linux" ]; supportedSystems = ["x86_64-linux"];
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 {
@ -154,8 +166,7 @@
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,26 +1,34 @@
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 ({
{ modules = [ path ]; } // args); path,
name,
}:
{modules = [path];} // args);
discoverTemplates = dir: overrides: discoverTemplates = dir: overrides:
pipe dir [ pipe dir [
builtins.readDir builtins.readDir
@ -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,12 +46,11 @@
# enable wireguard # enable wireguard
wireguard.enable = true; wireguard.enable = true;
# user setup # user setup
users = { users = {
enable = true; enable = true;
admins = [ "ellmau" ]; admins = ["ellmau"];
users = [ ]; users = [];
meta = { meta = {
ellmau.git = { ellmau.git = {
@ -55,20 +59,24 @@
}; };
}; };
}; };
fileSystems."/".options = [ "noatime" ]; fileSystems."/".options = ["noatime"];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
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 = {
@ -79,9 +87,8 @@
nat = { nat = {
enable = true; enable = true;
externalInterface = "ens3"; externalInterface = "ens3";
internalInterfaces = [ "wg-stelnet" ]; internalInterfaces = ["wg-stelnet"];
}; };
}; };
system.stateVersion = "22.05"; system.stateVersion = "22.05";
} }

View File

@ -1,33 +1,33 @@
# 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")
]; ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
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;
@ -22,7 +26,7 @@
sway.enable = true; sway.enable = true;
i3.enable = false; i3.enable = false;
# set dpi if used in mobile applications # set dpi if used in mobile applications
# dpi = 180; # dpi = 180;
}; };
# enable deamon to generate nix-index-db # enable deamon to generate nix-index-db
@ -42,8 +46,8 @@
# user setup # user setup
users = { users = {
enable = true; enable = true;
admins = [ "ellmau" ]; admins = ["ellmau"];
users = [ ]; users = [];
meta = { meta = {
ellmau.git = { ellmau.git = {

View File

@ -1,35 +1,39 @@
# 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"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
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
@ -43,8 +48,8 @@
# user setup # user setup
users = { users = {
enable = true; enable = true;
admins = [ "ellmau" ]; admins = ["ellmau"];
users = [ ]; users = [];
meta = { meta = {
ellmau.git = { ellmau.git = {

View File

@ -1,32 +1,36 @@
# 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"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
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,26 +1,29 @@
{ 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";
src = ./ppds; src = ./ppds;
phases = [ "unpackPhase" "installPhase" ]; phases = ["unpackPhase" "installPhase"];
installPhase = '' installPhase = ''
mkdir -p $out/share/cups/model/ mkdir -p $out/share/cups/model/
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 =
++ (with pkgs.aspellDicts; [ de en sv en-computers en-science ]); [pkgs.aspell]
++ (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";
@ -14,7 +19,7 @@ with lib; {
services = { services = {
dbus = { dbus = {
enable = true; enable = true;
packages = with pkgs; [ dconf ]; packages = with pkgs; [dconf];
}; };
}; };

View File

@ -1,9 +1,13 @@
{ 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 {

View File

@ -1,16 +1,20 @@
{ 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
defaultConfig = pkgs.runCommand "default.el" { } '' defaultConfig = pkgs.runCommand "default.el" {} ''
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,13 +25,17 @@ 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
@ -86,12 +94,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,8 +1,13 @@
{ 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 {
pname = "org-roam-ui"; pname = "org-roam-ui";
version = "2021-10-06"; version = "2021-10-06";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -11,7 +16,7 @@ with epkgs; rec{
rev = "bae6487afd5e6eec9f04b38b235bbac24042ca62"; rev = "bae6487afd5e6eec9f04b38b235bbac24042ca62";
sha256 = "14dbdvxf1l0dwbhc0ap3wr3ffafy4cxmwc9b7gm0gzzmcxvszisc"; sha256 = "14dbdvxf1l0dwbhc0ap3wr3ffafy4cxmwc9b7gm0gzzmcxvszisc";
}; };
packageRequires = [ f websocket org-roam simple-httpd ]; packageRequires = [f websocket org-roam simple-httpd];
postInstall = '' postInstall = ''
cp -r out $out/share/emacs/site-lisp cp -r out $out/share/emacs/site-lisp
''; '';
@ -27,4 +32,4 @@ with epkgs; rec{
sha256 = "baFDkfQLM2MYW2QhMpPnOMSfsLlcp9fO5xfyioZzOqg="; sha256 = "baFDkfQLM2MYW2QhMpPnOMSfsLlcp9fO5xfyioZzOqg=";
}; };
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
with lib; { with lib; {
options.elss.graphical = { options.elss.graphical = {
enable = mkEnableOption "configure graphical layer"; enable = mkEnableOption "configure graphical layer";
@ -18,14 +23,16 @@ with lib; {
}; };
i3.enable = mkEnableOption "enable i3"; 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 = if cfg.i3.enable then true else false; elss.users.x11.enable =
if cfg.i3.enable
then true
else false;
elss.networking.useNetworkManager = true; elss.networking.useNetworkManager = true;
services = { services = {
@ -77,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";
@ -21,7 +26,7 @@ with lib; {
noto-fonts-extra noto-fonts-extra
roboto roboto
roboto-mono roboto-mono
(nerdfonts.override { fonts = [ "Hasklig" ]; }) (nerdfonts.override {fonts = ["Hasklig"];})
material-icons material-icons
weather-icons weather-icons
xits-math xits-math

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
@ -44,12 +47,11 @@ with lib; {
Persistent = true; Persistent = true;
}; };
wantedBy = [ "timers.target" ]; wantedBy = ["timers.target"];
}; };
}; };
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;
@ -10,7 +12,7 @@
linkInputs = true; linkInputs = true;
autoOptimiseStore = true; autoOptimiseStore = true;
trustedUsers = [ "root" ] ++ config.elss.users.admins; trustedUsers = ["root"] ++ config.elss.users.admins;
# Enable flakes # Enable flakes
# Free up to 50 GiB whenever there is less than 10 GiB left. # Free up to 50 GiB whenever there is less than 10 GiB left.

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,16 +1,21 @@
{ 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, ... }: {
with lib;{ config,
config = lib,
let pkgs,
...
}:
with lib; {
config = 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, ... }: {
with lib;{ config,
config = pkgs,
let lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.nextcloud; cfg = config.elss.server.nextcloud;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -27,8 +31,8 @@ with lib;{
}; };
systemd.services."nextcloud-setup" = { systemd.services."nextcloud-setup" = {
requires = [ "postgresql.service" ]; requires = ["postgresql.service"];
after = [ "postrgresql.service" ]; after = ["postrgresql.service"];
}; };
sops.secrets = { sops.secrets = {
storemin = { storemin = {

View File

@ -1,12 +1,16 @@
{ config, lib, pkgs, ... }: {
with lib;{ config,
config = lib,
let pkgs,
...
}:
with lib; {
config = let
cfg = config.elss.server.nginx; cfg = config.elss.server.nginx;
in in
mkIf cfg.enable { mkIf cfg.enable {
services.nginx.enable = true; services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [80 443];
services.nginx.virtualHosts."localhost" = { services.nginx.virtualHosts."localhost" = {
addSSL = false; addSSL = false;
enableACME = false; enableACME = false;

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }: {
with lib;{ config,
config = pkgs,
let lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.smailserver; cfg = config.elss.server.smailserver;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -9,11 +13,11 @@ with lib;{
enable = true; enable = true;
fqdn = "mail.ellmauthaler.net"; fqdn = "mail.ellmauthaler.net";
sendingFqdn = "ellmauthaler.net"; sendingFqdn = "ellmauthaler.net";
domains = [ "ellmauthaler.net" ]; domains = ["ellmauthaler.net"];
loginAccounts = { loginAccounts = {
"ellmau@ellmauthaler.net" = { "ellmau@ellmauthaler.net" = {
aliases = [ "stefan@ellmauthaler.net" "postmaster@ellmauthaler.net" "abuse@ellmauthaler.net" ]; aliases = ["stefan@ellmauthaler.net" "postmaster@ellmauthaler.net" "abuse@ellmauthaler.net"];
hashedPasswordFile = config.sops.secrets.ellmauMail.path; hashedPasswordFile = config.sops.secrets.ellmauMail.path;
}; };
}; };

View File

@ -1,18 +1,24 @@
{ config, pkgs, lib, ... }: {
with lib;{ config,
config = pkgs,
let lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.sql; cfg = config.elss.server.sql;
in in
mkIf cfg.enable { mkIf cfg.enable {
services.postgresql = { services.postgresql = {
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 {
@ -10,7 +14,7 @@ with lib; {
enable = true; enable = true;
dnssec = "true"; dnssec = "true";
llmnr = "true"; llmnr = "true";
fallbackDns = [ "127.0.0.1" "::1" ]; fallbackDns = ["127.0.0.1" "::1"];
extraConfig = '' extraConfig = ''
DNS = 127.0.0.1 ::1 DNS = 127.0.0.1 ::1
Domains = ~. Domains = ~.
@ -18,13 +22,12 @@ with lib; {
}; };
unbound = { unbound = {
enable = true; enable = true;
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"];
resolvconf.useLocalResolver = true; resolvconf.useLocalResolver = true;
}; };
}; };

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,15 +1,18 @@
{ 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 {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.unstable.steam.override { withJava = true; }).run (pkgs.unstable.steam.override {withJava = true;}).run
]; ];
}; };
} }

View File

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

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;
@ -74,25 +80,23 @@ with lib; {
mkMerge [ mkMerge [
(mkUser login) (mkUser login)
{ {
extraGroups = [ "wheel" ]; extraGroups = ["wheel"];
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}";
extraGroups = [ ]; extraGroups = [];
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,11 +1,14 @@
{ 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";
interfaces = mkOption { interfaces = mkOption {
default = { }; default = {};
type = types.attrsOf (types.submodule { type = types.attrsOf (types.submodule {
options = { options = {
servers = mkOption { servers = mkOption {
@ -18,7 +21,7 @@
extraIps = mkOption { extraIps = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
description = "extra IPs to add to allowedIPs"; description = "extra IPs to add to allowedIPs";
}; };
@ -63,7 +66,7 @@
additionalAllowedIps = mkOption { additionalAllowedIps = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "Additional IPs to add to allowedIPs "; description = "Additional IPs to add to allowedIPs ";
default = [ ]; default = [];
}; };
}; };
}); });
@ -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 = {
@ -221,7 +233,7 @@
# (lib.mapAttrsToList (mkListenPorts hostName) cfg.wireguard.interfaces); # (lib.mapAttrsToList (mkListenPorts hostName) cfg.wireguard.interfaces);
allowedUDPPorts = lib.filter (port: port > 0) (map allowedUDPPorts = lib.filter (port: port > 0) (map
(interface: (interface:
lib.attrByPath [ interface "servers" hostName "listenPort" ] (-1) lib.attrByPath [interface "servers" hostName "listenPort"] (-1)
cfg.wireguard.interfaces) cfg.wireguard.interfaces)
serverInterfaces); serverInterfaces);
trustedInterfaces = map mkInterfaceName interfaces; trustedInterfaces = map mkInterfaceName interfaces;
@ -229,7 +241,7 @@
interfaces = lib.listToAttrs (map interfaces = lib.listToAttrs (map
(interface: { (interface: {
name = mkInterfaceName interface; name = mkInterfaceName interface;
value = { mtu = 1300; }; value = {mtu = 1300;};
}) })
interfaces); interfaces);
}; };
@ -239,11 +251,10 @@
systemd.services = lib.listToAttrs (map systemd.services = lib.listToAttrs (map
(interface: { (interface: {
name = "wireguard-${mkInterfaceName interface}"; name = "wireguard-${mkInterfaceName interface}";
value = { serviceConfig.Restart = "on-failure"; }; value = {serviceConfig.Restart = "on-failure";};
}) })
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,15 +1,19 @@
{ 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
mkIf cfg.enable { mkIf cfg.enable {
environment = { environment = {
shells = [ pkgs.zsh ]; shells = [pkgs.zsh];
pathsToLink = [ "/share/zsh/" ]; pathsToLink = ["/share/zsh/"];
sessionVariables = rec { sessionVariables = rec {
XDG_CACHE_HOME = "\${HOME}/.cache"; XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config"; XDG_CONFIG_HOME = "\${HOME}/.config";
@ -29,10 +33,10 @@ with lib; {
autosuggestions.enable = true; autosuggestions.enable = true;
syntaxHighlighting = { syntaxHighlighting = {
enable = true; enable = true;
highlighters = [ "main" "brackets" "root" "line" ]; highlighters = ["main" "brackets" "root" "line"];
#styles = { cursor = "standout,underline"; }; #styles = { cursor = "standout,underline"; };
}; };
setOptions = [ "auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory" ]; setOptions = ["auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory"];
shellInit = '' shellInit = ''
if [[ $TERM == "dumb" ]]; then if [[ $TERM == "dumb" ]]; then
@ -58,8 +62,8 @@ with lib; {
}; };
}; };
users.users = mapAllUsers (_: { shell = pkgs.zsh; } users.users = mapAllUsers (
_: {shell = pkgs.zsh;}
); );
}; };
} }

View File

@ -1,15 +1,14 @@
{ 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 {} \;
''; '';
in in
pkgs.mkShell { pkgs.mkShell {
sopsPGPKeyDirs = [ ./keys/users ./keys/hosts ]; sopsPGPKeyDirs = [./keys/users ./keys/hosts];
nativeBuildInputs = [ nativeBuildInputs = [
sops-nix.sops-import-keys-hook sops-nix.sops-import-keys-hook
@ -17,4 +16,4 @@ pkgs.mkShell {
sops-rekey sops-rekey
pkgs.wireguard-tools pkgs.wireguard-tools
]; ];
} }

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,32 +6,37 @@
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;
}; };
prince = pkgs.python3Packages.buildPythonPackage rec { prince = pkgs.python3Packages.buildPythonPackage rec {
name = "prince"; name = "prince";
src = pkgs.fetchFromGitHub{ src = pkgs.fetchFromGitHub {
owner = "MaxHalford"; owner = "MaxHalford";
repo = "prince"; repo = "prince";
rev = "bd5b29fafe853579c9d41e954caa4504d585665d"; rev = "bd5b29fafe853579c9d41e954caa4504d585665d";
sha256 = "X7gpHvy2cfIKMrfSGLZxmJsytLbe/VZd27VsYIyEoTI="; sha256 = "X7gpHvy2cfIKMrfSGLZxmJsytLbe/VZd27VsYIyEoTI=";
}; };
propagatedBuildInputs = with pkgs.python3Packages; [ matplotlib pandas numpy scipy scikit-learn ]; propagatedBuildInputs = with pkgs.python3Packages; [matplotlib pandas numpy scipy scikit-learn];
dontCheck = true; dontCheck = true;
dontUseSetuptoolsCheck = true; dontUseSetuptoolsCheck = true;
}; };
iPython = pkgs.kernels.iPythonWith { iPython = pkgs.kernels.iPythonWith {
name = "Python-env"; name = "Python-env";
packages = p: with p; [ sympy numpy pandas prince ]; packages = p: with p; [sympy numpy pandas prince];
ignoreCollisions = true; ignoreCollisions = true;
}; };
jupyterEnvironment = pkgs.jupyterlabWith { jupyterEnvironment = pkgs.jupyterlabWith {
kernels = [ iPython ]; kernels = [iPython];
}; };
in rec { in rec {
apps.jupterlab = { apps.jupterlab = {

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 (
unstable = import nixpkgs-unstable { inherit system; }; system: let
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

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

View File

@ -1,11 +1,15 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.i3; cfg = nixosConfig.elss.graphical.i3;
in in
mkIf cfg.enable { mkIf cfg.enable {
programs.autorandr = { programs.autorandr = {
enable = true; enable = true;
profiles = { profiles = {

View File

@ -1,5 +1,9 @@
{ config, lib, pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}: {
imports = [ imports = [
./alacritty.nix ./alacritty.nix
./autorandr.nix ./autorandr.nix

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.i3; cfg = nixosConfig.elss.graphical.i3;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,14 +1,18 @@
{ config, pkgs, lib, ...}:
{ {
programs= { config,
pkgs,
lib,
...
}: {
programs = {
git = { git = {
enable = true; enable = true;
package = pkgs.gitAndTools.gitFull; package = pkgs.gitAndTools.gitFull;
extraConfig = { extraConfig = {
core = { editor = "emacsclient"; }; core = {editor = "emacsclient";};
init = { defaultBranch = "main";}; init = {defaultBranch = "main";};
branch = { autosetuprebase = "always";}; branch = {autosetuprebase = "always";};
safe.directory = [ "/etc/nixos" ]; safe.directory = ["/etc/nixos"];
}; };
lfs.enable = true; lfs.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,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical; cfg = nixosConfig.elss.graphical;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.sway; cfg = nixosConfig.elss.graphical.sway;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

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

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical; cfg = nixosConfig.elss.graphical;
in in
mkIf cfg.enable { mkIf cfg.enable {

View File

@ -1,17 +1,20 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.i3; cfg = nixosConfig.elss.graphical.i3;
in in
mkIf cfg.enable { 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";
@ -57,8 +60,7 @@ with lib; {
"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 = {
@ -119,7 +121,7 @@ with lib; {
format.volume = "<ramp-volume> <label-volume>"; format.volume = "<ramp-volume> <label-volume>";
label.muted.text = "🔇"; label.muted.text = "🔇";
label.muted.foreground = "#666"; label.muted.foreground = "#666";
ramp.volume = [ "🔈" "🔉" "🔊" ]; ramp.volume = ["🔈" "🔉" "🔊"];
click.right = "${pkgs.pavucontrol}/bin/pavucontrol &"; click.right = "${pkgs.pavucontrol}/bin/pavucontrol &";
# format-volume-underline = Base2; # format-volume-underline = Base2;
# format-muted-underline = Base2; # format-muted-underline = Base2;
@ -204,7 +206,6 @@ with lib; {
#;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" = {

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.sway; cfg = nixosConfig.elss.graphical.sway;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -10,13 +15,20 @@ with lib; {
swayidle = { swayidle = {
enable = true; enable = true;
events = [ events = [
{
{ event = "before-sleep"; command = "swaylock -KfeFi ~/.background-image"; } event = "before-sleep";
{ event = "lock"; command = "swaylock -KfeFi ~/.background-image"; } command = "swaylock -KfeFi ~/.background-image";
}
{
event = "lock";
command = "swaylock -KfeFi ~/.background-image";
}
]; ];
timeouts = [ timeouts = [
{ timeout = 60; command = "swaylock -KfeFi ~/.background-image"; } {
timeout = 60;
command = "swaylock -KfeFi ~/.background-image";
}
]; ];
}; };
}; };
@ -40,8 +52,7 @@ with lib; {
modifier = "Mod4"; modifier = "Mod4";
keybindings = keybindings = let
let
modifier = config.wayland.windowManager.sway.config.modifier; modifier = config.wayland.windowManager.sway.config.modifier;
bctl = "${pkgs.brightnessctl}/bin/brightnessctl"; bctl = "${pkgs.brightnessctl}/bin/brightnessctl";
in in
@ -55,13 +66,10 @@ with lib; {
XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer -t"; XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer -t";
XF86AudioLowerVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ -10%"; XF86AudioLowerVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ -10%";
XF86AudioRaiseVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ +10%"; XF86AudioRaiseVolume = "exec ${pkgs.pulseaudioFull}/bin/pactl set-sink-volume @DEFAULT_SINK@ +10%";
}; };
keycodebindings = keycodebindings = let
let
modifier = config.wayland.windowManager.sway.config.modifier; modifier = config.wayland.windowManager.sway.config.modifier;
in in {};
{ };
startup = [ startup = [
{ {
@ -89,7 +97,7 @@ with lib; {
titlebar = true; titlebar = true;
}; };
bars = [ ]; bars = [];
}; };
extraConfig = '' extraConfig = ''
input "type:keyboard" { input "type:keyboard" {

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, nixosConfig, ... }: {
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; { with lib; {
config = config = let
let
cfg = nixosConfig.elss.graphical.sway; cfg = nixosConfig.elss.graphical.sway;
in in
mkIf cfg.enable { mkIf cfg.enable {
@ -13,9 +18,9 @@ with lib; {
systemd.enable = true; systemd.enable = true;
settings = { settings = {
mainBar = { mainBar = {
modules-left = [ "sway/workspaces" "sway/mode" ]; modules-left = ["sway/workspaces" "sway/mode"];
modules-center = [ "sway/window" ]; modules-center = ["sway/window"];
modules-right = [ "idle_inhibitor" "sway/language" "network#wifi" "network#base" "battery" "pulseaudio" "clock" "tray" ]; modules-right = ["idle_inhibitor" "sway/language" "network#wifi" "network#base" "battery" "pulseaudio" "clock" "tray"];
"idle_inhibitor" = { "idle_inhibitor" = {
format = "{icon}"; format = "{icon}";
@ -35,7 +40,7 @@ with lib; {
format-charging = "{capacity}% "; format-charging = "{capacity}% ";
format-plugged = "{capacity}% "; format-plugged = "{capacity}% ";
format-alt = "{time} {icon}"; format-alt = "{time} {icon}";
format-icons = [ "" "" "" "" "" ]; format-icons = ["" "" "" "" ""];
}; };
"clock" = { "clock" = {
format-alt = "{:%a, %d. %b %H:%M}"; format-alt = "{:%a, %d. %b %H:%M}";
@ -82,10 +87,8 @@ with lib; {
on-click = "${pkgs.pamixer}/bin/pamixer -t"; on-click = "${pkgs.pamixer}/bin/pamixer -t";
on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol &"; on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol &";
}; };
}; };
}; };
}; };
}; };
} }

View File

@ -1,5 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
programs = { programs = {
zsh = { zsh = {
enable = true; enable = true;
@ -49,7 +48,7 @@
bat = { bat = {
enable = true; enable = true;
config = { theme = "ansi"; }; config = {theme = "ansi";};
}; };
exa = { exa = {