Update flakes to support 24.05 and unstable branches

This commit is contained in:
anmiller 2024-06-07 13:47:48 +00:00
parent 4c312cfa58
commit 6e88e2b333

View File

@ -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; [