diff --git a/common.nix b/common.nix new file mode 100644 index 0000000..0537418 --- /dev/null +++ b/common.nix @@ -0,0 +1,47 @@ +{ + pkgs, + inputs, + ... +}: { + # Shared configuration + programs = { + command-not-found.dbPath = "/etc/programs.sqlite"; + fish.enable = true; + }; + + users = { + defaultUserShell = pkgs.fish; + + users.quadradical = { + isNormalUser = true; + description = "QuadRadical"; + extraGroups = ["networkmanager" "wheel"]; + }; + }; + + environment = { + etc."programs.sqlite".source = inputs.programsdb.packages.${pkgs.system}.programs-sqlite; + shells = [pkgs.fish]; + shellAliases = { + config = "$EDITOR ~/.config/nixos/$(hostname)/configuration.nix"; + flake = "$EDITOR ~/.config/nixos/flake.nix"; + common = "$EDITOR ~/.config/nixos/common.nix"; + stylix = "$EDITOR ~/.config/nixos/$(hostname)/stylix.nix"; + home-manager = "$EDITOR ~/.config/nixos/$(hostname)/home-manager.nix"; + format = "cd ~/.config/nixos/ && nix fmt; cd -"; + rebuild = "sudo nixos-rebuild switch --flake ~/.config/nixos/#"; + garbage = "sudo nix-collect-garbage -d"; + }; + + systemPackages = with pkgs; [ + micro + ]; + }; + + nixpkgs.config.allowUnfree = true; + time.timeZone = "America/Toronto"; + i18n.defaultLocale = "en_CA.UTF-8"; + hardware.pulseaudio.enable = false; + nix.settings.experimental-features = ["nix-command" "flakes"]; + security.rtkit.enable = true; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5012afd --- /dev/null +++ b/flake.lock @@ -0,0 +1,197 @@ +{ + "nodes": { + "base16": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658847131, + "narHash": "sha256-X6Mml7cT0YR3WCD5fkUhpRVV5ZPcwdcDsND8r8xMqTE=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "6b404cda2e04ca3cf5ca7b877af9c469e1386acb", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687969886, + "narHash": "sha256-tC2qFLmuM0PFaw0tMHVcFmzsG/351q09qa1EpuL2n1U=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a7002d6bfca54742d5fc9b485a1879953b4585b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ], + "utils": "utils_2" + }, + "locked": { + "lastModified": 1680000368, + "narHash": "sha256-TlgC4IJ7aotynUdkGRtaAVxquaiddO38Ws89nB7VGY8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "765e4007b6f9f111469a25d1df6540e8e0ca73a6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1687898314, + "narHash": "sha256-B4BHon3uMXQw8ZdbwxRK1BmxVOGBV4viipKpGaIlGwk=", + "owner": "NixOs", + "repo": "nixpkgs", + "rev": "e18dc963075ed115afb3e312b64643bf8fd4b474", + "type": "github" + }, + "original": { + "owner": "NixOs", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1679793451, + "narHash": "sha256-JafTtgMDATE8dZOImBhWMA9RCn9AP8FVOpN+9K/tTlg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cd51a933d91078775b300cf0f29aa3495231aa2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "programsdb": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1688139730, + "narHash": "sha256-temXtSt2FuK3WyDWxSpJCTQmBWeMEbcMAcHdqgdfPo8=", + "owner": "wamserma", + "repo": "flake-programs-sqlite", + "rev": "a508ab18797ba19f476026cedeeda43b4d70cf41", + "type": "github" + }, + "original": { + "owner": "wamserma", + "repo": "flake-programs-sqlite", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "programsdb": "programsdb", + "stylix": "stylix" + } + }, + "stylix": { + "inputs": { + "base16": "base16", + "flake-compat": "flake-compat", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1687876430, + "narHash": "sha256-c1fXtnyQNm9HQ74NSsrvTi1ZrbRpIyIRrR2+4Ozg2j0=", + "owner": "danth", + "repo": "stylix", + "rev": "7dfce721b923549a773bf32c16515ebf1a509dae", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_2": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b9f793c --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + inputs = { + nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; + stylix.url = "github:danth/stylix"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + programsdb = { + url = "github:wamserma/flake-programs-sqlite"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + nixpkgs, + home-manager, + stylix, + self, + ... + } @ inputs: let + system = hostname: + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = + [ + "${self}/${hostname}/configuration.nix" + "${self}/${hostname}/hardware-configuration.nix" + ./common.nix + ] + ++ nixpkgs.lib.optionals (builtins.pathExists "${self}/${hostname}/home-manager.nix") [ + home-manager.nixosModules.home-manager + "${self}/${hostname}/home-manager.nix" + ] + ++ nixpkgs.lib.optionals (builtins.pathExists "${self}/${hostname}/stylix.nix") [ + stylix.nixosModules.stylix + "${self}/${hostname}/stylix.nix" + ]; + }; + in { + nixosConfigurations = { + "quadraticpc" = system "quadraticpc"; + }; + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + }; +} diff --git a/home-manager/btop.nix b/home-manager/btop.nix new file mode 100644 index 0000000..7f563eb --- /dev/null +++ b/home-manager/btop.nix @@ -0,0 +1,8 @@ +{ + programs.btop = { + enable = true; + settings = { + theme_background = false; + }; + }; +} diff --git a/home-manager/git.nix b/home-manager/git.nix new file mode 100644 index 0000000..c7078db --- /dev/null +++ b/home-manager/git.nix @@ -0,0 +1,9 @@ +{ + programs.git = { + enable = true; + userName = "Henry Hiles"; + userEmail = "henry@henryhiles.com"; + }; + + programs.gh.enable = true; +} diff --git a/home-manager/vscode.nix b/home-manager/vscode.nix new file mode 100644 index 0000000..52b1ed8 --- /dev/null +++ b/home-manager/vscode.nix @@ -0,0 +1,80 @@ +{pkgs, ...}: { + programs.vscode = { + enable = true; + package = pkgs.vscodium; + extensions = [ + pkgs.vscode-extensions.eamodio.gitlens + pkgs.vscode-extensions.usernamehw.errorlens + pkgs.vscode-extensions.timonwong.shellcheck + pkgs.vscode-extensions.ritwickdey.liveserver + pkgs.vscode-extensions.dbaeumer.vscode-eslint + pkgs.vscode-extensions.esbenp.prettier-vscode + pkgs.vscode-extensions.oderwat.indent-rainbow + pkgs.vscode-extensions.astro-build.astro-vscode + pkgs.vscode-extensions.streetsidesoftware.code-spell-checker + pkgs.vscode-extensions.arcticicestudio.nord-visual-studio-code + ]; + keybindings = [ + { + key = "ctrl+s"; + command = "workbench.action.files.saveAll"; + } + { + key = "ctrl+s"; + command = "-workbench.action.files.save"; + } + ]; + userSettings = { + "editor.bracketPairColorization.enabled" = true; + "editor.guides.bracketPairs" = "active"; + "window.dialogStyle" = "custom"; + "editor.inlineSuggest.enabled" = true; + "window.titleBarStyle" = "custom"; + "editor.fontFamily" = "FiraCode Nerd Font"; + "editor.fontLigatures" = true; + "editor.formatOnSave" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + "prettier.tabWidth" = 4; + "workbench.startupEditor" = "none"; + "gitlens.hovers.currentLine.over" = "line"; + "gitlens.statusBar.enabled" = false; + "explorer.confirmDelete" = false; + "workbench.sideBar.location" = "right"; + "terminal.external.linuxExec" = "alacritty"; + "git.enableSmartCommit" = true; + "explorer.confirmDragAndDrop" = false; + "javascript.updateImportsOnFileMove.enabled" = "always"; + "editor.insertSpaces" = false; + "prettier.semi" = false; + "javascript.format.semicolons" = "remove"; + "window.menuBarVisibility" = "compact"; + "git.confirmSync" = false; + "editor.detectIndentation" = false; + "errorLens.enabledDiagnosticLevels" = ["error"]; + "git.mergeEditor" = true; + "terminal.integrated.shellIntegration.enabled" = false; + "gitlens.currentLine.enabled" = false; + "gitlens.codeLens.enabled" = false; + "workbench.colorTheme" = "Nord"; + "typescript.updateImportsOnFileMove.enabled" = "always"; + "editor.wordWrap" = "on"; + "[astro]" = { + "editor.defaultFormatter" = "astro-build.astro-vscode"; + }; + "cSpell.language" = "en-CAen-GBen"; + "prettier.trailingComma" = "none"; + "prettier.useTabs" = true; + "editor.minimap.enabled" = false; + "cSpell.userWords" = [ + "distrohop" + "dotfiles" + "Hiles" + "micromark" + "qscan" + "qweather" + "webapps" + ]; + "diffEditor.ignoreTrimWhitespace" = false; + }; + }; +} diff --git a/quadraticpc/background.jpg b/quadraticpc/background.jpg new file mode 100644 index 0000000..ed19d57 Binary files /dev/null and b/quadraticpc/background.jpg differ diff --git a/quadraticpc/configuration.nix b/quadraticpc/configuration.nix new file mode 100644 index 0000000..0a0b4f8 --- /dev/null +++ b/quadraticpc/configuration.nix @@ -0,0 +1,107 @@ +{pkgs, ...}: { + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelParams = ["sysrq_always_enabled=1"]; + }; + + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + nvidia = { + modesetting.enable = true; + nvidiaPersistenced = true; + open = true; + nvidiaSettings = false; + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + + intelBusId = "PCI:00:02:0"; + nvidiaBusId = "PCI:01:00:0"; + }; + }; + }; + + networking = { + hostName = "quadraticpc"; + networkmanager.enable = true; + }; + + services = { + xserver = { + enable = true; + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + layout = "us"; + videoDrivers = ["nvidia"]; + }; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + #jack.enable = true; + }; + + printing.enable = true; + auto-cpufreq.enable = true; + }; + + environment = { + shellAliases = { + neofetch = "neowofetch"; + }; + + sessionVariables = { + XDG_DATA_HOME = "$HOME/.local/share"; + EDITOR = "micro"; + VISUAL = "micro"; + NIXOS_OZONE_WL = "1"; + fish_greeting = ""; + }; + + systemPackages = with pkgs; [ + heroic + killall + armcord + hyfetch + gnomeExtensions.caffeine + gnomeExtensions.pop-shell + gnomeExtensions.appindicator + gnomeExtensions.search-light + gnomeExtensions.blur-my-shell + gnomeExtensions.aylurs-widgets + gnomeExtensions.just-perfection + gnomeExtensions.burn-my-windows + gnomeExtensions.fullscreen-avoider + gnomeExtensions.compiz-windows-effect + ]; + }; + + programs = { + steam = { + enable = true; + package = pkgs.symlinkJoin { + name = pkgs.steam.name; + paths = [pkgs.steam]; + buildInputs = [pkgs.makeWrapper]; + postBuild = ''wrapProgram $out/bin/steam --add-flags "-gamepadui"''; + }; + }; + fish.interactiveShellInit = "neowofetch"; + }; + + sound.enable = true; + system.stateVersion = "23.05"; + hardware.pulseaudio.enable = false; +} diff --git a/quadraticpc/hardware-configuration.nix b/quadraticpc/hardware-configuration.nix new file mode 100644 index 0000000..41d5ea9 --- /dev/null +++ b/quadraticpc/hardware-configuration.nix @@ -0,0 +1,47 @@ +# 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" "nvme" "usb_storage" "usbhid" "sd_mod"]; + kernelModules = []; + }; + kernelModules = ["kvm-intel"]; + extraModulePackages = []; + }; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/f4b1301b-c329-4c3c-9f3a-5584bc22d0c1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/3B50-5881"; + fsType = "vfat"; + }; + + swapDevices = []; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/quadraticpc/home-manager.nix b/quadraticpc/home-manager.nix new file mode 100644 index 0000000..9b8612a --- /dev/null +++ b/quadraticpc/home-manager.nix @@ -0,0 +1,19 @@ +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.quadradical = { + home = { + username = "quadradical"; + homeDirectory = "/home/quadradical"; + }; + }; + home-manager.sharedModules = [ + { + programs.home-manager.enable = true; + home.stateVersion = "23.11"; + } + ../home-manager/git.nix + ../home-manager/btop.nix + ../home-manager/vscode.nix + ]; +} diff --git a/quadraticpc/stylix.nix b/quadraticpc/stylix.nix new file mode 100644 index 0000000..af9adfa --- /dev/null +++ b/quadraticpc/stylix.nix @@ -0,0 +1,33 @@ +{pkgs, ...}: { + stylix = { + image = ./background.jpg; + base16Scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml"; + + fonts = { + serif = { + name = "Cantarell"; + package = pkgs.cantarell-fonts; + }; + + sansSerif = { + name = "Cantarell"; + package = pkgs.cantarell-fonts; + }; + + monospace = { + name = "FiraCode Nerd Font"; + package = pkgs.nerdfonts.override {fonts = ["FiraCode"];}; + }; + + emoji = { + name = "Twitter Color Emoji"; + package = pkgs.twitter-color-emoji; + }; + + sizes = { + applications = 11; + desktop = 11; + }; + }; + }; +}