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; {
config = {
elss = {

View File

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

View File

@ -1,57 +1,75 @@
{ flakes, flakeOutputs, ...}:
let
mkMachine = args:
let
name = 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 [
{
flakes,
flakeOutputs,
...
}: let
mkMachine = args: let
name =
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-comma
];
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: {
unstable = import flakes.nixpkgs-unstable {
system = "${system}";
config.allowUnfree=true;
config.allowUnfree = true;
};
};
# overlay-comma = final: prev: {
# comma = flakes.comma.packages."${system}";
# };
in
{
in {
inherit name;
value = pkgs.lib.nixosSystem {
inherit system;
modules = [
modules =
[
configuration
{ nix = {
{
nix = {
package = pkgs.legacyPackages.${system}.nixUnstable;
nixPath= [ "nixpkgs=${pkgs}" ];
nixPath = ["nixpkgs=${pkgs}"];
registry.nixpkgs.flake = pkgs;
registry.nixpkgs-unstable.flake = flakes.nixpkgs-unstable;
};
}
;}
] ++ extraModules
]
++ extraModules
++ flakes.nixpkgs.lib.mapAttrsToList (_: module: module)
flakeOutputs.nixosModules;
};
};
in
flakes.nixpkgs.lib.listToAttrs (map mkMachine [
flakes.nixpkgs.lib.listToAttrs (map mkMachine [
{
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";
extraModules = [ flakes.home-manager.nixosModules.home-manager ];
extraModules = [flakes.home-manager.nixosModules.home-manager];
}
{
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";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -59,22 +58,28 @@
};
};
outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs:
let
extended-lib = nixpkgs.lib.extend
outputs = {
self,
nixpkgs,
flake-utils-plus,
...
} @ inputs: let
extended-lib =
nixpkgs.lib.extend
(final: prev: {
elss = (import ./lib { lib = final; }) prev;
elss = (import ./lib {lib = final;}) prev;
});
inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules discoverTemplates;
in
flake-utils-plus.lib.mkFlake rec{
flake-utils-plus.lib.mkFlake rec {
inherit self inputs;
supportedSystems = [ "x86_64-linux" ];
supportedSystems = ["x86_64-linux"];
lib = extended-lib;
channelsConfig = {
allowUnfreePredicate = pkg: builtins.elem (extended-lib.getName pkg) [
allowUnfreePredicate = pkg:
builtins.elem (extended-lib.getName pkg) [
"slack"
"steam"
"steam-original"
@ -97,37 +102,44 @@
hostDefaults = {
system = "x86_64-linux";
channelName = "nixpkgs";
modules = [
modules =
[
inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops
inputs.dwarffs.nixosModules.dwarffs
inputs.simple-nixos-mailserver.nixosModules.mailserver
./common/wireguard.nix
] ++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
]
++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
specialArgs = {
nixos-hardware = inputs.nixos-hardware.nixosModules;
inherit inputs;
};
extraArgs = {
homeConfigurations = withModules ./users
homeConfigurations =
withModules ./users
(
{ name, path }:
{
name,
path,
}:
#import (./users + "/${name}")
import path
);
};
};
hosts = discoverMachines ./machines
hosts =
discoverMachines ./machines
{
specialArgs = { lib = extended-lib; };
specialArgs = {lib = extended-lib;};
};
nixosModules = discoverModules ./modules;
homeConfigurations = withModules ./users
(name:
let
homeConfigurations =
withModules ./users
(name: let
username = extended-lib.removeSuffix ".nix" name;
in
inputs.home-manager.lib.homeManagerConfiguration {
@ -154,8 +166,7 @@
rust = {
description = "Rust development environment flake";
welcomeText =
"Change into the folder and follow the prompt to create an automatic rust environment in this folder";
welcomeText = "Change into the folder and follow the prompt to create an automatic rust environment in this folder";
};
jupyter = {
description = "Jupyter server flake";

View File

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

View File

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

View File

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

View File

@ -1,5 +1,10 @@
{ config, pkgs, inputs, nixos-hardware, ... }:
{
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [
../../common/users.nix
./hardware-configuration.nix
@ -41,12 +46,11 @@
# enable wireguard
wireguard.enable = true;
# user setup
users = {
enable = true;
admins = [ "ellmau" ];
users = [ ];
admins = ["ellmau"];
users = [];
meta = {
ellmau.git = {
@ -55,20 +59,24 @@
};
};
};
fileSystems."/".options = [ "noatime" ];
fileSystems."/".options = ["noatime"];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking = {
interfaces.ens3 = {
ipv4.addresses = [{
ipv4.addresses = [
{
address = "89.58.45.113";
prefixLength = 22;
}];
ipv6.addresses = [{
}
];
ipv6.addresses = [
{
address = "fe80::94e0:6eff:fecd:d6cb";
prefixLength = 64;
}];
}
];
};
defaultGateway = "89.58.44.1";
defaultGateway6 = {
@ -79,9 +87,8 @@
nat = {
enable = true;
externalInterface = "ens3";
internalInterfaces = [ "wg-stelnet" ];
internalInterfaces = ["wg-stelnet"];
};
};
system.stateVersion = "22.05";
}

View File

@ -1,33 +1,33 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "xfs";
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-label/swap"; }];
swapDevices = [{device = "/dev/disk/by-label/swap";}];
# 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

View File

@ -1,12 +1,16 @@
{ config, pkgs, inputs, nixos-hardware, ...}:
{
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [
../../common/users.nix
./hardware-configuration.nix
./software.nix
];
elss = {
# base system
base.enable = true;
@ -22,7 +26,7 @@
sway.enable = true;
i3.enable = false;
# set dpi if used in mobile applications
# dpi = 180;
# dpi = 180;
};
# enable deamon to generate nix-index-db
@ -42,8 +46,8 @@
# user setup
users = {
enable = true;
admins = [ "ellmau" ];
users = [ ];
admins = ["ellmau"];
users = [];
meta = {
ellmau.git = {

View File

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

View File

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

View File

@ -1,5 +1,10 @@
{ config, pkgs, inputs, nixos-hardware, ... }:
{
config,
pkgs,
inputs,
nixos-hardware,
...
}: {
imports = [
../../common/users.nix
./printer.nix
@ -43,8 +48,8 @@
# user setup
users = {
enable = true;
admins = [ "ellmau" ];
users = [ ];
admins = ["ellmau"];
users = [];
meta = {
ellmau.git = {

View File

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

View File

@ -1,26 +1,29 @@
{ config, pkgs, ...}:
let
{
config,
pkgs,
...
}: let
ppd-local = pkgs.stdenv.mkDerivation rec {
pname = "local-ppds";
version = "2021-07-04";
src = ./ppds;
phases = [ "unpackPhase" "installPhase" ];
phases = ["unpackPhase" "installPhase"];
installPhase = ''
mkdir -p $out/share/cups/model/
cp -R Ricoh $out/share/cups/model
'';
};
in
{
services.printing.drivers = with pkgs; [
in {
services.printing.drivers = with pkgs;
[
foomatic-filters
gutenprint
hplip
] ++ [
]
++ [
ppd-local
];

View File

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

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
let
{
config,
pkgs,
lib,
...
}: let
aspellConf = ''
data-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
add-extra-dicts en_GB-science.rws
'';
in
{
in {
options.elss.programs.aspell.enable = lib.mkEnableOption "setup aspell";
config = lib.mkIf config.elss.programs.aspell.enable {
environment.systemPackages = [ pkgs.aspell ]
++ (with pkgs.aspellDicts; [ de en sv en-computers en-science ]);
environment.systemPackages =
[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; {
options.elss = {
base.enable = mkEnableOption "Set the base configuration for the system";
@ -14,7 +19,7 @@ with lib; {
services = {
dbus = {
enable = true;
packages = with pkgs; [ dconf ];
packages = with pkgs; [dconf];
};
};

View File

@ -1,9 +1,13 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib; {
options.elss.programs.communication.enable = mkEnableOption "enable the basic graphical communication tools";
config =
let
config = let
cfg = config.elss.programs.communication;
in
mkIf cfg.enable {

View File

@ -1,16 +1,20 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
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
cp ${defaultEl} $out/share/emacs/site-lisp/default.el
'';
emacsPackage = (pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages
(epkgs:
let
emacsPackage =
(pkgs.emacsPackagesFor pkgs.emacs).emacsWithPackages
(epkgs: let
lpkgs = import ./packages.nix {
inherit config lib pkgs epkgs;
};
@ -21,13 +25,17 @@ let
# gnupg
# nixpkgs-fmt
#])
[(defaultConfig)] ++
[(with epkgs.elpaPackages; [
[defaultConfig]
++ [
(with epkgs.elpaPackages; [
auctex
org
flymake
])]
++ (with epkgs.melpaStablePackages; [ ]) ++ (with epkgs.melpaPackages; [
])
]
++ (with epkgs.melpaStablePackages; [])
++ (with epkgs.melpaPackages;
[
ac-helm
academic-phrases
add-hooks
@ -86,12 +94,12 @@ let
yaml-mode
yasnippet
#zenburn-theme
] ++ (with lpkgs; [
]
++ (with lpkgs; [
org-roam-ui
ligatures
])));
in
{
in {
options.elss.programs.emacs.enable = mkEnableOption "Setup emacs package and install it";
config = mkIf config.elss.programs.emacs.enable {
services.emacs = {

View File

@ -1,8 +1,13 @@
{ config, lib, pkgs, epkgs, ...}:
let
{
config,
lib,
pkgs,
epkgs,
...
}: let
in
with epkgs; rec{
org-roam-ui = trivialBuild{
with epkgs; rec {
org-roam-ui = trivialBuild {
pname = "org-roam-ui";
version = "2021-10-06";
src = pkgs.fetchFromGitHub {
@ -11,7 +16,7 @@ with epkgs; rec{
rev = "bae6487afd5e6eec9f04b38b235bbac24042ca62";
sha256 = "14dbdvxf1l0dwbhc0ap3wr3ffafy4cxmwc9b7gm0gzzmcxvszisc";
};
packageRequires = [ f websocket org-roam simple-httpd ];
packageRequires = [f websocket org-roam simple-httpd];
postInstall = ''
cp -r out $out/share/emacs/site-lisp
'';
@ -27,4 +32,4 @@ with epkgs; rec{
sha256 = "baFDkfQLM2MYW2QhMpPnOMSfsLlcp9fO5xfyioZzOqg=";
};
};
}
}

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.graphical = {
enable = mkEnableOption "configure graphical layer";
@ -18,14 +23,16 @@ with lib; {
};
i3.enable = mkEnableOption "enable i3";
};
config =
let
config = let
cfg = config.elss.graphical;
#cursorsize = if config.variables.hostName == "nucturne" then 14 else 16;
#xserverDPI = if config.variables.hostName == "stel-xps" then 180 else null;
in
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;
services = {
@ -77,6 +84,5 @@ with lib; {
libsecret
arandr
];
};
}

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ...}:
{
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.locale.enable = mkEnableOption "setup default locale and font-handling";
@ -21,7 +26,7 @@ with lib; {
noto-fonts-extra
roboto
roboto-mono
(nerdfonts.override { fonts = [ "Hasklig" ]; })
(nerdfonts.override {fonts = ["Hasklig"];})
material-icons
weather-icons
xits-math

View File

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

View File

@ -1,11 +1,14 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.nix-index-db-update.enable =
mkEnableOption "periodically update the nix-index database";
config =
let
config = let
cfg = config.elss.nix-index-db-update;
nix-index-db-update = pkgs.writeShellScript "nix-index-db-update" ''
set -euo pipefail
@ -44,12 +47,11 @@ with lib; {
Persistent = true;
};
wantedBy = [ "timers.target" ];
wantedBy = ["timers.target"];
};
};
home-manager.users = mapAllUsers (_:
{ config, ... }: {
home-manager.users = mapAllUsers (_: {config, ...}: {
home.file.".cache/nix-index".source =
config.lib.file.mkOutOfStoreSymlink "/var/db/nix-index/";
});

View File

@ -1,6 +1,8 @@
{ pkgs, config, ... }:
{
pkgs,
config,
...
}: {
config = {
nix = {
useSandbox = true;
@ -10,7 +12,7 @@
linkInputs = true;
autoOptimiseStore = true;
trustedUsers = [ "root" ] ++ config.elss.users.admins;
trustedUsers = ["root"] ++ config.elss.users.admins;
# Enable flakes
# 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";
config = mkIf config.elss.programs.obsstudio.enable {
environment.systemPackages = with pkgs; [

View File

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

View File

@ -1,16 +1,21 @@
{ config, lib, pkgs, ... }:
with pkgs; with lib;
let
my-python-packages = python-packages: with python-packages; [
{
config,
lib,
pkgs,
...
}:
with pkgs;
with lib; let
my-python-packages = python-packages:
with python-packages; [
pandas
requests
# other python packages you want
];
python-with-my-packages = python3.withPackages my-python-packages;
in
{
in {
options.elss.programs.python.enable = mkEnableOption "install python 3";
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; {
options.elss.sops.enable = mkEnableOption "Use sops config";
config =
let
config = let
cfg = config.elss.sops;
in
mkIf cfg.enable {
sops = {
defaultSopsFile = ../secrets/secrets.yaml;
secrets.example_key.format = "yaml";
};
};
}

View File

@ -1,15 +1,17 @@
{ config, lib, pkgs, ... }:
with lib;{
config =
let
{
config,
lib,
pkgs,
...
}:
with lib; {
config = let
cfg = config.elss.server;
staging = config.elss.server.acme.staging;
in
mkIf cfg.enable {
security.acme = {
defaults = {
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
};

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib; {
options.elss.server = {
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";
smailserver.enable = mkEnableOption "Set up simple mail server";
unbound.enable = mkEnableOption "Set unbound dns up";
};
imports = [
@ -20,8 +24,7 @@ with lib; {
./unbound.nix
];
config =
let
config = let
cfg = config.elss.server;
in
mkIf cfg.enable {

View File

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

View File

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

View File

@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }:
with lib;{
config =
let
{
config,
pkgs,
lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.smailserver;
in
mkIf cfg.enable {
@ -9,11 +13,11 @@ with lib;{
enable = true;
fqdn = "mail.ellmauthaler.net";
sendingFqdn = "ellmauthaler.net";
domains = [ "ellmauthaler.net" ];
domains = ["ellmauthaler.net"];
loginAccounts = {
"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;
};
};

View File

@ -1,18 +1,24 @@
{ config, pkgs, lib, ... }:
with lib;{
config =
let
{
config,
pkgs,
lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.sql;
in
mkIf cfg.enable {
services.postgresql = {
enable = true;
package = pkgs.postgresql_14;
ensureDatabases = [ "nextcloud" ];
ensureUsers = [{
ensureDatabases = ["nextcloud"];
ensureUsers = [
{
name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
}];
}
];
};
};
}

View File

@ -1,7 +1,11 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib; {
config =
let
config = let
cfg = config.elss.server.unbound;
in
mkIf cfg.enable {
@ -10,7 +14,7 @@ with lib; {
enable = true;
dnssec = "true";
llmnr = "true";
fallbackDns = [ "127.0.0.1" "::1" ];
fallbackDns = ["127.0.0.1" "::1"];
extraConfig = ''
DNS = 127.0.0.1 ::1
Domains = ~.
@ -18,13 +22,12 @@ with lib; {
};
unbound = {
enable = true;
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.interface = ["127.0.0.0" "::1"];
settings.server.access-control = ["192.168.244.0/24 allow" "fdaa:3313:9dfa:dfa3::/64 allow"];
};
};
networking = {
nameservers = [ "127.0.0.1" "::1"];
nameservers = ["127.0.0.1" "::1"];
resolvconf.useLocalResolver = true;
};
};

View File

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

View File

@ -1,15 +1,18 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib; {
options.elss.steam-run.enable = mkEnableOption "configure steam-run to support unpatched binaries";
config =
let
config = let
cfg = config.elss.steam-run;
in
mkIf cfg.enable {
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; {
options.elss.graphical.sway.enable = mkEnableOption "Use sway";
config =
let
config = let
cfg = config.elss.graphical.sway;
in
mkIf cfg.enable {

View File

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

View File

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

View File

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}: {
options.elss.wireguard = with lib; {
enable = mkEnableOption "wireguard overlay network";
interfaces = mkOption {
default = { };
default = {};
type = types.attrsOf (types.submodule {
options = {
servers = mkOption {
@ -18,7 +21,7 @@
extraIps = mkOption {
type = types.listOf types.str;
default = [ ];
default = [];
description = "extra IPs to add to allowedIPs";
};
@ -63,7 +66,7 @@
additionalAllowedIps = mkOption {
type = types.listOf types.str;
description = "Additional IPs to add to allowedIPs ";
default = [ ];
default = [];
};
};
});
@ -78,14 +81,12 @@
ipv6 = {
ula = mkOption {
type = types.listOf types.str;
description =
"IPv6 prefixes to use for ULA wireguard addressing";
description = "IPv6 prefixes to use for ULA wireguard addressing";
};
gua = mkOption {
type = types.listOf types.str;
description =
"IPv6 prefixes to use for GUA wireguard addressing";
description = "IPv6 prefixes to use for GUA wireguard addressing";
};
};
@ -99,21 +100,25 @@
};
};
config =
let
config = let
cfg = config.elss;
hostName = config.system.name;
secretsFile = ../machines
secretsFile =
../machines
+ builtins.toPath "/${hostName}/secrets/wireguard.yaml";
takeNonEmpty = lib.filter (interface: interface != "");
testInterface = predicate:
lib.mapAttrsToList
(interface: value: if (predicate interface value) then interface else "")
(interface: value:
if (predicate interface value)
then interface
else "")
cfg.wireguard.interfaces;
onlyInterfaces = predicate: takeNonEmpty (testInterface predicate);
peerInterfaces =
onlyInterfaces (interface: value: builtins.hasAttr hostName value.peers);
serverInterfaces = onlyInterfaces
serverInterfaces =
onlyInterfaces
(interface: value: builtins.hasAttr hostName value.servers);
interfaces = serverInterfaces ++ peerInterfaces;
@ -135,39 +140,42 @@
};
mkPeerPeer = prefixes: peers: peer: {
allowedIPs = (mkAddresses prefixes peer.localIp)
++ (lib.concatMap (mkAddresses prefixes) peer.extraIps) ++ (if lib.hasAttr hostName peers then peers.${hostName}.additionalAllowedIps else [ ]);
allowedIPs =
(mkAddresses prefixes peer.localIp)
++ (lib.concatMap (mkAddresses prefixes) peer.extraIps)
++ (
if lib.hasAttr hostName peers
then peers.${hostName}.additionalAllowedIps
else []
);
persistentKeepalive = 25;
inherit (peer) publicKey endpoint;
};
mkPostSetup = name: prefixes: servers:
let
mkPostSetup = name: prefixes: servers: let
ifName = mkInterfaceName name;
serverIps = name: server: mkServerAddresses prefixes server.localIp;
dnsServers = lib.concatLists (lib.mapAttrsToList serverIps servers);
in
lib.concatStrings ([
''
${pkgs.systemd}/bin/resolvectl domain ${ifName} ${name}.${config.elss.dns.wgZone}
${pkgs.systemd}/bin/resolvectl default-route ${ifName} true
''
] ++ (map
]
++ (map
(ip: ''
${pkgs.systemd}/bin/resolvectl dns ${ifName} ${ip}
'')
dnsServers));
mkInterfaceConfig = hostName: interface: value:
let
mkInterfaceConfig = hostName: interface: value: let
isServer = builtins.hasAttr hostName value.servers;
isPeer = builtins.hasAttr hostName value.peers;
myConfig =
if isServer then
value.servers."${hostName}"
else
value.peers."${hostName}";
if isServer
then value.servers."${hostName}"
else value.peers."${hostName}";
in
assert lib.asserts.assertMsg
((isServer || isPeer) && !(isServer && isPeer))
@ -176,25 +184,30 @@
privateKeyFile = config.sops.secrets."wireguard-${interface}".path;
ips = mkAddresses value.prefixes myConfig.localIp;
inherit (myConfig) listenPort;
} // (if isServer then {
}
// (
if isServer
then {
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;
postSetup = mkPostSetup interface value.prefixes value.servers;
} else
{ }));
}
else {}
));
mkInterfaceSecret = interface: {
"wireguard-${interface}" = { sopsFile = secretsFile; };
"wireguard-${interface}" = {sopsFile = secretsFile;};
};
mkListenPorts = hostName: interface: value:
if builtins.hasAttr hostName value.servers then
value.servers."${hostName}".listenPort
else if builtins.hasAttr hostName value.peers then
value.peers."${hostName}".listenPort
else
-1;
if builtins.hasAttr hostName value.servers
then value.servers."${hostName}".listenPort
else if builtins.hasAttr hostName value.peers
then value.peers."${hostName}".listenPort
else -1;
mkSysctl = hostName: interface: [
{
@ -210,7 +223,6 @@
value = "1";
}
];
in
lib.mkIf cfg.wireguard.enable {
networking = {
@ -221,7 +233,7 @@
# (lib.mapAttrsToList (mkListenPorts hostName) cfg.wireguard.interfaces);
allowedUDPPorts = lib.filter (port: port > 0) (map
(interface:
lib.attrByPath [ interface "servers" hostName "listenPort" ] (-1)
lib.attrByPath [interface "servers" hostName "listenPort"] (-1)
cfg.wireguard.interfaces)
serverInterfaces);
trustedInterfaces = map mkInterfaceName interfaces;
@ -229,7 +241,7 @@
interfaces = lib.listToAttrs (map
(interface: {
name = mkInterfaceName interface;
value = { mtu = 1300; };
value = {mtu = 1300;};
})
interfaces);
};
@ -239,11 +251,10 @@
systemd.services = lib.listToAttrs (map
(interface: {
name = "wireguard-${mkInterfaceName interface}";
value = { serviceConfig.Restart = "on-failure"; };
value = {serviceConfig.Restart = "on-failure";};
})
interfaces);
boot.kernel.sysctl =
builtins.listToAttrs (lib.concatMap (mkSysctl hostName) serverInterfaces);

View File

@ -1,15 +1,19 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib; {
options.elss.zsh.enable = mkEnableOption "Setup systemwide zsh";
config =
let
config = let
inherit (elss.withConfig config) mapAllUsers;
cfg = config.elss.zsh;
in
mkIf cfg.enable {
environment = {
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh/" ];
shells = [pkgs.zsh];
pathsToLink = ["/share/zsh/"];
sessionVariables = rec {
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
@ -29,10 +33,10 @@ with lib; {
autosuggestions.enable = true;
syntaxHighlighting = {
enable = true;
highlighters = [ "main" "brackets" "root" "line" ];
highlighters = ["main" "brackets" "root" "line"];
#styles = { cursor = "standout,underline"; };
};
setOptions = [ "auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory" ];
setOptions = ["auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory"];
shellInit = ''
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> { }
, ...
}:
let
{
pkgs ? import <nixpkgs> {},
sops-nix ? pkgs.callPackage <sops-nix> {},
...
}: let
sops-rekey = pkgs.writeShellScriptBin "sops-rekey" ''
${pkgs.findutils}/bin/find . -wholename '*/secrets/*.yaml' -exec ${pkgs.sops}/bin/sops updatekeys {} \;
'';
in
pkgs.mkShell {
sopsPGPKeyDirs = [ ./keys/users ./keys/hosts ];
pkgs.mkShell {
sopsPGPKeyDirs = [./keys/users ./keys/hosts];
nativeBuildInputs = [
sops-nix.sops-import-keys-hook
@ -17,4 +16,4 @@ pkgs.mkShell {
sops-rekey
pkgs.wireguard-tools
];
}
}

View File

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

View File

@ -6,32 +6,37 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, jupyterWith, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
let
outputs = {
self,
nixpkgs,
jupyterWith,
flake-utils,
}:
flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin"] (
system: let
pkgs = import nixpkgs {
system = system;
overlays = nixpkgs.lib.attrValues jupyterWith.overlays;
};
prince = pkgs.python3Packages.buildPythonPackage rec {
name = "prince";
src = pkgs.fetchFromGitHub{
src = pkgs.fetchFromGitHub {
owner = "MaxHalford";
repo = "prince";
rev = "bd5b29fafe853579c9d41e954caa4504d585665d";
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;
dontUseSetuptoolsCheck = true;
};
iPython = pkgs.kernels.iPythonWith {
name = "Python-env";
packages = p: with p; [ sympy numpy pandas prince ];
packages = p: with p; [sympy numpy pandas prince];
ignoreCollisions = true;
};
jupyterEnvironment = pkgs.jupyterlabWith {
kernels = [ iPython ];
kernels = [iPython];
};
in rec {
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; };
} // (flake-utils.lib.eachDefaultSystem (system:
let
unstable = import nixpkgs-unstable { inherit system; };
}
// (flake-utils.lib.eachDefaultSystem (
system: let
unstable = import nixpkgs-unstable {inherit system;};
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay)];
overlays = [(import rust-overlay)];
};
in
rec {
devShell =
pkgs.mkShell {
in rec {
devShell = pkgs.mkShell {
RUST_LOG = "debug";
RUST_BACKTRACE = 1;
buildInputs = [
@ -50,4 +57,3 @@
}
));
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,18 @@
{ config, pkgs, lib, ...}:
{
programs= {
config,
pkgs,
lib,
...
}: {
programs = {
git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
extraConfig = {
core = { editor = "emacsclient"; };
init = { defaultBranch = "main";};
branch = { autosetuprebase = "always";};
safe.directory = [ "/etc/nixos" ];
core = {editor = "emacsclient";};
init = {defaultBranch = "main";};
branch = {autosetuprebase = "always";};
safe.directory = ["/etc/nixos"];
};
lfs.enable = true;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,17 +1,20 @@
{ config, pkgs, lib, nixosConfig, ... }:
{
config,
pkgs,
lib,
nixosConfig,
...
}:
with lib; {
config =
let
config = let
cfg = nixosConfig.elss.graphical.i3;
in
mkIf cfg.enable {
services.polybar = {
enable = true;
package = pkgs.polybarFull;
settings =
let
settings = let
# solarized theme colours ~ https://en.wikipedia.org/wiki/Solarized
#content tones
Base01 = "#586e75";
Base00 = "#657b83";
@ -57,8 +60,7 @@ with lib; {
"Weather Icons:size=12;0"
"Hasklug Nerd Font,Hasklig Medium:style=Medium,Regular"
];
in
{
in {
"bar/main" = {
font = fonts;
modules = {
@ -119,7 +121,7 @@ with lib; {
format.volume = "<ramp-volume> <label-volume>";
label.muted.text = "🔇";
label.muted.foreground = "#666";
ramp.volume = [ "🔈" "🔉" "🔊" ];
ramp.volume = ["🔈" "🔉" "🔊"];
click.right = "${pkgs.pavucontrol}/bin/pavucontrol &";
# format-volume-underline = Base2;
# format-muted-underline = Base2;
@ -204,7 +206,6 @@ with lib; {
#;label-disconnected = %ifname% disconnected
#;label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-foreground = foreground_altcol;
};
"module/eth" = {

View File

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

View File

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

View File

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