From 6e88e2b33388bc72300ef8139da4922006a810f1 Mon Sep 17 00:00:00 2001 From: anmiller Date: Fri, 7 Jun 2024 13:47:48 +0000 Subject: [PATCH] Update flakes to support 24.05 and unstable branches --- installers/install-nix-packages-flake.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/installers/install-nix-packages-flake.sh b/installers/install-nix-packages-flake.sh index 4c7712f..c80899a 100755 --- a/installers/install-nix-packages-flake.sh +++ b/installers/install-nix-packages-flake.sh @@ -35,18 +35,20 @@ nix_packages=( "kubernetes-helm" "rancher" - #"terraform" - "opentofu" - "terragrunt" ) unstable_packages=( # CVE in NixOS stable version of vault "vault" + + # Need unstable latest up to date terraform/terragrunt + "terraform" + "terragrunt" ) mkdir -p ~/.config/nixpkgs/ -templated_insert=$(for nix_package in ${nix_packages[@]}; do echo " $nix_package"; done) +templated_insert="$(for nix_package in ${nix_packages[@]}; do echo " $nix_package"; echo; done)" +templated_insert=${templated_insert}$(for unstable_package in ${unstable_packages[@]}; do echo; echo " unstablePkgs.$unstable_package"; done) # Reference: https://discourse.nixos.org/t/nix-profile-in-combination-with-declarative-package-management/21228/9 @@ -55,10 +57,11 @@ cat << EOF > ~/.config/nixpkgs/flake.nix description = "A declarative system installation"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; # also possible: nixos-unstable + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs, unstable }: let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; @@ -69,7 +72,7 @@ cat << EOF > ~/.config/nixpkgs/flake.nix forAllSystems = nixpkgs.lib.genAttrs supportedSystems; # Nixpkgs instantiated for supported system types. - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; config.allowUnfree = true; }); in { packages = forAllSystems (system: let @@ -79,6 +82,7 @@ cat << EOF > ~/.config/nixpkgs/flake.nix myPackageCollection = # libs and clis let pkgs = nixpkgs.legacyPackages.\${system}; # here we need just legacy packages + unstablePkgs = import unstable { inherit system; config.allowUnfree = true; }; in pkgs.buildEnv { name = "myPackages"; paths = with pkgs; [