From 15dda05d03b2dc1e1285fec848b617e482aa7012 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Tue, 8 Nov 2022 16:12:00 -0300 Subject: [PATCH 01/59] remove multi-nixpkgs template I don't intend to maintain this template, right now. It'll still be available at a separate branch. This reverts commit 7bbdfe484c3cc96352fb141971d85ca379490a78. --- flake.nix | 6 -- multi-nixpkgs/flake.lock | 97 ------------------------------ multi-nixpkgs/flake.nix | 83 ------------------------- multi-nixpkgs/home-manager | 1 - multi-nixpkgs/modules | 1 - multi-nixpkgs/nixos | 1 - multi-nixpkgs/nixpkgs-config.nix | 1 - multi-nixpkgs/overlays/default.nix | 20 ------ multi-nixpkgs/pkgs | 1 - multi-nixpkgs/shell.nix | 1 - 10 files changed, 212 deletions(-) delete mode 100644 multi-nixpkgs/flake.lock delete mode 100644 multi-nixpkgs/flake.nix delete mode 120000 multi-nixpkgs/home-manager delete mode 120000 multi-nixpkgs/modules delete mode 120000 multi-nixpkgs/nixos delete mode 120000 multi-nixpkgs/nixpkgs-config.nix delete mode 100644 multi-nixpkgs/overlays/default.nix delete mode 120000 multi-nixpkgs/pkgs delete mode 120000 multi-nixpkgs/shell.nix diff --git a/flake.nix b/flake.nix index dda8d23..591094b 100644 --- a/flake.nix +++ b/flake.nix @@ -16,12 +16,6 @@ ''; path = ./standard; }; - multi-nixpkgs = { - description = '' - An example, based on the standard flake, on how to use two (or more) nixpkgs versions - ''; - path = ./multi-nixpkgs; - }; }; }; } diff --git a/multi-nixpkgs/flake.lock b/multi-nixpkgs/flake.lock deleted file mode 100644 index a197cb2..0000000 --- a/multi-nixpkgs/flake.lock +++ /dev/null @@ -1,97 +0,0 @@ -{ - "nodes": { - "hardware": { - "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": "utils" - }, - "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-master": { - "locked": { - "lastModified": 1667669848, - "narHash": "sha256-nD2dk2A+1zUlUT18ppDFVWwimi26+ultc2QRsulQwQ8=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "1f3ebb2bd1a353a42e8f833895c26d8415c7b791", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "hardware": "hardware", - "home-manager": "home-manager", - "nixpkgs": "nixpkgs", - "nixpkgs-master": "nixpkgs-master" - } - }, - "utils": { - "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/multi-nixpkgs/flake.nix b/multi-nixpkgs/flake.nix deleted file mode 100644 index 4c415f1..0000000 --- a/multi-nixpkgs/flake.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - description = "Your new nix config"; - - inputs = { - # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - nixpkgs-master.url = "github:nixos/nixpkgs/master"; - - # Home manager - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; - }; - - outputs = { nixpkgs, home-manager, ... }@inputs: - let - forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" - ]; - in - rec { - # Your custom packages - # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs { inherit pkgs; } - ); - # Devshell for bootstrapping - # Acessible through 'nix develop' or 'nix-shell' (legacy) - devShells = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./shell.nix { inherit pkgs; } - ); - - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays { inherit inputs; }; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; - - nixosConfigurations = { - # FIXME replace with your hostname - your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues nixosModules) ++ [ - # > Our main nixos configuration file < - ./nixos/configuration.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) - ]; - }; - }; - - homeConfigurations = { - # FIXME replace with your username@hostname - "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues homeManagerModules) ++ [ - # > Our main home-manager configuration file < - ./home-manager/home.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) - ]; - }; - }; - }; -} diff --git a/multi-nixpkgs/home-manager b/multi-nixpkgs/home-manager deleted file mode 120000 index e047a58..0000000 --- a/multi-nixpkgs/home-manager +++ /dev/null @@ -1 +0,0 @@ -../standard/home-manager \ No newline at end of file diff --git a/multi-nixpkgs/modules b/multi-nixpkgs/modules deleted file mode 120000 index 3e9a3c5..0000000 --- a/multi-nixpkgs/modules +++ /dev/null @@ -1 +0,0 @@ -../standard/modules \ No newline at end of file diff --git a/multi-nixpkgs/nixos b/multi-nixpkgs/nixos deleted file mode 120000 index d159ef5..0000000 --- a/multi-nixpkgs/nixos +++ /dev/null @@ -1 +0,0 @@ -../standard/nixos \ No newline at end of file diff --git a/multi-nixpkgs/nixpkgs-config.nix b/multi-nixpkgs/nixpkgs-config.nix deleted file mode 120000 index 19056ba..0000000 --- a/multi-nixpkgs/nixpkgs-config.nix +++ /dev/null @@ -1 +0,0 @@ -../standard/nixpkgs-config.nix \ No newline at end of file diff --git a/multi-nixpkgs/overlays/default.nix b/multi-nixpkgs/overlays/default.nix deleted file mode 100644 index f520af5..0000000 --- a/multi-nixpkgs/overlays/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ inputs, ... }: -# This file defines overlays -{ - # Add bleeding edge packages under the 'master' namespace - master = final: _prev: { - master = inputs.nixpkgs-master.legacyPackages.${final.system}; - }; - - # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs { pkgs = final; }; - - # This one contains whatever you want to overlay - # You can change versions, add patches, set compilation flags, anything really. - # https://nixos.wiki/wiki/Overlays - modifications = final: prev: { - # example = prev.example.overrideAttrs (oldAttrs: rec { - # ... - # }); - }; -} diff --git a/multi-nixpkgs/pkgs b/multi-nixpkgs/pkgs deleted file mode 120000 index 75370a4..0000000 --- a/multi-nixpkgs/pkgs +++ /dev/null @@ -1 +0,0 @@ -../standard/pkgs \ No newline at end of file diff --git a/multi-nixpkgs/shell.nix b/multi-nixpkgs/shell.nix deleted file mode 120000 index 123d7c8..0000000 --- a/multi-nixpkgs/shell.nix +++ /dev/null @@ -1 +0,0 @@ -../standard/shell.nix \ No newline at end of file From 8071557c318fe5be75c5b0514ac23c39b8a90489 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Tue, 8 Nov 2022 17:59:31 -0300 Subject: [PATCH 02/59] reorganize modules and overlays This update makes using flake (self or external) modules and overlays more explicit, by setting nixpkgs options directly in the config, instead of the flake. To help import your own overlays and modules, the `outputs` attribute is now available on your configs. --- README.md | 19 ++------------- minimal/flake.lock | 24 +++++++++--------- minimal/home-manager/home.nix | 26 ++++++++++++++++++-- minimal/nixos/configuration.nix | 33 ++++++++++++++++++------- standard/flake.lock | 24 +++++++++--------- standard/flake.nix | 21 ++++++---------- standard/home-manager/home.nix | 37 +++++++++++++++++++++++++--- standard/nixos/configuration.nix | 42 ++++++++++++++++++++++++-------- standard/nixpkgs-config.nix | 10 -------- standard/nixpkgs.nix | 8 ++++++ standard/pkgs/default.nix | 7 +++--- standard/shell.nix | 24 ++++++------------ 12 files changed, 167 insertions(+), 108 deletions(-) delete mode 100644 standard/nixpkgs-config.nix create mode 100644 standard/nixpkgs.nix diff --git a/README.md b/README.md index 670462a..9c8537f 100644 --- a/README.md +++ b/README.md @@ -202,9 +202,9 @@ Found some outdated package on nixpkgs you need the latest version of? Perhaps you want to apply a patch to fix a behaviour you don't like? Nix makes it easy and manageble with overlays! -Use the `overlay/default.nix` file for this. +Use the `overlays/default.nix` file for this. -If you're creating patches, you can keep them on the `overlay` folder as well. +If you're creating patches, you can keep them on the `overlays` folder as well. See [the wiki article](https://nixos.wiki/wiki/Overlays) to see how it all works. @@ -228,21 +228,6 @@ Please [let me know](https://github.com/Misterio77/nix-starter-config/issues) any questions or issues you face with these templates, so I can add more info here! -## I'm trying to set nixpkgs.config options (e.g. allowUnfree), but they won't work! - -We instantiate nixpkgs and pass it to NixOS, to make the flake a bit simpler -and ensure both configs have the same nixpkgs instance, this has the drawback -of breaking nixpkgs configuration through in your NixOS config files. - -This is a design choice I made based on the `homeManagerConfiguration` -interface, that requires a `pkgs` instance anyway. If you prefer to set them -modularly, you'll have to remove the `pkgs` argument. If you use overlays, -you'll have to pass them into your configuration (through specialArgs) or set -`nixpkgs.overlays` right on the flake; in this case, you might prefer to use -[home-manager as a NixOS -module](https://nix-community.github.io/home-manager/index.html#sec-flakes-nixos-module) -and set `home-manager.useGlobalPkgs = true`. - ## Nix says my repo files don't exist, even though they do! Nix flakes only see files that git is currently tracked, so just `git add .` diff --git a/minimal/flake.lock b/minimal/flake.lock index 60d72e9..0fbb0a5 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -2,11 +2,11 @@ "nodes": { "hardware": { "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", + "lastModified": 1667768008, + "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", + "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", + "lastModified": 1667898954, + "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", + "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", + "lastModified": 1667811565, + "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", + "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", "type": "github" }, "original": { @@ -61,11 +61,11 @@ }, "utils": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index bafc020..58fc881 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -2,13 +2,35 @@ # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) { inputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors), use something like: + # If you want to use home-manager modules from other flakes (such as nix-colors): # inputs.nix-colors.homeManagerModule - # Feel free to split up your configuration and import pieces of it here. + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + # TODO: Set your username home = { username = "your-username"; diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index 2997965..f4f824c 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -2,22 +2,39 @@ # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) { inputs, lib, config, pkgs, ... }: { - + # You can import other NixOS modules here imports = [ - # If you want to use modules from other flakes (such as nixos-hardware), use something like: + # If you want to use modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd - # It's strongly recommended you take a look at - # https://github.com/nixos/nixos-hardware - # and import modules relevant to your hardware. + # You can also split up your configuration and import pieces of it here: + # ./users.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix - - # You can also split up your configuration and import pieces of it here. ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake @@ -26,9 +43,7 @@ # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - }; - nix = { settings = { # Enable flakes and new 'nix' command experimental-features = "nix-command flakes"; diff --git a/standard/flake.lock b/standard/flake.lock index 60d72e9..0fbb0a5 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -2,11 +2,11 @@ "nodes": { "hardware": { "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", + "lastModified": 1667768008, + "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", + "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", + "lastModified": 1667898954, + "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", + "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", + "lastModified": 1667811565, + "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", + "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", "type": "github" }, "original": { @@ -61,11 +61,11 @@ }, "utils": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/standard/flake.nix b/standard/flake.nix index 97aead5..4cf1842 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -17,8 +17,9 @@ # nix-colors.url = "github:misterio77/nix-colors"; }; - outputs = { nixpkgs, home-manager, ... }@inputs: + outputs = { self, nixpkgs, home-manager, ... }@inputs: let + inherit (self) outputs; forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "i686-linux" @@ -32,15 +33,13 @@ # Acessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs { inherit pkgs; } + in import ./pkgs { inherit pkgs; } ); # Devshell for bootstrapping # Acessible through 'nix develop' or 'nix-shell' (legacy) devShells = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./shell.nix { inherit pkgs; } + in import ./shell.nix { inherit pkgs; } ); # Your custom packages and modifications, exported as overlays @@ -55,12 +54,10 @@ nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues nixosModules) ++ [ + specialArgs = { inherit inputs outputs; }; + modules = [ # > Our main nixos configuration file < ./nixos/configuration.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) ]; }; }; @@ -69,12 +66,10 @@ # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues homeManagerModules) ++ [ + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ # > Our main home-manager configuration file < ./home-manager/home.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) ]; }; }; diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index bafc020..02c1df1 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -1,14 +1,43 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ inputs, lib, config, pkgs, ... }: { +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors), use something like: - # inputs.nix-colors.homeManagerModule + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example - # Feel free to split up your configuration and import pieces of it here. + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + # TODO: Set your username home = { username = "your-username"; diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 27ec31f..7db9279 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -1,23 +1,47 @@ # This is your system's configuration file. # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) -{ inputs, lib, config, pkgs, ... }: { - +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other NixOS modules here imports = [ - # If you want to use modules from other flakes (such as nixos-hardware), use something like: + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd - # It's strongly recommended you take a look at - # https://github.com/nixos/nixos-hardware - # and import modules relevant to your hardware. + # You can also split up your configuration and import pieces of it here: + # ./users.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix - - # You can also split up your configuration and import pieces of it here. ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake @@ -26,9 +50,7 @@ # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - }; - nix = { settings = { # Enable flakes and new 'nix' command experimental-features = "nix-command flakes"; diff --git a/standard/nixpkgs-config.nix b/standard/nixpkgs-config.nix deleted file mode 100644 index 84957b9..0000000 --- a/standard/nixpkgs-config.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ overlays, ... }: -{ - nixpkgs = { - config = { - allowUnfree = true; - }; - # Overlays is an attrset, convert to a list - overlays = builtins.attrValues overlays; - }; -} diff --git a/standard/nixpkgs.nix b/standard/nixpkgs.nix new file mode 100644 index 0000000..041de40 --- /dev/null +++ b/standard/nixpkgs.nix @@ -0,0 +1,8 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/standard/pkgs/default.nix b/standard/pkgs/default.nix index 55e428d..8c5e910 100644 --- a/standard/pkgs/default.nix +++ b/standard/pkgs/default.nix @@ -1,5 +1,6 @@ -# When you add custom packages, list them here -# These are similar to nixpkgs packages -{ pkgs }: { +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' + +{ pkgs ? (import ../nixpkgs.nix) { } }: { # example = pkgs.callPackage ./example { }; } diff --git a/standard/shell.nix b/standard/shell.nix index 0ab6972..9525915 100644 --- a/standard/shell.nix +++ b/standard/shell.nix @@ -1,18 +1,10 @@ # Shell for bootstrapping flake-enabled nix and home-manager -{ pkgs ? let - # If pkgs is not defined, instantiate nixpkgs from locked commit - lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; - nixpkgs = fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; - }; - system = builtins.currentSystem; - overlays = [ ]; # Explicit blank overlay to avoid interference - in - import nixpkgs { inherit system overlays; } -, ... -}: pkgs.mkShell { - # Enable experimental features without having to specify the argument - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git ]; +# You can enter it through 'nix develop' or (legacy) 'nix-shell' + +{ pkgs ? (import ./nixpkgs.nix) { } }: { + default = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [ nix home-manager git ]; + }; } From 716ca80f291e89ce53b8c49346da7cd43d3d4761 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sun, 13 Nov 2022 16:59:09 -0300 Subject: [PATCH 03/59] minimal: remove leftover nixosSystem pkgs arg --- minimal/flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/minimal/flake.nix b/minimal/flake.nix index d1fb8f7..7d98891 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -21,7 +21,6 @@ nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - pkgs = nixpkgs.legacyPackages.x86_64-linux; specialArgs = { inherit inputs; }; # Pass flake inputs to our config # > Our main nixos configuration file < modules = [ ./nixos/configuration.nix ]; @@ -31,7 +30,7 @@ homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config # > Our main home-manager configuration file < modules = [ ./home-manager/home.nix ]; From cce47e4df5225d83a61b56c209f8cdb2fbc26ace Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sun, 13 Nov 2022 16:59:32 -0300 Subject: [PATCH 04/59] workaround for nix-community/home-manager#2942 --- minimal/home-manager/home.nix | 2 ++ standard/home-manager/home.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index 58fc881..a3645b4 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -28,6 +28,8 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); }; }; diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 02c1df1..6b2d124 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -35,6 +35,8 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); }; }; From ba725c1d6cbb361a428f86e989b7d14f2a456ed1 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 28 Nov 2022 08:58:25 -0300 Subject: [PATCH 05/59] add CC0 license --- LICENSE | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. From 871bcba92553f4dc0b1ef67e74a989e276ce6b0a Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Fri, 2 Dec 2022 15:19:40 -0300 Subject: [PATCH 06/59] update to nixos 22.11, add a couple comments --- minimal/flake.lock | 30 +++++++----------------------- minimal/flake.nix | 8 ++++++-- minimal/home-manager/home.nix | 2 +- minimal/nixos/configuration.nix | 4 ++-- standard/flake.lock | 30 +++++++----------------------- standard/flake.nix | 8 ++++++-- standard/home-manager/home.nix | 2 +- standard/nixos/configuration.nix | 4 ++-- 8 files changed, 32 insertions(+), 56 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index 0fbb0a5..6b8c59c 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "hardware": { - "locked": { - "lastModified": 1667768008, - "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -23,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667898954, - "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", + "lastModified": 1669978198, + "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", + "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", "type": "github" }, "original": { @@ -38,23 +23,22 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667811565, - "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", + "lastModified": 1669834992, + "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", + "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "hardware": "hardware", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/minimal/flake.nix b/minimal/flake.nix index 7d98891..5a4d31e 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; # Home manager home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; + # hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! @@ -18,6 +18,8 @@ }; outputs = { nixpkgs, home-manager, ... }@inputs: { + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { @@ -27,6 +29,8 @@ }; }; + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index a3645b4..ea28c5e 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -51,5 +51,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; } diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index f4f824c..bd8fd26 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -77,7 +77,7 @@ }; }; - # This sets up a SSH server. Very important if you're setting up a headless system. + # This setups a SSH server. Very important if you're setting up a headless system. # Feel free to remove if you don't need it. services.openssh = { enable = true; @@ -88,5 +88,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.05"; + system.stateVersion = "22.11"; } diff --git a/standard/flake.lock b/standard/flake.lock index 0fbb0a5..6b8c59c 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "hardware": { - "locked": { - "lastModified": 1667768008, - "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -23,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667898954, - "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", + "lastModified": 1669978198, + "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", + "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", "type": "github" }, "original": { @@ -38,23 +23,22 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667811565, - "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", + "lastModified": 1669834992, + "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", + "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "hardware": "hardware", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/standard/flake.nix b/standard/flake.nix index 4cf1842..b19bf5f 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; # Home manager home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; + # hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! @@ -51,6 +51,8 @@ # These are usually stuff you would upstream into home-manager homeManagerModules = import ./modules/home-manager; + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { @@ -62,6 +64,8 @@ }; }; + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 6b2d124..dcce49e 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -58,5 +58,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; } diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 7db9279..f73db0e 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -74,7 +74,7 @@ # TODO: You can set an initial password for your user. # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. # Be sure to change it (using passwd) after rebooting! - # initialPassword = "correcthorsebatterystaple"; + initialPassword = "correcthorsebatterystaple"; isNormalUser = true; openssh.authorizedKeys.keys = [ # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect @@ -95,5 +95,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.05"; + system.stateVersion = "22.11"; } From 0537107ce41396dff1fb1dd43705a94e9120f576 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Thu, 29 Dec 2022 19:38:17 -0300 Subject: [PATCH 07/59] add overlays and pkgs by default Related to https://github.com/Misterio77/nix-starter-configs/issues/16 --- standard/home-manager/home.nix | 8 ++++---- standard/nixos/configuration.nix | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index dcce49e..9256458 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -17,11 +17,11 @@ nixpkgs = { # You can add overlays here overlays = [ - # If you want to use overlays your own flake exports (from overlays dir): - # outputs.overlays.modifications - # outputs.overlays.additions + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions - # Or overlays exported from other flakes: + # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default # Or define it inline, for example: diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index f73db0e..3745e4c 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -21,11 +21,11 @@ nixpkgs = { # You can add overlays here overlays = [ - # If you want to use overlays your own flake exports (from overlays dir): - # outputs.overlays.modifications - # outputs.overlays.additions + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions - # Or overlays exported from other flakes: + # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default # Or define it inline, for example: From 4a4bc737021044541ba487b6849638a5438b82ab Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Tue, 8 Nov 2022 16:12:00 -0300 Subject: [PATCH 08/59] remove multi-nixpkgs template I don't intend to maintain this template, right now. It'll still be available at a separate branch. This reverts commit 7bbdfe484c3cc96352fb141971d85ca379490a78. --- flake.nix | 6 -- multi-nixpkgs/flake.lock | 97 ------------------------------ multi-nixpkgs/flake.nix | 83 ------------------------- multi-nixpkgs/home-manager | 1 - multi-nixpkgs/modules | 1 - multi-nixpkgs/nixos | 1 - multi-nixpkgs/nixpkgs-config.nix | 1 - multi-nixpkgs/overlays/default.nix | 20 ------ multi-nixpkgs/pkgs | 1 - multi-nixpkgs/shell.nix | 1 - 10 files changed, 212 deletions(-) delete mode 100644 multi-nixpkgs/flake.lock delete mode 100644 multi-nixpkgs/flake.nix delete mode 120000 multi-nixpkgs/home-manager delete mode 120000 multi-nixpkgs/modules delete mode 120000 multi-nixpkgs/nixos delete mode 120000 multi-nixpkgs/nixpkgs-config.nix delete mode 100644 multi-nixpkgs/overlays/default.nix delete mode 120000 multi-nixpkgs/pkgs delete mode 120000 multi-nixpkgs/shell.nix diff --git a/flake.nix b/flake.nix index dda8d23..591094b 100644 --- a/flake.nix +++ b/flake.nix @@ -16,12 +16,6 @@ ''; path = ./standard; }; - multi-nixpkgs = { - description = '' - An example, based on the standard flake, on how to use two (or more) nixpkgs versions - ''; - path = ./multi-nixpkgs; - }; }; }; } diff --git a/multi-nixpkgs/flake.lock b/multi-nixpkgs/flake.lock deleted file mode 100644 index a197cb2..0000000 --- a/multi-nixpkgs/flake.lock +++ /dev/null @@ -1,97 +0,0 @@ -{ - "nodes": { - "hardware": { - "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "utils": "utils" - }, - "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-master": { - "locked": { - "lastModified": 1667669848, - "narHash": "sha256-nD2dk2A+1zUlUT18ppDFVWwimi26+ultc2QRsulQwQ8=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "1f3ebb2bd1a353a42e8f833895c26d8415c7b791", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "hardware": "hardware", - "home-manager": "home-manager", - "nixpkgs": "nixpkgs", - "nixpkgs-master": "nixpkgs-master" - } - }, - "utils": { - "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/multi-nixpkgs/flake.nix b/multi-nixpkgs/flake.nix deleted file mode 100644 index 4c415f1..0000000 --- a/multi-nixpkgs/flake.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - description = "Your new nix config"; - - inputs = { - # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - nixpkgs-master.url = "github:nixos/nixpkgs/master"; - - # Home manager - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; - }; - - outputs = { nixpkgs, home-manager, ... }@inputs: - let - forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" - ]; - in - rec { - # Your custom packages - # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs { inherit pkgs; } - ); - # Devshell for bootstrapping - # Acessible through 'nix develop' or 'nix-shell' (legacy) - devShells = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./shell.nix { inherit pkgs; } - ); - - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays { inherit inputs; }; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; - - nixosConfigurations = { - # FIXME replace with your hostname - your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues nixosModules) ++ [ - # > Our main nixos configuration file < - ./nixos/configuration.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) - ]; - }; - }; - - homeConfigurations = { - # FIXME replace with your username@hostname - "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues homeManagerModules) ++ [ - # > Our main home-manager configuration file < - ./home-manager/home.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) - ]; - }; - }; - }; -} diff --git a/multi-nixpkgs/home-manager b/multi-nixpkgs/home-manager deleted file mode 120000 index e047a58..0000000 --- a/multi-nixpkgs/home-manager +++ /dev/null @@ -1 +0,0 @@ -../standard/home-manager \ No newline at end of file diff --git a/multi-nixpkgs/modules b/multi-nixpkgs/modules deleted file mode 120000 index 3e9a3c5..0000000 --- a/multi-nixpkgs/modules +++ /dev/null @@ -1 +0,0 @@ -../standard/modules \ No newline at end of file diff --git a/multi-nixpkgs/nixos b/multi-nixpkgs/nixos deleted file mode 120000 index d159ef5..0000000 --- a/multi-nixpkgs/nixos +++ /dev/null @@ -1 +0,0 @@ -../standard/nixos \ No newline at end of file diff --git a/multi-nixpkgs/nixpkgs-config.nix b/multi-nixpkgs/nixpkgs-config.nix deleted file mode 120000 index 19056ba..0000000 --- a/multi-nixpkgs/nixpkgs-config.nix +++ /dev/null @@ -1 +0,0 @@ -../standard/nixpkgs-config.nix \ No newline at end of file diff --git a/multi-nixpkgs/overlays/default.nix b/multi-nixpkgs/overlays/default.nix deleted file mode 100644 index f520af5..0000000 --- a/multi-nixpkgs/overlays/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ inputs, ... }: -# This file defines overlays -{ - # Add bleeding edge packages under the 'master' namespace - master = final: _prev: { - master = inputs.nixpkgs-master.legacyPackages.${final.system}; - }; - - # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs { pkgs = final; }; - - # This one contains whatever you want to overlay - # You can change versions, add patches, set compilation flags, anything really. - # https://nixos.wiki/wiki/Overlays - modifications = final: prev: { - # example = prev.example.overrideAttrs (oldAttrs: rec { - # ... - # }); - }; -} diff --git a/multi-nixpkgs/pkgs b/multi-nixpkgs/pkgs deleted file mode 120000 index 75370a4..0000000 --- a/multi-nixpkgs/pkgs +++ /dev/null @@ -1 +0,0 @@ -../standard/pkgs \ No newline at end of file diff --git a/multi-nixpkgs/shell.nix b/multi-nixpkgs/shell.nix deleted file mode 120000 index 123d7c8..0000000 --- a/multi-nixpkgs/shell.nix +++ /dev/null @@ -1 +0,0 @@ -../standard/shell.nix \ No newline at end of file From 7c8941a764da327ed8cb1653e4f56fb3983d0ef8 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Tue, 8 Nov 2022 17:59:31 -0300 Subject: [PATCH 09/59] reorganize modules and overlays This update makes using flake (self or external) modules and overlays more explicit, by setting nixpkgs options directly in the config, instead of the flake. To help import your own overlays and modules, the `outputs` attribute is now available on your configs. --- README.md | 19 ++------------- minimal/flake.lock | 24 +++++++++--------- minimal/home-manager/home.nix | 26 ++++++++++++++++++-- minimal/nixos/configuration.nix | 33 ++++++++++++++++++------- standard/flake.lock | 24 +++++++++--------- standard/flake.nix | 21 ++++++---------- standard/home-manager/home.nix | 37 +++++++++++++++++++++++++--- standard/nixos/configuration.nix | 42 ++++++++++++++++++++++++-------- standard/nixpkgs-config.nix | 10 -------- standard/nixpkgs.nix | 8 ++++++ standard/pkgs/default.nix | 7 +++--- standard/shell.nix | 24 ++++++------------ 12 files changed, 167 insertions(+), 108 deletions(-) delete mode 100644 standard/nixpkgs-config.nix create mode 100644 standard/nixpkgs.nix diff --git a/README.md b/README.md index 670462a..9c8537f 100644 --- a/README.md +++ b/README.md @@ -202,9 +202,9 @@ Found some outdated package on nixpkgs you need the latest version of? Perhaps you want to apply a patch to fix a behaviour you don't like? Nix makes it easy and manageble with overlays! -Use the `overlay/default.nix` file for this. +Use the `overlays/default.nix` file for this. -If you're creating patches, you can keep them on the `overlay` folder as well. +If you're creating patches, you can keep them on the `overlays` folder as well. See [the wiki article](https://nixos.wiki/wiki/Overlays) to see how it all works. @@ -228,21 +228,6 @@ Please [let me know](https://github.com/Misterio77/nix-starter-config/issues) any questions or issues you face with these templates, so I can add more info here! -## I'm trying to set nixpkgs.config options (e.g. allowUnfree), but they won't work! - -We instantiate nixpkgs and pass it to NixOS, to make the flake a bit simpler -and ensure both configs have the same nixpkgs instance, this has the drawback -of breaking nixpkgs configuration through in your NixOS config files. - -This is a design choice I made based on the `homeManagerConfiguration` -interface, that requires a `pkgs` instance anyway. If you prefer to set them -modularly, you'll have to remove the `pkgs` argument. If you use overlays, -you'll have to pass them into your configuration (through specialArgs) or set -`nixpkgs.overlays` right on the flake; in this case, you might prefer to use -[home-manager as a NixOS -module](https://nix-community.github.io/home-manager/index.html#sec-flakes-nixos-module) -and set `home-manager.useGlobalPkgs = true`. - ## Nix says my repo files don't exist, even though they do! Nix flakes only see files that git is currently tracked, so just `git add .` diff --git a/minimal/flake.lock b/minimal/flake.lock index 60d72e9..0fbb0a5 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -2,11 +2,11 @@ "nodes": { "hardware": { "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", + "lastModified": 1667768008, + "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", + "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", + "lastModified": 1667898954, + "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", + "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", + "lastModified": 1667811565, + "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", + "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", "type": "github" }, "original": { @@ -61,11 +61,11 @@ }, "utils": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index bafc020..58fc881 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -2,13 +2,35 @@ # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) { inputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors), use something like: + # If you want to use home-manager modules from other flakes (such as nix-colors): # inputs.nix-colors.homeManagerModule - # Feel free to split up your configuration and import pieces of it here. + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + # TODO: Set your username home = { username = "your-username"; diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index 2997965..f4f824c 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -2,22 +2,39 @@ # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) { inputs, lib, config, pkgs, ... }: { - + # You can import other NixOS modules here imports = [ - # If you want to use modules from other flakes (such as nixos-hardware), use something like: + # If you want to use modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd - # It's strongly recommended you take a look at - # https://github.com/nixos/nixos-hardware - # and import modules relevant to your hardware. + # You can also split up your configuration and import pieces of it here: + # ./users.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix - - # You can also split up your configuration and import pieces of it here. ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake @@ -26,9 +43,7 @@ # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - }; - nix = { settings = { # Enable flakes and new 'nix' command experimental-features = "nix-command flakes"; diff --git a/standard/flake.lock b/standard/flake.lock index 60d72e9..0fbb0a5 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -2,11 +2,11 @@ "nodes": { "hardware": { "locked": { - "lastModified": 1667585378, - "narHash": "sha256-cvOwucrjBaAkaGk3FunG+MQiwiSBeIVTtO5n/YavpC0=", + "lastModified": 1667768008, + "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "6b35a59c19ddbbeb229fcd1d3dcd422dcc0fa927", + "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", + "lastModified": 1667898954, + "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", + "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667482890, - "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", + "lastModified": 1667811565, + "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", + "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", "type": "github" }, "original": { @@ -61,11 +61,11 @@ }, "utils": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/standard/flake.nix b/standard/flake.nix index 97aead5..4cf1842 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -17,8 +17,9 @@ # nix-colors.url = "github:misterio77/nix-colors"; }; - outputs = { nixpkgs, home-manager, ... }@inputs: + outputs = { self, nixpkgs, home-manager, ... }@inputs: let + inherit (self) outputs; forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "i686-linux" @@ -32,15 +33,13 @@ # Acessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs { inherit pkgs; } + in import ./pkgs { inherit pkgs; } ); # Devshell for bootstrapping # Acessible through 'nix develop' or 'nix-shell' (legacy) devShells = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; - in - import ./shell.nix { inherit pkgs; } + in import ./shell.nix { inherit pkgs; } ); # Your custom packages and modifications, exported as overlays @@ -55,12 +54,10 @@ nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues nixosModules) ++ [ + specialArgs = { inherit inputs outputs; }; + modules = [ # > Our main nixos configuration file < ./nixos/configuration.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) ]; }; }; @@ -69,12 +66,10 @@ # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config - modules = (builtins.attrValues homeManagerModules) ++ [ + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ # > Our main home-manager configuration file < ./home-manager/home.nix - # Our common nixpkgs config (unfree, overlays, etc) - (import ./nixpkgs-config.nix { inherit overlays; }) ]; }; }; diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index bafc020..02c1df1 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -1,14 +1,43 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ inputs, lib, config, pkgs, ... }: { +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors), use something like: - # inputs.nix-colors.homeManagerModule + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example - # Feel free to split up your configuration and import pieces of it here. + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + # TODO: Set your username home = { username = "your-username"; diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 27ec31f..7db9279 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -1,23 +1,47 @@ # This is your system's configuration file. # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) -{ inputs, lib, config, pkgs, ... }: { - +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other NixOS modules here imports = [ - # If you want to use modules from other flakes (such as nixos-hardware), use something like: + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd - # It's strongly recommended you take a look at - # https://github.com/nixos/nixos-hardware - # and import modules relevant to your hardware. + # You can also split up your configuration and import pieces of it here: + # ./users.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix - - # You can also split up your configuration and import pieces of it here. ]; + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake @@ -26,9 +50,7 @@ # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - }; - nix = { settings = { # Enable flakes and new 'nix' command experimental-features = "nix-command flakes"; diff --git a/standard/nixpkgs-config.nix b/standard/nixpkgs-config.nix deleted file mode 100644 index 84957b9..0000000 --- a/standard/nixpkgs-config.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ overlays, ... }: -{ - nixpkgs = { - config = { - allowUnfree = true; - }; - # Overlays is an attrset, convert to a list - overlays = builtins.attrValues overlays; - }; -} diff --git a/standard/nixpkgs.nix b/standard/nixpkgs.nix new file mode 100644 index 0000000..041de40 --- /dev/null +++ b/standard/nixpkgs.nix @@ -0,0 +1,8 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/standard/pkgs/default.nix b/standard/pkgs/default.nix index 55e428d..8c5e910 100644 --- a/standard/pkgs/default.nix +++ b/standard/pkgs/default.nix @@ -1,5 +1,6 @@ -# When you add custom packages, list them here -# These are similar to nixpkgs packages -{ pkgs }: { +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' + +{ pkgs ? (import ../nixpkgs.nix) { } }: { # example = pkgs.callPackage ./example { }; } diff --git a/standard/shell.nix b/standard/shell.nix index 0ab6972..9525915 100644 --- a/standard/shell.nix +++ b/standard/shell.nix @@ -1,18 +1,10 @@ # Shell for bootstrapping flake-enabled nix and home-manager -{ pkgs ? let - # If pkgs is not defined, instantiate nixpkgs from locked commit - lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; - nixpkgs = fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; - }; - system = builtins.currentSystem; - overlays = [ ]; # Explicit blank overlay to avoid interference - in - import nixpkgs { inherit system overlays; } -, ... -}: pkgs.mkShell { - # Enable experimental features without having to specify the argument - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git ]; +# You can enter it through 'nix develop' or (legacy) 'nix-shell' + +{ pkgs ? (import ./nixpkgs.nix) { } }: { + default = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [ nix home-manager git ]; + }; } From 5f6910ff8ed104d18e9cf53f992d897a45c3730a Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sun, 13 Nov 2022 16:59:09 -0300 Subject: [PATCH 10/59] minimal: remove leftover nixosSystem pkgs arg --- minimal/flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/minimal/flake.nix b/minimal/flake.nix index d1fb8f7..7d98891 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -21,7 +21,6 @@ nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - pkgs = nixpkgs.legacyPackages.x86_64-linux; specialArgs = { inherit inputs; }; # Pass flake inputs to our config # > Our main nixos configuration file < modules = [ ./nixos/configuration.nix ]; @@ -31,7 +30,7 @@ homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config # > Our main home-manager configuration file < modules = [ ./home-manager/home.nix ]; From cdf4442d1082b8b681fe4335fa9c6ce483e79126 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sun, 13 Nov 2022 16:59:32 -0300 Subject: [PATCH 11/59] workaround for nix-community/home-manager#2942 --- minimal/home-manager/home.nix | 2 ++ standard/home-manager/home.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index 58fc881..a3645b4 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -28,6 +28,8 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); }; }; diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 02c1df1..6b2d124 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -35,6 +35,8 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); }; }; From 80793d6a8df962aae8cdf44a35cb4c51d4d659a8 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 28 Nov 2022 08:58:25 -0300 Subject: [PATCH 12/59] add CC0 license --- LICENSE | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. From 5b6d9a064c179235b8cbf04c87300d15fee129f6 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Fri, 2 Dec 2022 15:19:40 -0300 Subject: [PATCH 13/59] update to nixos 22.11, add a couple comments --- minimal/flake.lock | 30 +++++++----------------------- minimal/flake.nix | 8 ++++++-- minimal/home-manager/home.nix | 2 +- minimal/nixos/configuration.nix | 4 ++-- standard/flake.lock | 30 +++++++----------------------- standard/flake.nix | 8 ++++++-- standard/home-manager/home.nix | 2 +- standard/nixos/configuration.nix | 4 ++-- 8 files changed, 32 insertions(+), 56 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index 0fbb0a5..6b8c59c 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "hardware": { - "locked": { - "lastModified": 1667768008, - "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -23,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667898954, - "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", + "lastModified": 1669978198, + "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", + "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", "type": "github" }, "original": { @@ -38,23 +23,22 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667811565, - "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", + "lastModified": 1669834992, + "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", + "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "hardware": "hardware", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/minimal/flake.nix b/minimal/flake.nix index 7d98891..5a4d31e 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; # Home manager home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; + # hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! @@ -18,6 +18,8 @@ }; outputs = { nixpkgs, home-manager, ... }@inputs: { + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { @@ -27,6 +29,8 @@ }; }; + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index a3645b4..ea28c5e 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -51,5 +51,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; } diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index f4f824c..bd8fd26 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -77,7 +77,7 @@ }; }; - # This sets up a SSH server. Very important if you're setting up a headless system. + # This setups a SSH server. Very important if you're setting up a headless system. # Feel free to remove if you don't need it. services.openssh = { enable = true; @@ -88,5 +88,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.05"; + system.stateVersion = "22.11"; } diff --git a/standard/flake.lock b/standard/flake.lock index 0fbb0a5..6b8c59c 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "hardware": { - "locked": { - "lastModified": 1667768008, - "narHash": "sha256-PGbX0s2hhXGnZDFVE6UIhPSOf5YegpWs5dUXpT/14F0=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "f6483e0def85efb9c1e884efbaff45a5e7aabb34", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixos-hardware", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -23,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1667898954, - "narHash": "sha256-VqHVeoxcOl9M6yQ+LV3yTWMb0h5Rl5yixn9PCY/MJJo=", + "lastModified": 1669978198, + "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d20e3d070c78271356a2d5d73c01f1de94586087", + "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", "type": "github" }, "original": { @@ -38,23 +23,22 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667811565, - "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", + "lastModified": 1669834992, + "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", + "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "hardware": "hardware", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/standard/flake.nix b/standard/flake.nix index 4cf1842..b19bf5f 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; # Home manager home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need - hardware.url = "github:nixos/nixos-hardware"; + # hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! @@ -51,6 +51,8 @@ # These are usually stuff you would upstream into home-manager homeManagerModules = import ./modules/home-manager; + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { @@ -62,6 +64,8 @@ }; }; + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 6b2d124..dcce49e 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -58,5 +58,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; } diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 7db9279..f73db0e 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -74,7 +74,7 @@ # TODO: You can set an initial password for your user. # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. # Be sure to change it (using passwd) after rebooting! - # initialPassword = "correcthorsebatterystaple"; + initialPassword = "correcthorsebatterystaple"; isNormalUser = true; openssh.authorizedKeys.keys = [ # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect @@ -95,5 +95,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.05"; + system.stateVersion = "22.11"; } From 8de736fe1aab6f67bcac323ff2203a34c5a27520 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Thu, 29 Dec 2022 19:38:17 -0300 Subject: [PATCH 14/59] add overlays and pkgs by default Related to https://github.com/Misterio77/nix-starter-configs/issues/16 --- standard/home-manager/home.nix | 8 ++++---- standard/nixos/configuration.nix | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index dcce49e..9256458 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -17,11 +17,11 @@ nixpkgs = { # You can add overlays here overlays = [ - # If you want to use overlays your own flake exports (from overlays dir): - # outputs.overlays.modifications - # outputs.overlays.additions + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions - # Or overlays exported from other flakes: + # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default # Or define it inline, for example: diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index f73db0e..3745e4c 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -21,11 +21,11 @@ nixpkgs = { # You can add overlays here overlays = [ - # If you want to use overlays your own flake exports (from overlays dir): - # outputs.overlays.modifications - # outputs.overlays.additions + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions - # Or overlays exported from other flakes: + # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default # Or define it inline, for example: From 36bb43592a3cc13898a250b2c5ca5539825e0bdc Mon Sep 17 00:00:00 2001 From: Will Forman Date: Sun, 8 Jan 2023 18:12:46 +0000 Subject: [PATCH 15/59] Create new multi-nixpkgs dir from standard --- multi-nixpkgs/flake.lock | 64 ++++++++++++ multi-nixpkgs/flake.nix | 81 +++++++++++++++ multi-nixpkgs/home-manager/home.nix | 62 ++++++++++++ .../modules/home-manager/default.nix | 7 ++ multi-nixpkgs/modules/nixos/default.nix | 7 ++ multi-nixpkgs/nixos/configuration.nix | 99 +++++++++++++++++++ .../nixos/hardware-configuration.nix | 10 ++ multi-nixpkgs/nixpkgs.nix | 8 ++ multi-nixpkgs/overlays/default.nix | 14 +++ multi-nixpkgs/pkgs/default.nix | 6 ++ multi-nixpkgs/shell.nix | 10 ++ 11 files changed, 368 insertions(+) create mode 100644 multi-nixpkgs/flake.lock create mode 100644 multi-nixpkgs/flake.nix create mode 100644 multi-nixpkgs/home-manager/home.nix create mode 100644 multi-nixpkgs/modules/home-manager/default.nix create mode 100644 multi-nixpkgs/modules/nixos/default.nix create mode 100644 multi-nixpkgs/nixos/configuration.nix create mode 100644 multi-nixpkgs/nixos/hardware-configuration.nix create mode 100644 multi-nixpkgs/nixpkgs.nix create mode 100644 multi-nixpkgs/overlays/default.nix create mode 100644 multi-nixpkgs/pkgs/default.nix create mode 100644 multi-nixpkgs/shell.nix diff --git a/multi-nixpkgs/flake.lock b/multi-nixpkgs/flake.lock new file mode 100644 index 0000000..6b8c59c --- /dev/null +++ b/multi-nixpkgs/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1669978198, + "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1669834992, + "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/multi-nixpkgs/flake.nix b/multi-nixpkgs/flake.nix new file mode 100644 index 0000000..b19bf5f --- /dev/null +++ b/multi-nixpkgs/flake.nix @@ -0,0 +1,81 @@ +{ + description = "Your new nix config"; + + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + + # Home manager + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + # TODO: Add any other flake you might need + # hardware.url = "github:nixos/nixos-hardware"; + + # Shameless plug: looking for a way to nixify your themes and make + # everything match nicely? Try nix-colors! + # nix-colors.url = "github:misterio77/nix-colors"; + }; + + outputs = { self, nixpkgs, home-manager, ... }@inputs: + let + inherit (self) outputs; + forAllSystems = nixpkgs.lib.genAttrs [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + in + rec { + # Your custom packages + # Acessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in import ./pkgs { inherit pkgs; } + ); + # Devshell for bootstrapping + # Acessible through 'nix develop' or 'nix-shell' (legacy) + devShells = forAllSystems (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in import ./shell.nix { inherit pkgs; } + ); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; + + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + # FIXME replace with your hostname + your-hostname = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ + # > Our main nixos configuration file < + ./nixos/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + # FIXME replace with your username@hostname + "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; + }; + }; + }; +} diff --git a/multi-nixpkgs/home-manager/home.nix b/multi-nixpkgs/home-manager/home.nix new file mode 100644 index 0000000..9256458 --- /dev/null +++ b/multi-nixpkgs/home-manager/home.nix @@ -0,0 +1,62 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) + +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); + }; + }; + + # TODO: Set your username + home = { + username = "your-username"; + homeDirectory = "/home/your-username"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # 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.11"; +} diff --git a/multi-nixpkgs/modules/home-manager/default.nix b/multi-nixpkgs/modules/home-manager/default.nix new file mode 100644 index 0000000..e41f7d9 --- /dev/null +++ b/multi-nixpkgs/modules/home-manager/default.nix @@ -0,0 +1,7 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/multi-nixpkgs/modules/nixos/default.nix b/multi-nixpkgs/modules/nixos/default.nix new file mode 100644 index 0000000..bec6184 --- /dev/null +++ b/multi-nixpkgs/modules/nixos/default.nix @@ -0,0 +1,7 @@ +# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/multi-nixpkgs/nixos/configuration.nix b/multi-nixpkgs/nixos/configuration.nix new file mode 100644 index 0000000..3745e4c --- /dev/null +++ b/multi-nixpkgs/nixos/configuration.nix @@ -0,0 +1,99 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) + +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.modifications + outputs.overlays.additions + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + nix = { + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + }; + + # FIXME: Add the rest of your current configuration + + # TODO: Set your hostname + networking.hostName = "your-hostname"; + + # TODO: This is just an example, be sure to use whatever bootloader you prefer + boot.loader.systemd-boot.enable = true; + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + # FIXME: Replace with your username + your-username = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "correcthorsebatterystaple"; + isNormalUser = true; + 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) + extraGroups = [ "wheel" ]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + # Forbid root login through SSH. + permitRootLogin = "no"; + # 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.11"; +} diff --git a/multi-nixpkgs/nixos/hardware-configuration.nix b/multi-nixpkgs/nixos/hardware-configuration.nix new file mode 100644 index 0000000..dd00939 --- /dev/null +++ b/multi-nixpkgs/nixos/hardware-configuration.nix @@ -0,0 +1,10 @@ +# This is just an example, you should generate yours with nixos-generate-config and put it in here. +{ + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + # Set your system kind (needed for flakes) + nixpkgs.hostPlatform = "x86_64-linux"; +} diff --git a/multi-nixpkgs/nixpkgs.nix b/multi-nixpkgs/nixpkgs.nix new file mode 100644 index 0000000..041de40 --- /dev/null +++ b/multi-nixpkgs/nixpkgs.nix @@ -0,0 +1,8 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/multi-nixpkgs/overlays/default.nix b/multi-nixpkgs/overlays/default.nix new file mode 100644 index 0000000..b2653c9 --- /dev/null +++ b/multi-nixpkgs/overlays/default.nix @@ -0,0 +1,14 @@ +# This file defines overlays +{ + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs { pkgs = final; }; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; +} diff --git a/multi-nixpkgs/pkgs/default.nix b/multi-nixpkgs/pkgs/default.nix new file mode 100644 index 0000000..8c5e910 --- /dev/null +++ b/multi-nixpkgs/pkgs/default.nix @@ -0,0 +1,6 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' + +{ pkgs ? (import ../nixpkgs.nix) { } }: { + # example = pkgs.callPackage ./example { }; +} diff --git a/multi-nixpkgs/shell.nix b/multi-nixpkgs/shell.nix new file mode 100644 index 0000000..9525915 --- /dev/null +++ b/multi-nixpkgs/shell.nix @@ -0,0 +1,10 @@ +# Shell for bootstrapping flake-enabled nix and home-manager +# You can enter it through 'nix develop' or (legacy) 'nix-shell' + +{ pkgs ? (import ./nixpkgs.nix) { } }: { + default = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [ nix home-manager git ]; + }; +} From 1318be736262057168d6ccd17ad870fdfe7d6654 Mon Sep 17 00:00:00 2001 From: Will Forman Date: Sun, 8 Jan 2023 18:20:22 +0000 Subject: [PATCH 16/59] Update multiple channel support --- README.md | 10 ++++++++++ multi-nixpkgs/flake.lock | 19 ++++++++++++++++++- multi-nixpkgs/flake.nix | 3 ++- multi-nixpkgs/home-manager/home.nix | 1 + multi-nixpkgs/nixos/configuration.nix | 1 + multi-nixpkgs/overlays/default.nix | 6 ++++++ 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9c8537f..40c4a1a 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,16 @@ the latest and greatest nix3 flake-enabled command UX. # What next? +## Multiple nixpkgs channels + +`multi-nixpkgs` shows how to setup multiple nixpkgs channels. For example, using the stable channel you can add the unstable version of neovim like: + +``` +home.packages = with pkgs; [ + unstable.neovim +]; +``` + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` diff --git a/multi-nixpkgs/flake.lock b/multi-nixpkgs/flake.lock index 6b8c59c..220e02c 100644 --- a/multi-nixpkgs/flake.lock +++ b/multi-nixpkgs/flake.lock @@ -37,10 +37,27 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1672953546, + "narHash": "sha256-oz757DnJ1ITvwyTovuwG3l9cX6j9j6/DH9eH+cXFJmc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a518c77148585023ff56022f09c4b2c418a51ef5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" } }, "utils": { diff --git a/multi-nixpkgs/flake.nix b/multi-nixpkgs/flake.nix index b19bf5f..a7d0764 100644 --- a/multi-nixpkgs/flake.nix +++ b/multi-nixpkgs/flake.nix @@ -4,6 +4,7 @@ inputs = { # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Home manager home-manager.url = "github:nix-community/home-manager"; @@ -43,7 +44,7 @@ ); # Your custom packages and modifications, exported as overlays - overlays = import ./overlays; + overlays = import ./overlays { inherit inputs; }; # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs nixosModules = import ./modules/nixos; diff --git a/multi-nixpkgs/home-manager/home.nix b/multi-nixpkgs/home-manager/home.nix index 9256458..53ba612 100644 --- a/multi-nixpkgs/home-manager/home.nix +++ b/multi-nixpkgs/home-manager/home.nix @@ -18,6 +18,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/multi-nixpkgs/nixos/configuration.nix b/multi-nixpkgs/nixos/configuration.nix index 3745e4c..98ea9fb 100644 --- a/multi-nixpkgs/nixos/configuration.nix +++ b/multi-nixpkgs/nixos/configuration.nix @@ -22,6 +22,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/multi-nixpkgs/overlays/default.nix b/multi-nixpkgs/overlays/default.nix index b2653c9..b068a55 100644 --- a/multi-nixpkgs/overlays/default.nix +++ b/multi-nixpkgs/overlays/default.nix @@ -1,5 +1,11 @@ +{ inputs, ... }: # This file defines overlays { + # Sets `unstable` under `pkgs` as the nixpkgs unstable channel + unstable = final: _prev: { + unstable = inputs.nixpkgs-unstable.legacyPackages.${final.system}; + }; + # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs { pkgs = final; }; From f0e313c88666315485e7d39d821147b1745e5386 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:08:47 -0300 Subject: [PATCH 17/59] add nixpkgs-unstable to standard template I decided it is a common enough usecase, so it makes sense to include it Co-authored-by: Will Forman --- standard/flake.lock | 19 ++++++++++++++++++- standard/flake.nix | 6 +++++- standard/home-manager/home.nix | 1 + standard/nixos/configuration.nix | 1 + standard/overlays/default.nix | 10 ++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/standard/flake.lock b/standard/flake.lock index 6b8c59c..220e02c 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -37,10 +37,27 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1672953546, + "narHash": "sha256-oz757DnJ1ITvwyTovuwG3l9cX6j9j6/DH9eH+cXFJmc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a518c77148585023ff56022f09c4b2c418a51ef5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" } }, "utils": { diff --git a/standard/flake.nix b/standard/flake.nix index b19bf5f..a335d6f 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -4,6 +4,10 @@ inputs = { # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + # You can access packages and modules from different nixpkgs revs + # at the same time. Here's an working example: + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager home-manager.url = "github:nix-community/home-manager"; @@ -43,7 +47,7 @@ ); # Your custom packages and modifications, exported as overlays - overlays = import ./overlays; + overlays = import ./overlays { inherit inputs; }; # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs nixosModules = import ./modules/nixos; diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 9256458..53ba612 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -18,6 +18,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 3745e4c..98ea9fb 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -22,6 +22,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.unstable outputs.overlays.modifications outputs.overlays.additions diff --git a/standard/overlays/default.nix b/standard/overlays/default.nix index b2653c9..9a03471 100644 --- a/standard/overlays/default.nix +++ b/standard/overlays/default.nix @@ -1,4 +1,5 @@ # This file defines overlays +{ inputs, ... }: { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs { pkgs = final; }; @@ -11,4 +12,13 @@ # ... # }); }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; } From f313c8acec862ada5aa73161c98589ecd5927554 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:22:38 -0300 Subject: [PATCH 18/59] document how to use home-manager as NixOS module --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 9c8537f..c0e3598 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,32 @@ the latest and greatest nix3 flake-enabled command UX. # What next? +## Use home-manager as a NixOS module + +If you prefer to build your home configuration together with your NixOS one, +it's pretty simple. + +Simply remove the `homeConfigurations` block from the `flake.nix` file; then +add this to your NixOS configuration (either directly on +`nixos/configuration.nix` or on a separate file and import it): + +```nix +{ inputs, ... }: { + imports = [ + # Import home-manager's NixOS module + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + # Import your home-manager configuration + your-username = import ../home-manager; + }; + }; +} +``` + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` From b705378663c3fe12a1838c3fef402fcd36c7b92a Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:29:20 -0300 Subject: [PATCH 19/59] fix wrong unstable overlay name --- standard/nixos/configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 98ea9fb..265a010 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -22,9 +22,9 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.unstable - outputs.overlays.modifications outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default From 855b2273259e9531a073e838f9ba791e1bdda94c Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:30:28 -0300 Subject: [PATCH 20/59] bump flake locks --- minimal/flake.lock | 12 ++++++------ standard/flake.lock | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index 6b8c59c..c74fba8 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -8,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1669978198, - "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", + "lastModified": 1676892629, + "narHash": "sha256-rlvsqoSBO5dCwfnn7xvImYREidIPJaiFS3b54TZF4pU=", "owner": "nix-community", "repo": "home-manager", - "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", + "rev": "72ce74d3eae78a6b31538ea7ebe0c1fcf4a10f7a", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1669834992, - "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", + "lastModified": 1676817468, + "narHash": "sha256-ovuJ1jQOC2/EEibufBkXmSN/O9mLx80Wh7aDmHmHAhA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", + "rev": "0cf4274b5d06325bd16dbf879a30981bc283e58a", "type": "github" }, "original": { diff --git a/standard/flake.lock b/standard/flake.lock index 220e02c..e7e3f30 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -8,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1669978198, - "narHash": "sha256-U8sZFwIIDFm9w/Kx58sYrIsWpuQUKmkcQmdBkuQ+gkE=", + "lastModified": 1676892629, + "narHash": "sha256-rlvsqoSBO5dCwfnn7xvImYREidIPJaiFS3b54TZF4pU=", "owner": "nix-community", "repo": "home-manager", - "rev": "71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9", + "rev": "72ce74d3eae78a6b31538ea7ebe0c1fcf4a10f7a", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1669834992, - "narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=", + "lastModified": 1676817468, + "narHash": "sha256-ovuJ1jQOC2/EEibufBkXmSN/O9mLx80Wh7aDmHmHAhA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502", + "rev": "0cf4274b5d06325bd16dbf879a30981bc283e58a", "type": "github" }, "original": { @@ -39,11 +39,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1672953546, - "narHash": "sha256-oz757DnJ1ITvwyTovuwG3l9cX6j9j6/DH9eH+cXFJmc=", + "lastModified": 1676721149, + "narHash": "sha256-mN2EpTGxxVNnFZLoLWRwh6f7UWhXy4qE+wO2CZyrXps=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a518c77148585023ff56022f09c4b2c418a51ef5", + "rev": "5f4e07deb7c44f27d498f8df9c5f34750acf52d2", "type": "github" }, "original": { From 691c6579c78d770a7cb67b48119fa3fedef9e363 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 20 Feb 2023 17:32:28 -0300 Subject: [PATCH 21/59] fix wrong unstable overlay name --- standard/home-manager/home.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 53ba612..1b03689 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -18,9 +18,9 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.unstable - outputs.overlays.modifications outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default From 2135e81495d41ba3ea52737c1e18b01efcd72694 Mon Sep 17 00:00:00 2001 From: Dmytro Kyrychuk Date: Sat, 20 May 2023 12:57:52 +0000 Subject: [PATCH 22/59] Sync home-manager and nixpkgs branches --- minimal/flake.nix | 2 +- standard/flake.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/minimal/flake.nix b/minimal/flake.nix index 5a4d31e..4f95f09 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -6,7 +6,7 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; # Home manager - home-manager.url = "github:nix-community/home-manager"; + home-manager.url = "github:nix-community/home-manager/release-22.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need diff --git a/standard/flake.nix b/standard/flake.nix index a335d6f..3123181 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -10,7 +10,7 @@ # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager - home-manager.url = "github:nix-community/home-manager"; + home-manager.url = "github:nix-community/home-manager/release-22.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need From 80b652c13bc6ec3fe9ce10e29f392a129a94aea7 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 20 May 2023 10:50:18 -0300 Subject: [PATCH 23/59] bump locks --- minimal/flake.lock | 13 +++++++------ standard/flake.lock | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index c74fba8..28a9eda 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -8,26 +8,27 @@ "utils": "utils" }, "locked": { - "lastModified": 1676892629, - "narHash": "sha256-rlvsqoSBO5dCwfnn7xvImYREidIPJaiFS3b54TZF4pU=", + "lastModified": 1681092193, + "narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", "owner": "nix-community", "repo": "home-manager", - "rev": "72ce74d3eae78a6b31538ea7ebe0c1fcf4a10f7a", + "rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-22.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1676817468, - "narHash": "sha256-ovuJ1jQOC2/EEibufBkXmSN/O9mLx80Wh7aDmHmHAhA=", + "lastModified": 1684398685, + "narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0cf4274b5d06325bd16dbf879a30981bc283e58a", + "rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c", "type": "github" }, "original": { diff --git a/standard/flake.lock b/standard/flake.lock index e7e3f30..bd02011 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -8,26 +8,27 @@ "utils": "utils" }, "locked": { - "lastModified": 1676892629, - "narHash": "sha256-rlvsqoSBO5dCwfnn7xvImYREidIPJaiFS3b54TZF4pU=", + "lastModified": 1681092193, + "narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", "owner": "nix-community", "repo": "home-manager", - "rev": "72ce74d3eae78a6b31538ea7ebe0c1fcf4a10f7a", + "rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-22.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1676817468, - "narHash": "sha256-ovuJ1jQOC2/EEibufBkXmSN/O9mLx80Wh7aDmHmHAhA=", + "lastModified": 1684398685, + "narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0cf4274b5d06325bd16dbf879a30981bc283e58a", + "rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c", "type": "github" }, "original": { @@ -39,11 +40,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1676721149, - "narHash": "sha256-mN2EpTGxxVNnFZLoLWRwh6f7UWhXy4qE+wO2CZyrXps=", + "lastModified": 1684570954, + "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5f4e07deb7c44f27d498f8df9c5f34750acf52d2", + "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3", "type": "github" }, "original": { From 9e4963ae5c1130b18a64db2790248e75a11f94cb Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Mon, 12 Jun 2023 10:22:00 -0300 Subject: [PATCH 24/59] update to 23.05 --- minimal/flake.lock | 34 +++++++-------------------- minimal/flake.nix | 4 ++-- minimal/home-manager/home.nix | 2 +- minimal/nixos/configuration.nix | 2 +- standard/flake.lock | 40 ++++++++++---------------------- standard/flake.nix | 4 ++-- standard/home-manager/home.nix | 2 +- standard/nixos/configuration.nix | 2 +- 8 files changed, 29 insertions(+), 61 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index 28a9eda..177441e 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -4,36 +4,35 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ], - "utils": "utils" + ] }, "locked": { - "lastModified": 1681092193, - "narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", + "lastModified": 1685599623, + "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", "owner": "nix-community", "repo": "home-manager", - "rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", + "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-22.11", + "ref": "release-23.05", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1684398685, - "narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=", + "lastModified": 1686431482, + "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c", + "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } @@ -43,21 +42,6 @@ "home-manager": "home-manager", "nixpkgs": "nixpkgs" } - }, - "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/minimal/flake.nix b/minimal/flake.nix index 4f95f09..1765bc3 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -3,10 +3,10 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # Home manager - home-manager.url = "github:nix-community/home-manager/release-22.11"; + home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index ea28c5e..2e70f6b 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -51,5 +51,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.11"; + home.stateVersion = "23.05"; } diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index bd8fd26..bb29905 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -88,5 +88,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.11"; + system.stateVersion = "23.05"; } diff --git a/standard/flake.lock b/standard/flake.lock index bd02011..05ed3b7 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -4,47 +4,46 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ], - "utils": "utils" + ] }, "locked": { - "lastModified": 1681092193, - "narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=", + "lastModified": 1685599623, + "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", "owner": "nix-community", "repo": "home-manager", - "rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af", + "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-22.11", + "ref": "release-23.05", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1684398685, - "narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=", + "lastModified": 1686431482, + "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c", + "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1684570954, - "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { @@ -60,21 +59,6 @@ "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } - }, - "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/standard/flake.nix b/standard/flake.nix index 3123181..cac331f 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # You can access packages and modules from different nixpkgs revs # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager - home-manager.url = "github:nix-community/home-manager/release-22.11"; + home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 1b03689..4198f3b 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -59,5 +59,5 @@ systemd.user.startServices = "sd-switch"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "22.11"; + home.stateVersion = "23.05"; } diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 265a010..e187383 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -96,5 +96,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.11"; + system.stateVersion = "23.05"; } From 902416b6483ecb07209029c76165f9edfb6af275 Mon Sep 17 00:00:00 2001 From: Yanni Papandreou Date: Thu, 22 Jun 2023 11:14:42 +0100 Subject: [PATCH 25/59] updated README to correct section on using home-manager as a NixOS module --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0e3598..87067e8 100644 --- a/README.md +++ b/README.md @@ -115,22 +115,26 @@ add this to your NixOS configuration (either directly on `nixos/configuration.nix` or on a separate file and import it): ```nix -{ inputs, ... }: { +{ inputs, outputs, ... }: { imports = [ # Import home-manager's NixOS module inputs.home-manager.nixosModules.home-manager ]; home-manager = { - extraSpecialArgs = { inherit inputs; }; + extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration + # Note: this assumes you have a `default.nix` in your home-manager directory. + # If not replace with the `your-username = import ../home-manager/home.nix` your-username = import ../home-manager; }; }; } ``` +> Note: The above is applicable to the standard version; for the minimal version the `flake.nix` does not pass `outputs` through `specialArgs`. + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` From 32ec2e41fb34ddfb3da5f8dbb939dc78bc4f4692 Mon Sep 17 00:00:00 2001 From: Yanni Papandreou Date: Thu, 22 Jun 2023 11:20:44 +0100 Subject: [PATCH 26/59] fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 87067e8..8bad631 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ add this to your NixOS configuration (either directly on users = { # Import your home-manager configuration # Note: this assumes you have a `default.nix` in your home-manager directory. - # If not replace with the `your-username = import ../home-manager/home.nix` + # If not replace with `your-username = import ../home-manager/home.nix` your-username = import ../home-manager; }; }; From fdb119ed51ee7e6d04a164ce6be7aaecd83a1bdb Mon Sep 17 00:00:00 2001 From: YanniPapandreou Date: Wed, 2 Aug 2023 16:05:21 +0100 Subject: [PATCH 27/59] removed comment about assumption Co-authored-by: Gabriel Fontes --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 8bad631..050bf43 100644 --- a/README.md +++ b/README.md @@ -125,9 +125,7 @@ add this to your NixOS configuration (either directly on extraSpecialArgs = { inherit inputs outputs; }; users = { # Import your home-manager configuration - # Note: this assumes you have a `default.nix` in your home-manager directory. - # If not replace with `your-username = import ../home-manager/home.nix` - your-username = import ../home-manager; + your-username = import ../home-manager/home.nix; }; }; } From 6c374a2824a4886922c9ccf8a5dfd505d23bd4cf Mon Sep 17 00:00:00 2001 From: YanniPapandreou Date: Wed, 2 Aug 2023 16:05:45 +0100 Subject: [PATCH 28/59] removed additional comment Co-authored-by: Gabriel Fontes --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 050bf43..b8ba3c7 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,6 @@ add this to your NixOS configuration (either directly on } ``` -> Note: The above is applicable to the standard version; for the minimal version the `flake.nix` does not pass `outputs` through `specialArgs`. - ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` From 5fa366f223f39f5815d65a8fc5753366ca759900 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 16 Sep 2023 18:17:31 -0300 Subject: [PATCH 29/59] standard: remove unused rec --- standard/flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/standard/flake.nix b/standard/flake.nix index cac331f..52b6564 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -31,8 +31,7 @@ "aarch64-darwin" "x86_64-darwin" ]; - in - rec { + in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: From 133826a072330e916691a1c236948cbdfec6250b Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 16 Sep 2023 18:19:35 -0300 Subject: [PATCH 30/59] minimal: expose outputs as well --- minimal/flake.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/minimal/flake.nix b/minimal/flake.nix index 1765bc3..97e3ebc 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -17,13 +17,15 @@ # nix-colors.url = "github:misterio77/nix-colors"; }; - outputs = { nixpkgs, home-manager, ... }@inputs: { + outputs = { self, nixpkgs, home-manager, ... }@inputs: let + inherit (self) outputs; + in { # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config + specialArgs = { inherit inputs outputs; }; # > Our main nixos configuration file < modules = [ ./nixos/configuration.nix ]; }; @@ -35,7 +37,7 @@ # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config + extraSpecialArgs = { inherit inputs outputs; }; # > Our main home-manager configuration file < modules = [ ./home-manager/home.nix ]; }; From 63975152b0a46aabdefadad24917d1caf67b3747 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 16 Sep 2023 18:41:44 -0300 Subject: [PATCH 31/59] add alejandra as formatter Co-authored-by: uf5 --- flake.lock | 27 +++++ flake.nix | 16 ++- minimal/flake.nix | 15 ++- minimal/home-manager/home.nix | 11 +- minimal/nixos/configuration.nix | 13 ++- standard/flake.nix | 117 ++++++++++++---------- standard/home-manager/home.nix | 12 ++- standard/modules/home-manager/default.nix | 1 - standard/modules/nixos/default.nix | 1 - standard/nixos/configuration.nix | 14 ++- standard/nixpkgs.nix | 11 +- standard/overlays/default.nix | 5 +- standard/pkgs/default.nix | 3 +- standard/shell.nix | 5 +- 14 files changed, 161 insertions(+), 90 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0d09824 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1694753796, + "narHash": "sha256-QPE7dqcicQH/nq9aywVXJWWtci4FvxHaM+BSIEbGBvA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "360a7d31c30abefdc490d203f80e3221b7a24af2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 591094b..30648da 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,19 @@ { description = "NixOS + standalone home-manager config flakes to get you started!"; - outputs = inputs: { + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + }; + + outputs = {nixpkgs, ...}: let + forAllSystems = nixpkgs.lib.genAttrs [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + in { templates = { minimal = { description = '' @@ -17,5 +30,6 @@ path = ./standard; }; }; + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); }; } diff --git a/minimal/flake.nix b/minimal/flake.nix index 97e3ebc..0a7f96d 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -17,7 +17,12 @@ # nix-colors.url = "github:misterio77/nix-colors"; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: let + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let inherit (self) outputs; in { # NixOS configuration entrypoint @@ -25,9 +30,9 @@ nixosConfigurations = { # FIXME replace with your hostname your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; + specialArgs = {inherit inputs outputs;}; # > Our main nixos configuration file < - modules = [ ./nixos/configuration.nix ]; + modules = [./nixos/configuration.nix]; }; }; @@ -37,9 +42,9 @@ # FIXME replace with your username@hostname "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs outputs; }; + extraSpecialArgs = {inherit inputs outputs;}; # > Our main home-manager configuration file < - modules = [ ./home-manager/home.nix ]; + modules = [./home-manager/home.nix]; }; }; }; diff --git a/minimal/home-manager/home.nix b/minimal/home-manager/home.nix index 2e70f6b..5f20559 100644 --- a/minimal/home-manager/home.nix +++ b/minimal/home-manager/home.nix @@ -1,7 +1,12 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) - -{ inputs, lib, config, pkgs, ... }: { +{ + inputs, + lib, + config, + pkgs, + ... +}: { # You can import other home-manager modules here imports = [ # If you want to use home-manager modules from other flakes (such as nix-colors): @@ -29,7 +34,7 @@ # Disable if you don't want unfree packages allowUnfree = true; # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = (_: true); + allowUnfreePredicate = _: true; }; }; diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index bb29905..11c0c3a 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -1,7 +1,12 @@ # This is your system's configuration file. # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) - -{ inputs, lib, config, pkgs, ... }: { +{ + inputs, + lib, + config, + pkgs, + ... +}: { # You can import other NixOS modules here imports = [ # If you want to use modules from other flakes (such as nixos-hardware): @@ -38,7 +43,7 @@ nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! @@ -73,7 +78,7 @@ # 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) - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; }; }; diff --git a/standard/flake.nix b/standard/flake.nix index 52b6564..96650e8 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -21,64 +21,71 @@ # nix-colors.url = "github:misterio77/nix-colors"; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: - let - inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" - ]; - in { - # Your custom packages - # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in import ./pkgs { inherit pkgs; } - ); - # Devshell for bootstrapping - # Acessible through 'nix develop' or 'nix-shell' (legacy) - devShells = forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in import ./shell.nix { inherit pkgs; } - ); + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + forAllSystems = nixpkgs.lib.genAttrs [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + pkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + in { + # Your custom packages + # Acessible through 'nix build', 'nix shell', etc + packages = forAllSystems ( + system: import ./pkgs {pkgs = pkgsFor.${system};} + ); + # Devshell for bootstrapping + # Acessible through 'nix develop' or 'nix-shell' (legacy) + devShells = forAllSystems ( + system: import ./shell.nix {pkgs = pkgsFor.${system};} + ); - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays { inherit inputs; }; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: pkgsFor.${system}.alejandra); - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - # FIXME replace with your hostname - your-hostname = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs; }; - modules = [ - # > Our main nixos configuration file < - ./nixos/configuration.nix - ]; - }; - }; + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - # FIXME replace with your username@hostname - "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = { inherit inputs outputs; }; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/home.nix - ]; - }; + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + # FIXME replace with your hostname + your-hostname = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./nixos/configuration.nix + ]; }; }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + # FIXME replace with your username@hostname + "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; + }; + }; + }; } diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index 4198f3b..eedacc2 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -1,7 +1,13 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) - -{ inputs, outputs, lib, config, pkgs, ... }: { +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { # You can import other home-manager modules here imports = [ # If you want to use modules your own flake exports (from modules/home-manager): @@ -37,7 +43,7 @@ # Disable if you don't want unfree packages allowUnfree = true; # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = (_: true); + allowUnfreePredicate = _: true; }; }; diff --git a/standard/modules/home-manager/default.nix b/standard/modules/home-manager/default.nix index e41f7d9..45aae31 100644 --- a/standard/modules/home-manager/default.nix +++ b/standard/modules/home-manager/default.nix @@ -1,6 +1,5 @@ # Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). # These should be stuff you would like to share with others, not your personal configurations. - { # List your module files here # my-module = import ./my-module.nix; diff --git a/standard/modules/nixos/default.nix b/standard/modules/nixos/default.nix index bec6184..8605069 100644 --- a/standard/modules/nixos/default.nix +++ b/standard/modules/nixos/default.nix @@ -1,6 +1,5 @@ # Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). # These should be stuff you would like to share with others, not your personal configurations. - { # List your module files here # my-module = import ./my-module.nix; diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index e187383..a72f947 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -1,7 +1,13 @@ # This is your system's configuration file. # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) - -{ inputs, outputs, lib, config, pkgs, ... }: { +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { # You can import other NixOS modules here imports = [ # If you want to use modules your own flake exports (from modules/nixos): @@ -46,7 +52,7 @@ nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! @@ -81,7 +87,7 @@ # 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) - extraGroups = [ "wheel" ]; + extraGroups = ["wheel"]; }; }; diff --git a/standard/nixpkgs.nix b/standard/nixpkgs.nix index 041de40..e4d0588 100644 --- a/standard/nixpkgs.nix +++ b/standard/nixpkgs.nix @@ -1,8 +1,9 @@ # A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file # This is useful to avoid using channels when using legacy nix commands -let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +let + lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; in -import (fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; -}) + import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; + }) diff --git a/standard/overlays/default.nix b/standard/overlays/default.nix index 9a03471..a13ea3c 100644 --- a/standard/overlays/default.nix +++ b/standard/overlays/default.nix @@ -1,8 +1,7 @@ # This file defines overlays -{ inputs, ... }: -{ +{inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs { pkgs = final; }; + additions = final: _prev: import ../pkgs {pkgs = final;}; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/standard/pkgs/default.nix b/standard/pkgs/default.nix index 8c5e910..7403a05 100644 --- a/standard/pkgs/default.nix +++ b/standard/pkgs/default.nix @@ -1,6 +1,5 @@ # Custom packages, that can be defined similarly to ones from nixpkgs # You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' - -{ pkgs ? (import ../nixpkgs.nix) { } }: { +{pkgs ? (import ../nixpkgs.nix) {}}: { # example = pkgs.callPackage ./example { }; } diff --git a/standard/shell.nix b/standard/shell.nix index 9525915..5982048 100644 --- a/standard/shell.nix +++ b/standard/shell.nix @@ -1,10 +1,9 @@ # Shell for bootstrapping flake-enabled nix and home-manager # You can enter it through 'nix develop' or (legacy) 'nix-shell' - -{ pkgs ? (import ./nixpkgs.nix) { } }: { +{pkgs ? (import ./nixpkgs.nix) {}}: { default = pkgs.mkShell { # Enable experimental features without having to specify the argument NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git ]; + nativeBuildInputs = with pkgs; [nix home-manager git]; }; } From 8d0d1aa8be847e04da4c68c16626cade6eabe0de Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 16 Sep 2023 18:56:24 -0300 Subject: [PATCH 32/59] standard: document forAllSystems and pkgsFor --- standard/flake.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/standard/flake.nix b/standard/flake.nix index 96650e8..7161954 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -28,14 +28,26 @@ ... } @ inputs: let inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ + # Supported systems for your flake packages, shell, etc. + systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; - pkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; + # Generate a nixpkgs instance for each system + pkgsFor = forAllSystems (system: + import nixpkgs { + inherit system; + # You may configure this by adding overlays, enabling unfree, etc. + # This is NOT the nixpkgs instance your NixOS/home-manager configs will + # use, this is only used by 'nix build', 'nix shell', etc. + # overlays = []; + }); in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc @@ -47,7 +59,6 @@ devShells = forAllSystems ( system: import ./shell.nix {pkgs = pkgsFor.${system};} ); - # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' formatter = forAllSystems (system: pkgsFor.${system}.alejandra); From fe21fa16704972126a9660622b8464bd215c7894 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 16 Sep 2023 19:04:29 -0300 Subject: [PATCH 33/59] standard: simplify Remove pkgsFor (use legacyPackages instead), remove shell, remove support for legacy nix-build --- standard/flake.nix | 20 ++------------------ standard/nixpkgs.nix | 9 --------- standard/pkgs/default.nix | 4 ++-- standard/shell.nix | 9 --------- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 standard/nixpkgs.nix delete mode 100644 standard/shell.nix diff --git a/standard/flake.nix b/standard/flake.nix index 7161954..669d2c9 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -39,29 +39,13 @@ # This is a function that generates an attribute by calling a function you # pass to it, with each system as an argument forAllSystems = nixpkgs.lib.genAttrs systems; - # Generate a nixpkgs instance for each system - pkgsFor = forAllSystems (system: - import nixpkgs { - inherit system; - # You may configure this by adding overlays, enabling unfree, etc. - # This is NOT the nixpkgs instance your NixOS/home-manager configs will - # use, this is only used by 'nix build', 'nix shell', etc. - # overlays = []; - }); in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems ( - system: import ./pkgs {pkgs = pkgsFor.${system};} - ); - # Devshell for bootstrapping - # Acessible through 'nix develop' or 'nix-shell' (legacy) - devShells = forAllSystems ( - system: import ./shell.nix {pkgs = pkgsFor.${system};} - ); + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' - formatter = forAllSystems (system: pkgsFor.${system}.alejandra); + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Your custom packages and modifications, exported as overlays overlays = import ./overlays {inherit inputs;}; diff --git a/standard/nixpkgs.nix b/standard/nixpkgs.nix deleted file mode 100644 index e4d0588..0000000 --- a/standard/nixpkgs.nix +++ /dev/null @@ -1,9 +0,0 @@ -# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file -# This is useful to avoid using channels when using legacy nix commands -let - lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; -in - import (fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; - }) diff --git a/standard/pkgs/default.nix b/standard/pkgs/default.nix index 7403a05..3d9e23c 100644 --- a/standard/pkgs/default.nix +++ b/standard/pkgs/default.nix @@ -1,5 +1,5 @@ # Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' -{pkgs ? (import ../nixpkgs.nix) {}}: { +# You can build them using 'nix build .#example' +pkgs: { # example = pkgs.callPackage ./example { }; } diff --git a/standard/shell.nix b/standard/shell.nix deleted file mode 100644 index 5982048..0000000 --- a/standard/shell.nix +++ /dev/null @@ -1,9 +0,0 @@ -# Shell for bootstrapping flake-enabled nix and home-manager -# You can enter it through 'nix develop' or (legacy) 'nix-shell' -{pkgs ? (import ./nixpkgs.nix) {}}: { - default = pkgs.mkShell { - # Enable experimental features without having to specify the argument - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [nix home-manager git]; - }; -} From 42abb6adb76464bed5f62651e5c958cf9bab9ae7 Mon Sep 17 00:00:00 2001 From: Juan Giordana Date: Tue, 7 Nov 2023 20:52:27 -0300 Subject: [PATCH 34/59] Bugfix; Correct typo. Correct small typo: Acessible. --- standard/flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/flake.nix b/standard/flake.nix index 669d2c9..61960d1 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -41,7 +41,7 @@ forAllSystems = nixpkgs.lib.genAttrs systems; in { # Your custom packages - # Acessible through 'nix build', 'nix shell', etc + # Accessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # Formatter for your nix files, available through 'nix fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt' From ac10a68e16a17cf079c3419211a910b7e24e54b9 Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Wed, 26 Jul 2023 18:00:42 -0400 Subject: [PATCH 35/59] Fix $NIX_PATH --- minimal/nixos/configuration.nix | 31 ++++++++++++++++++------------- standard/nixos/configuration.nix | 31 ++++++++++++++++++------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index 11c0c3a..f752915 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -40,21 +40,26 @@ }; }; - nix = { - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; - settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; }; # FIXME: Add the rest of your current configuration diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index a72f947..37a30f5 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -49,21 +49,26 @@ }; }; - nix = { - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; - settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; }; # FIXME: Add the rest of your current configuration From 90103a9ca36d11d5e3218f1264d8af17cf2516b5 Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Wed, 26 Jul 2023 18:07:58 -0400 Subject: [PATCH 36/59] Fix OpenSSH warnings --- minimal/nixos/configuration.nix | 10 ++++++---- standard/nixos/configuration.nix | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/minimal/nixos/configuration.nix b/minimal/nixos/configuration.nix index f752915..9ca3131 100644 --- a/minimal/nixos/configuration.nix +++ b/minimal/nixos/configuration.nix @@ -91,10 +91,12 @@ # Feel free to remove if you don't need it. services.openssh = { enable = true; - # Forbid root login through SSH. - permitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - passwordAuthentication = false; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # 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 diff --git a/standard/nixos/configuration.nix b/standard/nixos/configuration.nix index 37a30f5..c8b7600 100644 --- a/standard/nixos/configuration.nix +++ b/standard/nixos/configuration.nix @@ -100,10 +100,12 @@ # Feel free to remove if you don't need it. services.openssh = { enable = true; - # Forbid root login through SSH. - permitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - passwordAuthentication = false; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # 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 From a62389590683cfd7a000539571de6619b9568afc Mon Sep 17 00:00:00 2001 From: musjj <72612857+musjj@users.noreply.github.com> Date: Tue, 15 Aug 2023 03:17:56 +0700 Subject: [PATCH 37/59] clarify how to setup home-manager in ephemeral environments --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index b8ba3c7..120498d 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,24 @@ Here's some awesome blog posts about it: - [NixOS: tmpfs as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) and [tmpfs as home](https://elis.nu/blog/2020/06/nixos-tmpfs-as-home/) +Note that for `home-manager` to work correctly here, you need to set up its +NixOS module, as described in the [previous section](#use-home-manager-as-a-nixos-module). +Additionally, if you want the standalone `home-manager` tool to be available in +your environment, you need to add it into your package list in +`configuration.nix` like this: + +```nix +# To install it for a specific user +users.users = { + your-username = { + packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; + }; +}; + +# To install it for all users +environment.systemPackages = [ inputs.home-manager.packages.${pkgs.system}.default ] +``` + ## Adding custom packages Something you want to use that's not in nixpkgs yet? You can easily build and From 972935c1b35d8b92476e26b0e63a044d191d49c3 Mon Sep 17 00:00:00 2001 From: musjj <72612857+musjj@users.noreply.github.com> Date: Sun, 12 Nov 2023 21:51:16 +0700 Subject: [PATCH 38/59] home-manager: re-organize sections with some minor re-wording --- README.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 120498d..d9ef10c 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,26 @@ add this to your NixOS configuration (either directly on } ``` +In this setup, the `home-manager` tool will not be installed (see +[nix-community/home-manager#4342](https://github.com/nix-community/home-manager/pull/4342)). +To rebuild your home configuration, use `nixos-rebuild` instead. + +But if you want to install the `home-manager` tool anyways, you can add the +package into your configuration: + +```nix +# To install it for a specific user +users.users = { + your-username = { + packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; + }; +}; + +# To install it globally +environment.systemPackages = + [ inputs.home-manager.packages.${pkgs.system}.default ]; +``` + ## Adding more hosts or users You can organize them by hostname and username on `nixos` and `home-manager` @@ -208,21 +228,6 @@ Here's some awesome blog posts about it: Note that for `home-manager` to work correctly here, you need to set up its NixOS module, as described in the [previous section](#use-home-manager-as-a-nixos-module). -Additionally, if you want the standalone `home-manager` tool to be available in -your environment, you need to add it into your package list in -`configuration.nix` like this: - -```nix -# To install it for a specific user -users.users = { - your-username = { - packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; - }; -}; - -# To install it for all users -environment.systemPackages = [ inputs.home-manager.packages.${pkgs.system}.default ] -``` ## Adding custom packages From 81a6a9cc0db9bbb1c0f2a8fca7d765aad910f43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Sat, 11 Nov 2023 18:35:02 +0100 Subject: [PATCH 39/59] fix: Workaround for `allowUnfreePredicate` is solved I think this workaround can be removed. I am however not sure in which version of home-manager that came in. Probably we cannot yet merge this since its not in `release-23.05` branch as this templates refer to. https://github.com/nix-community/home-manager/pull/4304 --- standard/home-manager/home.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/standard/home-manager/home.nix b/standard/home-manager/home.nix index eedacc2..7aa567f 100644 --- a/standard/home-manager/home.nix +++ b/standard/home-manager/home.nix @@ -42,8 +42,6 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; - # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = _: true; }; }; From bb8a72b8e0e25f6a0ceb3574942a54cffe006cb9 Mon Sep 17 00:00:00 2001 From: LateNightIceCream Date: Thu, 25 Apr 2024 10:51:27 +0200 Subject: [PATCH 40/59] change to the additions overlay function call --- standard/overlays/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standard/overlays/default.nix b/standard/overlays/default.nix index a13ea3c..7bfcb4c 100644 --- a/standard/overlays/default.nix +++ b/standard/overlays/default.nix @@ -1,7 +1,7 @@ # This file defines overlays {inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; + additions = final: _prev: import ../pkgs final.pkgs; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. From f1035a44844b8d4f13654acaafc704a217866384 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 27 Apr 2024 10:02:37 -0300 Subject: [PATCH 41/59] bump to 23.11 --- minimal/flake.lock | 16 ++++++++-------- minimal/flake.nix | 11 ++--------- standard/flake.lock | 22 +++++++++++----------- standard/flake.nix | 11 ++--------- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/minimal/flake.lock b/minimal/flake.lock index 177441e..8f0e1a1 100644 --- a/minimal/flake.lock +++ b/minimal/flake.lock @@ -7,32 +7,32 @@ ] }, "locked": { - "lastModified": 1685599623, - "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", + "lastModified": 1714043624, + "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", "owner": "nix-community", "repo": "home-manager", - "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", + "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1713995372, + "narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "dd37924974b9202f8226ed5d74a252a9785aedf8", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } diff --git a/minimal/flake.nix b/minimal/flake.nix index 0a7f96d..e1f978d 100644 --- a/minimal/flake.nix +++ b/minimal/flake.nix @@ -3,18 +3,11 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; }; outputs = { diff --git a/standard/flake.lock b/standard/flake.lock index 05ed3b7..cf2a756 100644 --- a/standard/flake.lock +++ b/standard/flake.lock @@ -7,43 +7,43 @@ ] }, "locked": { - "lastModified": 1685599623, - "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", + "lastModified": 1714043624, + "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", "owner": "nix-community", "repo": "home-manager", - "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", + "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1713995372, + "narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "dd37924974b9202f8226ed5d74a252a9785aedf8", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", "type": "github" }, "original": { diff --git a/standard/flake.nix b/standard/flake.nix index 61960d1..0b8a8e0 100644 --- a/standard/flake.nix +++ b/standard/flake.nix @@ -3,22 +3,15 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; # You can access packages and modules from different nixpkgs revs # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; }; outputs = { From 877f702df2e057a42979f50042290f5629ca1441 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 27 Apr 2024 10:06:04 -0300 Subject: [PATCH 42/59] add note about out-of-date lock Co-authored-by: Charlot Shaw <141575226+charlot-shaw@users.noreply.github.com> --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d9ef10c..ddeb852 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ nix flake init -t github:misterio77/nix-starter-config#standard yet. - Take a look at `flake.nix`, making sure to fill out anything marked with FIXME (required) or TODO (usually tips or optional stuff you might want) +- Update your flake lock with `nix flake update`, so you get the latest + packages and modules - `git add` and `git push` your changes! Or at least copy them somewhere if you're on a live medium. @@ -284,6 +286,14 @@ and you should be good to go. Files on `.gitignore`, of course, are invisible to nix - this is to guarantee your build won't depend on anything that is not on your repo. +## Nix installs the wrong version of software/fails to find new software + +The nix dependencies (such as `nixpkgs`) used by your configuration will +strictly follow the `flake.lock` file, using the commits written into it when +you (re)generated. + +To update your flake inputs, simply use `nix flake update`. +