From 537f4119f0a4081199a5225e744b902f14d63477 Mon Sep 17 00:00:00 2001 From: Gustav Bruhn Date: Mon, 21 Apr 2025 16:05:38 +0200 Subject: [PATCH] add desktop --- flake.lock | 36 ++++---- flake.nix | 14 +++ hosts/desktop/configuration.nix | 109 +++++++++++++++++++++++ hosts/desktop/hardware-configuration.nix | 39 ++++++++ hosts/desktop/home.nix | 36 ++++++++ 5 files changed, 216 insertions(+), 18 deletions(-) create mode 100644 hosts/desktop/configuration.nix create mode 100644 hosts/desktop/hardware-configuration.nix create mode 100644 hosts/desktop/home.nix diff --git a/flake.lock b/flake.lock index f6378e1..840f7e7 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ ] }, "locked": { - "lastModified": 1744735751, - "narHash": "sha256-OPpfgL3qUIbQdbmp1/ZwnlsuTLooHN4or0EABnZTFRY=", + "lastModified": 1745205007, + "narHash": "sha256-k67bEcLkSo13TIBfs0CGYkJjG12aaikabMtxWbSeqr0=", "owner": "nix-community", "repo": "home-manager", - "rev": "db7738e67a101ad945abbcb447e1310147afaf1b", + "rev": "3fbe9a2b76ff5c4dcb2a2a2027dac31cfc993c8c", "type": "github" }, "original": { @@ -44,11 +44,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1744715315, - "narHash": "sha256-EY7Yd6ns+ihaM2dCK6+/45gaTKnhmHbK/Vb0Vr9+hSs=", + "lastModified": 1745233746, + "narHash": "sha256-4yE9tsO4EBf+OQJGAek5ZhgrzmjGyztKaNXY/dmJuQk=", "owner": "lilyinstarlight", "repo": "nixos-cosmic", - "rev": "1093e56c36baabdbb2643aad583edbdafb7aa5a1", + "rev": "644a91f54a1aaa2c5b43fbfb19a6668a9685523c", "type": "github" }, "original": { @@ -75,11 +75,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1744932701, + "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", "type": "github" }, "original": { @@ -107,11 +107,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1744932701, + "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", "type": "github" }, "original": { @@ -142,11 +142,11 @@ ] }, "locked": { - "lastModified": 1744684506, - "narHash": "sha256-pDPDMT1rdkTWi8MIoZ67gT3L817R7P0Jo+PP+BrnyJI=", + "lastModified": 1745207416, + "narHash": "sha256-2g2TnXgJEvSvpk7ujY69pSplmM3oShhoOidZf1iHTHU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "47beae969336c05e892e1e4a9dbaac9593de34ab", + "rev": "68a0ff1a43d08aa1ec3730e7e7d06f6da0ba630a", "type": "github" }, "original": { @@ -162,11 +162,11 @@ ] }, "locked": { - "lastModified": 1744689966, - "narHash": "sha256-a0BjlNdCQthLPKJgjN5/1XS5LEZ9z43gUsQDCPgBBe4=", + "lastModified": 1745121923, + "narHash": "sha256-8X9JuDfxAEQlBhB0ARgFj9fbDOlCvPx6AbQ1h2T47/g=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "d5181260f73840f5b258fc3efc7cae3f6bfb82e4", + "rev": "02084a38e9dbc4fa17f3474c3e9d43bb7db55799", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 529c992..8af0ab1 100644 --- a/flake.nix +++ b/flake.nix @@ -39,5 +39,19 @@ nixos-hardware.nixosModules.framework-13-7040-amd ]; }; + nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/desktop/configuration.nix + inputs.home-manager.nixosModules.default + { + nix.settings = { + substituters = ["https://cosmic.cachix.org/"]; + trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; + }; + } + nixos-cosmic.nixosModules.default + ]; + }; }; } diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix new file mode 100644 index 0000000..85e8b88 --- /dev/null +++ b/hosts/desktop/configuration.nix @@ -0,0 +1,109 @@ +{ + config, + pkgs, + inputs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ../../modules/nixos/cosmic.nix + # ../../modules/nixos/niri.nix + ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "desktop"; # Define your hostname. + + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Stockholm"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "se"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "sv-latin1"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.bruhng = { + isNormalUser = true; + description = "Gustav Bruhn"; + extraGroups = ["networkmanager" "wheel"]; + }; + + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + + home-manager = { + extraSpecialArgs = {inherit inputs;}; + users = { + "bruhng" = import ./home.nix; + }; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + nil + discord + alejandra + inputs.zen-browser.packages.${pkgs.system}.default + tmux + fastfetch + nmap + spotify + + ]; + + programs.steam.enable = true; + + # List services that you want to enable: + services.fwupd.enable = true; + security.polkit.enable = true; + + # fonts + fonts.packages = with pkgs; [ + nerd-fonts.jetbrains-mono + ]; + + system.stateVersion = "25.05"; # Do not channge +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..fbd88b6 --- /dev/null +++ b/hosts/desktop/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" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f30c7188-4875-42c0-abfd-78f9653437de"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/50EC-BA3D"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp0s20f0u10.useDHCP = lib.mkDefault true; + # networking.interfaces.enp7s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix new file mode 100644 index 0000000..4d36757 --- /dev/null +++ b/hosts/desktop/home.nix @@ -0,0 +1,36 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + ../../modules/home-manager/helix.nix + ../../modules/home-manager/zsh.nix + ]; + home.username = "bruhng"; + home.homeDirectory = "/home/bruhng"; + + home.stateVersion = "24.11"; # Please read the comment before changing. + + home.packages = with pkgs; [ + # example for override + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + (writeShellScriptBin "updateNix" (builtins.readFile ../../update.sh)) + ]; + programs.git = { + enable = true; + userName = "Gustav Bruhn"; + userEmail = "gustav@bruhn.tech"; + }; + + home.file = { + }; + + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}