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,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;
}; };

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 {
@ -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,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;

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

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,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,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,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,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,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";

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 {

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;
@ -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

@ -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,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,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,18 +1,21 @@
{ 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 = {
@ -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 = [
{ {

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 {
@ -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;