pinning nixpkgs with niv

This commit is contained in:
Daniel Langbein 2023-09-14 13:10:27 +02:00
parent a2fe1208b9
commit 49fac325cd
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
4 changed files with 19 additions and 3 deletions

View File

@ -96,6 +96,8 @@ sudo /run/current-system/bin/switch-to-configuration boot
## Dependency management with niv ## Dependency management with niv
* https://nix.dev/tutorials/first-steps/towards-reproducibility-pinning-nixpkgs#dependency-management-with-niv
niv: niv:
> Easy dependency management for Nix projects. > Easy dependency management for Nix projects.
@ -122,6 +124,20 @@ Change the tracking branch of nixpkgs from unstable to 23.05:
niv modify nixpkgs --branch nixos-23.05 niv modify nixpkgs --branch nixos-23.05
``` ```
Pinning Nixpkgs. At the top of your `configuration.nix` file, replace
```nix
{ config, pkgs, ... }:
{}
```
with
```nix
{ config, sources ? import ../../nix/sources.nix, pkgs ? import sources.nixpkgs {}, ... }:
{}
```
## Add Home Manager with niv ## Add Home Manager with niv
Home Manager: Home Manager:

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`). # and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, ... }: { config, sources ? import ../../nix/sources.nix, pkgs ? import sources.nixpkgs {}, ... }:
let let
# Import Home Manager with niv. # Import Home Manager with niv.
home-manager = (import ../../nix/sources.nix).home-manager; home-manager = (import ../../nix/sources.nix).home-manager;

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`). # and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, ... }: { config, sources ? import ../../nix/sources.nix, pkgs ? import sources.nixpkgs {}, ... }:
let let
# Import Home Manager with niv. # Import Home Manager with niv.
home-manager = (import ../../nix/sources.nix).home-manager; home-manager = (import ../../nix/sources.nix).home-manager;

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`). # and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, ... }: { config, sources ? import ../../nix/sources.nix, pkgs ? import sources.nixpkgs {}, ... }:
let let
# Import Home Manager with niv. # Import Home Manager with niv.
home-manager = (import ../../nix/sources.nix).home-manager; home-manager = (import ../../nix/sources.nix).home-manager;