From 21e6feaa1feea6caca06cda5e5b62e025c3ed83d Mon Sep 17 00:00:00 2001 From: Emmet Date: Wed, 16 Aug 2023 10:14:01 -0500 Subject: [PATCH] Preliminary WSL profile setup --- profiles/README.org | 1 + profiles/wsl/README.org | 3 ++ profiles/wsl/configuration.nix | 94 ++++++++++++++++++++++++++++++++++ profiles/wsl/home.nix | 66 ++++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 profiles/wsl/README.org create mode 100644 profiles/wsl/configuration.nix create mode 100644 profiles/wsl/home.nix diff --git a/profiles/README.org b/profiles/README.org index 823abee3..c239eb68 100644 --- a/profiles/README.org +++ b/profiles/README.org @@ -6,5 +6,6 @@ Current profiles I have available are: - [[./personal][Personal]] - What I would run on a personal laptop/desktop* - [[./work][Work]] - What I would run on a work laptop/desktop (if they let me bring my own OS :P) - [[./homelab][Homelab]] - What I would run on a server or homelab +- [[./wsl][WSL]] - What I would run inside WSL on Windows *My [[./personal][personal]] and [[./work][work]] profiles are actually functionally identical (the [[./work][work]] profile is actually imported into the [[./personal][personal]] profile)! The only difference between them is that my [[./personal][personal]] profile has a few extra things like gaming and social apps. diff --git a/profiles/wsl/README.org b/profiles/wsl/README.org new file mode 100644 index 00000000..ea364427 --- /dev/null +++ b/profiles/wsl/README.org @@ -0,0 +1,3 @@ +#+title: Trying to use a computer without Linux is hard + +This is my =WSL= profile, which is a minimal installation I use on Windows underneath WSL. This is essentially just for Emacs, some useful CLI apps I can't live without (namely ranger), and LibreOffice, which runs strangely slow on Windows. diff --git a/profiles/wsl/configuration.nix b/profiles/wsl/configuration.nix new file mode 100644 index 00000000..50c7ac0d --- /dev/null +++ b/profiles/wsl/configuration.nix @@ -0,0 +1,94 @@ +# 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, lib, pkgs, blocklist-hosts, username, name, hostname, timezone, locale, wm, theme, ... }: +{ + imports = + [ ../../system/hardware-configuration.nix + ../../system/hardware/kernel.nix # Kernel config + ../../system/hardware/opengl.nix + ../../system/hardware/printing.nix + ../../system/hardware/bluetooth.nix + ../../system/security/doas.nix + ../../system/security/gpg.nix + ../../system/security/blocklist.nix + ../../system/security/firewall.nix + ../../system/security/firejail.nix + ../../system/style/stylix.nix + ]; + + # Fix nix path + nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" + "nixos-config=$HOME/dotfiles/system/configuration.nix" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + + # Experimental features + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # I'm sorry Stallman-taichou + nixpkgs.config.allowUnfree = true; + + # Kernel modules + boot.kernelModules = [ "i2c-dev" "i2c-piix4" "cpufreq_powersave" ]; + + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + # Networking + networking.hostName = hostname; # Define your hostname. + networking.networkmanager.enable = true; # Use networkmanager + + # Timezone and locale + time.timeZone = timezone; # time zone + i18n.defaultLocale = locale; + i18n.extraLocaleSettings = { + LC_ADDRESS = locale; + LC_IDENTIFICATION = locale; + LC_MEASUREMENT = locale; + LC_MONETARY = locale; + LC_NAME = locale; + LC_NUMERIC = locale; + LC_PAPER = locale; + LC_TELEPHONE = locale; + LC_TIME = locale; + }; + + # User account + users.users.${username} = { + isNormalUser = true; + description = name; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + uid = 1000; + }; + + # System packages + environment.systemPackages = with pkgs; [ + vim + wget + zsh + git + home-manager + ]; + + # I use zsh btw + environment.shells = with pkgs; [ zsh ]; + users.defaultUserShell = pkgs.zsh; + programs.zsh.enable = true; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal + pkgs.xdg-desktop-portal-gtk + ]; + }; + + # It is ok to leave this unchanged for compatibility purposes + system.stateVersion = "22.11"; + +} diff --git a/profiles/wsl/home.nix b/profiles/wsl/home.nix new file mode 100644 index 00000000..66d7d568 --- /dev/null +++ b/profiles/wsl/home.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, stdenv, fetchurl, nix-doom-emacs, stylix, username, email, dotfilesDir, theme, wm, editor, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = username; + home.homeDirectory = "/home/"+username; + + programs.home-manager.enable = true; + + imports = [ + nix-doom-emacs.hmModule + stylix.homeManagerModules.stylix + ../../user/shell/sh.nix # My zsh and bash config + ../../user/shell/cli-collection.nix # Useful CLI apps + ../../user/bin/phoenix.nix # My nix command wrapper + ../../user/app/doom-emacs/doom.nix # My doom emacs config + ../../user/app/ranger/ranger.nix # My ranger file manager config + ../../user/app/git/git.nix # My git config + ../../user/style/stylix.nix # Styling and themes for my apps + ../../user/lang/cc/cc.nix # C and C++ tools + ]; + + home.stateVersion = "22.11"; # Please read the comment before changing. + + home.packages = with pkgs; [ + # Core + zsh + git + + # Office + libreoffice-fresh-unwrapped + + # Various dev packages + texinfo + libffi zlib + nodePackages.ungit + ]; + + xdg.enable = true; + xdg.userDirs = { + enable = true; + createDirectories = true; + music = "${config.home.homeDirectory}/Media/Music"; + videos = "${config.home.homeDirectory}/Media/Videos"; + pictures = "${config.home.homeDirectory}/Media/Pictures"; + templates = "${config.home.homeDirectory}/Templates"; + download = "${config.home.homeDirectory}/Downloads"; + documents = "${config.home.homeDirectory}/Documents"; + desktop = null; + publicShare = null; + extraConfig = { + XDG_DOTFILES_DIR = "${config.home.homeDirectory}/.dotfiles"; + XDG_ARCHIVE_DIR = "${config.home.homeDirectory}/Archive"; + XDG_ORG_DIR = "${config.home.homeDirectory}/Org"; + XDG_BOOK_DIR = "${config.home.homeDirectory}/Media/Books"; + }; + }; + xdg.mime.enable = true; + xdg.mimeApps.enable = true; + + home.sessionVariables = { + EDITOR = editor; + }; + +}