From bd872d5985a676a515e71ff1c9b263887d9a4852 Mon Sep 17 00:00:00 2001 From: cnst Date: Sat, 22 Jun 2024 17:05:40 +0200 Subject: [PATCH] alots --- flake.lock | 87 ++++++++++++++++++++++++++--------------- flake.nix | 26 ++++++------ home-manager/home.nix | 6 ++- nixos/configuration.nix | 80 +++++++++++++++++++++++++------------ 4 files changed, 127 insertions(+), 72 deletions(-) diff --git a/flake.lock b/flake.lock index 52ae0601..0c0b4683 100644 --- a/flake.lock +++ b/flake.lock @@ -69,6 +69,22 @@ "type": "github" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -143,11 +159,11 @@ ] }, "locked": { - "lastModified": 1717664902, - "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", + "lastModified": 1718879355, + "narHash": "sha256-RTyqP4fBX2MdhNuMP+fnR3lIwbdtXhyj7w7fwtvgspc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", + "rev": "8cd35b9496d21a6c55164d8547d9d5280162b07a", "type": "github" }, "original": { @@ -208,11 +224,11 @@ ] }, "locked": { - "lastModified": 1718788307, - "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", + "lastModified": 1719037157, + "narHash": "sha256-aOKd8+mhBsLQChCu1mn/W5ww79ta5cXVE59aJFrifM8=", "owner": "nix-community", "repo": "home-manager", - "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", + "rev": "cd886711998fe5d9ff7979fdd4b4cbd17b1f1511", "type": "github" }, "original": { @@ -230,11 +246,11 @@ ] }, "locked": { - "lastModified": 1718526747, - "narHash": "sha256-sKrD/utGvmtQALvuDj4j0CT3AJXP1idOAq2p+27TpeE=", + "lastModified": 1718788307, + "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", "owner": "nix-community", "repo": "home-manager", - "rev": "0a7ffb28e5df5844d0e8039c9833d7075cdee792", + "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", "type": "github" }, "original": { @@ -325,35 +341,21 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1718714799, - "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixvim": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgs" + ], "nixvim": "nixvim_2", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1718967624, - "narHash": "sha256-Qu6w2uxdiRIRMpXbF6ItKeDrZzAelR6e8rnnJQTLtl8=", + "lastModified": 1719068614, + "narHash": "sha256-XTVc7z7HJiX1j4zVCm9+V3223f4FQuNt5lZKgOeMzNA=", "owner": "cnsta", "repo": "cnixvim", - "rev": "8e3ce2ad4b703f36e4fc74ef86a4601fc727f71b", + "rev": "ef0e10e815060ff243ba85d56f63e84f434d2717", "type": "github" }, "original": { @@ -377,11 +379,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1718869672, - "narHash": "sha256-artyEBzWUsNXtYj7jBr816wRJj2Y3DYDHw6ECrQotX0=", + "lastModified": 1719042662, + "narHash": "sha256-xwj8hxu02myIPkNsch/v2NbxuRmuvlcphrbYPECE49c=", "owner": "nix-community", "repo": "nixvim", - "rev": "744dfea48bdd331e66b9e874822559fa6fae98af", + "rev": "49452662b7b4dd2467cbac19e0f9820d570d8976", "type": "github" }, "original": { @@ -420,9 +422,30 @@ "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", "nixvim": "nixvim", + "solaar": "solaar", "systems": "systems_2" } }, + "solaar": { + "inputs": { + "flake-compat": "flake-compat_4", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715955760, + "narHash": "sha256-XM9hLLKwEoQvwXZHbBSqYnra2xScO3YQ19Cv4KmO+0A=", + "rev": "1564bf36b610f25468284c1bdb6e6e6325d21226", + "revCount": 35, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/Svenum/Solaar-Flake/1.1.13/018f86f0-9d39-7328-9e18-a3e0231bc256/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/Svenum/Solaar-Flake/%2A.tar.gz" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 7a9ce2b7..6ef717b3 100644 --- a/flake.nix +++ b/flake.nix @@ -5,10 +5,15 @@ # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; - + # Solaar + solaar = { + url = "https://flakehub.com/f/Svenum/Solaar-Flake/*.tar.gz"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Nixvim nixvim = { url = "github:cnsta/cnixvim"; + inputs.nixpkgs.follows = "nixpkgs"; }; # Home manager home-manager = { @@ -21,10 +26,11 @@ nixpkgs, home-manager, systems, + solaar, ... } @ inputs: let inherit (self) outputs; - lib = nixpkgs.lib // home-manager.lib; + lib = nixpkgs.lib // home-manager.lib; forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); pkgsFor = lib.genAttrs (import systems) ( system: @@ -40,18 +46,10 @@ cnix = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; # > Our main nixos configuration file < - modules = [./nixos/configuration.nix]; - }; - }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "cnst@cnix" = home-manager.lib.homeManagerConfiguration { - pkgs = pkgsFor.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - # > Our main home-manager configuration file < - modules = [./home-manager/home.nix]; + modules = [ + solaar.nixosModules.default + ./nixos/configuration.nix + ]; }; }; }; diff --git a/home-manager/home.nix b/home-manager/home.nix index 2a91c9d2..ca4871ca 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -62,7 +62,6 @@ gvfs swaybg wireguard-tools - solaar wpa_supplicant ntfs3g xdg-utils @@ -84,6 +83,7 @@ gruvbox-gtk-theme mullvad-vpn thefuck + calcurse ]; # Hyprland & accessories @@ -127,8 +127,10 @@ syntaxHighlighting.enable = true; shellAliases = { + nixconfig = "cd /home/cnst/.nix-config/"; ll = "ls -l"; - update = "sudo nixos-rebuild switch"; + nixupdate = "sudo nixos-rebuild switch --flake .#cnix"; + flakeupdate = "nix flake update"; }; history = { size = 10000; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 33e07c01..b234b5e0 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -2,6 +2,7 @@ # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) { inputs, + outputs, lib, config, pkgs, @@ -10,6 +11,7 @@ }: { # You can import other NixOS modules here imports = [ + inputs.home-manager.nixosModules.home-manager # If you want to use modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd @@ -21,6 +23,14 @@ ./hardware-configuration.nix ]; + home-manager = { + extraSpecialArgs = {inherit inputs outputs;}; + users = { + # Import your home-manager configuration + cnst = import ../home-manager/home.nix; + }; + }; + nixpkgs = { # You can add overlays here overlays = [ @@ -76,6 +86,9 @@ pkgs.curl pkgs.ripgrep pkgs.nixd + pkgs.python312Packages.oauth2 + pkgs.python312Packages.httplib2 + pkgs.killall ]; localBinInPath = true; }; @@ -89,44 +102,61 @@ jetbrains-mono (nerdfonts.override {fonts = ["JetBrainsMono" "FiraCode" "Iosevka" "3270" "DroidSansMono"];}) ]; # Bootloader - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; # Enable networking - networking.networkmanager.enable = true; - # TODO: Set your hostname - networking.hostName = "cnix"; + networking = { + networkmanager.enable = true; + hostName = "cnix"; + }; # Enable sound with pipewire. hardware = { pulseaudio.enable = false; + bluetooth = { + enable = true; + powerOnBoot = true; + }; graphics = { enable = true; }; }; + zramSwap.enable = true; + security.rtkit.enable = true; programs = { + solaar.enable = true; hyprland = { enable = true; xwayland.enable = true; }; + steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; zsh.enable = true; }; # Time zone & Locale time.timeZone = "Europe/Stockholm"; - i18n.defaultLocale = "en_US.UTF-8"; + 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"; + 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"; + }; }; # Console keymap @@ -137,18 +167,18 @@ cnst = { isNormalUser = true; shell = pkgs.zsh; - openssh.authorizedKeys.keys = [ - # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect - ]; - # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + # openssh.authorizedKeys.keys = []; extraGroups = ["wheel" "networkmanager" "audio" "video"]; }; }; # services services = { - mullvad-vpn.enable = true; - mullvad-vpn.package = pkgs.mullvad-vpn; + blueman.enable = true; + mullvad-vpn = { + enable = true; + package = pkgs.mullvad-vpn; + }; greetd = { enable = true; settings = { @@ -190,8 +220,10 @@ }; pipewire = { enable = true; - alsa.enable = true; - alsa.support32Bit = true; + alsa = { + enable = true; + support32Bit = true; + }; pulse.enable = true; # If you want to use JACK applications, uncomment this #jack.enable = true;