From d382772c60e2079c97df7ea1e071f9d8fe876d3e Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Thu, 4 Jan 2024 02:23:45 +0300 Subject: [PATCH] init commit --- flake.lock | 133 ++++++++++++++++ flake.nix | 72 +++++++++ home-manager/home.nix | 219 +++++++++++++++++++++++++++ modules/_template.nix | 16 ++ modules/home-manager/alacritty.nix | 28 ++++ modules/home-manager/default.nix | 5 + modules/home-manager/gtk-config.nix | 44 ++++++ modules/home-manager/opinions.nix | 66 ++++++++ modules/nixos/default.nix | 4 + modules/nixos/gnome.nix | 24 +++ modules/nixos/grub.nix | 22 +++ nixos/configuration.nix | 72 +++++++++ nixos/hardware-configuration.nix | 37 +++++ nixos/lenovo-thinkpad-x1-1st-gen.nix | 11 ++ nixos/security.nix | 15 ++ nixos/software.nix | 53 +++++++ nixos/users.nix | 15 ++ overlays/default.nix | 36 +++++ pkgs/default.nix | 5 + 19 files changed, 877 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home-manager/home.nix create mode 100644 modules/_template.nix create mode 100644 modules/home-manager/alacritty.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/gtk-config.nix create mode 100644 modules/home-manager/opinions.nix create mode 100644 modules/nixos/default.nix create mode 100644 modules/nixos/gnome.nix create mode 100644 modules/nixos/grub.nix create mode 100644 nixos/configuration.nix create mode 100644 nixos/hardware-configuration.nix create mode 100644 nixos/lenovo-thinkpad-x1-1st-gen.nix create mode 100644 nixos/security.nix create mode 100644 nixos/software.nix create mode 100644 nixos/users.nix create mode 100644 overlays/default.nix create mode 100644 pkgs/default.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..39c3742 --- /dev/null +++ b/flake.lock @@ -0,0 +1,133 @@ +{ + "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1689473676, + "narHash": "sha256-L0RhUr9+W5EPWBpLcmkKpUeCEWRs/kLzVMF3Vao2ZU0=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "d95123ca6377cd849cfdce92c0a24406b0c6a789", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, + "hardware": { + "locked": { + "lastModified": 1704266875, + "narHash": "sha256-luA5SGmeIRZlgLfSLUuR3eacS63q2bJ0Yywqak5lj3E=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "8e34f33464d77bea2d5cf7dc1066647b1ad2b324", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704099619, + "narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1695388192, + "narHash": "sha256-2jelpE7xK+4M7jZNyWL7QYOYegQLYBDQS5bvdo8XRUQ=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "37227f274b34a3b51649166deb94ce7fec2c6a4c", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703992652, + "narHash": "sha256-C0o8AUyu8xYgJ36kOxJfXIroy9if/G6aJbNOpA5W0+M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "32f63574c85fbc80e4ba1fbb932cde9619bad25e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1694911725, + "narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "819180647f428a3826bfc917a54449da1e532ce0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "hardware": "hardware", + "home-manager": "home-manager", + "nix-colors": "nix-colors", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8496dd3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +{ + description = "goop-drive config"; + + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + # Home manager + home-manager.url = "github:nix-community/home-manager/release-23.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + hardware.url = "github:nixos/nixos-hardware"; + + nix-colors.url = "github:misterio77/nix-colors"; + }; + + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. + systems = [ + "x86_64-linux" + ]; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; + in { + # Your custom packages + # Accessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; + + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + goop-drive = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./nixos/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + "oatmealine@goop-drive" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + ./home-manager/home.nix + ]; + }; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..ce41e9a --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,219 @@ +{ inputs, outputs, config, pkgs, ... }: + +let + nix-colors-lib = inputs.nix-colors.lib.contrib { inherit pkgs; }; +in { + imports = [ + inputs.nix-colors.homeManagerModules.default + outputs.homeManagerModules.alacritty + outputs.homeManagerModules.opinions + outputs.homeManagerModules.gtkConfig + ]; + + nixpkgs.config.allowUnfree = true; + + home.username = "oatmealine"; + home.homeDirectory = "/home/oatmealine"; + + colorScheme = inputs.nix-colors.colorSchemes.catppuccin-mocha; + + opinions = { + fonts = { + regular = { + package = pkgs.atkinson-hyperlegible; + family = "Atkinson Hyperlegible"; + size = 11; + }; + monospace = { + package = pkgs.cozette; + family = "CozetteVector"; + size = 10; + }; + monospaceBitmap = { + package = pkgs.cozette; + family = "Cozette"; + size = 10; + }; + }; + + lowercaseXdgDirs = true; + }; + + programs.git = { + enable = true; + userName = ''Jill "oatmealine" Monoids''; + userEmail = "oatmealine@disroot.org"; + }; + + dconf = { + enable = true; + #settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + }; + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + # archives + zip + xz + unzip + p7zip + + # utils + ripgrep # recursively searches directories for a regex pattern + jq # A lightweight and flexible command-line JSON processor + nil + + # misc + cowsay + file + which + tree + gnused + grc + + nix-output-monitor + + btop # replacement of htop/nmon + + # system call monitoring + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files + + # system tools + sysstat + lm_sensors # for `sensors` command + ethtool + pciutils # lspci + usbutils # lsusb + powertop + + vivaldi + (discord.override { + withOpenASAR = true; + withVencord = true; + }) + telegram-desktop + + doas-sudo-shim + + gnome.gnome-tweaks + + onlyoffice-bin + ]; + + alacritty.enable = true; + + gtkConfig = { + enable = true; + cursor = { + package = pkgs.graphite-cursors; + name = "graphite-dark"; + }; + icon = { + package = pkgs.papirus-nord; + name = "Papirus-Dark"; + }; + }; + + programs.vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + bbenoist.nix + ]; + }; + + programs.fish = let + colorScript = nix-colors-lib.shellThemeFromScheme { scheme = config.colorScheme; }; + in { + enable = true; + interactiveShellInit = '' + sh ${colorScript} + ''; + plugins = [ + { name = "grc"; src = pkgs.fishPlugins.grc.src; } + #{ name = "tide"; src = pkgs.fishPlugins.tide.src; } + ]; + }; + + programs.micro = { + enable = true; + settings = { + autosu = true; + clipboard = "terminal"; + colorscheme = "generated"; + savecursor = true; + scrollbar = true; + tabsize = 2; + tabstospaces = true; + }; + }; + home.file."micro-generated-colorscheme" = { + enable = true; + target = ".config/micro/colorschemes/generated.micro"; + text = with config.colorScheme.colors; '' + color-link default "#${base05},#${base00}" + color-link comment "#${base03},#${base00}" + color-link identifier "#${base0D},#${base00}" + color-link constant "#${base0E},#${base00}" + color-link constant.string "#E6DB74,#${base00}" + color-link constant.string.char "#BDE6AD,#${base00}" + color-link statement "#${base08},#${base00}" + color-link symbol.operator "#${base08},#${base00}" + color-link preproc "#CB4B16,#${base00}" + color-link type "#${base0D},#${base00}" + color-link special "#${base0B},#${base00}" + color-link underlined "#D33682,#${base00}" + color-link error "bold #CB4B16,#${base00}" + color-link todo "bold #D33682,#${base00}" + color-link hlsearch "#${base00},#E6DB74" + color-link statusline "#${base00},#${base05}" + color-link tabbar "#${base00},#${base05}" + color-link indent-char "#505050,#${base00}" + color-link line-number "#AAAAAA,#${base01}" + color-link current-line-number "#AAAAAA,#${base00}" + color-link diff-added "#00AF00" + color-link diff-modified "#FFAF00" + color-link diff-deleted "#D70000" + color-link gutter-error "#CB4B16,#${base00}" + color-link gutter-warning "#E6DB74,#${base00}" + color-link cursor-line "#${base01}" + color-link color-column "#${base01}" + #No extended types; Plain brackets. + color-link type.extended "default" + #color-link symbol.brackets "default" + color-link symbol.tag "#${base0E},#${base00}" + ''; + }; + + services.syncthing = { + enable = true; + tray.enable = true; + }; + + dconf.settings = { + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + ]; + }; + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = "Print"; + command = "${pkgs.lib.getExe pkgs.flameshot} gui"; + name = "take-screenshot"; + }; + }; + + # This value determines the home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new home Manager release introduces backwards + # incompatible changes. + # + # You can update home Manager without changing this value. See + # the home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "23.11"; + + # Let home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/modules/_template.nix b/modules/_template.nix new file mode 100644 index 0000000..b5c105c --- /dev/null +++ b/modules/_template.nix @@ -0,0 +1,16 @@ +# Module template + +{ lib, config, inputs, ... }: + +with lib; +let + cfg = config.thing; +in { + options.thing = { + enable = mkEnableOption "TODO"; + }; + + config = mkIf cfg.enable { + + }; +} \ No newline at end of file diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix new file mode 100644 index 0000000..e1a9461 --- /dev/null +++ b/modules/home-manager/alacritty.nix @@ -0,0 +1,28 @@ +# alacritty - a cross-platform, GPU-accelerated terminal emulator + +{ lib, config, inputs, ... }: + +with lib; +let + cfg = config.alacritty; +in { + options.alacritty = { + enable = mkEnableOption "Enable Alacritty config"; + }; + + config = mkIf cfg.enable { + programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + window.resize_increments = true; + colors.draw_bold_text_with_bright_colors = true; + font = { + normal = { family = config.opinions.fonts.monospaceBitmap.family; }; + size = config.opinions.fonts.monospaceBitmap.size; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..23260de --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,5 @@ +{ + alacritty = import ./alacritty.nix; + opinions = import ./opinions.nix; + gtkConfig = import ./gtk-config.nix; +} diff --git a/modules/home-manager/gtk-config.nix b/modules/home-manager/gtk-config.nix new file mode 100644 index 0000000..1c8550c --- /dev/null +++ b/modules/home-manager/gtk-config.nix @@ -0,0 +1,44 @@ +{ lib, config, inputs, pkgs, ... }: + +with lib; +let + cfg = config.gtkConfig; + nix-colors-lib = inputs.nix-colors.lib.contrib { inherit pkgs; }; +in { + options.gtkConfig = { + enable = mkEnableOption "Enable GTK configuration"; + cursor = mkOption { + type = types.submodule { + options = { + package = mkOption { type = types.package; }; + name = mkOption { type = types.str; }; + }; + }; + }; + icon = mkOption { + type = types.submodule { + options = { + package = mkOption { type = types.package; }; + name = mkOption { type = types.str; }; + }; + }; + }; + }; + + config = mkIf cfg.enable { + gtk = { + enable = true; + cursorTheme = cfg.cursor; + iconTheme = cfg.icon; + font = { + package = config.opinions.fonts.regular.package; + name = config.opinions.fonts.regular.family; + size = config.opinions.fonts.regular.size; + }; + theme = { + package = nix-colors-lib.gtkThemeFromScheme { scheme = config.colorScheme; }; + name = config.colorScheme.slug; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/opinions.nix b/modules/home-manager/opinions.nix new file mode 100644 index 0000000..acbd844 --- /dev/null +++ b/modules/home-manager/opinions.nix @@ -0,0 +1,66 @@ +# Opinionated tweaks and values. Mostly configurable! + +{ lib, config, inputs, ... }: + +with lib; +let + # ty https://github.com/Misterio77/nix-config/blob/main/modules/home-manager/fonts.nix + mkFontOption = kind: { + family = mkOption { + type = types.str; + default = null; + description = "Family name for ${kind} font profile"; + example = "Fira Code"; + }; + package = mkOption { + type = types.package; + default = null; + description = "Package for ${kind} font profile"; + example = "pkgs.fira-code"; + }; + size = mkOption { + type = types.number; + default = 11; + description = "${kind} font profile size, px"; + example = "11"; + }; + }; + cfg = config.opinions; +in { + options.opinions = { + enable = mkEnableOption "Whether to enable opinionated tweaks"; + + fonts = mkOption { + type = types.submodule { + options = { + regular = mkFontOption "regular"; + monospace = mkFontOption "monospace"; + monospaceBitmap = mkFontOption "bitmap monospace"; + }; + }; + }; + + lowercaseXdgDirs = mkEnableOption "Make XDG folder names all lowercase"; + }; + + config = mkIf cfg.enable { + # fonts + fonts.fontconfig.enable = true; + home.packages = [ cfg.fonts.monospace.package cfg.regular.package ]; + + # xdg dirs + xdg.userDirs = mkIf cfg.lowercaseXdgDirs { + enable = true; + createDirectories = true; + + desktop = "$HOME/desktop"; + documents = "$HOME/documents"; + download = "$HOME/downloads"; + music = "$HOME/music"; + pictures = "$HOME/pictures"; + publicShare = "$HOME/public"; + templates = "$HOME/templates"; + videos = "$HOME/videos"; + }; + }; +} \ No newline at end of file diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..b9f60e8 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,4 @@ +{ + gnome = ./gnome.nix; + grub = ./grub.nix; +} diff --git a/modules/nixos/gnome.nix b/modules/nixos/gnome.nix new file mode 100644 index 0000000..4c719d8 --- /dev/null +++ b/modules/nixos/gnome.nix @@ -0,0 +1,24 @@ +{ lib, config, inputs, pkgs, ... }: + +with lib; +let + cfg = config.gnome; +in { + options.gnome = { + enable = mkEnableOption "Use GNOME as the desktop manager"; + wayland = mkEnableOption "Use Wayland"; + }; + + config = mkIf cfg.enable { + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.desktopManager.gnome.enable = true; + + services.xserver.displayManager.gdm = { + enable = true; + wayland = mkForce cfg.wayland; + }; + }; +} diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix new file mode 100644 index 0000000..dc933da --- /dev/null +++ b/modules/nixos/grub.nix @@ -0,0 +1,22 @@ +{ lib, config, pkga, ... }: + +with lib; +let + cfg = config.grubConfig; +in { + options.grubConfig = { + enable = mkEnableOption "GRUB customization"; + font = mkOption { + type = types.str; + }; + fontSize = mkOption { + type = types.number; + }; + }; + + config = mkIf cfg.enable { + boot.loader.grub.enable = true; + boot.loader.grub.font = cfg.font; + boot.loader.grub.fontSize = cfg.fontSize; + }; +} \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..1997985 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,72 @@ +{ config, pkgs, inputs, outputs, ... }: + +{ + imports = + [ + inputs.hardware.nixosModules.common-cpu-intel + inputs.hardware.nixosModules.common-pc-laptop-ssd + inputs.hardware.nixosModules.common-pc-laptop + ./lenovo-thinkpad-x1-1st-gen.nix + + ./hardware-configuration.nix + + outputs.nixosModules.grub + outputs.nixosModules.gnome + + ./security.nix + ./users.nix + ./software.nix + ]; + + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowAliases = false; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + #grubConfig = { + # enable = true; + # font = "${pkgs.cozette}/share/fonts/truetype/CozetteVector.ttf"; + # fontSize = 10; + #}; + + networking.hostName = "goop-drive"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Moscow"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_GB.UTF-8"; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = "workman"; + }; + console.useXkbConfig = true; + + # Enable CUPS to print documents. + #services.printing.enable = false; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # 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.11"; # Did you read the comment? +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..6343a39 --- /dev/null +++ b/nixos/hardware-configuration.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/9d6f59a0-ba40-4033-a417-d0fceb5954a3"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F8A2-9BC1"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cf178bd9-c2dd-4878-9cca-17e4dc80dcf5"; } + ]; + + # 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.wlp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wwp0s20u4i6.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/lenovo-thinkpad-x1-1st-gen.nix b/nixos/lenovo-thinkpad-x1-1st-gen.nix new file mode 100644 index 0000000..5b730e2 --- /dev/null +++ b/nixos/lenovo-thinkpad-x1-1st-gen.nix @@ -0,0 +1,11 @@ +# Largely based upon https://www.thinkwiki.org/wiki/X1_Linux_Tweaks + +{ config, ... }: +{ + # Laptop-specific battery usage tuning + #powerManagement.powertop.enable = true; + boot.kernelParams = [ + # Enable the i915 Sandybridge Framebuffer Compression (confirmed 475mw savings) + "i915.i915_enable_fbc=1" + ]; +} \ No newline at end of file diff --git a/nixos/security.nix b/nixos/security.nix new file mode 100644 index 0000000..97064a1 --- /dev/null +++ b/nixos/security.nix @@ -0,0 +1,15 @@ +{ + #security.sudo.enable = false; + security.doas = { + enable = true; + extraRules = [ + { users = [ "oatmealine" ]; noPass = true; persist = false; keepEnv = true; } + ]; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; +} \ No newline at end of file diff --git a/nixos/software.nix b/nixos/software.nix new file mode 100644 index 0000000..37f5c76 --- /dev/null +++ b/nixos/software.nix @@ -0,0 +1,53 @@ +{ pkgs, inputs, ... }: + +{ + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + gnome = { + enable = true; + wayland = false; + }; + + programs.fish.enable = true; + users.defaultUserShell = pkgs.fish; + programs.steam.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + micro + git + curl + wget + doas + catppuccin-gtk + home-manager + ]; + + environment.variables.EDITOR = "micro"; + + fonts.packages = with pkgs; [ + corefonts + noto-fonts + noto-fonts-cjk-sans + twitter-color-emoji + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + proggyfonts + atkinson-hyperlegible + cozette + ]; +} diff --git a/nixos/users.nix b/nixos/users.nix new file mode 100644 index 0000000..0c41302 --- /dev/null +++ b/nixos/users.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + users.users.oatmealine = { + isNormalUser = true; + description = "jill"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + users.users.root = { + packages = [ pkgs.shadow ]; + shell = pkgs.shadow; + hashedPassword = "!"; + }; +} \ No newline at end of file diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..2911c13 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,36 @@ +# This file defines overlays +{inputs, pkgs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs {pkgs = final;}; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; + + dynamic-triple-buffering = (final: prev: { + gnome = prev.gnome.overrideScope' (gnomeFinal: gnomePrev: { + mutter = gnomePrev.mutter.overrideAttrs ( old: { + src = pkgs.fetchgit { + url = "https://gitlab.gnome.org/vanvugt/mutter.git"; + # GNOME 45: triple-buffering-v4-45 + rev = "0b896518b2028d9c4d6ea44806d093fd33793689"; + sha256 = "sha256-mzNy5GPlB2qkI2KEAErJQzO//uo8yO0kPQUwvGDwR4w="; + }; + } ); + }); + }) +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..3d9e23c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + # example = pkgs.callPackage ./example { }; +}