commit ad93dd2ca6ab244488aad477e9a251ed17eaff62 Author: NixOS Date: Fri Jan 5 02:21:04 2024 +0000 initial commit with config diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..33fcd25 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,133 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable flakes. + nix = { + # package = pkgs.nixFlakes; # Ask Katie what that does + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + + networking.hostName = "oyvoLaptop"; # Define your hostname. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "America/Montreal"; + + # Select internationalization properties. + i18n.defaultLocale = "en_CA.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + useXkbConfig = true; # use xkb.options in tty. + }; + + # Enable Wayland and Sway this way, for now (UPDATE: just using home manager lol) + # programs.sway.enable = true; + # Enable screensharing + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + # Enable graphics. + hardware.opengl.enable = true; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + security.rtkit.enable = true; # needed for pipewire + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Enable Bluetooth. + hardware.bluetooth.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.alice = { + isNormalUser = true; + home = "/home/alice"; + extraGroups = [ "wheel" "networkmanager" ]; # Enable 'sudo' for the user. + initialPassword = "manysuchcases"; + }; + home-manager.users.alice = import ./home.nix; + + # Make sure swaylock works (defined in home.nix) + security.pam.services.swaylock = { }; + + # Make sure suspend actually happens + services.logind.extraConfig = '' + InhibitDelayMaxSec=5 + ''; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim + git + gay # very important, do not remove + ]; + + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # 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. + # + # 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 = "23.11"; # Did you read the comment? + +} + diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4a65113 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "NixOS configuration with flakes"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + # nixos-hardware.url = "github:NixOS/nixos-hardware/master" # Why does this exist on my macbook? + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = { self, nixpkgs, home-manager }: + let + system = "x86_64-linux"; + in + { + nixosConfigurations = { + oyvoLaptop = nixpkgs.lib.nixosSystem { + inherit system; + + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..84c53b6 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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 = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/737c9ec6-588b-43b7-8966-811049b7e29a"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E8A8-2706"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3a01cccd-286b-47b4-9a4e-5a04d02a7184"; } + ]; + + # 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.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..d0c39b9 --- /dev/null +++ b/home.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: + +{ + home.username = "alice"; + home.homeDirectory = "/home/alice"; + + home.stateVersion = "23.11"; + + home.packages = with pkgs; + [ texliveFull ] ++ # TeX distribution + [ kitty ] ++ # Terminal emulator + [ firefox libreoffice ]; # Basic graphical apps + + programs.home-manager.enable = true; + + programs.git = { + enable = true; + extraConfig = { init.defaultBranch = "main"; }; + }; + + wayland.windowManager.sway = import ./wayland/sway.nix { inherit config lib pkgs; }; + + programs.swaylock = { + enable = true; + settings = { + font-size = 12; + }; + }; + services.swayidle = { + enable = true; + events = [ + { event = "before-sleep"; command = "${pkgs.lib.getExe pkgs.swaylock} -f"; } + ]; + }; + + programs.waybar = import ./wayland/waybar.nix { inherit config lib pkgs; }; + + fonts.fontconfig.enable = true; + + programs.kitty = { + enable = true; + shellIntegration.enableZshIntegration = true; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + }; + + programs.zathura = { + enable = true; + }; + + programs.thunderbird = { + enable = true; + }; +} diff --git a/wayland/sway.nix b/wayland/sway.nix new file mode 100644 index 0000000..da94a6c --- /dev/null +++ b/wayland/sway.nix @@ -0,0 +1,18 @@ +{ scripts, config, lib, pkgs, ... }: + +{ + enable = true; + config = { + terminal = "kitty"; + bars = [{ + command = "${pkgs.lib.getExe pkgs.waybar}"; + position = "bottom"; + }]; + modifier = "Mod4"; + input = { "type:touchpad" = { natural_scroll = "enabled"; }; }; + window = { + border = 2; + titlebar = true; + }; + }; +}; diff --git a/wayland/waybar.nix b/wayland/waybar.nix new file mode 100644 index 0000000..74e28a4 --- /dev/null +++ b/wayland/waybar.nix @@ -0,0 +1,5 @@ +{ scripts, config, lib, pkgs, ... }: + +{ + enable = true; +};