commit 97c213ebae30c23073ed90ad55658f61a9e84ae1
Author: Vineet Kumar <git@vineetk.net>
Date: Fri, 9 Aug 2024 17:37:42 -0400
start working on using nixos
Diffstat:
4 files changed, 309 insertions(+), 0 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -0,0 +1,62 @@
+{
+ "nodes": {
+ "home-manager": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ },
+ "locked": {
+ "lastModified": 1723015306,
+ "narHash": "sha256-jQnFEtH20/OsDPpx71ntZzGdRlpXhUENSQCGTjn//NA=",
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "rev": "b3d5ea65d88d67d4ec578ed11d4d2d51e3de525e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1722185531,
+ "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1722987190,
+ "narHash": "sha256-68hmex5efCiM2aZlAAEcQgmFI4ZwWt8a80vOeB/5w3A=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "21cc704b5e918c5fbf4f9fff22b4ac2681706d90",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-24.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "home-manager": "home-manager",
+ "nixpkgs": "nixpkgs_2"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
@@ -0,0 +1,22 @@
+{
+ description = "simple nixos flake";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
+ home-manager.url = "github:nix-community/home-manager";
+ };
+
+ outputs = { self, nixpkgs, ... }@attrs: {
+ # TODO: deduplicate this
+ nixosConfigurations.demiurge = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ specialArgs = attrs;
+ modules = [ ./hosts/demiurge ];
+ };
+ nixosConfigurations.lappy = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ specialArgs = attrs;
+ modules = [ ./hosts/lappy ];
+ };
+ };
+}
diff --git a/hosts/lappy/default.nix b/hosts/lappy/default.nix
@@ -0,0 +1,183 @@
+# 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, home-manager, lib, pkgs, ... }:
+
+{
+ imports =
+ [ # Include the results of the hardware scan.
+ ./hardware.nix
+ home-manager.nixosModules.default
+ ];
+
+ # Use the systemd-boot EFI boot loader.
+ boot.loader.systemd-boot.enable = true;
+ boot.loader.efi.canTouchEfiVariables = true;
+
+ networking.hostName = "lappy"; # Define your hostname.
+ # Pick only one of the below networking options.
+ networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
+ # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
+
+ # Set your time zone.
+ time.timeZone = "America/Toronto";
+
+ # Configure network proxy if necessary
+ # networking.proxy.default = "http://user:password@proxy:port/";
+ # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
+
+ # Select internationalisation properties.
+ i18n.defaultLocale = "en_US.UTF-8";
+ console = {
+ font = "Lat2-Terminus16";
+ # keyMap = "us";
+ # useXkbConfig = true; # use xkb.options in tty.
+ };
+
+ # Enable the X11 windowing system.
+ services.xserver = {
+ enable = true;
+ displayManager.startx.enable = true;
+ windowManager.i3.enable = true;
+ videoDrivers = [ "modesetting" ];
+ };
+
+ services.picom = {
+ enable = true;
+ fade = false;
+ inactiveOpacity = 0.9;
+ shadow = true;
+ };
+
+ # Configure keymap in X11
+ # services.xserver.xkb.layout = "us";
+ # services.xserver.xkb.options = "eurosign:e,caps:escape";
+
+ # Enable CUPS to print documents.
+ services.printing.enable = true;
+
+ # Enable sound.
+ hardware.pulseaudio.enable = true;
+ # OR
+ # services.pipewire = {
+ # enable = true;
+ # pulse.enable = true;
+ # };
+
+ # Enable touchpad support (enabled default in most desktopManager).
+ services.libinput.enable = true;
+
+ # enable flakes and nix cli
+ nix.settings.experimental-features = [ "nix-command" "flakes" ];
+
+ # Define a user account. Don't forget to set a password with ‘passwd’.
+ users.users.vin = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
+ shell = pkgs.loksh;
+ openssh.authorizedKeys.keys =
+ [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvM0xCLziR+ZT/SYE1aZM6dklbw4fEC17TWqbADIZRH kou@demiurge" ];
+ packages = with pkgs; [
+ aerc
+ alacritty # doing st/suckless declaratively seems like it'll suck
+ doas
+ kicad
+ librewolf
+ loksh
+ mpv
+ mupdf
+ neofetch
+ profanity
+ rclone
+ redshift
+ tmux
+ tree
+ ];
+ };
+
+ # List packages installed in system profile. To search, run:
+ # $ nix search wget
+ environment.systemPackages = with pkgs; [
+ git
+ vis # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
+ wget
+ ];
+
+ # 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;
+ # };
+
+ security.sudo.enable = false;
+ security.doas.enable = true;
+ security.doas.extraRules = [{
+ users = ["vin"];
+ keepEnv = true;
+ persist = true;
+ }];
+
+ # List services that you want to enable:
+
+ # Enable the OpenSSH daemon.
+ services.openssh.enable = true;
+
+ services.tlp = {
+ enable = true;
+ settings = {
+ CPU_SCALING_GOVERNOR_ON_AC = "performance";
+ CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
+
+ CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
+ CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
+
+ CPU_MIN_PERF_ON_AC = 0;
+ CPU_MAX_PERF_ON_AC = 100;
+ CPU_MIN_PERF_ON_BAT = 0;
+ CPU_MAX_PERF_ON_BAT = 20;
+ };
+ };
+
+ powerManagement.powertop.enable = true;
+
+ # Open ports in the firewall.
+ # networking.firewall.allowedTCPPorts = [ ... ];
+ # networking.firewall.allowedUDPPorts = [ ... ];
+ # Or disable the firewall altogether.
+ # networking.firewall.enable = false;
+
+ networking.wireless.networks = {
+ OpenDyna = {
+ pskRaw = "***REDACTED_PSK***";
+ };
+ FloridaPoly-BYOD = {};
+ };
+
+ # 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 - 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.05"; # Did you read the comment?
+
+}
diff --git a/hosts/lappy/hardware.nix b/hosts/lappy/hardware.nix
@@ -0,0 +1,42 @@
+# 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" "thunderbolt" "nvme" "rtsx_pci_sdmmc" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-intel" ];
+ boot.extraModulePackages = [ ];
+
+ fileSystems."/" =
+ { device = "/dev/disk/by-uuid/ca781a71-db87-42ec-9387-bfb4f84f9fc3";
+ fsType = "f2fs";
+ };
+
+ boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/d7eaeae5-f442-49ea-b32f-1b1bb061273a";
+
+ fileSystems."/boot" =
+ { device = "/dev/disk/by-uuid/73C9-F112";
+ fsType = "vfat";
+ options = [ "fmask=0077" "dmask=0077" ];
+ };
+
+ swapDevices =
+ [ { device = "/dev/disk/by-uuid/37426a26-2a30-4ac6-b83e-94b2179c0148"; }
+ ];
+
+ # 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.<interface>.useDHCP`.
+ networking.useDHCP = lib.mkDefault true;
+ # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}