From cc1efb2588bf0a56adf16adff4a70da6fcbcc2b9 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 17 May 2024 10:28:02 +0200 Subject: [PATCH] More variables --- README.md | 2 -- flake.lock | 17 ----------------- flake.nix | 6 ++---- nixos/configuration.nix | 29 ++++++++++++++--------------- variables.nix | 2 ++ 5 files changed, 18 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 061765c..6929027 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,6 @@ git clone https://github.com/anotherhadi/nixy ~/.config/nixos ``` - Change the `variables.nix` file to match your configuration -- Remove the hardware module in flake.nix line 30 -- Change the `nixos/configuration.nix` file to match your system - Copy your `hardware-configuration.nix` file to the `nixos` folder ```sh diff --git a/flake.lock b/flake.lock index 6d65255..f747191 100644 --- a/flake.lock +++ b/flake.lock @@ -421,22 +421,6 @@ "type": "github" } }, - "nixos-hardware": { - "locked": { - "lastModified": 1715148395, - "narHash": "sha256-lRxjTxY3103LGMjWdVqntKZHhlmMX12QUjeFrQMmGaE=", - "owner": "NixOS", - "repo": "nixos-hardware", - "rev": "a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixos-hardware", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1696375444, @@ -606,7 +590,6 @@ "apple-fonts": "apple-fonts", "home-manager": "home-manager", "hyprland": "hyprland", - "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_3", "nixvim": "nixvim", "rose-pine-hyprcursor": "rose-pine-hyprcursor", diff --git a/flake.nix b/flake.nix index 9170bd5..4b50115 100644 --- a/flake.nix +++ b/flake.nix @@ -17,18 +17,16 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; rose-pine-hyprcursor.url = "github:ndom91/rose-pine-hyprcursor"; }; - outputs = inputs@{ nixpkgs, home-manager, sops-nix, hyprland, spicetify-nix - , nixos-hardware, ... }: { + outputs = + inputs@{ nixpkgs, home-manager, sops-nix, hyprland, spicetify-nix, ... }: { nixosConfigurations = { nixy = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - nixos-hardware.nixosModules.omen-16-n0005ne # REMOVE ./nixos/configuration.nix ./nixos/fonts.nix ./nixos/tuigreet.nix diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 82b32d8..9fe4f0b 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: let variable = import ../variables.nix; imports = [ ./hardware-configuration.nix ]; @@ -24,8 +24,6 @@ in { networking.networkmanager.enable = true; - ############## - networking.hostName = variable.hostName; time.timeZone = variable.timeZone; @@ -50,13 +48,13 @@ in { services = { xserver = { - xkb.layout = "fr"; + xkb.layout = variable.keyboardLayout; xkb.variant = ""; }; blueman.enable = true; gnome.gnome-keyring.enable = true; }; - console.keyMap = "fr"; + console.keyMap = variable.keyboardLayout; programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; @@ -103,22 +101,23 @@ in { auto-optimise-store = true; experimental-features = [ "nix-command" "flakes" ]; }; - gc = { + gc = if variable.enableAutoGarbageCollector then { automatic = true; persistent = true; dates = "weekly"; options = "--delete-older-than 7d"; - }; + } else + { }; }; - # Auto Update - # system.autoUpgrade = { - # enable = true; - # dates = "04:00"; - # flake = "${config.users.users.${variable.username}.home}/.config/nixos"; - # flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; - # allowReboot = false; - # }; + system.autoUpgrade = if variable.enableAutoUpgrade then { + enable = true; + dates = "04:00"; + flake = "${config.users.users.${variable.username}.home}/.config/nixos"; + flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; + allowReboot = false; + } else + { }; services.dbus.enable = true; diff --git a/variables.nix b/variables.nix index d92b890..8676e39 100644 --- a/variables.nix +++ b/variables.nix @@ -14,6 +14,8 @@ }; stateVersion = "23.11"; + enableAutoUpgrade = false; + enableAutoGarbageCollector = false; enableSops = true; enableNextcloud = true; enableNvidia = true;