This commit is contained in:
2023-02-18 15:19:35 -05:00
parent df823f7e4e
commit 2b45edc5cc
4 changed files with 46 additions and 32 deletions

8
data.nix Normal file
View File

@@ -0,0 +1,8 @@
{
# Age module definitions that is to be used by hosts to get secrets.
ageModules = {
secret1.file = ./secrets/secret1.age;
};
config.age.secrets.secret1.path = ./secrets/secret1.age;
}

40
flake.lock generated
View File

@@ -3,14 +3,16 @@
"agenix": { "agenix": {
"inputs": { "inputs": {
"darwin": "darwin", "darwin": "darwin",
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1676153903, "lastModified": 1676599101,
"narHash": "sha256-uetRyjgMiZCs6srmZ10M764Vn7F53M9mVuqnzHmyBqU=", "narHash": "sha256-CKS6UsOGhoNxGDBt9wyFiWHvtng/+BMAJ4G8ahhe1DE=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "ea17cc71b4e1bc5b2601f210a1c85db9453ad723", "rev": "de657061b13cf329c57a1a9730a5049a971b40b3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -87,11 +89,11 @@
"utils": "utils_2" "utils": "utils_2"
}, },
"locked": { "locked": {
"lastModified": 1675935446, "lastModified": 1676367705,
"narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", "narHash": "sha256-un5UbRat9TwruyImtwUGcKF823rCEp4fQxnsaLFL7CM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2dce7f1a55e785a22d61668516df62899278c9e4", "rev": "da72e6fc6b7dc0c3f94edbd310aae7cd95c678b5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -138,27 +140,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1674641431, "lastModified": 1676569297,
"narHash": "sha256-qfo19qVZBP4qn5M5gXc/h1MDgAtPA5VxJm9s8RUAkVk=", "narHash": "sha256-2n4C4H3/U+3YbDrQB6xIw7AaLdFISCCFwOkcETAigqU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9b97ad7b4330aacda9b2343396eb3df8a853b4fc", "rev": "ac1f5b72a9e95873d1de0233fddcb56f99884b37",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1676300157,
"narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "545c7a31e5dedea4a6d372712a18e00ce097d462",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -174,7 +160,7 @@
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs"
} }
}, },
"utils": { "utils": {

View File

@@ -16,6 +16,7 @@
#ssssh secret!! Agenix install #ssssh secret!! Agenix install
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
#import nixos-generators for building images #import nixos-generators for building images
nixos-generators = { nixos-generators = {
@@ -25,8 +26,13 @@
}; };
outputs = outputs = inputs@{ self, nixpkgs, home-manager, nixos-generators, deploy-rs
inputs@{ self, nixpkgs, home-manager, nixos-generators, deploy-rs, agenix, ... }: { , agenix, ... }:
let
system = "x86_64-linux";
myData = import ./data.nix;
in {
nixosConfigurations = { nixosConfigurations = {
HyperV = nixpkgs.lib.nixosSystem { HyperV = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@@ -34,7 +40,17 @@
modules = [ modules = [
./hosts/HyperV/configuration.nix ./hosts/HyperV/configuration.nix
./modules ./modules
# Add agenix for secret management.
agenix.nixosModules.age
{
environment.systemPackages = [agenix.defaultPackage.${system}];
}
]; ];
specialArgs = {
inherit inputs myData;
};
}; };
}; };
@@ -46,6 +62,7 @@
./hosts/HyperV/configuration.nix ./hosts/HyperV/configuration.nix
./hosts/HyperV/hyperv.nix ./hosts/HyperV/hyperv.nix
./modules ./modules
]; ];
format = "hyperv"; format = "hyperv";
}; };

View File

@@ -8,11 +8,14 @@
# #./hardware-configuration.nix # #./hardware-configuration.nix
# ]; # ];
imports = [ inputs.agenix.nixosModules.default ]; # imports = [ inputs.agenix.nixosModules.default ];
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
environment.systemPackages = environment.systemPackages =
[ pkgs.cifs-utils inputs.agenix.packages.x86_64-linux.default ]; [ pkgs.cifs-utils];
age.secrets.secret1.file = ../../secrets/secret1.age;
age.secrets.secret1.file = ../secrets/secret1.age;
#environment.etc."secret1".source = config.age.secrets.secret1.path;
} }