Compare commits

...

2 commits

2 changed files with 6 additions and 12 deletions

View file

@ -1,8 +1,7 @@
{ lib, pkgs, ... }: { lib, ... }:
let let
inherit (lib) mkDefault; inherit (lib) mkDefault;
nixPath = "/run/current-system/nixpkgs";
in in
{ {
imports = [ imports = [
@ -16,15 +15,6 @@ in
system.stateVersion = "24.05"; # do not change system.stateVersion = "24.05"; # do not change
nixpkgs.hostPlatform = mkDefault "x86_64-linux"; nixpkgs.hostPlatform = mkDefault "x86_64-linux";
# use flake's nixpkgs over channels
nix.nixPath = [ "nixpkgs=${nixPath}" ];
system.extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs
'';
systemd.tmpfiles.rules = [
"L+ ${nixPath} - - - - ${pkgs.path}"
];
## This is just nice to have, but it is also particularly important for the ## This is just nice to have, but it is also particularly important for the
## Forgejo CI runners because the Nix configuration in the actions is directly ## Forgejo CI runners because the Nix configuration in the actions is directly
## taken from here. ## taken from here.

View file

@ -50,6 +50,7 @@ variable "initialUser" {
locals { locals {
system = "x86_64-linux" system = "x86_64-linux"
pins = jsondecode(file("${path.module}/.npins.json")) pins = jsondecode(file("${path.module}/.npins.json"))
nix_path = "${join(":", [for name, path in local.pins : "${name}=${path}"])}:flake=${local.pins["nixpkgs"]}:flake"
peripheral_configs = { peripheral_configs = {
garage = "test01" garage = "test01"
} }
@ -105,7 +106,8 @@ resource "terraform_data" "nixos" {
provisioner "local-exec" { provisioner "local-exec" {
working_dir = path.root working_dir = path.root
environment = { environment = {
NIX_PATH = join(":", [for name, path in local.pins : "${name}=${path}"]), # nix path used on deploy
NIX_PATH = local.nix_path
} }
# TODO: refactor back to command="ignoreme" interpreter=concat([]) to protect sensitive data from error logs? # TODO: refactor back to command="ignoreme" interpreter=concat([]) to protect sensitive data from error logs?
# TODO: build on target? # TODO: build on target?
@ -132,6 +134,8 @@ resource "terraform_data" "nixos" {
# FIXME: get VM details from TF # FIXME: get VM details from TF
${path.root}/../infra/test-machines/${each.value.hostname} ${path.root}/../infra/test-machines/${each.value.hostname}
]; ];
# nix path for debugging
nix.nixPath = [ "${local.nix_path}" ];
}; };
}; };
in { in {