feat: add existing config

+81
configuration.nix
···
···
+
# 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`).
+
+
{ config, pkgs, ... }:
+
+
{
+
imports =
+
[ # Include the results of the hardware scan.
+
./hardware-configuration.nix
+
+
./programs
+
./networking
+
];
+
+
boot.loader.efi = {
+
canTouchEfiVariables = true;
+
efiSysMountPoint = "/boot/efi";
+
};
+
+
boot.loader.grub = {
+
enable = true;
+
device = "nodev";
+
efiSupport = true;
+
};
+
+
# Set your time zone.
+
time.timeZone = "Asia/Hong_Kong";
+
+
# Select internationalisation properties.
+
i18n.defaultLocale = "en_US.UTF-8";
+
console = {
+
font = "Lat2-Terminus16";
+
keyMap = "us";
+
};
+
+
# Enable CUPS to print documents.
+
# services.printing.enable = true;
+
+
# Enable sound.
+
sound.enable = false;
+
+
# Define a user account. Don't forget to set a password with ‘passwd’.
+
users.users.cassie = {
+
isNormalUser = true;
+
extraGroups = [ "wheel" ];
+
openssh = {
+
authorizedKeys.keyFiles = [ "/etc/nixos/creds/ssh/cassie" ];
+
};
+
packages = with pkgs; [];
+
};
+
+
programs.tmux = {
+
enable = true;
+
newSession = true;
+
keyMode = "vi";
+
historyLimit = 10000;
+
};
+
+
# 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;
+
# };
+
+
# 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;
+
+
# 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?
+
}
+
+12
creds/ssh/cassie
···
···
+
# SmartCards
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGvCpt7yWIptJ9XFBhwVIj9zR30OzkWI976B/P5+0whD cardno:13 901 056
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGvCpt7yWIptJ9XFBhwVIj9zR30OzkWI976B/P5+0whD cardno:19 302 295
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMjRM3BNkLbU57RyfUx7kOlZeBEj/NByr1PfXri82aP cardno:19 302 432
+
+
# Static devices
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIPTbZL0dq0ynBl8fy9yZmrKVWd/fOybZoqBKchP0MPM sophie@marisa
+
+
# Phones
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIELnUun49XZwfj535a5COURTKF85A79jn7oyUt4EDa8+ u0_a288@localhost
+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOsxx+UE9xiHbQM+lKF5CbDcZOlu0AGg7rrzMbldJARO u0_a282@localhost
+
+71
hardware-configuration.nix
···
···
+
# 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 = [ "xhci_pci" "ahci" "usbhid" "sr_mod" ];
+
boot.initrd.kernelModules = [ "dm-snapshot" ];
+
boot.kernelModules = [ "kvm-intel" ];
+
boot.extraModulePackages = [ ];
+
+
fileSystems."/" =
+
{ device = "/dev/disk/by-uuid/0b38be0c-5365-4f02-85b8-72f37bb2ddf8";
+
fsType = "btrfs";
+
};
+
+
fileSystems."/var/log" =
+
{ device = "/dev/disk/by-uuid/e6ff7c96-3bef-4a17-9114-64ef1460fc00";
+
fsType = "btrfs";
+
};
+
+
fileSystems."/var/log/audit" =
+
{ device = "/dev/disk/by-uuid/a20e2995-7297-4f69-af89-b58ff314e029";
+
fsType = "btrfs";
+
};
+
+
fileSystems."/srv/osm-data" =
+
{ device = "/dev/disk/by-uuid/3c1a8b58-fbe6-4522-8e27-72419b3c2d6f";
+
fsType = "btrfs";
+
};
+
+
fileSystems."/boot" =
+
{ device = "/dev/disk/by-uuid/9E0F-3FDE";
+
fsType = "vfat";
+
};
+
+
fileSystems."/boot/efi" =
+
{ device = "/dev/disk/by-uuid/9EB1-FA5A";
+
fsType = "vfat";
+
};
+
+
fileSystems."/srv/www/keine" =
+
{ device = "/dev/disk/by-uuid/0a0e102a-b1ac-44a2-947b-2ec505b532ad";
+
fsType = "btrfs";
+
};
+
+
fileSystems."/home" =
+
{ device = "/dev/disk/by-uuid/50165105-6b82-4228-9640-2d32ce45f76e";
+
fsType = "btrfs";
+
};
+
+
swapDevices =
+
[ { device = "/dev/disk/by-uuid/efd68464-2e0c-4aaf-8264-519dd7d05ddf"; }
+
];
+
+
# 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.br0.useDHCP = lib.mkDefault true;
+
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
+
+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
+
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
}
+11
networking/default.nix
···
···
+
{ ... }:
+
+
{
+
imports = [
+
./firewall.nix
+
./interface.nix
+
];
+
+
networking.hostName = "koumakan";
+
networking.networkmanager.enable = true;
+
}
+11
networking/firewall.nix
···
···
+
{ pkgs, ... }:
+
+
{
+
networking.firewall = {
+
enable = true;
+
allowedTCPPorts = [
+
22 # ssh
+
80 443 # http[s]
+
];
+
};
+
}
+4
networking/interface.nix
···
···
+
{ ... } :
+
{
+
networking.networkmanager.ethernet.macAddress = builtins.readFile ../creds/nma.cry;
+
}
+13
programs/default.nix
···
···
+
{ ... }:
+
{
+
imports = [
+
./nix.nix
+
./editors.nix
+
./shells.nix
+
+
./ssh.nix
+
./scm.nix
+
+
./misc.nix
+
];
+
}
+10
programs/editors.nix
···
···
+
{ pkgs, ... }:
+
+
{
+
programs.neovim = {
+
enable = true;
+
defaultEditor = true;
+
viAlias = true;
+
vimAlias = true;
+
};
+
}
+17
programs/misc.nix
···
···
+
{ pkgs, ... }:
+
+
{
+
# Miscellaneous packages that do not have an option.
+
# It is recommended to use packages.<package>.enable when possible.
+
+
# To search for a specific package, run this command.
+
# $ nix search wget
+
environment.systemPackages = with pkgs; [
+
wget
+
curl
+
ripgrep
+
gnupg
+
pinentry
+
git-crypt
+
];
+
}
+9
programs/nix.nix
···
···
+
{ ... }:
+
+
{
+
nix.settings.experimental-features = [
+
"nix-command"
+
"flakes"
+
];
+
}
+
+9
programs/scm.nix
···
···
+
{ ... }:
+
{
+
programs.git = {
+
enable = true;
+
config = {
+
init.defaultBranch = "main";
+
};
+
};
+
}
+19
programs/shells.nix
···
···
+
{ ... }:
+
+
{
+
programs.zsh = {
+
enable = true;
+
histSize = 50000;
+
+
# plugins
+
syntaxHighlighting.enable = true;
+
+
ohMyZsh = {
+
enable = true;
+
theme = "crcandy";
+
plugins = [
+
"git"
+
];
+
};
+
};
+
}
+13
programs/ssh.nix
···
···
+
{ pkgs, ... }:
+
+
{
+
# Enable the OpenSSH daemon.
+
services.openssh = {
+
enable = true;
+
settings = {
+
PermitRootLogin = "no";
+
PasswordAuthentication = false;
+
+
};
+
};
+
}