From 5dc392a9b6b47aee2ae5b1c4b76fe821992d9027 Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Thu, 29 Feb 2024 11:25:56 +0100 Subject: [PATCH] Laptop --- flake.lock | 69 +++++----- flake.nix | 13 +- home-manager/kalle-laptop/kalle.nix | 128 ++++++++++++++++++ nixos/kalle-laptop/configuration.nix | 117 ++++++++++++++++ nixos/kalle-laptop/hardware-configuration.nix | 39 ++++++ 5 files changed, 326 insertions(+), 40 deletions(-) create mode 100644 home-manager/kalle-laptop/kalle.nix create mode 100644 nixos/kalle-laptop/configuration.nix create mode 100644 nixos/kalle-laptop/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 5bb8f6d..c5f60ad 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "discord-screenaudio": { - "flake": false, - "locked": { - "lastModified": 1698432393, - "narHash": "sha256-pD3NtDRqpi3too7jKGvno9QkYN6pSbP/hycRqS2SwaE=", - "ref": "refs/heads/master", - "rev": "3f3f17949d13f479c2f21573d5471b5ecf33c633", - "revCount": 178, - "submodules": true, - "type": "git", - "url": "ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2" - }, - "original": { - "submodules": true, - "type": "git", - "url": "ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -25,11 +7,11 @@ ] }, "locked": { - "lastModified": 1707683400, - "narHash": "sha256-Zc+J3UO1Xpx+NL8UB6woPHyttEy9cXXtm+0uWwzuYDc=", + "lastModified": 1708988456, + "narHash": "sha256-RCz7Xe64tN2zgWk+MVHkzg224znwqknJ1RnB7rVqUWw=", "owner": "nix-community", "repo": "home-manager", - "rev": "21b078306a2ab68748abf72650db313d646cf2ca", + "rev": "1d085ea4444d26aa52297758b333b449b2aa6fca", "type": "github" }, "original": { @@ -69,14 +51,15 @@ "nixpkgs": [ "xdg-desktop-portal-hyprland", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1704287638, - "narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=", + "lastModified": 1708681732, + "narHash": "sha256-ULZZLZ9C33G13IaXLuAc4oTzHUvnATI8Fj2u6gzMfT0=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "6624f2bb66d4d27975766e81f77174adbe58ec97", + "rev": "f4466367ef0a92a6425d482050dc2b8840c0e644", "type": "github" }, "original": { @@ -87,11 +70,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707546158, - "narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=", + "lastModified": 1709150264, + "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0", + "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", "type": "github" }, "original": { @@ -120,11 +103,11 @@ "plugin-rainbow-delimiters-nvim": { "flake": false, "locked": { - "lastModified": 1707759118, - "narHash": "sha256-kNnZV06VYE7DhNDbJIHd6MvdX04qFjXgy7OHO1ai6x0=", + "lastModified": 1709163331, + "narHash": "sha256-QETHqUrqY9acAUxRgROGI3Qopy+P6tW36uVqHCemj10=", "owner": "HiPhish", "repo": "rainbow-delimiters.nvim", - "rev": "586f44d21ef687a4d41b5b24c1566d686ae84250", + "rev": "4902de74335ba0c4816cb67c5d5052c0c5fc7e56", "type": "gitlab" }, "original": { @@ -151,7 +134,6 @@ }, "root": { "inputs": { - "discord-screenaudio": "discord-screenaudio", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "plugin-harpoon1": "plugin-harpoon1", @@ -175,6 +157,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, "xdg-desktop-portal-hyprland": { "inputs": { "hyprland-protocols": "hyprland-protocols", @@ -182,14 +179,14 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems" + "systems": "systems_2" }, "locked": { - "lastModified": 1706521509, - "narHash": "sha256-AInZ50acOJ3wzUwGzNr1TmxGTMx+8j6oSTzz4E7Vbp8=", + "lastModified": 1708954916, + "narHash": "sha256-GUbIMXUrcb6Pxmz9lQ3j6XMFLsQaSwTvViNKYNSMdd0=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "c06fd88b3da492b8f9067be021b9184f7012b5a8", + "rev": "15fd76cb6ebb0e3c3b2c3a3daf452e7b781c6e8a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0912bef..fffdf6d 100644 --- a/flake.nix +++ b/flake.nix @@ -19,10 +19,6 @@ plugin-harpoon1.url = "github:ThePrimeagen/harpoon"; plugin-harpoon1.flake = false; - # Discord screen audio - discord-screenaudio.url = "git+ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2&submodules=1"; - discord-screenaudio.flake = false; - # Track hyprland xdg desktop portal master until screenshots get released again xdg-desktop-portal-hyprland.url = "github:hyprwm/xdg-desktop-portal-hyprland"; xdg-desktop-portal-hyprland.inputs.nixpkgs.follows = "nixpkgs"; @@ -46,6 +42,10 @@ specialArgs = { inherit inputs outputs; }; modules = [ ./nixos/kalle-pc/configuration.nix ]; }; + "kalle-laptop" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ ./nixos/kalle-laptop/configuration.nix ]; + }; }; homeConfigurations = { "kalle@kalle-pc" = home-manager.lib.homeManagerConfiguration { @@ -53,6 +53,11 @@ extraSpecialArgs = { inherit inputs outputs; }; modules = [ ./home-manager/kalle-pc/kalle.nix ]; }; + "kalle@kalle-laptop" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ ./home-manager/kalle-laptop/kalle.nix ]; + }; }; }; } diff --git a/home-manager/kalle-laptop/kalle.nix b/home-manager/kalle-laptop/kalle.nix new file mode 100644 index 0000000..524c9ff --- /dev/null +++ b/home-manager/kalle-laptop/kalle.nix @@ -0,0 +1,128 @@ +{ inputs +, outputs +, lib +, config +, pkgs +, ... +}: + +{ + home = { + username = "kalle"; + homeDirectory = "/home/kalle"; + }; + + imports = + [ + ../../nvim + ../../tmux + ]; + + nixpkgs = { + overlays = with outputs.overlays; [ + nvim-plugins + ]; + + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + + permittedInsecurePackages = [ + "electron-25.9.0" + ]; + }; + }; + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + discord + vesktop + firefox + chromium + httpie + kate + dolphin + ark + rustup + gcc + pavucontrol + difftastic + sops + obsidian + + cachix + ]; + + programs.home-manager.enable = true; + + programs.bash = { + enable = true; + shellAliases = { + # Git aliases + gg = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an (%ae)%C(reset)' --all"; + gca = "git add -A; git commit -a --amend --no-edit"; + gs = "git status"; + + # Replace some commands with better versions + ssh = "kitty +kitten ssh"; + diff = "${pkgs.difftastic}/bin/difftastic"; + }; + initExtra = '' + function open() { + xdg-open $@ &> /dev/null & + } + ''; + }; + + programs.kitty = { + enable = true; + theme = "Catppuccin-Mocha"; + settings = { + background_opacity = "0.8"; + allow_remote_control = true; + }; + }; + + programs.starship = { + enable = true; + settings = { + add_newline = true; + + # Remove text from nix shell component + nix_shell.format = "via [$symbol]($style) "; + + git_status.disabled = true; + package.disabled = true; + }; + }; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + + programs.git = { + enable = true; + userName = "Kalle Struik"; + userEmail = "kalle@kallestruik.nl"; + difftastic.enable = true; + extraConfig = { + init.defaultBranch = "main"; + }; + }; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # 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 should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.05"; # Please read the comment before changing. +} diff --git a/nixos/kalle-laptop/configuration.nix b/nixos/kalle-laptop/configuration.nix new file mode 100644 index 0000000..6256dde --- /dev/null +++ b/nixos/kalle-laptop/configuration.nix @@ -0,0 +1,117 @@ +{ inputs +, config +, pkgs +, ... +}: + +{ + imports = + [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + nixpkgs.config.allowUnfree = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "kalle-laptop"; + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; # use xkbOptions in tty. + }; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + + displayManager.sddm.enable = true; + desktopManager.plasma6.enable = true; + + # Configure keymap in X11 + xkb = { + layout = "us"; + options = "eurosign:e,caps:escape"; + }; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + users.users.kalle = { + isNormalUser = true; + group = "kalle"; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + }; + + users.groups.kalle.gid = 1000; + + environment.systemPackages = with pkgs; [ + xdg-user-dirs + ]; + + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-color-emoji + + fira-code + fira-code-symbols + + (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) + ]; + + fontconfig = { + defaultFonts = { + serif = [ "Noto Serif" "Symbols Nerd Font" ]; + sansSerif = [ "Noto Sans" "Symbols Nerd Font" ]; + monospace = [ "Fira Code" "Symbols Nerd Font Mono" ]; + }; + }; + }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Disable firewall. + networking.firewall.enable = false; + + # 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.05"; # Did you read the comment? + +} + diff --git a/nixos/kalle-laptop/hardware-configuration.nix b/nixos/kalle-laptop/hardware-configuration.nix new file mode 100644 index 0000000..0d67738 --- /dev/null +++ b/nixos/kalle-laptop/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 = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f39bc45f-1489-4fe3-8a2f-6f768563ce20"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/C42C-12CF"; + 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.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.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; +}