[treewide] reformat all files with nixfmt-rfc-style

This commit is contained in:
Trolli Schmittlauch 2024-03-16 17:18:20 +01:00
parent 3a31c21ae2
commit 2bdff39416
17 changed files with 653 additions and 531 deletions

View file

@ -1,20 +1,22 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
inputs = config.inputInjection.flake-inputs; inputs = config.inputInjection.flake-inputs;
unstable = inputs.nixos-unstable; unstable = inputs.nixos-unstable;
in in
{ {
imports = imports = [
[
./packages.nix ./packages.nix
./nitrokey.nix ./nitrokey.nix
]; ];
services.davfs2.enable = true; services.davfs2.enable = true;
# exfat support # exfat support
#boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ]; #boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];
@ -38,8 +40,7 @@ in
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
programs.bash.enableCompletion = true; programs.bash.enableCompletion = true;
programs.wireshark = programs.wireshark = {
{
enable = true; enable = true;
package = pkgs.wireshark; package = pkgs.wireshark;
}; };
@ -59,8 +60,18 @@ in
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
networking.firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; networking.firewall.allowedTCPPortRanges = [
networking.firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; # for KDE connect {
from = 1714;
to = 1764;
}
];
networking.firewall.allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
]; # for KDE connect
# FIXME: kdeconnect module # FIXME: kdeconnect module
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; # networking.firewall.enable = false;
@ -104,19 +115,17 @@ in
}; };
}; };
}; };
}; };
services.avahi.enable = true; services.avahi.enable = true;
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing = services.printing = {
{
enable = true; enable = true;
drivers = [ pkgs.hplip ]; drivers = [ pkgs.hplip ];
}; };
# scanners # scanners
hardware.sane = hardware.sane = {
{
enable = true; enable = true;
extraBackends = [ pkgs.hplip ]; extraBackends = [ pkgs.hplip ];
}; };
@ -125,13 +134,14 @@ in
hardware.pulseaudio = { hardware.pulseaudio = {
enable = true; enable = true;
# decouple pulseaudio application and sink volumes # decouple pulseaudio application and sink volumes
daemon.config = { flat-volumes = "no"; }; daemon.config = {
flat-volumes = "no";
};
# C3D2 hq music # C3D2 hq music
zeroconf.discovery.enable = true; zeroconf.discovery.enable = true;
zeroconf.publish.enable = true; zeroconf.publish.enable = true;
}; };
# Bluetooth # Bluetooth
hardware.bluetooth = { hardware.bluetooth = {
enable = true; enable = true;
@ -141,7 +151,6 @@ in
package = pkgs.pulseaudioFull; package = pkgs.pulseaudioFull;
}; };
# FIXME: at some point, hide GUI and sound (desktop vs. server) behind an option # FIXME: at some point, hide GUI and sound (desktop vs. server) behind an option
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services.xserver.enable = true;
@ -171,7 +180,18 @@ in
users.users.spiollinux = { users.users.spiollinux = {
isNormalUser = true; isNormalUser = true;
uid = 1000; uid = 1000;
extraGroups = [ "vboxusers" "wheel" "networkmanager" "scanner" "lp" "wireshark" "dialout" "cdrom" "input" "adbusers" ]; extraGroups = [
"vboxusers"
"wheel"
"networkmanager"
"scanner"
"lp"
"wireshark"
"dialout"
"cdrom"
"input"
"adbusers"
];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
@ -184,8 +204,7 @@ in
nixpkgs.config.whitelistedLicenses = [ pkgs.lib.licenses.virtualbox-puel ]; nixpkgs.config.whitelistedLicenses = [ pkgs.lib.licenses.virtualbox-puel ];
users.extraGroups.vboxusers.members = [ "spiollinux" ]; users.extraGroups.vboxusers.members = [ "spiollinux" ];
programs.zsh = programs.zsh = {
{
enable = true; enable = true;
autosuggestions.enable = true; autosuggestions.enable = true;
}; };
@ -214,7 +233,11 @@ in
keep-outputs = true; keep-outputs = true;
keep-derivations = true; keep-derivations = true;
trusted-users = [ "spiollinux" ]; trusted-users = [ "spiollinux" ];
experimental-features = [ "nix-command" "flakes" "repl-flake" ]; experimental-features = [
"nix-command"
"flakes"
"repl-flake"
];
# use all cores for building # use all cores for building
cores = 0; cores = 0;
}; };
@ -254,6 +277,4 @@ in
# stop NetworkManager from managing virtual interfaces # stop NetworkManager from managing virtual interfaces
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ]; networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
} }

View file

@ -1,11 +1,13 @@
{ pkgs, lib, ...}: { pkgs, lib, ... }:
{ {
hardware.nitrokey.enable = true; hardware.nitrokey.enable = true;
environment.systemPackages = [ pkgs.pynitrokey ]; environment.systemPackages = [ pkgs.pynitrokey ];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"nrfutil" "nrfutil"
"pc-ble-driver-py" "pc-ble-driver-py"
"pc-ble-driver" "pc-ble-driver"
"pypemicro" "pypemicro"
]; ];
} }

View file

@ -1,10 +1,17 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
{ {
# take overlays from flake # take overlays from flake
nixpkgs.overlays = lib.attrValues config.inputInjection.flake-inputs.self.overlays; nixpkgs.overlays = lib.attrValues config.inputInjection.flake-inputs.self.overlays;
# List packages installed in system profile. # List packages installed in system profile.
environment.systemPackages = with pkgs; [ environment.systemPackages =
with pkgs;
[
wget wget
vim vim
vimPlugins.vim-nix vimPlugins.vim-nix
@ -45,7 +52,10 @@
networkmanager-openvpn networkmanager-openvpn
plasma5Packages.kdeGear.akonadi-mime # for KOrganizer plasma5Packages.kdeGear.akonadi-mime # for KOrganizer
] ]
++ (with plasma5Packages; with kdeGear; [ ++ (
with plasma5Packages;
with kdeGear;
[
#akonadi #akonadi
#akonadi-calendar #akonadi-calendar
#akonadi-contacts #akonadi-contacts
@ -83,7 +93,6 @@
# for some Flatpak packkages # for some Flatpak packkages
accountsservice accountsservice
]); ]
);
} }

View file

@ -25,35 +25,47 @@
flake = false; flake = false;
url = "git+ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git"; url = "git+ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git";
}; };
}; };
outputs = outputs =
{ self, nixpkgs, nur, lanzaboote, utils, home-manager, treefmt-nix, ... }@inputs: {
self,
nixpkgs,
nur,
lanzaboote,
utils,
home-manager,
treefmt-nix,
...
}@inputs:
let let
# FIXME: allow different systems # FIXME: allow different systems
systems = utils.lib.system; systems = utils.lib.system;
# necessary to make the top-level inputs available to system configuration # necessary to make the top-level inputs available to system configuration
# inspired by https://jade.fyi/blog/flakes-arent-real/ # inspired by https://jade.fyi/blog/flakes-arent-real/
inputInjection = {pkgs, lib, ...}: { inputInjection =
{ pkgs, lib, ... }:
{
options.inputInjection = lib.mkOption { options.inputInjection = lib.mkOption {
type = with lib.types; attrsOf unspecified; type = with lib.types; attrsOf unspecified;
default = {}; default = { };
}; };
config.inputInjection = { config.inputInjection = {
flake-inputs = inputs; flake-inputs = inputs;
}; };
}; };
defaultModules = system: [ defaultModules = system: [ inputInjection ];
inputInjection mkSystem =
]; system: extraModules:
mkSystem = system: extraModules:
nixpkgs.lib.nixosSystem rec { nixpkgs.lib.nixosSystem rec {
modules = (defaultModules system) ++ extraModules; modules = (defaultModules system) ++ extraModules;
inherit system; inherit system;
specialArgs = {inherit system;}; specialArgs = {
inherit system;
}; };
mkHomeManager = confName: user: system: # unfortunately, home-manager configs are still system-specific };
mkHomeManager =
confName: user: system: # unfortunately, home-manager configs are still system-specific
# FIXME: this is thus still linux-x86_64 specific # FIXME: this is thus still linux-x86_64 specific
home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
@ -75,7 +87,9 @@
inherit inputs system; inherit inputs system;
}; };
}; };
treefmtConf = {pkgs, ...}:{ treefmtConf =
{ pkgs, ... }:
{
projectRootFile = "flake.nix"; projectRootFile = "flake.nix";
programs.nixfmt-rfc-style.enable = true; programs.nixfmt-rfc-style.enable = true;
}; };
@ -83,11 +97,21 @@
{ {
overlays.default = import ./packages; overlays.default = import ./packages;
nixosConfigurations = { nixosConfigurations = {
thinknix = mkSystem systems.x86_64-linux [ ./hosts/thinknix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s lanzaboote.nixosModules.lanzaboote ]; thinknix = mkSystem systems.x86_64-linux [
framenix = mkSystem systems.x86_64-linux [ ./hosts/framenix inputs.nixos-hardware.nixosModules.framework-13-7040-amd lanzaboote.nixosModules.lanzaboote ]; ./hosts/thinknix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s
lanzaboote.nixosModules.lanzaboote
];
framenix = mkSystem systems.x86_64-linux [
./hosts/framenix
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
lanzaboote.nixosModules.lanzaboote
];
}; };
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux; homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
} // utils.lib.eachDefaultSystem(system: }
// utils.lib.eachDefaultSystem (
system:
let let
nixpkgs = import inputs.nixpkgs { nixpkgs = import inputs.nixpkgs {
inherit system; inherit system;
@ -100,13 +124,13 @@
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system}; pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf; treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf;
in { in
devShells.default = pkgs.mkShell { {
buildInputs = []; devShells.default = pkgs.mkShell { buildInputs = [ ]; };
};
formatter = treefmtEval.config.build.wrapper; formatter = treefmtEval.config.build.wrapper;
checks.formatting = treefmtEval.config.build.check self; checks.formatting = treefmtEval.config.build.check self;
# expose nixpkgs with overlay; TODO: figure out role of config # expose nixpkgs with overlay; TODO: figure out role of config
#legacyPackages = nixpkgs; #legacyPackages = nixpkgs;
}); }
);
} }

View file

@ -1,4 +1,10 @@
{ pkgs, inputs, config, system, ... }: {
pkgs,
inputs,
config,
system,
...
}:
with pkgs; with pkgs;
let let
@ -45,7 +51,6 @@ let
logseq logseq
# for Hibiscus banking software # for Hibiscus banking software
jameica jameica
#ToDo: which of these drivers is actually used? #ToDo: which of these drivers is actually used?
@ -53,7 +58,8 @@ let
chromedriver chromedriver
]; ];
graphicsApps = [ graphicsApps =
[
inkscape inkscape
darktable darktable
hugin hugin
@ -62,12 +68,10 @@ let
gimp gimp
xournal xournal
] ]
++ ( ++ (with gimpPlugins; [
with gimpPlugins; [
fourier fourier
lqrPlugin lqrPlugin
] ]);
);
multimediaApps = [ multimediaApps = [
mpv mpv
@ -127,14 +131,17 @@ let
nix-output-monitor nix-output-monitor
]; ];
kdeTools = with plasma5Packages; with kdeGear; [ kdeTools =
with plasma5Packages;
with kdeGear;
[
okular okular
gwenview gwenview
yakuake yakuake
kmail kmail
kontact kontact
korganizer korganizer
akonadi-mime #for KOrganizer akonadi-mime # for KOrganizer
kaddressbook kaddressbook
kdeconnect kdeconnect
dolphin dolphin
@ -153,13 +160,11 @@ let
akonadiconsole akonadiconsole
tokodon # mastodon client tokodon # mastodon client
] ]
++ ( ++ (with kdeFrameworks; [
with kdeFrameworks; [
networkmanager-qt networkmanager-qt
kcrash kcrash
breeze-gtk breeze-gtk
] ]);
);
devTools = [ devTools = [
curl curl
@ -182,14 +187,12 @@ let
cabal2nix cabal2nix
]; ];
latexApps = [ latexApps = [
texmaker texmaker
kile kile
biber biber
# customize texlive installation # customize texlive installation
( (texlive.combine {
texlive.combine {
inherit (texlive) inherit (texlive)
scheme-medium scheme-medium
@ -213,8 +216,7 @@ let
logreq logreq
koma-script koma-script
; ;
} })
)
]; ];
pythonApps = with python3Packages; [ pythonApps = with python3Packages; [
@ -228,7 +230,6 @@ let
mypy mypy
]; ];
fonts = [ fonts = [
comic-neue comic-neue
source-sans-pro source-sans-pro
@ -237,9 +238,7 @@ let
ubuntu_font_family ubuntu_font_family
twemoji-color-font twemoji-color-font
open-sans open-sans
(iosevka-bin.override { (iosevka-bin.override { variant = "curly-slab"; })
variant = "curly-slab";
})
config.nur.repos.schmittlauch.vollkorn config.nur.repos.schmittlauch.vollkorn
# TODO: humor-sans # TODO: humor-sans
]; ];
@ -248,15 +247,14 @@ let
superTuxKart superTuxKart
#hedgewars #hedgewars
]; ];
in in
{ {
nixpkgs.overlays = (import ./overlays.nix); nixpkgs.overlays = (import ./overlays.nix);
nixpkgs.config = { nixpkgs.config = {
clementine.spotify = false; clementine.spotify = false;
vim = vim = {
{ gui = "gtk3"; gui = "gtk3";
python = true; python = true;
multibyteSupport = true; multibyteSupport = true;
}; };
@ -273,14 +271,12 @@ in
++ kdeTools ++ kdeTools
++ fonts ++ fonts
++ nixHelpers ++ nixHelpers
++ games ++ games;
;
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.stateVersion = "22.11"; home.stateVersion = "22.11";
programs.direnv = programs.direnv = {
{
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
enableZshIntegration = true; enableZshIntegration = true;
@ -292,19 +288,16 @@ in
programs.bat.enable = true; programs.bat.enable = true;
services.gpg-agent = services.gpg-agent = {
{
enable = true; enable = true;
#enableSshSupport = true; #enableSshSupport = true;
pinentryFlavor = "qt"; pinentryFlavor = "qt";
}; };
programs.ssh = programs.ssh = {
{
enable = true; enable = true;
# ssh host config # ssh host config
matchBlocks = matchBlocks = import "${inputs.mysecrets}/ssh_hosts.nix";
import "${inputs.mysecrets}/ssh_hosts.nix";
}; };
programs.tmux = { programs.tmux = {
@ -312,7 +305,8 @@ in
keyMode = "vi"; keyMode = "vi";
extraConfig = extraConfig =
# for direnv not messing up the environment # for direnv not messing up the environment
''set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES" ''
set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES set-environment -gu DIRENV_WATCHES
@ -334,11 +328,13 @@ in
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
programs.git = programs.git =
let contacts = import "${inputs.mysecrets}/contacts.nix"; let
contacts = import "${inputs.mysecrets}/contacts.nix";
in in
{ {
enable = true; enable = true;
includes = [ includes =
[
{ {
condition = "gitdir:~/Seafile/Studium/"; condition = "gitdir:~/Seafile/Studium/";
contents = { contents = {
@ -355,21 +351,29 @@ in
} }
] ]
# set default name for several other common locations # set default name for several other common locations
++ map ++
map
(dir: { (dir: {
condition = "gitdir:${dir}"; condition = "gitdir:${dir}";
contents = { contents = {
user.name = "Trolli Schmittlauch"; user.name = "Trolli Schmittlauch";
user.email = contacts.mainMail; user.email = contacts.mainMail;
}; };
}) [ "~/src/" "~/bin/" "~/tmp/" "~/nixconfigs/" ]; })
[
"~/src/"
"~/bin/"
"~/tmp/"
"~/nixconfigs/"
];
extraConfig = { extraConfig = {
credential.helper = "cache"; credential.helper = "cache";
push.default = "simple"; push.default = "simple";
init.defaultBranch = "mainline"; init.defaultBranch = "mainline";
diff.tool = "vimdiff"; diff.tool = "vimdiff";
merge.tool = "vimdiff"; merge.tool = "vimdiff";
core.excludesfile = toString (pkgs.writeText ".gitignore_global" '' core.excludesfile = toString (
pkgs.writeText ".gitignore_global" ''
# Direnv stuff # Direnv stuff
.direnv .direnv
.envrc .envrc
@ -378,7 +382,8 @@ in
*~ *~
*.swp *.swp
*.swo *.swo
''); ''
);
core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab"; core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
}; };
lfs.enable = true; lfs.enable = true;
@ -424,7 +429,7 @@ in
]; ];
} }
EOF EOF
${EDITOR:-vim} default.nix ${"EDITOR:-vim"} default.nix
fi fi
} }
@ -433,11 +438,15 @@ in
} }
''; '';
oh-my-zsh = { oh-my-zsh = {
enable = true; enable = true;
theme = "bira"; theme = "bira";
plugins = [ "git" "python" "systemd" "gpg-agent"]; plugins = [
"git"
"python"
"systemd"
"gpg-agent"
];
}; };
}; };
home.shellAliases = { home.shellAliases = {

View file

@ -1,9 +1,9 @@
[ [
( (self: super: rec {
self: super: myVim =
rec { with super;
myVim = with super; neovim.override { configure = { neovim.override {
configure = {
packages.myVimPackage = with pkgs.vimPlugins; { packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on start # loaded on start
start = [ start = [
@ -25,8 +25,7 @@
]; ];
}; };
customRC = builtins.readFile ./vimrc; customRC = builtins.readFile ./vimrc;
};}; };
} };
) })
] ]

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, system, ...}: {
config,
lib,
pkgs,
system,
...
}:
let let
unstable = config.inputInjection.flake-inputs.nixos-unstable.legacyPackages.${system}; unstable = config.inputInjection.flake-inputs.nixos-unstable.legacyPackages.${system};
in in
@ -65,4 +71,3 @@ in
pkgs.framework-tool pkgs.framework-tool
]; ];
} }

View file

@ -1,18 +1,27 @@
# 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 = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"thunderbolt"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
# 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
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction

View file

@ -1,13 +1,21 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
fsOptions = [ "noatime" "ssd" "compress=zstd" ]; fsOptions = [
"noatime"
"ssd"
"compress=zstd"
];
in in
{ {
boot.initrd.luks = { boot.initrd.luks = {
devices = devices =
# allow discards on all devices # allow discards on all devices
builtins.mapAttrs (name: val: val // {allowDiscards = true;}) builtins.mapAttrs (name: val: val // { allowDiscards = true; }) {
{
"system".device = "/dev/disk/by-uuid/1838cdc5-9b0b-4c46-9f23-9465549eeb92"; "system".device = "/dev/disk/by-uuid/1838cdc5-9b0b-4c46-9f23-9465549eeb92";
"cryptswap".device = "/dev/disk/by-uuid/ded7d649-ab3a-42ee-ae4a-f8c4ba029e9c"; "cryptswap".device = "/dev/disk/by-uuid/ded7d649-ab3a-42ee-ae4a-f8c4ba029e9c";
}; };
@ -37,7 +45,10 @@ in
services.fstrim.enable = true; services.fstrim.enable = true;
services.btrfs.autoScrub = { services.btrfs.autoScrub = {
enable = true; enable = true;
fileSystems = [ "/" "/home" ]; fileSystems = [
"/"
"/home"
];
}; };
boot.tmp.useTmpfs = true; boot.tmp.useTmpfs = true;

View file

@ -1,7 +1,5 @@
{ {
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/24c47f3d-0d3e-4575-92a2-174b5a6b6086"; } ];
[ { device = "/dev/disk/by-uuid/24c47f3d-0d3e-4575-92a2-174b5a6b6086"; }
];
zramSwap = { zramSwap = {
enable = true; enable = true;

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ...}: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [
../../common ../../common
@ -10,7 +15,6 @@
./secureboot.nix ./secureboot.nix
]; ];
hardware.trackpoint = { hardware.trackpoint = {
enable = true; enable = true;
sensitivity = 180; sensitivity = 180;
@ -19,7 +23,6 @@
networking.hostName = "thinknix"; networking.hostName = "thinknix";
# This value determines the NixOS release with which your system is to be # This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database # compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you # servers. You should change this only after NixOS release notes say you

View file

@ -1,20 +1,28 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
nix.settings.max-jobs = lib.mkDefault 4; nix.settings.max-jobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
# modesetting is always better than intel (legacy) # modesetting is always better than intel (legacy)
services.xserver.videoDrivers = [ "modesetting" ]; services.xserver.videoDrivers = [ "modesetting" ];
} }

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ...}: {
config,
lib,
pkgs,
...
}:
{ {
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# UEFI secure boot # UEFI secure boot
environment.systemPackages = [ environment.systemPackages = [ pkgs.sbctl ];
pkgs.sbctl
];
# Lanzaboote currently replaces the systemd-boot module. # Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix # This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false # generated at installation time. So we force it to false
@ -16,5 +19,4 @@
enable = true; enable = true;
pkiBundle = "/etc/secureboot"; pkiBundle = "/etc/secureboot";
}; };
} }

View file

@ -1,14 +1,23 @@
{ config, lib, pkgs, ...}: {
config,
lib,
pkgs,
...
}:
let let
fsOptions = [ "noatime" "ssd" "space_cache" "compress=zstd" ]; fsOptions = [
"noatime"
"ssd"
"space_cache"
"compress=zstd"
];
in in
{ {
# encrypted partitions # encrypted partitions
boot.initrd.luks = { boot.initrd.luks = {
devices = devices =
# allow discards on all devices # allow discards on all devices
builtins.mapAttrs (name: val: val // {allowDiscards = true;}) builtins.mapAttrs (name: val: val // { allowDiscards = true; }) {
{
"system".device = "/dev/disk/by-uuid/85154131-b2a8-4ef5-9d74-47429cb267ef"; "system".device = "/dev/disk/by-uuid/85154131-b2a8-4ef5-9d74-47429cb267ef";
"cryptswap".device = "/dev/disk/by-uuid/ac586df6-6332-4809-beb1-f51906a2adaa"; "cryptswap".device = "/dev/disk/by-uuid/ac586df6-6332-4809-beb1-f51906a2adaa";
"ssd2".device = "/dev/disk/by-uuid/cadd4e1f-3642-4faa-8d4e-37dd85465df1"; "ssd2".device = "/dev/disk/by-uuid/cadd4e1f-3642-4faa-8d4e-37dd85465df1";
@ -57,16 +66,20 @@ in
services.fstrim.enable = true; services.fstrim.enable = true;
services.btrfs.autoScrub = { services.btrfs.autoScrub = {
enable = true; enable = true;
fileSystems = [ "/" "/home" ]; fileSystems = [
"/"
"/home"
];
}; };
boot.tmp.useTmpfs = true; boot.tmp.useTmpfs = true;
fileSystems."/tmp".fsType = "tmpfs"; fileSystems."/tmp".fsType = "tmpfs";
services.smartd = services.smartd = {
{
enable = true; enable = true;
devices = [{ device = "/dev/sda"; } { device = "/dev/sdb"; }]; devices = [
{ device = "/dev/sda"; }
{ device = "/dev/sdb"; }
];
}; };
} }

View file

@ -1,7 +1,5 @@
{ {
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-uuid/bf928178-4e92-4e7e-8df2-18fbd658eecf"; } ];
{ device = "/dev/disk/by-uuid/bf928178-4e92-4e7e-8df2-18fbd658eecf"; }
];
zramSwap = { zramSwap = {
enable = true; enable = true;

View file

@ -1,10 +1,15 @@
{ config, pkgs, experimentUid ? 1000, ... }: {
config,
pkgs,
experimentUid ? 1000,
...
}:
let let
projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW"; projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
projectPath = builtins.toPath projectDir; projectPath = builtins.toPath projectDir;
projectMount = "/mnt/project"; projectMount = "/mnt/project";
shell = (import (projectDir + "/Hash2Pub/default.nix") {}).shell; shell = (import (projectDir + "/Hash2Pub/default.nix") { }).shell;
simulationSetupScript = pkgs.writeShellScriptBin "simulationSetup" '' simulationSetupScript = pkgs.writeShellScriptBin "simulationSetup" ''
# make cabal-install work offline # make cabal-install work offline
mkdir $HOME/.cabal mkdir $HOME/.cabal
@ -13,24 +18,29 @@ let
# run simulation script within the shell # run simulation script within the shell
${pkgs.nix}/bin/nix-shell ${shell.drvPath} --command "cd ${projectMount} && bash ./build/simulationrunner.sh 2>&1" ${pkgs.nix}/bin/nix-shell ${shell.drvPath} --command "cd ${projectMount} && bash ./build/simulationrunner.sh 2>&1"
''; '';
instanceData = builtins.fromJSON (builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json"); instanceData = builtins.fromJSON (
builtins.readFile "${projectDir}/simulationData/inputs/generated/instances_sample.json"
);
in in
{ {
privateNetwork = true; privateNetwork = true;
ephemeral = true; ephemeral = true;
bindMounts = { bindMounts = {
"${projectMount}" = { hostPath = projectDir; isReadOnly = false; }; "${projectMount}" = {
hostPath = projectDir;
isReadOnly = false;
};
}; };
config = { config = {
networking = { networking = {
firewall.enable = false; firewall.enable = false;
interfaces.lo.ipv6.addresses = interfaces.lo.ipv6.addresses = builtins.map (inst: {
builtins.map (inst: {address = inst.ip; prefixLength = 0;}) instanceData; address = inst.ip;
extraHosts = prefixLength = 0;
pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData; }) instanceData;
extraHosts = pkgs.lib.concatMapStringsSep "\n" (inst: "${inst.ip} ${inst.hostname}") instanceData;
}; };
# avoid permission problems with project builds # avoid permission problems with project builds
users.users.experimentor = { users.users.experimentor = {
@ -39,12 +49,14 @@ in
}; };
# adjust open file limits # adjust open file limits
security.pam.loginLimits = [{ security.pam.loginLimits = [
domain = "*" {
; type = "-" domain = "*";
; item = "nofile" type = "-";
; value = "50000" item = "nofile";
;}]; value = "50000";
}
];
environment.systemPackages = [ environment.systemPackages = [
pkgs.netcat pkgs.netcat

View file

@ -8,5 +8,4 @@ final: prev: {
}) })
]; ];
}); });
} }