modularise a bit

This commit is contained in:
tristan 2023-04-15 12:23:31 +01:00
parent e871ce10c7
commit f96e27fecd
5 changed files with 44 additions and 67 deletions

View file

@ -1,192 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
# https://search.nixos.org/options
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
};
nix.settings.trusted-users = [ "root" "tristan" ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# boot.loader.grub.enable = true;
# boot.loader.grub.version = 2;
# boot.loader.grub.devices = ["nodev"];
# boot.loader.grub.useOSProber = true;
# boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "zenix";
networking.networkmanager.enable = true;
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
};
# use pipewire
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
security.pam.services.swaylock = {};
security.doas.enable = true;
# Configure graphical stuff
services.xserver = {
enable = true;
layout = "gb";
libinput.enable = true;
# the only display manager that works?
displayManager.gdm.enable = true;
displayManager.autoLogin = {
enable = true;
user = "tristan";
};
};
qt.enable = true;
qt.platformTheme = "gtk2";
qt.style = "gtk2";
services.printing.enable = true;
# services.flatpak.enable = true;
xdg.portal.enable = true;
users.users.tristan = {
isNormalUser = true;
extraGroups = [ "wheel" "video" ];
initialPassword = "pass";
shell = pkgs.fish;
};
programs.fish.enable = true;
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERMINAL = "foot";
};
environment.systemPackages = with pkgs; [
foot
brave
tealdeer
alsa-utils
wofi
waybar
swaylock-effects
swayidle
swaybg
pcmanfm
pavucontrol
trash-cli
(neovim.override {
vimAlias = true;
configure = {
packages.myPlugins = with pkgs.vimPlugins; {
start = [ vim-surround vim-commentary vim-nix ];
opt = [];
};
customRC = ''
vnoremap * y/\V<C-R>=escape(@",'/\')<CR><CR>
vnoremap <C-R> "ry:%s/<C-R>=escape(@r,'/\')<CR>
vnoremap A :norm A
set number
set rnu
set ignorecase
set smartcase
set mouse=a
set path=.,**
let g:netrw_banner=0
let g:netrw_liststyle=3
set undofile
set undodir=~/.local/share/nvim/undo
'';
};
})
];
services.dbus.enable = true;
programs.light.enable = true;
programs.dconf.enable = true;
programs.hyprland.enable = true;
programs.tmux.enable = true;
programs.tmux.extraConfig = ''
set escape-time 0
set -g default-terminal screen
bind -n M-s split-window -v
bind -n M-v split-window -h
bind -n M-Enter split-window -h
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind -n M-q kill-pane
bind -n M-< resize-pane -L 10
bind -n M-> resize-pane -R 10
bind -n M-- resize-pane -D 10
bind -n M-+ resize-pane -U 10
bind -n M-u copy-mode
bind -n M-p paste-buffer
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
'';
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.tailscale.enable = true;
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
networking.firewall.checkReversePath = "loose";
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
system.stateVersion = "22.11"; # Did you read the comment?
}

View file

@ -1,48 +0,0 @@
# 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")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909";
fsType = "btrfs";
options = [ "subvol=@" "compress=zstd" "autodefrag" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/cc0617df-8cbf-4618-abbc-df64c96de151";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909";
fsType = "btrfs";
options = [ "subvol=@home" "compress=zstd" "autodefrag" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FE7E-0DE3";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/da57b489-ab77-4830-b710-9f96cf43d053"; }
];
# 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
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

23
system/zenix.nix Normal file
View file

@ -0,0 +1,23 @@
# https://search.nixos.org/options
{ config, pkgs, ... }:
{
networking.hostName = "zenix";
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
};
services.openssh.enable = true;
services.tailscale.enable = true;
networking.firewall.checkReversePath = "loose";
networking.firewall.allowedTCPPorts = [ ];
system.stateVersion = "22.11"; # do not change
}