Update formatter

This commit is contained in:
Fabian Hauser 2024-04-10 10:53:41 +07:00
parent 4eea2232fb
commit d8235cb2a9
55 changed files with 1031 additions and 664 deletions

View file

@ -1,7 +1,13 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
environment.systemPackages = with pkgs;
environment.systemPackages =
with pkgs;
[
vim
tmux
@ -25,8 +31,20 @@
units
powertop
lm_sensors
] ++ [ nixfmt nix-index nix-diff nixpkgs-review nixos-option ]
++ [ autojump powerline-go ] ++ [ # File Utilities
]
++ [
nixfmt
nix-index
nix-diff
nixpkgs-review
nixos-option
]
++ [
autojump
powerline-go
]
++ [
# File Utilities
ripgrep
unzip
p7zip
@ -40,7 +58,9 @@
vimPlugins.airline
git
git-lfs
] ++ [ # Filesystem & Disk Utilities
]
++ [
# Filesystem & Disk Utilities
exfat
samba
cifs-utils
@ -52,7 +72,9 @@
smartmontools
parted
usbutils
] ++ [ # Networking Utilities
]
++ [
# Networking Utilities
nmap
bind
curl
@ -68,5 +90,4 @@
imapsync
bluez-tools
];
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
users = {
@ -7,10 +12,15 @@ let
isNormalUser = true;
description = "Fabian Hauser";
group = "fhauser";
extraGroups =
[ "wheel" "video" "docker" "networkmanager" "libvirtd" "adbusers" ];
hashedPassword =
"$6$rounds=20000$TYZ8CojfBLwejcwn$smEJe6/anL9NGf.Ytfny14nBfhr4TRPv2XK1lgHz7yg.zQow1HACePirEjsjxzFC6vTHGaT8t2NxobUsHbWLg1";
extraGroups = [
"wheel"
"video"
"docker"
"networkmanager"
"libvirtd"
"adbusers"
];
hashedPassword = "$6$rounds=20000$TYZ8CojfBLwejcwn$smEJe6/anL9NGf.Ytfny14nBfhr4TRPv2XK1lgHz7yg.zQow1HACePirEjsjxzFC6vTHGaT8t2NxobUsHbWLg1";
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000603507108"
];
@ -22,18 +32,22 @@ let
description = "Testuser empty0";
group = "empty0";
extraGroups = [ "video" ];
hashedPassword =
"$6$mlI7Au.EzmrL9uJj$vz8ujechSkx83tsFcRA8D04vh5.3ZwPlPmE.wsf2CTKvLio48a1eXtRxUHkkDfPlLAjqyJ55bSSw2lLazH9Ip/";
hashedPassword = "$6$mlI7Au.EzmrL9uJj$vz8ujechSkx83tsFcRA8D04vh5.3ZwPlPmE.wsf2CTKvLio48a1eXtRxUHkkDfPlLAjqyJ55bSSw2lLazH9Ip/";
};
};
in {
imports = [ ../../modules ./unfree.nix ./applications.nix ./overlays.nix ];
in
{
imports = [
../../modules
./unfree.nix
./applications.nix
./overlays.nix
];
boot.loader.timeout = 2;
boot.tmp.useTmpfs = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
catppuccin.flavour = "mocha";
console.keyMap = "de_CH-latin1";
@ -46,17 +60,21 @@ in {
empty0.gid = 1003;
};
users.users = users // {
root.openssh.authorizedKeys.keys = with lib;
concatLists (mapAttrsToList (name: user:
if elem "wheel" user.extraGroups then
user.openssh.authorizedKeys.keys
else
[ ]) users);
root.openssh.authorizedKeys.keys =
with lib;
concatLists (
mapAttrsToList (
name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else [ ]
) users
);
};
# Package management
nix = {
settings.trusted-users = [ "root" "@wheel" ];
settings.trusted-users = [
"root"
"@wheel"
];
optimise.automatic = true;
gc = {
automatic = true;

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, options, ... }:
{
config,
lib,
pkgs,
options,
...
}:
{
nixpkgs.overlays = [ (import ../../overlays) ];

View file

@ -1,7 +1,13 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
nixpkgs.config.allowUnfreePredicate = pkg:
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"unrar"

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
@ -14,24 +19,26 @@
'';
# request-key expects a configuration file under /etc
environment.etc."request-key.conf" = {
text = let
upcall = "${pkgs.cifs-utils}/bin/cifs.upcall";
keyctl = "${pkgs.keyutils}/bin/keyctl";
in ''
#OP TYPE DESCRIPTION CALLOUT_INFO PROGRAM
# -t is required for DFS share servers...
create cifs.spnego * * ${upcall} -t %k
create dns_resolver * * ${upcall} %k
# Everything below this point is essentially the default configuration,
# modified minimally to work under NixOS. Notably, it provides debug
# logging.
create user debug:* negate ${keyctl} negate %k 30 %S
create user debug:* rejected ${keyctl} reject %k 30 %c %S
create user debug:* expired ${keyctl} reject %k 30 %c %S
create user debug:* revoked ${keyctl} reject %k 30 %c %S
create user debug:loop:* * |${pkgs.coreutils}/bin/cat
create user debug:* * ${pkgs.keyutils}/share/keyutils/request-key-debug.sh %k %d %c %S
negate * * * ${keyctl} negate %k 30 %S
'';
text =
let
upcall = "${pkgs.cifs-utils}/bin/cifs.upcall";
keyctl = "${pkgs.keyutils}/bin/keyctl";
in
''
#OP TYPE DESCRIPTION CALLOUT_INFO PROGRAM
# -t is required for DFS share servers...
create cifs.spnego * * ${upcall} -t %k
create dns_resolver * * ${upcall} %k
# Everything below this point is essentially the default configuration,
# modified minimally to work under NixOS. Notably, it provides debug
# logging.
create user debug:* negate ${keyctl} negate %k 30 %S
create user debug:* rejected ${keyctl} reject %k 30 %c %S
create user debug:* expired ${keyctl} reject %k 30 %c %S
create user debug:* revoked ${keyctl} reject %k 30 %c %S
create user debug:loop:* * |${pkgs.coreutils}/bin/cat
create user debug:* * ${pkgs.keyutils}/share/keyutils/request-key-debug.sh %k %d %c %S
negate * * * ${keyctl} negate %k 30 %S
'';
};
}

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
imports = [
./desktop-environment.nix
@ -8,5 +14,4 @@
./security.nix
./video.nix
];
}

View file

@ -1,16 +1,29 @@
{ config, pkgs, lib, ... }:
let mkDefault = lib.mkDefault;
in {
{
config,
pkgs,
lib,
...
}:
let
mkDefault = lib.mkDefault;
in
{
environment.systemPackages = with pkgs;
[ # Utilities
environment.systemPackages =
with pkgs;
[
# Utilities
freetype
feh
lxappearance
sound-theme-freedesktop
] ++ [ # Networking
]
++ [
# Networking
gnome.networkmanager-openconnect
] ++ [ # Various
]
++ [
# Various
xfce.thunar
xfce.thunar-archive-plugin
xfce.xfce4-appfinder # xfce.thunar-volman # needed?
@ -79,5 +92,4 @@ in {
wlr.enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
}

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
services.xserver.windowManager.i3.enable = true;

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
@ -44,5 +49,4 @@
programs.light.enable = true;
programs.adb.enable = true;
}

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
services.pcscd.enable = true;

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
#boot.kernelModules = [ "v4l2loopback" ];

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
let
thunderboltDevices = ''
THUNDERBOLT_DEVICES="$(${pkgs.pciutils}/bin/lspci -D | ${pkgs.gnugrep}/bin/grep -i thunderbolt | cut --delimiter=' ' --fields=1)"
@ -33,7 +39,8 @@ let
echo 'Done.'
'';
in {
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [
@ -47,7 +54,10 @@ in {
"igb"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "uhid" ];
boot.kernelModules = [
"kvm-amd"
"uhid"
];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "acpi_enforce_resources=lax" ];
@ -56,6 +66,5 @@ in {
hardware.cpu.amd.updateMicrocode = true;
nix.settings.max-jobs = lib.mkDefault 24;
powerManagement.powerUpCommands =
"${forceThunderboltOnScript}/bin/force-thunderbolt-power-on";
powerManagement.powerUpCommands = "${forceThunderboltOnScript}/bin/force-thunderbolt-power-on";
}

View file

@ -1,13 +1,18 @@
# 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, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.loader.grub.extraConfig =
"\n serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1\n terminal_input serial\n terminal_output serial\n ";
boot.loader.grub.extraConfig = "\n serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1\n terminal_input serial\n terminal_output serial\n ";
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
@ -18,7 +23,11 @@
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "virtio" "tun" ];
boot.kernelModules = [
"kvm-amd"
"virtio"
"tun"
];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "console=ttyS0,115200n8" ];

View file

@ -1,3 +1,12 @@
{ config, lib, pkgs, modulesPath, ... }: {
hardware.rasdaemon = { enable = true; };
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
hardware.rasdaemon = {
enable = true;
};
}

View file

@ -1,4 +1,12 @@
{ config, lib, pkgs, modulesPath, hardwareModules, ... }: {
{
config,
lib,
pkgs,
modulesPath,
hardwareModules,
...
}:
{
imports = with hardwareModules; [
(modulesPath + "/installer/scan/not-detected.nix")
@ -22,8 +30,7 @@
# Ignore Alcor smartcard (gpg is not very smart)
# See https://ludovicrousseau.blogspot.com/2015/12/remove-andor-customize-pcsc-reader-names.html
systemd.services.pcscd.environment.PCSCLITE_FILTER_IGNORE_READER_NAMES =
"Alcor";
systemd.services.pcscd.environment.PCSCLITE_FILTER_IGNORE_READER_NAMES = "Alcor";
#hardware.video.hidpi.enable = true;

View file

@ -1,18 +1,36 @@
{ config, lib, pkgs, modulesPath, hardwareModules, pkgFccUnlock, ... }: {
{
config,
lib,
pkgs,
modulesPath,
hardwareModules,
pkgFccUnlock,
...
}:
{
imports = with hardwareModules; [
(modulesPath + "/installer/scan/not-detected.nix")
hardwareModules.lenovo-thinkpad-x1-9th-gen
];
boot.initrd.availableKernelModules =
[ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "ahci" "usbhid" ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"ahci"
"usbhid"
];
boot.kernelModules = [ "kvm-intel" ];
boot.initrd.kernelModules =
[ "dm-snapshot" ]; # TODO: This should be moved to defaults
boot.initrd.kernelModules = [ "dm-snapshot" ]; # TODO: This should be moved to defaults
environment.systemPackages = with pkgs; [ modemmanager libmbim ];
environment.systemPackages = with pkgs; [
modemmanager
libmbim
];
environment.etc."ModemManager/fcc-unlock.d/1eac:1001" = {
source = "${pkgFccUnlock}/bin/fcc-unlock";

View file

@ -1,9 +1,19 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
services.printing = {
enable = true;
drivers = with pkgs; [ gutenprint hplip splix cups-googlecloudprint ];
drivers = with pkgs; [
gutenprint
hplip
splix
cups-googlecloudprint
];
};
services.system-config-printer.enable = true;

110
flake.nix
View file

@ -15,83 +15,79 @@
url = "git+file:///etc/nixos/fcc-unlock";
inputs.nixos-stable.follows = "nixpkgs-stable";
};
};
outputs = { self, nixpkgs-unstable, nixpkgs-stable, home-manager
, nixos-hardware, fcc-unlock, catppuccin, ... }@inputs:
outputs =
{
self,
nixpkgs-unstable,
nixpkgs-stable,
home-manager,
nixos-hardware,
fcc-unlock,
catppuccin,
...
}@inputs:
let
system = "x86_64-linux";
pkgsUnstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true; # For vscode
};
hosts = [ "speer" "hummelberg" "ochsenchopf" ];
in {
checks.${system}.formatCheck = let pkgs = pkgsUnstable;
in pkgs.runCommand "nixfmt-check" { } ''
set -euo pipefail
cd ${self}
${self.apps.${system}.format.program} --check
mkdir $out
'';
hosts = [
"speer"
"hummelberg"
"ochsenchopf"
];
in
{
# Build with `nixos-rebuild --flake .#<hostname>` or
# `nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel
nixosConfigurations = let
sharedSpecialArgs = {
inherit pkgsUnstable;
pkgFccUnlock = fcc-unlock.packages.${system}.default;
};
home-manager-config = {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = sharedSpecialArgs;
users.fhauser.imports = [
./home/fhauser/default.nix
catppuccin.homeManagerModules.catppuccin
];
nixosConfigurations =
let
sharedSpecialArgs = {
inherit pkgsUnstable;
pkgFccUnlock = fcc-unlock.packages.${system}.default;
};
};
mapHostnameToAttr = host:
nixpkgs-stable.lib.nixosSystem {
inherit system;
specialArgs = sharedSpecialArgs // {
hardwareModules = nixos-hardware.nixosModules;
home-manager-config = {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = sharedSpecialArgs;
users.fhauser.imports = [
./home/fhauser/default.nix
catppuccin.homeManagerModules.catppuccin
];
};
modules = [
home-manager.nixosModules.home-manager
catppuccin.nixosModules.catppuccin
./host/${host}/default.nix
] ++ (if host == "bachtel" then [ ] else [ home-manager-config ]);
};
in pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr;
mapHostnameToAttr =
host:
nixpkgs-stable.lib.nixosSystem {
inherit system;
specialArgs = sharedSpecialArgs // {
hardwareModules = nixos-hardware.nixosModules;
};
modules = [
home-manager.nixosModules.home-manager
catppuccin.nixosModules.catppuccin
./host/${host}/default.nix
] ++ (if host == "bachtel" then [ ] else [ home-manager-config ]);
};
in
pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr;
# Nix development shell
devShells.${system}.default = import ./shell.nix { pkgs = pkgsUnstable; };
# Run checks and build all hosts as default package
packages.${system}.default = with pkgsUnstable.lib;
packages.${system}.default =
with pkgsUnstable.lib;
let
checks = attrValues self.checks.${system};
nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel)
self.nixosConfigurations;
in pkgsUnstable.linkFarmFromDrvs "allHosts" (checks ++ nixosConfigs);
nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
in
pkgsUnstable.linkFarmFromDrvs "allHosts" (checks ++ nixosConfigs);
apps.${system} = {
# Execute nixfmt on the repository
format = let
pkgs = pkgsUnstable;
formatter = pkgsUnstable.writeShellScriptBin "formatter" ''
${pkgs.findutils}/bin/find . -type f -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt $@ {} +
'';
in {
type = "app";
program = "${formatter}/bin/formatter";
};
};
formatter.${system} = pkgsUnstable.nixfmt-rfc-style;
};
}

View file

@ -1,3 +1,4 @@
{ pkgs, lib, ... }: {
{ pkgs, lib, ... }:
{
catppuccin.flavour = "mocha";
}

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
@ -34,15 +39,23 @@
};
home = {
sessionVariables = { NIXOS_OZONE_WL = "1"; };
packages = with pkgs;
[ # Networking
sessionVariables = {
NIXOS_OZONE_WL = "1";
};
packages =
with pkgs;
[
# Networking
transmission # GUI Tools, maybe extract...
] ++ [ # Desktop Environment Applications
]
++ [
# Desktop Environment Applications
google-chrome
chromium
nextcloud-client
] ++ [ # office
]
++ [
# office
calibre
libreoffice-fresh # TODO: Dictionaries, nixos/nixpkgs#14430
tectonic
@ -52,14 +65,18 @@
pkgs.gnome-online-accounts
gnome.gnome-control-center
todoist-electron
] ++ [ # Communication
]
++ [
# Communication
#TODO: ekiga?
jitsi-meet-electron
teamviewer
rdesktop
#davinci-resolve
lightworks
] ++ [ # Development
]
++ [
# Development
vscodium
virt-manager
modemmanager # TODO: makes sense here?
@ -67,34 +84,33 @@
];
#TODO: Write module
activation.statefulConfigSymlinks =
config.lib.dag.entryAfter [ "writeBoundary" ] ''
set -eo pipefail
activation.statefulConfigSymlinks = config.lib.dag.entryAfter [ "writeBoundary" ] ''
set -eo pipefail
STATEFUL_ROOT="$HOME/.stateful"
if [ ! -d "$STATEFUL_ROOT" ]; then
$DRY_RUN_CMD mkdir "$STATEFUL_ROOT"
STATEFUL_ROOT="$HOME/.stateful"
if [ ! -d "$STATEFUL_ROOT" ]; then
$DRY_RUN_CMD mkdir "$STATEFUL_ROOT"
fi
STATEFUL_CONFS=(
".config/spotify"
".mozilla"
".password-store"
)
for STATEFUL_CONF in ''${STATEFUL_CONFS[@]}; do
if [ -e "$STATEFUL_CONF" ] && [ ! -h "$STATEFUL_CONF" ]; then
echo "File $STATEFUL_CONF already exists, exiting!" >&2
exit 1
fi
STATEFUL_CONFS=(
".config/spotify"
".mozilla"
".password-store"
)
for STATEFUL_CONF in ''${STATEFUL_CONFS[@]}; do
if [ -e "$STATEFUL_CONF" ] && [ ! -h "$STATEFUL_CONF" ]; then
echo "File $STATEFUL_CONF already exists, exiting!" >&2
exit 1
fi
if [ -h "$STATEFUL_CONF" ]; then
$DRY_RUN_CMD rm "$STATEFUL_CONF"
fi
if [ -h "$STATEFUL_CONF" ]; then
$DRY_RUN_CMD rm "$STATEFUL_CONF"
fi
STATEFUL_CONF_DIR="$STATEFUL_ROOT/$STATEFUL_CONF"
$DRY_RUN_CMD mkdir -p "$STATEFUL_CONF_DIR"
$DRY_RUN_CMD ln -s $VERBOSE_ARG "$STATEFUL_CONF_DIR" "$HOME/$STATEFUL_CONF"
done
'';
STATEFUL_CONF_DIR="$STATEFUL_ROOT/$STATEFUL_CONF"
$DRY_RUN_CMD mkdir -p "$STATEFUL_CONF_DIR"
$DRY_RUN_CMD ln -s $VERBOSE_ARG "$STATEFUL_CONF_DIR" "$HOME/$STATEFUL_CONF"
done
'';
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
dconf.settings."org/gnome/evolution-data-server/calendar".notify-enable-audio =
false;
{ pkgs, ... }:
{
dconf.settings."org/gnome/evolution-data-server/calendar".notify-enable-audio = false;
}

View file

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

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
services.gammastep = {
enable = true;
settings.general.brightness-night = "0.9";

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
@ -6,8 +7,7 @@
s = "status --short --branch";
a = "add --patch";
c = "commit --message";
l =
"log --color --graph --pretty=format:'%Cred%h%Creset - %C(bold)%s%Creset%C(yellow)%d%Creset %C(green)%an%Creset %C(cyan)%cr%Creset (S: %G?)' --abbrev-commit";
l = "log --color --graph --pretty=format:'%Cred%h%Creset - %C(bold)%s%Creset%C(yellow)%d%Creset %C(green)%an%Creset %C(cyan)%cr%Creset (S: %G?)' --abbrev-commit";
d = "diff";
fup = "commit --fixup";
@ -57,26 +57,34 @@
rerere.enabled = true;
fetch.recurseSubmodules = "on-demand";
};
ignores = [ "*~" "*.swp" ".direnv/" ];
lfs.enable = true;
includes = let
mkConfig = (dir: {
condition = "gitdir:${dir}";
contents = {
user = {
signingkey = "0x8A52A140BEBF7D2C";
email = "fabian@fh2.ch";
name = "Fabian Hauser";
};
};
});
in map mkConfig [
"~/private/"
"/etc/nixos/"
"~/.password-store/"
"~/.stateful/"
"~/shares/cloud.qo.is/"
"~/shares/drive.switch.ch/"
ignores = [
"*~"
"*.swp"
".direnv/"
];
lfs.enable = true;
includes =
let
mkConfig = (
dir: {
condition = "gitdir:${dir}";
contents = {
user = {
signingkey = "0x8A52A140BEBF7D2C";
email = "fabian@fh2.ch";
name = "Fabian Hauser";
};
};
}
);
in
map mkConfig [
"~/private/"
"/etc/nixos/"
"~/.password-store/"
"~/.stateful/"
"~/shares/cloud.qo.is/"
"~/shares/drive.switch.ch/"
];
};
}

View file

@ -1,4 +1,5 @@
{ pkgs, pkgsUnstable, ... }: {
{ pkgs, pkgsUnstable, ... }:
{
#TODO: ENV variabls for agent
programs.gpg = {
enable = true;
@ -14,8 +15,7 @@
"personal-cipher-preferences" = "AES256 AES192 AES CAST5";
"cert-digest-algo" = "SHA512";
"personal-digest-preferences" = "SHA512 SHA384 SHA256 SHA224";
"default-preference-list" =
"SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
"default-preference-list" = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
"display-charset" = "utf-8";
"fixed-list-mode" = true;
"with-fingerprint" = true;
@ -23,7 +23,9 @@
"verify-options" = "show-uid-validity";
"list-options" = "show-uid-validity";
};
scdaemonSettings = { disable-ccid = true; };
scdaemonSettings = {
disable-ccid = true;
};
# TODO: Complete this list and maybe transfer to managed configuration?
#publicKeys = [
# { source = "./fabian.hauser@qo.is.pub"; trust = 5; }
@ -36,17 +38,19 @@
enableSshSupport = true;
enableExtraSocket = true;
# TODO: pinentryPackage =
extraConfig = let
pinentryBemenu = pkgs.writeShellApplication {
name = "pinentry-bemenu-with-env";
text = ''
PATH="$PATH:${pkgs.coreutils}/bin:${pkgs.bemenu}/bin"
"${pkgs.pinentry-bemenu}/bin/pinentry-bemenu" "$@"
'';
};
in ''
pinentry-program ${pinentryBemenu}/bin/pinentry-bemenu-with-env
'';
extraConfig =
let
pinentryBemenu = pkgs.writeShellApplication {
name = "pinentry-bemenu-with-env";
text = ''
PATH="$PATH:${pkgs.coreutils}/bin:${pkgs.bemenu}/bin"
"${pkgs.pinentry-bemenu}/bin/pinentry-bemenu" "$@"
'';
};
in
''
pinentry-program ${pinentryBemenu}/bin/pinentry-bemenu-with-env
'';
sshKeys = [
"99DFB0F28CF9420A2D6383139E86814A1568C81B" # 0x8193A5D218B553DD / fabian.hauser@threema.ch
"638143D3F6421377E9D4C7F1D2EDC5AA0A860351" # 0x3E957C9C8CB5D6B2 / fabian.hauser@qo.is

View file

@ -1,77 +1,109 @@
{ pkgs, lib, config, ... }: {
{
pkgs,
lib,
config,
...
}:
{
# systemd.user.services.kanshi.Install.WantedBy = "home-manager-fhauser.service"; # TODO: Upstream array type of systemdTarget
services.kanshi = {
enable = true;
profiles = let
backgroundPicturePath = "~/pictures/backgrounds";
backgroundCommand = ''
#swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill"
'';
mkScreen = (screen: {
criteria = screen;
status = "enable";
scale = 1.0;
});
homeDellScreen = "Dell Inc. DELL P2720DC 22JPK53";
p14sScreen = "BOE 0x08CE Unknown";
in rec {
#mobile-work.exec = backgroundCommand;
mobile-work.outputs = [
(mkScreen p14sScreen // {
position = "0,0";
scale = 2.0;
})
];
mobile-work-external.outputs = [
(mkScreen p14sScreen // {
position = "1920,0";
scale = 2.0;
})
(mkScreen "Lenovo Group Limited M14 V907R2HD" // { position = "0,0"; })
];
mobile-private.outputs = [
(mkScreen "Unknown 0x1536 0x00000000" // {
position = "0,0";
scale = 1.5;
})
];
home-dock.outputs = mobile-work.outputs ++ [
(mkScreen homeDellScreen // {
position = "1920,0";
scale = 1.0;
status = "enable";
})
];
office-dock.outputs = [
(mkScreen "Dell Inc. DELL P2720DC BRKPK53" // { position = "0,0"; })
(mkScreen "Dell Inc. DELL P2720DC 6JRRK53" // { position = "2560,0"; })
(mkScreen p14sScreen // {
position = "5120,0";
scale = 2.0;
})
];
office-cyrille-dock.outputs = [
(mkScreen "Acer Technologies Acer PE270K 0x0000B784" // {
position = "0,0";
scale = 1.5;
})
(mkScreen p14sScreen // {
position = "2560,0";
scale = 2.0;
})
];
home-pc.outputs = [
(mkScreen homeDellScreen // { position = "0,0"; })
(mkScreen "HP Inc. HP Z27 CN482201RP" // {
position = "2560,0";
scale = 1.5;
})
];
home-pc-row.outputs = home-pc.outputs ++ [
(mkScreen "Eizo Nanao Corporation EV2450 92395086" // {
position = "5120,0";
})
];
};
profiles =
let
backgroundPicturePath = "~/pictures/backgrounds";
backgroundCommand = ''
#swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill"
'';
mkScreen = (
screen: {
criteria = screen;
status = "enable";
scale = 1.0;
}
);
homeDellScreen = "Dell Inc. DELL P2720DC 22JPK53";
p14sScreen = "BOE 0x08CE Unknown";
in
rec {
#mobile-work.exec = backgroundCommand;
mobile-work.outputs = [
(
mkScreen p14sScreen
// {
position = "0,0";
scale = 2.0;
}
)
];
mobile-work-external.outputs = [
(
mkScreen p14sScreen
// {
position = "1920,0";
scale = 2.0;
}
)
(mkScreen "Lenovo Group Limited M14 V907R2HD" // { position = "0,0"; })
];
mobile-private.outputs = [
(
mkScreen "Unknown 0x1536 0x00000000"
// {
position = "0,0";
scale = 1.5;
}
)
];
home-dock.outputs = mobile-work.outputs ++ [
(
mkScreen homeDellScreen
// {
position = "1920,0";
scale = 1.0;
status = "enable";
}
)
];
office-dock.outputs = [
(mkScreen "Dell Inc. DELL P2720DC BRKPK53" // { position = "0,0"; })
(mkScreen "Dell Inc. DELL P2720DC 6JRRK53" // { position = "2560,0"; })
(
mkScreen p14sScreen
// {
position = "5120,0";
scale = 2.0;
}
)
];
office-cyrille-dock.outputs = [
(
mkScreen "Acer Technologies Acer PE270K 0x0000B784"
// {
position = "0,0";
scale = 1.5;
}
)
(
mkScreen p14sScreen
// {
position = "2560,0";
scale = 2.0;
}
)
];
home-pc.outputs = [
(mkScreen homeDellScreen // { position = "0,0"; })
(
mkScreen "HP Inc. HP Z27 CN482201RP"
// {
position = "2560,0";
scale = 1.5;
}
)
];
home-pc-row.outputs = home-pc.outputs ++ [
(mkScreen "Eizo Nanao Corporation EV2450 92395086" // { position = "5120,0"; })
];
};
};
}

View file

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

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
services.mako = {
enable = true;
catppuccin.enable = true;

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
home.file.".psqlrc".text = ''
\set QUIET 1
@ -17,5 +18,4 @@
\unset QUIET
\conninfo
'';
}

View file

@ -30,4 +30,10 @@ let
password_value=$(${pkgs.pass-wayland}/bin/pass show "$password" | tail -1 2>/dev/null)
${pkgs.wtype}/bin/wtype "''${password_value}"
'';
in { home.packages = [ passbemenu suspend ]; }
in
{
home.packages = [
passbemenu
suspend
];
}

View file

@ -1,8 +1,14 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs = {
bash = {
enable = true;
historyIgnore = [ "ls" "cd" "exit" "j" ];
historyIgnore = [
"ls"
"cd"
"exit"
"j"
];
shellAliases = {
# Sane defaults
l = "ls -lah";
@ -14,13 +20,10 @@
ack = "rg";
# Git helpers
git-fetch-pr =
"git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'";
git-config-fetchall = ''
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"'';
git-fetch-pr = "git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'";
git-config-fetchall = ''git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"'';
git-enable-signing =
"git config commit.gpgsign true && git config tag.gpgsign true";
git-enable-signing = "git config commit.gpgsign true && git config tag.gpgsign true";
# Common Typos
gits = "git s";
};
@ -29,7 +32,13 @@
xdg-open "$*" >/dev/null 2>&1 &
}
'';
shellOptions = [ "autocd" "checkjobs" "dotglob" "globstar" "histappend" ];
shellOptions = [
"autocd"
"checkjobs"
"dotglob"
"globstar"
"histappend"
];
sessionVariables = {
#TODO: Some of these should be migrated to the according application.
GPG_TTY = "$(tty)";

View file

@ -1,29 +1,38 @@
{ pkgs, lib, ... }: {
programs.ssh = let
forceIdentityThreema = {
identityFile = toString (pkgs.writeText "fabian.hauser@threema.ch.pub" ''
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7h492sXT7zdamf+nbOt+y6jiqxicOnm6+wiuEG1EvZ openpgp:0x18B553DD
'');
identitiesOnly = true;
};
forceIdentityPrivate = {
identityFile = toString (pkgs.writeText "fabian.hauser@qo.is.pub" ''
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000610954665
'');
identitiesOnly = true;
};
in {
enable = true;
matchBlocks = {
"work.github.com" = forceIdentityThreema // {
hostname = "github.com";
user = "git";
{ pkgs, lib, ... }:
{
programs.ssh =
let
forceIdentityThreema = {
identityFile = toString (
pkgs.writeText "fabian.hauser@threema.ch.pub" ''
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7h492sXT7zdamf+nbOt+y6jiqxicOnm6+wiuEG1EvZ openpgp:0x18B553DD
''
);
identitiesOnly = true;
};
"github.com" = forceIdentityPrivate // { user = "git"; };
forceIdentityPrivate = {
identityFile = toString (
pkgs.writeText "fabian.hauser@qo.is.pub" ''
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000610954665
''
);
identitiesOnly = true;
};
in
{
enable = true;
matchBlocks = {
"work.github.com" = forceIdentityThreema // {
hostname = "github.com";
user = "git";
};
"github.com" = forceIdentityPrivate // {
user = "git";
};
};
extraConfig = ''
IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh
'';
#TODO: Authorized keys implementation, see https://github.com/nix-community/home-manager/pull/9
};
extraConfig = ''
IdentityAgent /run/user/1000/gnupg/S.gpg-agent.ssh
'';
#TODO: Authorized keys implementation, see https://github.com/nix-community/home-manager/pull/9
};
}

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
adhereTheSwayTarget = {
Install.WantedBy = lib.mkForce [ "sway-session.target" ];
@ -13,7 +18,8 @@ let
${pkgs.bemenu}/bin/bemenu --list 20 --ignorecase --prompt 'Start: ' | \
xargs swaymsg exec --
'';
in rec {
in
rec {
home.packages = with pkgs; [
sway-contrib.grimshot
wl-clipboard
@ -30,7 +36,9 @@ in rec {
enable = true;
systemd.enable = true;
xwayland = true;
wrapperFeatures = { gtk = true; };
wrapperFeatures = {
gtk = true;
};
catppuccin.enable = true;
extraSessionCommands = ''
#export XDG_CURRENT_DESKTOP=Unity
@ -49,7 +57,9 @@ in rec {
xkb_layout = "ch,de";
xkb_options = "eurosign:e";
};
"*" = { xkb_numlock = "enable"; };
"*" = {
xkb_numlock = "enable";
};
};
terminal = "${pkgs.kitty}/bin/kitty";
menu = "${bemenuLauncher}/bin/bemenuLauncher";
@ -60,66 +70,66 @@ in rec {
#TODO: Workspace Programm assignment: Not working properly
assigns = {
"10" = [{ app_id = "^firefox$"; }];
"11" = [{ app_id = "^(claws-mail|thunderbird|evolution)$"; }];
"12" = [{
class = "^Chromium-browser$";
instance = "^web.threema.ch";
}];
"13" = [{ class = "^Spotify$"; }];
"10" = [ { app_id = "^firefox$"; } ];
"11" = [ { app_id = "^(claws-mail|thunderbird|evolution)$"; } ];
"12" = [
{
class = "^Chromium-browser$";
instance = "^web.threema.ch";
}
];
"13" = [ { class = "^Spotify$"; } ];
};
keybindings = let
mod = wayland.windowManager.sway.config.modifier;
playerctl = "${pkgs.playerctl}/bin/playerctl";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
light = "${pkgs.light}/bin/light";
in lib.mkOptionDefault {
"${mod}+p" = "exec passbemenu";
"${mod}+Shift+d" =
"exec ${pkgs.rofimoji}/bin/rofimoji --action type --selector fuzzel";
"${mod}+x" = "move workspace to output right";
"${mod}+y" = "move workspace to output left";
keybindings =
let
mod = wayland.windowManager.sway.config.modifier;
playerctl = "${pkgs.playerctl}/bin/playerctl";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
light = "${pkgs.light}/bin/light";
in
lib.mkOptionDefault {
"${mod}+p" = "exec passbemenu";
"${mod}+Shift+d" = "exec ${pkgs.rofimoji}/bin/rofimoji --action type --selector fuzzel";
"${mod}+x" = "move workspace to output right";
"${mod}+y" = "move workspace to output left";
"${mod}+section" = "workspace 0";
"${mod}+0" = "workspace 10";
"${mod}+apostrophe" = "workspace 11";
"${mod}+dead_circumflex" = "workspace 12";
"${mod}+dead_diaeresis" = "workspace 13";
"${mod}+dollar" = "workspace 14";
"${mod}+section" = "workspace 0";
"${mod}+0" = "workspace 10";
"${mod}+apostrophe" = "workspace 11";
"${mod}+dead_circumflex" = "workspace 12";
"${mod}+dead_diaeresis" = "workspace 13";
"${mod}+dollar" = "workspace 14";
"${mod}+Shift+section" = "move container to workspace 0";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+apostrophe" = "move container to workspace 11";
"${mod}+Shift+dead_circumflex" = "move container to workspace 12";
"${mod}+Shift+dead_diaeresis" = "move container to workspace 13";
"${mod}+Shift+dollar" = "move container to workspace 14";
"${mod}+Shift+section" = "move container to workspace 0";
"${mod}+Shift+0" = "move container to workspace 10";
"${mod}+Shift+apostrophe" = "move container to workspace 11";
"${mod}+Shift+dead_circumflex" = "move container to workspace 12";
"${mod}+Shift+dead_diaeresis" = "move container to workspace 13";
"${mod}+Shift+dollar" = "move container to workspace 14";
"Ctrl+mod1+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session";
"Ctrl+mod1+Shift+L" = "exec ${pkgs.systemd}/bin/systemctl suspend";
"Ctrl+mod1+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session";
"Ctrl+mod1+Shift+L" = "exec ${pkgs.systemd}/bin/systemctl suspend";
# pulse audio volume control
XF86AudioLowerVolume =
"exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%-";
XF86AudioRaiseVolume =
"exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%+";
XF86AudioMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle";
XF86AudioMicMute =
"exec ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
# pulse audio volume control
XF86AudioLowerVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%-";
XF86AudioRaiseVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 3%+";
XF86AudioMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle";
XF86AudioMicMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
# Spotify control
XF86AudioPause = "exec ${playerctl} play-pause";
XF86AudioPlay = "exec ${playerctl} play-pause";
XF86AudioNext = "exec ${playerctl} next";
XF86AudioPrev = "exec ${playerctl} previous";
# Spotify control
XF86AudioPause = "exec ${playerctl} play-pause";
XF86AudioPlay = "exec ${playerctl} play-pause";
XF86AudioNext = "exec ${playerctl} next";
XF86AudioPrev = "exec ${playerctl} previous";
# screen brightness
XF86MonBrightnessUp = "exec ${light} -A 10";
XF86MonBrightnessDown = "exec ${light} -U 5";
# screen brightness
XF86MonBrightnessUp = "exec ${light} -A 10";
XF86MonBrightnessDown = "exec ${light} -U 5";
# screenshot
Print = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
};
# screenshot
Print = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
};
};
extraConfig = ''
# Disable the laptop screen when the lid is closed.
@ -137,8 +147,7 @@ in rec {
Unit.After = lib.mkForce [ "waybar.service" ];
Service = {
ExecStartPre = "${pkgs.coreutils}/bin/sleep 3";
Environment = lib.mkForce
"PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity";
Environment = lib.mkForce "PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity";
};
};
systemd.user.services.owncloud-client = adhereTheSwayTarget // {
@ -146,8 +155,7 @@ in rec {
Unit.After = lib.mkForce [ "waybar.service" ];
Service = {
ExecStartPre = "${pkgs.coreutils}/bin/sleep 3";
Environment = lib.mkForce
"PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity";
Environment = lib.mkForce "PATH=${config.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity";
};
};
systemd.user.services.pasystray = adhereTheSwayTarget;
@ -163,5 +171,7 @@ in rec {
catppuccin.enable = true;
};
dconf.settings = { "org/gnome/desktop/interface".menus-have-icons = true; };
dconf.settings = {
"org/gnome/desktop/interface".menus-have-icons = true;
};
}

View file

@ -1,35 +1,36 @@
{ pkgs, ... }: {
systemd.user.services.swayidle = let
lock =
"${pkgs.swaylock}/bin/swaylock --hide-keyboard-layout --ignore-empty-password --daemonize --show-failed-attempts --color=000000";
logTimeCmd = "${pkgs.coreutils}/bin/date --rfc-3339=seconds >> ~/locklog";
idleCmd = (action:
''${pkgs.sway}/bin/swaymsg "output * dpms ${action}" && ${logTimeCmd}'');
timeout-screens-off = 600;
timeout-lock = 630;
timeout-suspend = 1800;
in {
Unit = {
Description = "Idle Manager for Wayland";
Documentation = [ "man:swayidle(1)" ];
PartOf = [ "graphical-session.target" ];
{ pkgs, ... }:
{
systemd.user.services.swayidle =
let
lock = "${pkgs.swaylock}/bin/swaylock --hide-keyboard-layout --ignore-empty-password --daemonize --show-failed-attempts --color=000000";
logTimeCmd = "${pkgs.coreutils}/bin/date --rfc-3339=seconds >> ~/locklog";
idleCmd = (action: ''${pkgs.sway}/bin/swaymsg "output * dpms ${action}" && ${logTimeCmd}'');
timeout-screens-off = 600;
timeout-lock = 630;
timeout-suspend = 1800;
in
{
Unit = {
Description = "Idle Manager for Wayland";
Documentation = [ "man:swayidle(1)" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = "PATH=${pkgs.bash}/bin";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w -d \
timeout ${toString timeout-lock} '${lock}' \
timeout ${toString timeout-screens-off} '${idleCmd "off"}' \
resume '${idleCmd "on"}' \
timeout ${toString timeout-suspend} '${pkgs.systemd}/bin/systemctl suspend' \
lock '${lock}' \
before-sleep '${lock}';
''; # TODO: Make this configurable and add home-manager module. (Requires sway with systemd-target support)
};
Install = {
WantedBy = [ "sway-session.target" ];
};
};
Service = {
Environment = "PATH=${pkgs.bash}/bin";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w -d \
timeout ${toString timeout-lock} '${lock}' \
timeout ${toString timeout-screens-off} '${idleCmd "off"}' \
resume '${idleCmd "on"}' \
timeout ${
toString timeout-suspend
} '${pkgs.systemd}/bin/systemctl suspend' \
lock '${lock}' \
before-sleep '${lock}';
''; # TODO: Make this configurable and add home-manager module. (Requires sway with systemd-target support)
};
Install = { WantedBy = [ "sway-session.target" ]; };
};
programs.swaylock.catppuccin.enable = true;
}

View file

@ -1,7 +1,8 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
@ -50,6 +51,9 @@
filetype plugin indent on
syntax on
'';
plugins = with pkgs.vimPlugins; [ vim-sensible vim-airline ];
plugins = with pkgs.vimPlugins; [
vim-sensible
vim-airline
];
};
}

View file

@ -1,4 +1,10 @@
{ pkgs, lib, config, ... }: {
{
pkgs,
lib,
config,
...
}:
{
xsession.preferStatusNotifierItems = true;
wayland.windowManager.sway.config.bars = [ ];
@ -8,118 +14,126 @@
enable = true;
target = "tray.target";
};
settings = [{
position = "top";
#height =
modules-left = [ "sway/mode" "sway/workspaces" ];
modules-center = [ "sway/window" ];
modules-right = [
"idle_inhibitor"
"backlight"
"battery"
"pulseaudio"
"tray"
"clock"
];
backlight.format = " {percent}%";
disk.format = " {percentage_used}%";
clock.format = "{:%Y-%m-%d%H:%M}";
"sway/workspaces" = {
disable-scroll-wraparound = true;
enable-bar-scroll = true;
numeric-first = true;
};
battery = {
interval = 60;
states = {
warning = 15;
critical = 10;
};
format = " {capacity}% {time}"; # Icon: bolt
format-discharging = "{icon} {capacity}% {time}";
format-time = "{H}:{M}";
format-icons = [
"" # Icon: battery-full
"" # Icon: battery-three-quarters
"" # Icon: battery-half
"" # Icon: battery-quarter
"" # Icon: battery-empty
settings = [
{
position = "top";
#height =
modules-left = [
"sway/mode"
"sway/workspaces"
];
tooltip = "true";
};
cpu = {
interval = "5";
format = " {usage}% ({load})"; # Icon: microchip
states = {
warning = "70";
critical = "90";
modules-center = [ "sway/window" ];
modules-right = [
"idle_inhibitor"
"backlight"
"battery"
"pulseaudio"
"tray"
"clock"
];
backlight.format = " {percent}%";
disk.format = " {percentage_used}%";
clock.format = "{:%Y-%m-%d%H:%M}";
"sway/workspaces" = {
disable-scroll-wraparound = true;
enable-bar-scroll = true;
numeric-first = true;
};
};
memory = {
interval = "5";
format = " {}%"; # Icon: microchip
states = {
warning = "70";
critical = "90";
battery = {
interval = 60;
states = {
warning = 15;
critical = 10;
};
format = " {capacity}% {time}"; # Icon: bolt
format-discharging = "{icon} {capacity}% {time}";
format-time = "{H}:{M}";
format-icons = [
"" # Icon: battery-full
"" # Icon: battery-three-quarters
"" # Icon: battery-half
"" # Icon: battery-quarter
"" # Icon: battery-empty
];
tooltip = "true";
};
};
"sway/mode" = {
format =
''<span style="italic"> {}</span>''; # Icon: expand-arrows-alt
tooltip = "false";
};
"sway/window" = {
format = "{}";
max-length = "120";
};
"sway/workspaces" = {
all-outputs = false;
disable-scroll = true;
format = "{icon}";
format-icons = {
"10" = " 10";
"11" = " 11";
"12" = " 12";
"13" = " 13";
cpu = {
interval = "5";
format = " {usage}% ({load})"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
};
pulseaudio = {
scroll-step = 3;
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "🔇";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [ "" "" "" ];
memory = {
interval = "5";
format = " {}%"; # Icon: microchip
states = {
warning = "70";
critical = "90";
};
};
on-click = "pavucontrol";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " active";
deactivated = "";
"sway/mode" = {
format = ''<span style="italic"> {}</span>''; # Icon: expand-arrows-alt
tooltip = "false";
};
};
tray = {
icon-size = "21";
spacing = "10";
};
}];
"sway/window" = {
format = "{}";
max-length = "120";
};
"sway/workspaces" = {
all-outputs = false;
disable-scroll = true;
format = "{icon}";
format-icons = {
"10" = " 10";
"11" = " 11";
"12" = " 12";
"13" = " 13";
};
};
pulseaudio = {
scroll-step = 3;
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
format-muted = "🔇";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [
""
""
""
];
};
on-click = "pavucontrol";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " active";
deactivated = "";
};
};
tray = {
icon-size = "21";
spacing = "10";
};
}
];
style = ''
/* =============================================================================

View file

@ -1,7 +1,8 @@
{ pkgs, ... }:
let
web-app = name: url:
web-app =
name: url:
pkgs.writeScriptBin name ''
#!${pkgs.stdenv.shell}
exec ${pkgs.chromium}/bin/chromium --user-data-dir=$HOME/.config/chromium-app-${name} --app="${url}"
@ -11,6 +12,13 @@ let
threema-work = web-app "threema-work" "https://web-beta.threema.ch/";
threema-red = web-app "threema-red" "https://web-work-staging.threema.ch/";
threema-tickets = web-app "threema-tickets" "https://ticket.threema.ch/scp/";
in {
home.packages = [ whatsapp threema threema-work threema-red threema-tickets ];
in
{
home.packages = [
whatsapp
threema
threema-work
threema-red
threema-tickets
];
}

View file

@ -1,4 +1,11 @@
{ config, pkgs, lib, nixosConfig, ... }: {
{
config,
pkgs,
lib,
nixosConfig,
...
}:
{
imports = [
./multimedia.nix
./applications

View file

@ -1,9 +1,24 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
home.packages = with pkgs;
[ neverball wesnoth pingus superTux superTuxKart extremetuxracer zeroad ]
++ (with pkgs.gnome; [ # Selection of gnome games
home.packages =
with pkgs;
[
neverball
wesnoth
pingus
superTux
superTuxKart
extremetuxracer
zeroad
]
++ (with pkgs.gnome; [
# Selection of gnome games
five-or-more
four-in-a-row
gnome-chess

View file

@ -1,64 +1,72 @@
{ pkgs, lib, config, ... }: {
{
pkgs,
lib,
config,
...
}:
{
xdg.mimeApps = rec {
enable = true;
associations.added = defaultApplications;
defaultApplications = let
browser = [ "firefox.desktop" ];
email = [ "org.gnome.Evolution.desktop" ];
doc-editor = [ "writer.desktop" ];
sheet-editor = [ "calc.desktop" ];
presentation-editor = [ "impress.desktop" ];
pdf = [ "org.gnome.Evince.desktop" ];
image = [ "org.gnome.Loupe.desktop" "gimp.desktop" ];
image-vector = [ "org.inkscape.Inkscape.desktop" ];
ebooks = [ "calibre-ebook-viewer.desktop" ];
code-general = [ "codium.desktop" ];
video = [ "mpv.desktop" ];
compression = [ "org.gnome.Nautilus.desktop" ];
in {
"text/html" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/chrome" = browser;
"application/xhtml+xml" = browser;
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/x-extension-xhtml" = browser;
"application/x-extension-xht" = browser;
"x-scheme-handler/mailto" = email;
"text/calendar" = email;
defaultApplications =
let
browser = [ "firefox.desktop" ];
email = [ "org.gnome.Evolution.desktop" ];
doc-editor = [ "writer.desktop" ];
sheet-editor = [ "calc.desktop" ];
presentation-editor = [ "impress.desktop" ];
pdf = [ "org.gnome.Evince.desktop" ];
image = [
"org.gnome.Loupe.desktop"
"gimp.desktop"
];
image-vector = [ "org.inkscape.Inkscape.desktop" ];
ebooks = [ "calibre-ebook-viewer.desktop" ];
code-general = [ "codium.desktop" ];
video = [ "mpv.desktop" ];
compression = [ "org.gnome.Nautilus.desktop" ];
in
{
"text/html" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/chrome" = browser;
"application/xhtml+xml" = browser;
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/x-extension-xhtml" = browser;
"application/x-extension-xht" = browser;
"x-scheme-handler/mailto" = email;
"text/calendar" = email;
"application/vnd.oasis.opendocument.text" = doc-editor;
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
doc-editor;
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" =
sheet-editor;
"application/vnd.openxmlformats-officedocument.presentationml.presentation" =
presentation-editor;
"application/vnd.oasis.opendocument.presentation" = presentation-editor;
"application/pdf" = pdf;
"application/x-extension-pdf" = pdf;
"application/epub+zip" = ebooks;
"application/vnd.oasis.opendocument.text" = doc-editor;
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = doc-editor;
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = sheet-editor;
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = presentation-editor;
"application/vnd.oasis.opendocument.presentation" = presentation-editor;
"application/pdf" = pdf;
"application/x-extension-pdf" = pdf;
"application/epub+zip" = ebooks;
"text/plain" = code-general;
"application/json" = code-general;
"text/markdown" = code-general;
"text/plain" = code-general;
"application/json" = code-general;
"text/markdown" = code-general;
"image/png" = image;
"image/jpg" = image;
"image/jpeg" = image;
"image/x-tga" = image;
"image/tiff" = image;
"image/x-canon-cr2" = image;
"application/x-ptoptimizer-script" = [ "hugin.desktop" ];
"image/svg+xml" = image-vector;
"image/png" = image;
"image/jpg" = image;
"image/jpeg" = image;
"image/x-tga" = image;
"image/tiff" = image;
"image/x-canon-cr2" = image;
"application/x-ptoptimizer-script" = [ "hugin.desktop" ];
"image/svg+xml" = image-vector;
"video/mp4" = video;
"video/x-matroska" = video;
"video/mp4" = video;
"video/x-matroska" = video;
"application/zip" = compression;
};
"application/zip" = compression;
};
};
}

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
@ -12,8 +17,16 @@
profile = "gpu-hq";
};
};
home.packages = with pkgs;
[ vlc v4l-utils playerctl yt-dlp ] ++ [ # Audio
home.packages =
with pkgs;
[
vlc
v4l-utils
playerctl
yt-dlp
]
++ [
# Audio
gnome.gnome-sound-recorder
enblend-enfuse
ffmpeg
@ -29,7 +42,9 @@
pasystray
pavucontrol
spotify
] ++ [ # Imaging
]
++ [
# Imaging
gimp
hugin
lensfun
@ -39,7 +54,9 @@
# ImageMagick-perl perl-File-Type perl-Term-ProgressBar #TODO: Support libraries for scripts
inkscape
ghostscript
] ++ [ # Codecs for Audio and Video
]
++ [
# Codecs for Audio and Video
vobcopy
libdv
libdvbpsi # TODO: librtmp?
@ -54,5 +71,4 @@
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-ugly
];
}

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
imports = [
./filesystems.nix
@ -16,7 +17,8 @@
#TODO: Clean up next section
services.xserver.dpi = 180;
virtualisation = { # TODO: This should probably be somewhere else.
virtualisation = {
# TODO: This should probably be somewhere else.
docker = {
enable = true;
enableOnBoot = false;

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
boot.initrd.luks.devices = {
"root".device = "/dev/disk/by-uuid/fae1b81e-894c-47b4-92e5-0a817fd6f66f";
"swap".device = "/dev/disk/by-uuid/dc1fe9ff-7eb7-40c3-8fbd-d99398e5e5d6";
@ -21,10 +27,9 @@
};
};
swapDevices = [{ device = "/dev/mapper/swap"; }];
swapDevices = [ { device = "/dev/mapper/swap"; } ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}

View file

@ -2,15 +2,17 @@
{
hardware.printers.ensureDefaultPrinter = "hsr-mfp-8261";
hardware.printers.ensurePrinters = [{
name = "hsr-mfp-8261";
deviceUri = "smb://hsr.ch/printsrv-d.hsr.ch/d8261-a4mfp";
location = "HSR 8.261";
model = "HP/hp-color_laserjet_mfp_m577-ps.ppd.gz";
ppdOptions = {
Duplex = "DuplexNoTumble";
PageSize = "A4";
auth-info-required = "username,password";
};
}];
hardware.printers.ensurePrinters = [
{
name = "hsr-mfp-8261";
deviceUri = "smb://hsr.ch/printsrv-d.hsr.ch/d8261-a4mfp";
location = "HSR 8.261";
model = "HP/hp-color_laserjet_mfp_m577-ps.ppd.gz";
ppdOptions = {
Duplex = "DuplexNoTumble";
PageSize = "A4";
auth-info-required = "username,password";
};
}
];
}

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
imports = [
./filesystems.nix
@ -11,7 +12,8 @@
../../defaults/desktop
];
virtualisation = { # TODO: This should probably be somewhere else.
virtualisation = {
# TODO: This should probably be somewhere else.
docker = {
enable = true;
enableOnBoot = false;
@ -38,5 +40,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View file

@ -1,29 +1,39 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
boot.initrd.luks.devices = { "luks".device = "/dev/disk/by-label/luks"; };
fileSystems = let rootdev = "/dev/disk/by-label/hv_ochsenchopf";
in {
"/" = {
device = rootdev;
fsType = "btrfs";
options = [ "subvol=nixos" ];
};
"/home" = {
device = rootdev;
fsType = "btrfs";
options = [ "subvol=home" ];
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
boot.initrd.luks.devices = {
"luks".device = "/dev/disk/by-label/luks";
};
swapDevices = [{ device = "/dev/disk/by-label/swap"; }];
fileSystems =
let
rootdev = "/dev/disk/by-label/hv_ochsenchopf";
in
{
"/" = {
device = rootdev;
fsType = "btrfs";
options = [ "subvol=nixos" ];
};
"/home" = {
device = rootdev;
fsType = "btrfs";
options = [ "subvol=home" ];
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
};
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
imports = [
./filesystems.nix
@ -14,7 +15,8 @@
#../../defaults/printing
];
virtualisation = { # TODO: This should probably be somewhere else.
virtualisation = {
# TODO: This should probably be somewhere else.
docker = {
enable = true;
enableOnBoot = false;
@ -32,5 +34,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

View file

@ -1,6 +1,11 @@
{ config, pkgs, lib, ... }: {
boot.initrd.luks.devices.system.device =
"/dev/disk/by-uuid/bf353bb1-43bf-453f-ae7e-0fa9b4d8778c";
{
config,
pkgs,
lib,
...
}:
{
boot.initrd.luks.devices.system.device = "/dev/disk/by-uuid/bf353bb1-43bf-453f-ae7e-0fa9b4d8778c";
boot.initrd.kernelModules = [ "dm-snapshot" ];
fileSystems = {

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
networking = {
networkmanager.enable = true;
useDHCP = false;

View file

@ -2,15 +2,17 @@
{
hardware.printers.ensureDefaultPrinter = "hsr-mfp-8261";
hardware.printers.ensurePrinters = [{
name = "hsr-mfp-8261";
deviceUri = "smb://hsr.ch/printsrv-d.hsr.ch/d8261-a4mfp";
location = "HSR 8.261";
model = "HP/hp-color_laserjet_mfp_m577-ps.ppd.gz";
ppdOptions = {
Duplex = "DuplexNoTumble";
PageSize = "A4";
auth-info-required = "username,password";
};
}];
hardware.printers.ensurePrinters = [
{
name = "hsr-mfp-8261";
deviceUri = "smb://hsr.ch/printsrv-d.hsr.ch/d8261-a4mfp";
location = "HSR 8.261";
model = "HP/hp-color_laserjet_mfp_m577-ps.ppd.gz";
ppdOptions = {
Duplex = "DuplexNoTumble";
PageSize = "A4";
auth-info-required = "username,password";
};
}
];
}

View file

@ -1,5 +1,5 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
imports = [ ];
}

View file

@ -3,5 +3,6 @@ with super.lib;
let
# Load the system wide overlays
overlays = (import <nixpkgs/nixos> { }).config.nixpkgs.overlays;
# Apply all overlays to the input of the current "main" overlay
in foldl' (flip extends) (_: super) overlays self
in
# Apply all overlays to the input of the current "main" overlay
foldl' (flip extends) (_: super) overlays self

View file

@ -1,4 +1,3 @@
self: super:
{
self: super: {
}

View file

@ -1,12 +1,20 @@
{ pkgs ? import <nixpkgs-unstable> { } }:
{
pkgs ? import <nixpkgs-unstable> { },
}:
pkgs.mkShell rec {
name = "qois-infrastructure-shell";
buildInputs = let
extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide ];
vscode-with-extensions =
pkgs.vscode-with-extensions.override { vscodeExtensions = extensions; };
in with pkgs; [ vscode-with-extensions nixfmt rnix-lsp ];
buildInputs =
let
extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide ];
vscode-with-extensions = pkgs.vscode-with-extensions.override { vscodeExtensions = extensions; };
in
with pkgs;
[
vscode-with-extensions
nixfmt
rnix-lsp
];
LANG = "C.UTF-8";
LC_ALL = "C.UTF-8";
shellHook = ''