diff --git a/flake.lock b/flake.lock index d05567b..f984d68 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,30 @@ { "nodes": { + "hydration-notifier": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1784796978, + "narHash": "sha256-sGg60m0swGGU6Pa0CFLOQwhajYKtx8UE/4y1A8LZoBY=", + "ref": "refs/heads/main", + "rev": "06ff96efece79366ece5b727f2cf9c793f581d49", + "revCount": 9, + "type": "git", + "url": "https://tangled.org/tobinio.dev/hydration-notifier" + }, + "original": { + "type": "git", + "url": "https://tangled.org/tobinio.dev/hydration-notifier" + } + }, "nixpkgs": { "locked": { - "lastModified": 1783703440, - "narHash": "sha256-O3/YajjWo001VUIgD8BwaRdSNLUFe7nZ1qV5TwhRBcw=", + "lastModified": 1784707089, + "narHash": "sha256-2V/6imsUgB7mPZlHY54oeVBRDoZbPKnvzwkAHUSSufk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f0500b9660505dc3cb647775fe9a978a74b5283", + "rev": "b3fe9581c9061c749abef42b6d4ee7b7c05c33fa", "type": "github" }, "original": { @@ -16,16 +34,51 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1784707089, + "narHash": "sha256-2V/6imsUgB7mPZlHY54oeVBRDoZbPKnvzwkAHUSSufk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b3fe9581c9061c749abef42b6d4ee7b7c05c33fa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1784796856, + "narHash": "sha256-wWFrV5/Qbm+lyt5x20E/bSbfJiGKMo4RCxZV8cl/WZI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e2587caef70cea85dd97d7daab492899902dbf5d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "sops-nix": "sops-nix" + "hydration-notifier": "hydration-notifier", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", + "sops-nix": "sops-nix", + "zen-browser": "zen-browser" } }, "sops-nix": { "inputs": { "nixpkgs": [ - "nixpkgs" + "nixpkgs-stable" ] }, "locked": { @@ -41,6 +94,26 @@ "repo": "sops-nix", "type": "github" } + }, + "zen-browser": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1784354557, + "narHash": "sha256-z2XthIV/68GNghbqmaPVrShPIfMPwpZKTA47REKC5bA=", + "owner": "youwen5", + "repo": "zen-browser-flake", + "rev": "239dc504b56eabcfc1dce945e7e22ca99694be89", + "type": "github" + }, + "original": { + "owner": "youwen5", + "repo": "zen-browser-flake", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 096fded..9eba571 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,58 @@ { - description = "My NixOS config"; + description = "My NixOS configurations"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-26.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; - sops-nix.url = "github:Mic92/sops-nix"; - sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + + zen-browser = { + url = "github:youwen5/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; + + hydration-notifier.url = "git+https://tangled.org/tobinio.dev/hydration-notifier"; }; - outputs = { nixpkgs, sops-nix, ... }: { - nixosConfigurations.homeserver = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + outputs = + { + nixpkgs-stable, + nixpkgs-unstable, + sops-nix, + ... + }@inputs: + { + + nixosConfigurations = { + homeserver = nixpkgs-stable.lib.nixosSystem { + system = "x86_64-linux"; - modules = [ - ./hosts/homeserver/configuration.nix - sops-nix.nixosModules.sops - ]; + specialArgs = { + inherit inputs; + }; + + modules = [ + ./hosts/homeserver/configuration.nix + sops-nix.nixosModules.sops + ]; + }; + + laptop = nixpkgs-unstable.lib.nixosSystem { + system = "x86_64-linux"; + + specialArgs = { + inherit inputs; + }; + + modules = [ + ./hosts/laptop/configuration.nix + inputs.hydration-notifier.nixosModules.default + ]; + }; + }; }; - }; } diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix new file mode 100644 index 0000000..124a07b --- /dev/null +++ b/hosts/laptop/configuration.nix @@ -0,0 +1,182 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ inputs, config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + + # Set your time zone. + time.timeZone = "Europe/Vienna"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_AT.UTF-8"; + LC_IDENTIFICATION = "de_AT.UTF-8"; + LC_MEASUREMENT = "de_AT.UTF-8"; + LC_MONETARY = "de_AT.UTF-8"; + LC_NAME = "de_AT.UTF-8"; + LC_NUMERIC = "de_AT.UTF-8"; + LC_PAPER = "de_AT.UTF-8"; + LC_TELEPHONE = "de_AT.UTF-8"; + LC_TIME = "de_AT.UTF-8"; + }; + + # Enable the KDE Plasma Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "at"; + variant = ""; + }; + + # 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; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + services.hydration-notifier.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users."tobinio" = { + isNormalUser = true; + description = "Tobias Frischmann"; + extraGroups = [ "networkmanager" "wheel" "dialout" ]; + packages = with pkgs; [ + inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + + zed-editor + just + + starship + zoxide + + btop + + discord + + pangolin-cli + + nixd + nixfmt + ]; + shell = pkgs.fish; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + set fish_greeting # Disable greeting + + starship init fish | source + zoxide init fish | source + + alias zed zeditor + alias cd z + + . /home/tobinio/export-esp.sh + ''; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + git + + espup + espflash + + rustup + gcc + + nextcloud-client + ]; + + programs.steam.enable = true; + + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + stdenv.cc.cc + zlib + openssl + ]; + + # 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; + + # 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 = "26.05"; # Did you read the comment? + +} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix new file mode 100644 index 0000000..3d6ba15 --- /dev/null +++ b/hosts/laptop/hardware-configuration.nix @@ -0,0 +1,45 @@ +# 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" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/056f50ac-7bbb-4950-9683-a77add5d547e"; + fsType = "btrfs"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/056f50ac-7bbb-4950-9683-a77add5d547e"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/056f50ac-7bbb-4950-9683-a77add5d547e"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E45C-E0C4"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/1e9a32fc-fb1d-46a0-b24d-012d1c58ec2a"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/justfile b/justfile index 5b24381..7d1a373 100644 --- a/justfile +++ b/justfile @@ -1,2 +1,2 @@ -switch: - sudo nixos-rebuild switch --flake .#homeserver +switch flake: + sudo nixos-rebuild switch --flake .#{{flake}}