refactor out common options

This commit is contained in:
Rachel Lambda Samuelsson 2023-11-18 11:29:47 +01:00
parent dcba96d085
commit 78bdf0a511
4 changed files with 152 additions and 284 deletions

View File

@ -1,6 +1,5 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# [HARDWARE] # [HARDWARE]
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
@ -11,7 +10,6 @@
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
}; };
programs.gamemode.enable = true;
# [BOOT] # [BOOT]
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@ -19,133 +17,7 @@
# [NETWORKING] # [NETWORKING]
networking.hostName = "computational"; networking.hostName = "computational";
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true;
# [NFS]
fileSystems."/home/rachel/music" = {
device = "rachel.cafe:/srv/music";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
};
# [LOCALE]
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" ];
# [NIX]
nix = {
settings = {
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 30d";
};
registry = {
templates = {
from = {
type = "indirect";
id = "templates";
};
to = {
type = "git";
url = "https://githug.xyz/xenchel/templates";
};
};
};
};
nixpkgs.config.allowUnfree = true;
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
layout = "fox,sus";
xkbOptions = "ctrl:nocaps";
extraLayouts.sus = {
description = "Swedish US";
languages = [ "se" ];
symbolsFile = ../shared/sus.xkb;
};
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = ../shared/fox.xkb;
};
};
# [TTY]
console.useXkbConfig = true;
# [SOUND]
sound.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# [PACKAGES]
environment.systemPackages = with pkgs; [
git
neovim
];
programs.steam.enable = true;
# [SERVICES]
services.printing.enable = true;
# [SECURITY / FIREWALL]
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ ];
networking.firewall.allowedUDPPorts = [ ];
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "qt";
};
security.doas = {
enable = true;
extraRules = [{
runAs = "root";
groups = [ "wheel" ];
noPass = false;
keepEnv = true;
}];
};
# [USER / HOME MANAGER]
users.users.rachel = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"video"
"input"
"audio"
];
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# 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.05"; # Did you read the comment?
system.stateVersion = "23.05";
} }

View File

@ -42,6 +42,7 @@
modules = [ modules = [
nix-config-module nix-config-module
./lambda/configuration.nix ./lambda/configuration.nix
./shared/desktop.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
rachel-home-module rachel-home-module
]; ];
@ -52,6 +53,7 @@
modules = [ modules = [
nix-config-module nix-config-module
./computational/configuration.nix ./computational/configuration.nix
./shared/desktop.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
rachel-home-module rachel-home-module
]; ];

View File

@ -1,6 +1,5 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# [HARDWARE] # [HARDWARE]
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
@ -59,157 +58,5 @@
wifi.macAddress = "random"; wifi.macAddress = "random";
}; };
services.openssh = { system.stateVersion = "23.05";
enable = true;
settings = {
PasswordAuthentication = true;
PermitRootLogin = "no";
};
};
# [NFS]
fileSystems."/home/rachel/music" = {
device = "rachel.cafe:/srv/music";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
};
# [LOCALE]
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.supportedLocales = [ "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" ];
# [NIX]
nix = {
settings = {
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 30d";
};
registry = {
templates = {
from = {
type = "indirect";
id = "templates";
};
to = {
type = "git";
url = "https://githug.xyz/xenchel/templates";
};
};
};
};
nixpkgs.config.allowUnfree = true;
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
layout = "fox,sus";
xkbOptions = "ctrl:nocaps";
extraLayouts.sus = {
description = "Swedish US";
languages = [ "se" ];
symbolsFile = ../shared/sus.xkb;
};
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = ../shared/fox.xkb;
};
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
accelProfile = "flat" ;
tapping = false;
};
};
};
# [TTY]
console = {
useXkbConfig = true;
font = "LatGrkCyr-12x22";
};
# [SOUND]
sound.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# [PACKAGES / PROGRAMS]
environment.systemPackages = with pkgs; [
git
neovim
];
programs.gamemode = {
enable = true;
settings.general.renice = 20;
};
programs.steam.enable = true;
# [SERVICES]
services.printing.enable = true;
# [SECURITY / FIREWALL]
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ ];
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "qt";
};
security.doas = {
enable = true;
extraRules = [{
runAs = "root";
groups = [ "wheel" ];
noPass = false;
keepEnv = true;
}];
};
# [USER / HOME MANAGER]
users.users.rachel = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"video"
"input"
"audio"
];
};
# Done for gamemoderun
security.pam.loginLimits = [
{ domain = "rachel"; item = "nice"; "type" = "soft"; value = "-20"; }
{ domain = "rachel"; item = "nice"; "type" = "hard"; value = "-20"; }
];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# 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.05"; # Did you read the comment?
} }

147
shared/desktop.nix Normal file
View File

@ -0,0 +1,147 @@
{ pkgs, ... }:
{
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
# [NFS]
fileSystems."/home/rachel/music" = {
device = "rachel.cafe:/srv/music";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
};
# [LOCALE]
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.supportedLocales = [ "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" ];
# [NIX]
nix = {
settings = {
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 30d";
};
registry = {
templates = {
from = {
type = "indirect";
id = "templates";
};
to = {
type = "git";
url = "https://githug.xyz/xenchel/templates";
};
};
};
};
nixpkgs.config.allowUnfree = true;
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
layout = "fox,sus";
xkbOptions = "ctrl:nocaps";
extraLayouts.sus = {
description = "Swedish US";
languages = [ "se" ];
symbolsFile = ../shared/sus.xkb;
};
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = ../shared/fox.xkb;
};
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
accelProfile = "flat" ;
tapping = false;
};
};
};
# [TTY]
console = {
useXkbConfig = true;
font = "LatGrkCyr-12x22";
};
# [SOUND]
sound.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# [PACKAGES / PROGRAMS]
environment.systemPackages = with pkgs; [
git
neovim
];
programs.gamemode = {
enable = true;
settings.general.renice = 20;
};
programs.steam.enable = true;
# [SERVICES]
services.printing.enable = true;
# [SECURITY / FIREWALL]
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ ];
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "qt";
};
security.doas = {
enable = true;
extraRules = [{
runAs = "root";
groups = [ "wheel" ];
noPass = false;
keepEnv = true;
}];
};
# [USER]
users.users.rachel = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"video"
"input"
"audio"
];
};
# Done for gamemoderun
security.pam.loginLimits = [
{ domain = "rachel"; item = "nice"; "type" = "soft"; value = "-20"; }
{ domain = "rachel"; item = "nice"; "type" = "hard"; value = "-20"; }
];
}