Move nixos to stow module

This commit is contained in:
agryphus 2024-02-27 15:56:42 -05:00
parent b6788b67a5
commit 36ade1c42d
17 changed files with 172 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
imports = [
# Do not remove
./core.nix
# Want this for bare metal
# ./hardware-configuration.nix
# Specific profiles for this machine
# ./profiles/lf.nix
# ./profiles/nvim.nix
# ./profiles/desktop_x.nix
];
networking.hostName = "nix";
time.timeZone = "America/New_York";
# Define a user account. Don't forget to set a password with passwd.
users.users.nixos = {
isNormalUser = true;
extraGroups = [ # User implicitly in "users" group
"wheel" # Sudo priviledges
];
shell = pkgs.zsh;
# Set so when mutableUsers is set to "false", the user still has a way to login.
password = "";
};
}

View file

@ -0,0 +1,222 @@
{ config, pkgs, ... }:
{
# Nix settings
nix = {
package = pkgs.nixFlakes;
settings.auto-optimise-store = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# Files to add to /etc
environment.etc = {
"zshenv.local".text = ''
export ZDOTDIR="$HOME/.config/zsh"
'';
};
environment.pathsToLink = [
"/share"
];
i18n.defaultLocale = "en_US.UTF-8";
fonts.packages = with pkgs; [
# The nerdfonts package does not allow the installation of only the
# Symbols Nerd Font. Also, the "mono" (actually double wide)
# version of this font centers the symbols which is nice.
nur.repos.bandithedoge.symbols-nerd-font
hack-font
fira-code
];
networking.networkmanager.enable = true;
# Bluetooth daemon
services.blueman.enable = true;
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
# Audio daemon
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
# Udev service
services.udev = {
# Allows member of the "video" group to change system backlight
extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video %S%p/brightness", RUN+="${pkgs.coreutils}/bin/chmod g+w %S%p/brightness"
'';
path = [ pkgs.coreutils ]; # For chgrp
};
# Misc services
services.udisks2.enable = true; # USB Mounting
# services.printing.enable = true; # CUPS
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs = {
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
nix-ld.enable = true; # Run unpatched binaries
zsh.enable = true;
};
virtualisation.docker.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users = {
mutableUsers = true;
users.root = {
# Disables root login, since nothing can hash to "!". Requires setting mutableUsers to "false",
# rebuilding, and then setting mutableUsers back to "true".
hashedPassword = "!";
};
};
documentation = {
# Pull in extra documentation/manpages
dev.enable = true;
# Allow whatis, apropos, and man -k to work, but breaks mandb
man.generateCaches = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# General programs that I like and use
bluetuith # TUI bluetooth manager
bear # Generate Clang compilation database
devour # Opens new program on top of terminal
distrobox # Easily spin up VMs of other distos
docker # Containerization
entr # Hooks for file changes
expect # Provides `unbuffer`
ffmpeg
git # Imagine not having this
grc # Generic command output colorizer
htop-vim # Process monitor, with vim bindings
imagemagick # Image conversion/processing tool
jq # Commandline JSON processor
killall # Easy way to kill a process
man-pages # Documentation
man-pages-posix # Documentation
neofetch # Aesthetic sysinfo
pass-nodmenu # CLI password store (without dmenu dependency)
pinentry-curses # Terminal-based pinentry program
python311 # Python
socat # Interact with sockets
tldr # Brief info about a command
tmux # Terminal multiplexor
udisks # Good way of dealing with USBs and similar media
# Shell
starship # Universal shell prompt
zsh
zsh-autocomplete
zsh-autosuggestions
zsh-nix-shell # Use zsh for nix build shell
zsh-syntax-highlighting # Shell syntax highlighting
# Silly programs
asciiquarium
bsdgames # Fun collection of command-line games
neo-cowsay # The cow says moo
sl # Choo choo
# Some nix specific stuff
nil # Nix LSP
nix-index # See which packages source a file
nix-output-monitor # Track dependency graph during builds
nix-prefetch-git # Like nix-prefetch-url, but for git
nvd # See diffs between builds
# Pop into an environment abiding by the Filesystem Hierarchy Standard to run
# applications which do not play nicely with NixOS.
(
let
fhs-run = pkgs.buildFHSUserEnv {
name = "fhs-run";
targetPkgs = pkgs: [];
multiPkgs = pkgs: [ pkgs.dpkg ];
runScript = pkgs.writeScript "init.sh" ''
echo "fhs-run" >> $out/etc/hostname # Give shell a hostname
eval "$@" # Execute whatever arguments
'';
};
in
fhs-run
)
# Defining an environment to run "make" with the proper libraries installed
# "make", in the main environment, references the script, which envokes the
# environment, and passes the args to gnumake.
(
let
make-shell = pkgs.buildEnv {
name = "make-shell";
paths = with pkgs; [
# Tools
gnumake
pkg-config
# Libraries
harfbuzz
xorg.libX11.dev
xorg.libXft
xorg.libXinerama
];
};
in
(pkgs.writeScriptBin "make" ''
#!/usr/bin/env sh
nix-shell -p ${make-shell} --run "make $*"
'')
)
];
nixpkgs.overlays = [
(self: super: {
asciiquarium = super.asciiquarium.overrideAttrs (oa: {
src = pkgs.fetchgit {
url = "https://github.com/nothub/asciiquarium";
rev = "204090ff4c97b2e00cd67f26b1a37ca7accd4f95";
hash = "sha256-0Y0bcsa6GfP/A+gZe6o94WNWfQNHVEtMZfMuvWVBu0c=";
};
});
})
];
nixpkgs.config.packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
};
# 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?
}

View file

@ -0,0 +1,6 @@
{ lib, stdenv }:
stdenv.mkDerivation {
}

View file

@ -0,0 +1,103 @@
{ lib
, stdenv
, buildNpmPackage
, fetchFromGitLab
, nodePackages
, meson
, pkg-config
, ninja
, gobject-introspection
, gtk3
, libpulseaudio
, gjs
, wrapGAppsHook
, upower
, gnome
, gtk-layer-shell
, glib-networking
, networkmanager
, libdbusmenu-gtk3
, gvfs
, libsoup_3
, libnotify
, pam
, extraPackages ? [ ]
, version ? "git"
, buildTypes ? false
}:
let
gvc-src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "libgnome-volume-control";
rev = "8e7a5a4c3e51007ce6579292642517e3d3eb9c50";
sha256 = "sha256-FosJwgTCp6/EI6WVbJhPisokRBA6oT0eo7d+Ya7fFX8=";
};
in
stdenv.mkDerivation rec {
pname = "ags";
inherit version;
src = buildNpmPackage {
name = pname;
src = ../.;
dontBuild = true;
npmDepsHash = "sha256-ucWdADdMqAdLXQYKGOXHNRNM9bhjKX4vkMcQ8q/GZ20=";
installPhase = ''
mkdir $out
cp -r * $out
'';
};
mesonFlags = builtins.concatLists [
(lib.optional buildTypes "-Dbuild_types=true")
];
prePatch = ''
mkdir -p ./subprojects/gvc
cp -r ${gvc-src}/* ./subprojects/gvc
'';
postPatch = ''
chmod +x post_install.sh
patchShebangs post_install.sh
'';
nativeBuildInputs = [
pkg-config
meson
ninja
nodePackages.typescript
wrapGAppsHook
gobject-introspection
];
buildInputs = [
gjs
gtk3
libpulseaudio
upower
gnome.gnome-bluetooth
gtk-layer-shell
glib-networking
networkmanager
libdbusmenu-gtk3
gvfs
libsoup_3
libnotify
pam
] ++ extraPackages;
meta = with lib; {
description = "A customizable and extensible shell";
homepage = "https://github.com/Aylur/ags";
platforms = [ "x86_64-linux" "aarch64-linux" ];
license = licenses.gpl3;
meta.maintainers = [ lib.maintainers.Aylur ];
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, modulesPath, ... }:
{
environment.systemPackages = with pkgs; [
emacs29-pgtk # Transparency on Wayland requires Pure GTK
# Misc
ispell # Spellchecker
fd # Find entries in filesystem. Helps doom emacs run faster.
# For vterm
cmake
libtool
## LSPs
nodePackages.pyright
];
}

View file

@ -0,0 +1,22 @@
{ config, pkgs, ... }:
{
i18n = {
inputMethod = {
# Have to install fcitx5 through here so that the binary is patched to be able to see the addons.
# If also installed through system packages, the binary without addonds will take precedence.
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-configtool
fcitx5-rime
fcitx5-chinese-addons
];
};
};
fonts.packages = with pkgs; [
source-han-sans
source-han-serif
];
}

View file

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
{
programs.java = {
enable = true;
package = pkgs.javaPackages.openjfx17;
};
environment.systemPackages = with pkgs; [
javaPackages.openjfx19
jdk17
];
}

View file

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
lf
atool # Provides aunpack, to open archives. Also can list archive contents.
bat # A prettified 'cat'
broot # A slicker fzf
chafa # Display images in the terminal (supports sixel)
ffmpegthumbnailer # Get thumbnails of videos
file # Get information about a specific file
fzf # Fuzzy finder. Might fully replace with broot
imagemagick # Image conversion/processing tool
mediainfo # Get info about media
mpv # Audio and video player
nsxiv # Image viewer
odt2txt # Convert open documents to text
perl536Packages.FileMimeInfo # Provides mimeopen, to ask what program to open files in
poppler_utils # Provides pdftoppm, to turn pdfs into images
unrar-wrapper # Extract .rar files
xclip # Copy file name to clip
xdragon # Drag and drop utility
zathura # PDF viewer
];
}

View file

@ -0,0 +1,7 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
];
}

View file

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
neomutt # Mail client
lynx
isync # Downloads the mail
offlineimap # Downloads the mail
msmtp # Sents the mail
];
}

View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
neovim
# LSPs
clang-tools
lua-language-server
# Misc
ripgrep # Used by telescope
gcc
unzip
];
}

View file

@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nmap
];
}

View file

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
steam
];
}

View file

@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
services.syncthing = {
enable = true;
dataDir = "/home/vince/.local/share";
openDefaultPorts = true;
configDir = "/home/vince/.config/syncthing";
user = "vince";
group = "users";
guiAddress = "localhost:8384";
};
environment.systemPackages = with pkgs; [
syncthing # Syncing files between machines
];
}

View file

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "btrfs";
# Implicitly downloads virtualbox
virtualisation.virtualbox.host.enable = true;
users.extraGroups.vboxusers.members = [ "user-with-access-to-virtualbox" ];
}

View file

@ -0,0 +1,69 @@
{ config, pkgs, ... }:
{
security.sudo.extraConfig = ''
%wheel ALL=(ALL:ALL) NOPASSWD: ${pkgs.systemd}/bin/systemctl restart autorandr
'';
# X Server
services.xserver = {
enable = true;
autorun = false;
autoRepeatDelay = 300;
autoRepeatInterval = 50;
# Configure keymap in X11
layout = "us";
xkbOptions = "eurosign:e,caps:escape";
# Touchpad stuff
libinput = {
enable = true;
touchpad.naturalScrolling = true;
};
displayManager = {
lightdm.enable = false;
startx.enable = true;
};
windowManager.dwm.enable = true;
};
# Monitor switching service. Allow users to restart the service without password
services.autorandr.enable = true;
environment.systemPackages = with pkgs; [
arandr # Visually move relative positions of monitors
autorandr # Save and load xrandr profiles
blueman # Bluetooth manager
dunst # Notification daemon
dwmblocks # Suckless statusbar for DWM
dwm # Suckless tiling window manager
feh # Image viewer I use for background setting
firefox # My browser of choice
libnotify # Send messages to notification daemon
libreoffice # MSOffice btfo
maim # Screenshot utility
picom # X Compositor
pinentry-rofi # Rofi frontend for pinentry program
rofi # Menu prompt program
rofi-pass # Rofi frontend for password store
st # Suckless terminal
sxhkd # Hotkey daemon
texlive.combined.scheme-full # LaTeX to create documents
typst # Cool, minimal LaTeX alternative
ungoogled-chromium # If I need a special chrome feature
xsecurelock # Session locker
# GTK Themes
lxappearance-gtk2 # Theme switcher
gruvbox-dark-gtk
# X tools
xorg.xauth
xclip
];
}

View file

@ -0,0 +1,84 @@
{ config, pkgs, ... }:
{
# Or else swaylock will not accept correct password
security.pam.services.swaylock = {};
programs = {
hyprland = { # Dynamic tiling window manager
enable = true;
enableNvidiaPatches = true;
xwayland.enable = true;
};
waybar.enable = true; # Status bar
};
systemd.user.services = {
hyprland-autoname-workspaces = {
description = "Hyprland-autoname-workspaces as systemd service";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
script = "${pkgs.hyprland-autoname-workspaces}/bin/hyprland-autoname-workspaces";
};
network-manager-applet = {
description = "Start the network manager applet";
wantedBy = [ "default.target" ];
serviceConfig.Type = "forking";
serviceConfig.Restart = "always";
serviceConfig.RestartSec = 2;
serviceConfig.ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet";
};
};
environment.systemPackages = with pkgs; [
blueman # Bluetooth manager
dunst # Notification daemon
eww-wayland
firefox # My browser of choice
foot # Wayland native terminal
gobble # Wayland alternative to devour
grim # Screenshot tool
grimblast # Allows freezing screen
hicolor-icon-theme # Icons
hyprland-autoname-workspaces
hyprpaper
kanshi # Autorandr substitute
libnotify # Send messages to notification daemon
libreoffice # MSOffice btfo
networkmanagerapplet # Wifi dropdown menu
pinentry-rofi # Rofi frontend for pinentry program
pyprland # Plugin manager for Hyprland
rofi # Menu prompt program
rofi-pass # Rofi frontend for password store
slurp # Screen selection utility
swaylock # Wayland session locker
swww # Sets background images
texlive.combined.scheme-full # LaTeX to create documents
typst # Cool, minimal LaTeX alternative
ungoogled-chromium # If I need a special chrome feature
wayland-utils
wdisplays # Arnadr substitute
wl-clipboard # Copy/paste utility
wlr-randr # Xrandr substitute
# GTK Themes
lxappearance-gtk2 # Theme switcher
gruvbox-dark-gtk
# Specific versions of packages
(import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz";
}) {}).hyprpicker # v0.1.1. Current verison causes segfault.
];
nixpkgs.overlays = [
(self: super: {
grimblast = super.grimblast.override (oa: {
hyprpicker = (import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz";
}) {}).hyprpicker; # v0.1.1. Current verison causes segfault.
});
})
];
}