From 7e9aa4328ac2ae30404d2ff5060df6113c0c43a1 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 9 Jul 2022 01:44:35 -0300 Subject: [PATCH] update to new home-manager flake format --- flake.lock | 36 ++++++++++++++++++++++++++---------- flake.nix | 21 ++++++++++++--------- home-manager/home.nix | 9 +++++++++ nixos/configuration.nix | 17 +++++++++-------- 4 files changed, 56 insertions(+), 27 deletions(-) diff --git a/flake.lock b/flake.lock index 214aa11..8963660 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "hardware": { "locked": { - "lastModified": 1653145312, - "narHash": "sha256-affCuB0Boa8CDFykoJVPZfhHLBok7Sq+QEOJvo3Xf+k=", + "lastModified": 1656933710, + "narHash": "sha256-SVG8EqY1OTJWBRY4hpct2ZR2Rk0L8hCFkug3m0ABoZE=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "8b5e1bf2fd62adefff05ae67cd49440be93ea193", + "rev": "3bf48d3587d3f34f745a19ebc968b002ef5b5c5a", "type": "github" }, "original": { @@ -19,14 +19,15 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ] + ], + "utils": "utils" }, "locked": { - "lastModified": 1653153149, - "narHash": "sha256-8B/tWWZziFq4DqnAm9uO7M4Z4PNfllYg5+teX1e5yDQ=", + "lastModified": 1657241847, + "narHash": "sha256-/aN3p2LaRNVXf7w92GWgXq9H5f23YRQPOvsm3BrBqzU=", "owner": "nix-community", "repo": "home-manager", - "rev": "94780dd888881bf35165dfdd334a57ef6b14ead8", + "rev": "8160b3b45b8457d58d2b3af2aeb2eb6f47042e0f", "type": "github" }, "original": { @@ -37,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1653060744, - "narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=", + "lastModified": 1657114324, + "narHash": "sha256-fWuaUNXrHcz/ciHRHlcSO92dvV3EVS0GJQUSBO5JIB4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dfd82985c273aac6eced03625f454b334daae2e8", + "rev": "a5c867d9fe9e4380452628e8f171c26b69fa9d3d", "type": "github" }, "original": { @@ -57,6 +58,21 @@ "home-manager": "home-manager", "nixpkgs": "nixpkgs" } + }, + "utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0853035..06f8451 100644 --- a/flake.nix +++ b/flake.nix @@ -16,14 +16,19 @@ # Bring some functions into scope (from builtins and other flakes) inherit (nixpkgs.lib) nixosSystem; inherit (home-manager.lib) homeManagerConfiguration; - in - rec { + # We'll use x86_64-linux for everything, but you can have hosts/homes for + # different systems and architectures if you want + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { # System configurations # Accessible via 'nixos-rebuild' nixosConfigurations = { # FIXME: Replace with your hostname your-hostname = nixosSystem { - system = "x86_64-linux"; + inherit system; + pkgs = nixpkgs.legacyPackages.${system}; + # >> Main NixOS configuration file << modules = [ ./nixos/configuration.nix ]; # Make our inputs available to the config (for importing modules) @@ -35,13 +40,11 @@ # Accessible via 'home-manager' homeConfigurations = { # FIXME: Replace with your username@hostname - "your-name@your-hostname" = homeManagerConfiguration rec { - # FIXME: Replace with your username - username = "your-name"; - homeDirectory = "/home/${username}"; - system = "x86_64-linux"; + "your-name@your-hostname" = homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.${system}; + # >> Main home-manager configuration file << - configuration = ./home-manager/home.nix; + modules = [ ./home-manager/home.nix ]; # Make our inputs available to the config (for importing modules) extraSpecialArgs = { inherit inputs; }; }; diff --git a/home-manager/home.nix b/home-manager/home.nix index 13e4cfc..a7af0ad 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -12,6 +12,12 @@ # Comment out if you wish to disable unfree packages for your system nixpkgs.config.allowUnfree = true; + # TODO: Set your username + home = { + username = "your-name"; + homeDirectory = "/home/your-name"; + }; + # Add stuff for your user as you see fit: # programs.neovim.enable = true; # home.packages = with pkgs; [ steam ]; @@ -22,4 +28,7 @@ # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "22.05"; } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 7262593..bfc6edb 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -29,14 +29,12 @@ ''; nix = { - # Make sure we have at least nix 2.4 - # TODO: You can remove me if you're using NixOS 22.05+ - package = pkgs.nixFlakes; - # Enable flakes and new 'nix' command - extraOptions = '' - experimental-features = nix-command flakes - ''; - autoOptimiseStore = true; + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; }; # Remove if you wish to disable unfree packages for your system @@ -76,4 +74,7 @@ # Use keys only. Remove if you want to SSH using password (not recommended) passwordAuthentication = false; }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "22.05"; }