From 7b1018c9975df4820c5812505d2913cd169d84a5 Mon Sep 17 00:00:00 2001 From: roxwize Date: Tue, 17 Dec 2024 15:50:18 -0500 Subject: [PATCH] ~ --- nixos/base.nix | 85 +++++++++ nixos/flake.nix | 30 ++++ nixos/home.nix | 269 ++++++++++++++--------------- nixos/hosts/qemu/configuration.nix | 99 +---------- 4 files changed, 248 insertions(+), 235 deletions(-) create mode 100644 nixos/base.nix create mode 100644 nixos/flake.nix diff --git a/nixos/base.nix b/nixos/base.nix new file mode 100644 index 0000000..046c3cd --- /dev/null +++ b/nixos/base.nix @@ -0,0 +1,85 @@ +{ config, lib, pkgs, home-manager, ... }: +{ + imports = [ + ./packages.nix + home-manager.nixosModules.home-manager + ]; + + nix.settings.experimental-features = ["nix-command" "flakes"]; + nixpkgs.config.allowUnfree = true; + + networking.networkmanager.enable = true; + + programs = { + dconf.enable = true; + firefox.enable = true; + fish.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + # X11 + xserver = { + enable = true; + xkb.layout = "us"; + windowManager = { + openbox.enable = true; + twm.enable = true; + }; + desktopManager = { + pantheon.enable = true; + }; + }; + displayManager = { + sddm = { + enable = true; + settings = { + Autologin = { + User = "rae"; + Session = "none+openbox"; + }; + }; + }; + }; + # desktopManager = { + # plasma6.enable = true; + # }; + + # Touchpad support + libinput.enable = true; + # OpenSSH + openssh.enable = true; + # Sound + pipewire = { + enable = true; + pulse.enable = true; + }; + # CUPS printing + printing.enable = true; + }; + + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + fira-code + gohufont + ]; + }; + + users.users.rae = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + hashedPassword = "$y$j9T$YPq.Kl8rss1JmJ5Vg6cHE/$2kdfzCkkhaO.I4u714EQnS/ZFert5byisiRVxtC.9G2"; + shell = pkgs.fish; + }; + + home-manager.users.rae = import ./home.nix; + + system.copySystemConfiguration = true; +} diff --git a/nixos/flake.nix b/nixos/flake.nix new file mode 100644 index 0000000..fc8b55d --- /dev/null +++ b/nixos/flake.nix @@ -0,0 +1,30 @@ +{ + description = "rae's nixOS config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ self, nixpkgs, home-manager, ... }: { + nixosConfigurations = { + qemu = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/qemu/configuration.nix + # home-manager.nixosModules.home-manager { + # home-manager = { + # useGlobalPkgs = true; + # useUserPackages = true; + # users.rae = import ./home.nix; + # }; + # } + ]; + }; + }; + }; +} diff --git a/nixos/home.nix b/nixos/home.nix index 277a8d8..83152c1 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -1,155 +1,146 @@ { pkgs, ... }: -let - home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz"; -in { - imports = [ - "${home-manager}/nixos" - ]; - - home-manager.users.rae = { - home = { - stateVersion = "24.11"; - sessionVariables = { - BROWSER = "firefox"; - TERM = "kitty"; - }; - file = { - ".twmrc".source = ../configs/twm; - ".local/share/themes".source = ../configs/openbox/themes; - }; + home = { + stateVersion = "24.11"; + sessionVariables = { + BROWSER = "firefox"; + TERM = "kitty"; }; - xdg.configFile = { - "openbox".source = ../configs/openbox; + file = { + ".twmrc".source = ../configs/twm; + ".local/share/themes".source = ../configs/openbox/themes; }; + }; + xdg.configFile = { + "openbox".source = ../configs/openbox; + }; - programs = { - git = { - enable = true; - userName = "roxwize"; - userEmail = "rae@roxwize.xyz"; - }; - kitty = { - enable = true; - font.name = "Fira Code"; - theme = "Aquarium Light"; # or Base2Tone Meadow Dark - }; - neovim = { - enable = true; - defaultEditor = true; - vimAlias = true; - plugins = with pkgs.vimPlugins; [ - vim-wakatime - ]; - extraLuaConfig = '' - vim.opt["tabstop"] = 4 - vim.opt["shiftwidth"] = 4 - ''; - }; + programs = { + git = { + enable = true; + userName = "roxwize"; + userEmail = "rae@roxwize.xyz"; }; + kitty = { + enable = true; + font.name = "Fira Code"; + theme = "Aquarium Light"; # or Base2Tone Meadow Dark + }; + neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + plugins = with pkgs.vimPlugins; [ + vim-wakatime + ]; + extraLuaConfig = '' + vim.opt["tabstop"] = 4 + vim.opt["shiftwidth"] = 4 + ''; + }; + }; - services = { - polybar = { - enable = true; - script = "polybar &"; - settings = - let - background = "#0000"; - foreground = "#fff"; - color0 = "#d9eafd"; - color1 = "#bcccdc"; - color2 = "#9aa6b2"; - in { - "global/wm" = { - margin-top = 2; - margin-bottom = 2; - }; - "bar/top" = { - background = background; - foreground = "#000"; - width = "100%"; - height = 32; - font-0 = "GohuFont:style=Regular:size=14;3"; - modules-left = "cpu memory"; - modules-center = "xworkspaces"; - modules-right = "battery audio date"; - module-margin = 1; - offset-y = 14; - padding = 2; - }; + services = { + polybar = { + enable = true; + script = "polybar &"; + settings = + let + background = "#0000"; + foreground = "#fff"; + color0 = "#d9eafd"; + color1 = "#bcccdc"; + color2 = "#9aa6b2"; + in { + "global/wm" = { + margin-top = 2; + margin-bottom = 2; + }; + "bar/top" = { + background = background; + foreground = "#000"; + width = "100%"; + height = 32; + font-0 = "GohuFont:style=Regular:size=14;3"; + modules-left = "cpu memory"; + modules-center = "xworkspaces"; + modules-right = "battery audio date"; + module-margin = 1; + offset-y = 14; + padding = 2; + }; - "module/cpu" = { - type = "internal/cpu"; - label = "CPU: %percentage%%"; - label-background = color0; - label-padding = 2; - interval = 2; - }; - "module/memory" = { - type = "internal/memory"; - label = "RAM: %percentage_used%%"; - label-background = color1; - label-padding = 2; - interval = 2; - }; - "module/xwindow" = { - type = "internal/xwindow"; - label-active-font = 0; - }; - "module/xworkspaces" = { - type = "internal/xworkspaces"; - enable-scroll = false; - label-active = "%name%"; - label-active-background = color2; - label-active-padding = 1; - label-occupied = "%name%"; - label-occupied-padding = 1; - label-empty = "%name%"; - label-empty-padding = 1; - label-urgent = "%name%"; - label-urgent-background = color0; - label-urgent-padding = 1; - }; - "module/audio" = { - type = "internal/pulseaudio"; - }; - "module/battery" = { - type = "internal/battery"; - battery = "BAT0"; - adapter = "ADP1"; - label-charging = "BAT: %percentage%%++"; - label-discharging = "BAT: %percentage%%"; - label-background = color1; - label-padding = 2; - }; - "module/date" = { - type = "internal/date"; - date = "%b %d %y"; - time = "%I:%M %p"; - label-background = color0; - label-padding = 2; - interval = 5; - }; + "module/cpu" = { + type = "internal/cpu"; + label = "CPU: %percentage%%"; + label-background = color0; + label-padding = 2; + interval = 2; + }; + "module/memory" = { + type = "internal/memory"; + label = "RAM: %percentage_used%%"; + label-background = color1; + label-padding = 2; + interval = 2; + }; + "module/xwindow" = { + type = "internal/xwindow"; + label-active-font = 0; + }; + "module/xworkspaces" = { + type = "internal/xworkspaces"; + enable-scroll = false; + label-active = "%name%"; + label-active-background = color2; + label-active-padding = 1; + label-occupied = "%name%"; + label-occupied-padding = 1; + label-empty = "%name%"; + label-empty-padding = 1; + label-urgent = "%name%"; + label-urgent-background = color0; + label-urgent-padding = 1; + }; + "module/audio" = { + type = "internal/pulseaudio"; + }; + "module/battery" = { + type = "internal/battery"; + battery = "BAT0"; + adapter = "ADP1"; + label-charging = "BAT: %percentage%%++"; + label-discharging = "BAT: %percentage%%"; + label-background = color1; + label-padding = 2; + }; + "module/date" = { + type = "internal/date"; + date = "%b %d %y"; + time = "%I:%M %p"; + label-background = color0; + label-padding = 2; + interval = 5; }; }; }; + }; - dconf.settings = { - "net/launchpad/plank/docks/dock1" = { - dock-items = ["firefox.dockitem" "io.elementary.terminal.dockitem" "codium.dockitem" "io.elementary.settings.dockitem"]; - }; - "org/gnome/desktop/background" = { - picture-uri = "file://" + builtins.toString /home/rae/.dotfiles/assets/wallpapers/kendal.png; - }; - "org/gnome/desktop/wm/preferences" = { - button-layout = ":minimize,maximize,close"; - }; + dconf.settings = { + "net/launchpad/plank/docks/dock1" = { + dock-items = ["firefox.dockitem" "io.elementary.terminal.dockitem" "codium.dockitem" "io.elementary.settings.dockitem"]; }; - - gtk = { - enable = true; - cursorTheme.name = "Posy's Cursor"; - theme.name = "io.elementary.stylesheet.blueberry"; + "org/gnome/desktop/background" = { + picture-uri = "file://" + builtins.toString /home/rae/.dotfiles/assets/wallpapers/kendal.png; + }; + "org/gnome/desktop/wm/preferences" = { + button-layout = ":minimize,maximize,close"; }; }; + + gtk = { + enable = true; + cursorTheme.name = "Posy's Cursor"; + theme.name = "io.elementary.stylesheet.blueberry"; + }; } diff --git a/nixos/hosts/qemu/configuration.nix b/nixos/hosts/qemu/configuration.nix index f1b1675..752221f 100644 --- a/nixos/hosts/qemu/configuration.nix +++ b/nixos/hosts/qemu/configuration.nix @@ -2,12 +2,10 @@ { imports = [ ./hardware-configuration.nix + ../../base.nix ../../home.nix - ../../packages.nix ]; - nixpkgs.config.allowUnfree = true; - boot.loader = { # efi.efiSysMountPoint = "/boot/efi"; grub = { @@ -18,10 +16,7 @@ }; }; - networking = { - hostName = "gayfurries"; - networkmanager.enable = true; - }; + networking.hostName = "gayfurries"; time.timeZone = "America/New_York"; i18n.defaultLocale = "en_US.UTF-8"; @@ -31,99 +26,11 @@ # useXkbConfig = true; # use xkb.options in tty. }; - programs = { - dconf.enable = true; - firefox.enable = true; - fish.enable = true; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - - services = { - # X11 - xserver = { - enable = true; - xkb.layout = "us"; - windowManager = { - openbox.enable = true; - twm.enable = true; - }; - desktopManager = { - pantheon.enable = true; - }; - }; - displayManager = { - sddm = { - enable = true; - settings = { - Autologin = { - User = "rae"; - Session = "none+openbox"; - }; - }; - }; - }; - # desktopManager = { - # plasma6.enable = true; - # }; - - # Touchpad support - libinput.enable = true; - # OpenSSH - openssh.enable = true; - # Sound - pipewire = { - enable = true; - pulse.enable = true; - }; - # CUPS printing - printing.enable = true; - }; - - fonts = { - enableDefaultPackages = true; - packages = with pkgs; [ - noto-fonts - noto-fonts-cjk-sans - noto-fonts-emoji - fira-code - gohufont - ]; - }; - - users.users.rae = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - hashedPassword = "$y$j9T$YPq.Kl8rss1JmJ5Vg6cHE/$2kdfzCkkhaO.I4u714EQnS/ZFert5byisiRVxtC.9G2"; - shell = pkgs.fish; - }; - # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; - system.copySystemConfiguration = true; - - # This option defines the first version of NixOS you have installed on this particular machine, - # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. - # - # Most users should NEVER change this value after the initial install, for any reason, - # even if you've upgraded your system to a new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how - # to actually do that. - # - # This value being lower than the current NixOS release does NOT mean your system is - # out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, - # and migrated your data accordingly. - # - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "24.11"; # Did you read the comment? + system.stateVersion = "24.11"; }