This commit is contained in:
Albert Copeland 2023-06-29 21:00:39 +09:00
parent 20f83a4df9
commit af77389479
5 changed files with 326 additions and 148 deletions

View file

@ -1,173 +1,178 @@
# 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, ... }: { { config, pkgs, ... }: {
# Desktop/Laptop configuration.nix imports =
# Import other files to this config: [
imports = [ # Include the results of the hardware scan.
./home-manager.nix ./hardware-configuration.nix
./variables.nix
]; ];
# Basic configs # Bootloader.
time.timeZone = ${timezone} boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Plymouth splash screen
boot.plymouth.enable = true;
# Boot settings # Setup keyfile
boot = { boot.initrd.secrets = {
blacklistedKernelModules = [ "nouveau" ]; "/crypto_keyfile.bin" = null;
cleanTmpDir = true;
}; };
# Keep the system up-to-date automatically # Plymouth troubleshooting
system = { boot.initrd.systemd.enable = true;
stateVersion = ${nixos-version} boot.kernelParams = ["quiet"];
autoUpgrade = {
enable = true;
allowReboot = false;
channel = https://channels.nixos.org/nixos-${nixos-version}
};
};
# Networking: # Enable swap on luks
boot.initrd.luks.devices."luks-9704447e-6bd0-4a35-9c24-20cbab81c431".device = "/dev/disk/by-uuid/9704447e-6bd0-4a35-9c24-20cbab81c431";
boot.initrd.luks.devices."luks-9704447e-6bd0-4a35-9c24-20cbab81c431".keyFile = "/crypto_keyfile.bin";
# Enable networking
networking = { networking = {
hostname = ${hostname}; hostName = "nixos-p1";
networkmanager = {
enable = true;
};
enableIPv6 = false; enableIPv6 = false;
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ 22 ]; allowedTCPPorts = [ 22 ];
allowedUDPPorts = [ 41641 ]; allowedUDPPorts = [ ];
};
networkmanager = {
enable = true;
}; };
}; };
# Create a user: # Set your time zone.
# https://nixos.org/manual/nixos/stable/index.html#sec-user-management time.timeZone = "Asia/Tokyo";
users.users.${username} = {
isNormalUser = false; # Select internationalisation properties.
initialPassword = "Password"; i18n.defaultLocale = "en_US.UTF-8";
description = "${user-full-name}";
extraGroups = [ "wheel", "networkmanager" ]; i18n.extraLocaleSettings = {
uid = 1000; LC_ADDRESS = "en_US.UTF-8";
shell = "/bin/bash" LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
}; };
# Enable various services: # Configure the fingerprint reader
services = { services.fprintd = {
openssh = {
enable = true; enable = true;
tod.enable = true;
tod.driver = pkgs.libfprint-2-tod1-vfs0090;
}; };
ntp = {
# Configure keymap in X11
services.xserver = {
enable = true; enable = true;
layout = "us";
xkbVariant = "";
libinput = {
enable = true;
touchpad.tapping = true;
}; };
tailscale = { # Enable the GNOME Desktop Environment.
enable = true; displayManager.gdm.enable = true;
useRoutingFeatures = "server"; desktopManager.gnome.enable = true;
}; # Enable nVidia drivers
# X Display Manager videoDrivers = [ "nvidia" ];
# https://nixos.org/manual/nixos/stable/index.html#sec-x11
xserver = {
enable = true;
videoDrivers = nvidia;
autorun = true; autorun = true;
layout = "en";
displayManager = {
gdm = {
enable = true;
}; };
};
desktopManager = { # Set Gnome settings:
gnome = { services.gnome = {
enable = true;
};
};
# https://nixos.org/manual/nixos/stable/index.html#sec-gnome-enable
# Adding icon themes: https://nixos.org/manual/nixos/stable/index.html#sec-gnome-icons-and-gtk-themes
gnome = {
core-utilities.enable = false;
games.enable = false; games.enable = false;
core-utilities.enable = true;
}; };
};
pipewire = { # https://nixos.wiki/wiki/GNOME
environment.gnome.excludePackages = (with pkgs; [
gnome.cheese
gnome.gnome-music
gnome.epiphany
gnome.geary
gnome.totem
gnome.gnome-characters
gnome-tour
gnome.gnome-maps
]);
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
alsa.support32bit = true; alsa.support32Bit = true;
}; pulse.enable = true;
}; };
# NixPkgs configuration # Define a user account. Don't forget to set a password with passwd.
nixpkgs = { users.users.albert = {
system = "${system-arch}" isNormalUser = true;
config = { description = "Albert J. Copeland";
allowUnfree = true; extraGroups = [ "networkmanager" "wheel" ];
}; packages = with pkgs; [
firefox
bitwarden
steam
lutris
vlc
];
}; };
# Install various packages # Allow unfree packages
environment = { nixpkgs.config.allowUnfree = true;
systemPackages = with pkgs; [
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# Secureboot
sbctl
# Fingerprint Reader
fprintd
# General packages
wget
vim vim
git git
curl curl
htop htop
tailscale
iftop iftop
jq nload
zip iotop
tar glxinfo
bash tailscale
# Gnome Extensions / Packages
gnomeExtensions.dash-to-dock
gnomeExtensions.blur-my-shell
gnomeExtensions.vitals
gnomeExtensions.user-themes
gnomeExtensions.caffeine
gnome3.gnome-tweaks
]; ];
# If a GUI is enabled, install GUI apps: # Enable the OpenSSH daemon and Tailscale.
if config.services.xserver.enable then [ services.openssh.enable = true;
pkgs.firefox services.tailscale.enable = true;
pkgs.steam
pkgs.bitwarden # Enable nVidia drivers:
pkgs.lutris hardware.nvidia = {
pkgs.vscodium
pkgs.vlc
];
}; };
# Configure programs # This value determines the NixOS release from which the default
programs = { # settings for stateful data, like file locations and database versions
bash = { # on your system were taken. Its perfectly fine and recommended to leave
enableCompletion = true; # this value at the release version of the first install of this system.
enableLsColors = true; # Before changing this value read the documentation for this option
shellAliases = { # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
d = "docker"; system.stateVersion = "unstable"; # Did you read the comment?
dc = "docker-compose";
de = "docker exec -it";
ddate = "date +%Y.%m.%d";
dday = "date +%A";
e = "emacsclient -nw"; # emacs in a terminal
f = "fossil";
g = "git";
ga = "git add -A";
gb = "git branch";
gc = "git commit";
gca = "git commit -a";
gco = "git checkout";
gd = "git diff";
gl = "git pull --prune";
gp = "git push origin HEAD";
gs = "git status -sb";
hs = "home-manager switch";
ll = "ls -lah";
rm = "rm -i";
tdate = "date +%Y.%m.%d..%H.%M";
ttime = "date +%H.%M";
}
};
firefox = {
# https://nixos.org/manual/nixos/stable/options.html#opt-programs.firefox.preferences
};
vim = {
defaultEditor = true;
};
xwayland = {
enable = true;
};
dconf = {
enable = true;
};
};
} }

173
testing/configuration.nix Normal file
View file

@ -0,0 +1,173 @@
{ config, pkgs, ...}: {
# Desktop/Laptop configuration.nix
# Import other files to this config:
imports = [
./home-manager.nix
./variables.nix
];
# Basic configs
time.timeZone = ${timezone}
# Boot settings
boot = {
blacklistedKernelModules = [ "nouveau" ];
cleanTmpDir = true;
};
# Keep the system up-to-date automatically
system = {
stateVersion = ${nixos-version}
autoUpgrade = {
enable = true;
allowReboot = false;
channel = https://channels.nixos.org/nixos-${nixos-version}
};
};
# Networking:
networking = {
hostname = ${hostname};
enableIPv6 = false;
firewall = {
enable = true;
allowedTCPPorts = [ 22 ];
allowedUDPPorts = [ 41641 ];
};
networkmanager = {
enable = true;
};
};
# Create a user:
# https://nixos.org/manual/nixos/stable/index.html#sec-user-management
users.users.${username} = {
isNormalUser = false;
initialPassword = "Password";
description = "${user-full-name}";
extraGroups = [ "wheel", "networkmanager" ];
uid = 1000;
shell = "/bin/bash"
};
# Enable various services:
services = {
openssh = {
enable = true;
};
ntp = {
enable = true;
};
tailscale = {
enable = true;
useRoutingFeatures = "server";
};
# X Display Manager
# https://nixos.org/manual/nixos/stable/index.html#sec-x11
xserver = {
enable = true;
videoDrivers = nvidia;
autorun = true;
layout = "en";
displayManager = {
gdm = {
enable = true;
};
};
desktopManager = {
gnome = {
enable = true;
};
};
# https://nixos.org/manual/nixos/stable/index.html#sec-gnome-enable
# Adding icon themes: https://nixos.org/manual/nixos/stable/index.html#sec-gnome-icons-and-gtk-themes
gnome = {
core-utilities.enable = false;
games.enable = false;
};
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32bit = true;
};
};
# NixPkgs configuration
nixpkgs = {
system = "${system-arch}"
config = {
allowUnfree = true;
};
};
# Install various packages
environment = {
systemPackages = with pkgs; [
vim
git
curl
htop
tailscale
iftop
jq
zip
tar
bash
];
# If a GUI is enabled, install GUI apps:
if config.services.xserver.enable then [
pkgs.firefox
pkgs.steam
pkgs.bitwarden
pkgs.lutris
pkgs.vscodium
pkgs.vlc
];
};
# Configure programs
programs = {
bash = {
enableCompletion = true;
enableLsColors = true;
shellAliases = {
d = "docker";
dc = "docker-compose";
de = "docker exec -it";
ddate = "date +%Y.%m.%d";
dday = "date +%A";
e = "emacsclient -nw"; # emacs in a terminal
f = "fossil";
g = "git";
ga = "git add -A";
gb = "git branch";
gc = "git commit";
gca = "git commit -a";
gco = "git checkout";
gd = "git diff";
gl = "git pull --prune";
gp = "git push origin HEAD";
gs = "git status -sb";
hs = "home-manager switch";
ll = "ls -lah";
rm = "rm -i";
tdate = "date +%Y.%m.%d..%H.%M";
ttime = "date +%H.%M";
}
};
firefox = {
# https://nixos.org/manual/nixos/stable/options.html#opt-programs.firefox.preferences
};
vim = {
defaultEditor = true;
};
xwayland = {
enable = true;
};
dconf = {
enable = true;
};
};
}